From 0e788d312ab195a689b59cf450d8f86fdf84bc48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Sevilla?= Date: Fri, 28 Apr 2023 13:35:26 +0200 Subject: [PATCH] Remove vendor directory (#300) Signed-off-by: Raul Sevilla --- Makefile | 9 +- vendor/cloud.google.com/go/LICENSE | 202 - .../go/compute/metadata/metadata.go | 536 - .../go/compute/metadata/retry.go | 114 - .../go/compute/metadata/retry_linux.go | 26 - .../github.com/Azure/go-autorest/.gitignore | 32 - .../github.com/Azure/go-autorest/CHANGELOG.md | 1004 - .../github.com/Azure/go-autorest/GNUmakefile | 23 - .../github.com/Azure/go-autorest/Gopkg.lock | 324 - .../github.com/Azure/go-autorest/Gopkg.toml | 59 - vendor/github.com/Azure/go-autorest/LICENSE | 191 - vendor/github.com/Azure/go-autorest/README.md | 165 - .../Azure/go-autorest/autorest/LICENSE | 191 - .../Azure/go-autorest/autorest/adal/LICENSE | 191 - .../Azure/go-autorest/autorest/adal/README.md | 294 - .../Azure/go-autorest/autorest/adal/config.go | 151 - .../go-autorest/autorest/adal/devicetoken.go | 273 - .../autorest/adal/go_mod_tidy_hack.go | 25 - .../go-autorest/autorest/adal/persist.go | 135 - .../Azure/go-autorest/autorest/adal/sender.go | 101 - .../Azure/go-autorest/autorest/adal/token.go | 1396 - .../go-autorest/autorest/adal/token_1.13.go | 76 - .../go-autorest/autorest/adal/token_legacy.go | 75 - .../go-autorest/autorest/adal/version.go | 45 - .../go-autorest/autorest/authorization.go | 353 - .../go-autorest/autorest/authorization_sas.go | 66 - .../autorest/authorization_storage.go | 307 - .../Azure/go-autorest/autorest/autorest.go | 150 - .../Azure/go-autorest/autorest/azure/async.go | 995 - .../Azure/go-autorest/autorest/azure/azure.go | 388 - .../autorest/azure/environments.go | 331 - .../autorest/azure/metadata_environment.go | 245 - .../Azure/go-autorest/autorest/azure/rp.go | 204 - .../Azure/go-autorest/autorest/client.go | 328 - .../Azure/go-autorest/autorest/date/LICENSE | 191 - .../Azure/go-autorest/autorest/date/date.go | 96 - .../autorest/date/go_mod_tidy_hack.go | 24 - .../Azure/go-autorest/autorest/date/time.go | 103 - .../go-autorest/autorest/date/timerfc1123.go | 100 - .../go-autorest/autorest/date/unixtime.go | 123 - .../go-autorest/autorest/date/utility.go | 25 - .../Azure/go-autorest/autorest/error.go | 103 - .../go-autorest/autorest/go_mod_tidy_hack.go | 25 - .../Azure/go-autorest/autorest/preparer.go | 549 - .../Azure/go-autorest/autorest/responder.go | 269 - .../go-autorest/autorest/retriablerequest.go | 52 - .../autorest/retriablerequest_1.7.go | 55 - .../autorest/retriablerequest_1.8.go | 67 - .../Azure/go-autorest/autorest/sender.go | 458 - .../Azure/go-autorest/autorest/utility.go | 232 - .../go-autorest/autorest/utility_1.13.go | 30 - .../go-autorest/autorest/utility_legacy.go | 32 - .../Azure/go-autorest/autorest/version.go | 41 - .../Azure/go-autorest/azure-pipelines.yml | 105 - vendor/github.com/Azure/go-autorest/doc.go | 18 - .../Azure/go-autorest/logger/LICENSE | 191 - .../go-autorest/logger/go_mod_tidy_hack.go | 24 - .../Azure/go-autorest/logger/logger.go | 337 - .../Azure/go-autorest/tracing/LICENSE | 191 - .../go-autorest/tracing/go_mod_tidy_hack.go | 24 - .../Azure/go-autorest/tracing/tracing.go | 67 - .../Masterminds/goutils/.travis.yml | 18 - .../Masterminds/goutils/CHANGELOG.md | 8 - .../Masterminds/goutils/LICENSE.txt | 202 - .../github.com/Masterminds/goutils/README.md | 70 - .../Masterminds/goutils/appveyor.yml | 21 - .../goutils/cryptorandomstringutils.go | 230 - .../Masterminds/goutils/randomstringutils.go | 248 - .../Masterminds/goutils/stringutils.go | 240 - .../Masterminds/goutils/wordutils.go | 357 - .../Masterminds/semver/v3/.gitignore | 1 - .../Masterminds/semver/v3/.golangci.yml | 26 - .../Masterminds/semver/v3/CHANGELOG.md | 194 - .../Masterminds/semver/v3/LICENSE.txt | 19 - .../github.com/Masterminds/semver/v3/Makefile | 37 - .../Masterminds/semver/v3/README.md | 244 - .../Masterminds/semver/v3/collection.go | 24 - .../Masterminds/semver/v3/constraints.go | 568 - .../github.com/Masterminds/semver/v3/doc.go | 184 - .../github.com/Masterminds/semver/v3/fuzz.go | 22 - .../Masterminds/semver/v3/version.go | 606 - .../Masterminds/sprig/v3/.gitignore | 2 - .../Masterminds/sprig/v3/CHANGELOG.md | 370 - .../Masterminds/sprig/v3/LICENSE.txt | 19 - .../github.com/Masterminds/sprig/v3/Makefile | 9 - .../github.com/Masterminds/sprig/v3/README.md | 101 - .../github.com/Masterminds/sprig/v3/crypto.go | 653 - .../github.com/Masterminds/sprig/v3/date.go | 152 - .../Masterminds/sprig/v3/defaults.go | 163 - .../github.com/Masterminds/sprig/v3/dict.go | 174 - vendor/github.com/Masterminds/sprig/v3/doc.go | 19 - .../Masterminds/sprig/v3/functions.go | 382 - .../github.com/Masterminds/sprig/v3/list.go | 464 - .../Masterminds/sprig/v3/network.go | 12 - .../Masterminds/sprig/v3/numeric.go | 186 - .../Masterminds/sprig/v3/reflect.go | 28 - .../github.com/Masterminds/sprig/v3/regex.go | 83 - .../github.com/Masterminds/sprig/v3/semver.go | 23 - .../Masterminds/sprig/v3/strings.go | 236 - vendor/github.com/Masterminds/sprig/v3/url.go | 66 - .../github.com/PuerkitoBio/purell/.gitignore | 5 - .../github.com/PuerkitoBio/purell/.travis.yml | 12 - vendor/github.com/PuerkitoBio/purell/LICENSE | 12 - .../github.com/PuerkitoBio/purell/README.md | 188 - .../github.com/PuerkitoBio/purell/purell.go | 379 - .../github.com/PuerkitoBio/urlesc/.travis.yml | 15 - vendor/github.com/PuerkitoBio/urlesc/LICENSE | 27 - .../github.com/PuerkitoBio/urlesc/README.md | 16 - .../github.com/PuerkitoBio/urlesc/urlesc.go | 180 - vendor/github.com/davecgh/go-spew/LICENSE | 15 - .../github.com/davecgh/go-spew/spew/bypass.go | 145 - .../davecgh/go-spew/spew/bypasssafe.go | 38 - .../github.com/davecgh/go-spew/spew/common.go | 341 - .../github.com/davecgh/go-spew/spew/config.go | 306 - vendor/github.com/davecgh/go-spew/spew/doc.go | 211 - .../github.com/davecgh/go-spew/spew/dump.go | 509 - .../github.com/davecgh/go-spew/spew/format.go | 419 - .../github.com/davecgh/go-spew/spew/spew.go | 148 - .../elastic/go-elasticsearch/v7/.codecov.yml | 8 - .../elastic/go-elasticsearch/v7/.dockerignore | 2 - .../elastic/go-elasticsearch/v7/.gitignore | 5 - .../elastic/go-elasticsearch/v7/LICENSE | 201 - .../elastic/go-elasticsearch/v7/Makefile | 480 - .../elastic/go-elasticsearch/v7/README.md | 377 - .../elastic/go-elasticsearch/v7/doc.go | 67 - .../go-elasticsearch/v7/elasticsearch.go | 271 - .../go-elasticsearch/v7/esapi/api._.go | 937 - .../go-elasticsearch/v7/esapi/api.bulk.go | 355 - .../v7/esapi/api.cat.aliases.go | 306 - .../v7/esapi/api.cat.allocation.go | 320 - .../v7/esapi/api.cat.count.go | 280 - .../v7/esapi/api.cat.fielddata.go | 297 - .../v7/esapi/api.cat.health.go | 289 - .../go-elasticsearch/v7/esapi/api.cat.help.go | 224 - .../v7/esapi/api.cat.indices.go | 385 - .../v7/esapi/api.cat.master.go | 290 - .../v7/esapi/api.cat.nodeattrs.go | 290 - .../v7/esapi/api.cat.nodes.go | 342 - .../v7/esapi/api.cat.pending_tasks.go | 303 - .../v7/esapi/api.cat.plugins.go | 303 - .../v7/esapi/api.cat.recovery.go | 336 - .../v7/esapi/api.cat.repositories.go | 290 - .../v7/esapi/api.cat.segments.go | 293 - .../v7/esapi/api.cat.shards.go | 333 - .../v7/esapi/api.cat.snapshots.go | 320 - .../v7/esapi/api.cat.tasks.go | 328 - .../v7/esapi/api.cat.templates.go | 307 - .../v7/esapi/api.cat.thread_pool.go | 321 - .../v7/esapi/api.clear_scroll.go | 228 - .../esapi/api.cluster.allocation_explain.go | 239 - .../api.cluster.delete_component_template.go | 229 - ...cluster.delete_voting_config_exclusions.go | 211 - .../api.cluster.exists_component_template.go | 230 - .../api.cluster.get_component_template.go | 240 - .../v7/esapi/api.cluster.get_settings.go | 251 - .../v7/esapi/api.cluster.health.go | 359 - .../v7/esapi/api.cluster.pending_tasks.go | 226 - ...i.cluster.post_voting_config_exclusions.go | 237 - .../api.cluster.put_component_template.go | 250 - .../v7/esapi/api.cluster.put_settings.go | 245 - .../v7/esapi/api.cluster.remote_info.go | 196 - .../v7/esapi/api.cluster.reroute.go | 292 - .../v7/esapi/api.cluster.state.go | 334 - .../v7/esapi/api.cluster.stats.go | 244 - .../go-elasticsearch/v7/esapi/api.count.go | 423 - .../go-elasticsearch/v7/esapi/api.create.go | 324 - ....dangling_indices.delete_dangling_index.go | 243 - ....dangling_indices.import_dangling_index.go | 243 - ....dangling_indices.list_dangling_indices.go | 196 - .../go-elasticsearch/v7/esapi/api.delete.go | 326 - .../v7/esapi/api.delete_by_query.go | 654 - .../esapi/api.delete_by_query_rethrottle.go | 218 - .../v7/esapi/api.delete_script.go | 229 - .../go-elasticsearch/v7/esapi/api.exists.go | 351 - .../v7/esapi/api.exists_source.go | 336 - .../go-elasticsearch/v7/esapi/api.explain.go | 394 - .../v7/esapi/api.features.get_features.go | 211 - .../v7/esapi/api.features.reset_features.go | 198 - .../v7/esapi/api.field_caps.go | 293 - .../v7/esapi/api.fleet.global_checkpoints.go | 258 - .../go-elasticsearch/v7/esapi/api.get.go | 351 - .../v7/esapi/api.get_script.go | 216 - .../v7/esapi/api.get_script_context.go | 198 - .../v7/esapi/api.get_script_languages.go | 198 - .../v7/esapi/api.get_source.go | 340 - .../go-elasticsearch/v7/esapi/api.index.go | 386 - .../v7/esapi/api.indices.add_block.go | 273 - .../v7/esapi/api.indices.analyze.go | 230 - .../v7/esapi/api.indices.clear_cache.go | 310 - .../v7/esapi/api.indices.clone.go | 261 - .../v7/esapi/api.indices.close.go | 282 - .../v7/esapi/api.indices.create.go | 269 - .../v7/esapi/api.indices.delete.go | 267 - .../v7/esapi/api.indices.delete_alias.go | 233 - .../api.indices.delete_index_template.go | 229 - .../v7/esapi/api.indices.delete_template.go | 229 - .../v7/esapi/api.indices.exists.go | 279 - .../v7/esapi/api.indices.exists_alias.go | 269 - .../api.indices.exists_index_template.go | 243 - .../v7/esapi/api.indices.exists_template.go | 243 - .../v7/esapi/api.indices.exists_type.go | 266 - .../v7/esapi/api.indices.flush.go | 278 - .../v7/esapi/api.indices.flush_synced.go | 254 - .../v7/esapi/api.indices.forcemerge.go | 291 - .../v7/esapi/api.indices.get.go | 306 - .../v7/esapi/api.indices.get_alias.go | 279 - .../v7/esapi/api.indices.get_field_mapping.go | 310 - .../esapi/api.indices.get_index_template.go | 253 - .../v7/esapi/api.indices.get_mapping.go | 305 - .../v7/esapi/api.indices.get_settings.go | 319 - .../v7/esapi/api.indices.get_template.go | 266 - .../v7/esapi/api.indices.get_upgrade.go | 252 - .../v7/esapi/api.indices.open.go | 282 - .../v7/esapi/api.indices.put_alias.go | 248 - .../esapi/api.indices.put_index_template.go | 250 - .../v7/esapi/api.indices.put_mapping.go | 325 - .../v7/esapi/api.indices.put_settings.go | 312 - .../v7/esapi/api.indices.put_template.go | 263 - .../v7/esapi/api.indices.recovery.go | 239 - .../v7/esapi/api.indices.refresh.go | 252 - .../v7/esapi/api.indices.resolve_index.go | 219 - .../v7/esapi/api.indices.rollover.go | 298 - .../v7/esapi/api.indices.segments.go | 265 - .../v7/esapi/api.indices.shard_stores.go | 265 - .../v7/esapi/api.indices.shrink.go | 275 - .../api.indices.simulate_index_template.go | 260 - .../v7/esapi/api.indices.simulate_template.go | 270 - .../v7/esapi/api.indices.split.go | 275 - .../v7/esapi/api.indices.stats.go | 357 - .../v7/esapi/api.indices.update_aliases.go | 231 - .../v7/esapi/api.indices.upgrade.go | 278 - .../v7/esapi/api.indices.validate_query.go | 399 - .../go-elasticsearch/v7/esapi/api.info.go | 188 - .../v7/esapi/api.ingest.delete_pipeline.go | 231 - .../v7/esapi/api.ingest.geo_ip_stats.go | 196 - .../v7/esapi/api.ingest.get_pipeline.go | 242 - .../v7/esapi/api.ingest.processor_grok.go | 196 - .../v7/esapi/api.ingest.put_pipeline.go | 238 - .../v7/esapi/api.ingest.simulate.go | 237 - .../go-elasticsearch/v7/esapi/api.mget.go | 337 - .../go-elasticsearch/v7/esapi/api.msearch.go | 324 - .../v7/esapi/api.msearch_template.go | 300 - .../v7/esapi/api.mtermvectors.go | 397 - .../v7/esapi/api.nodes.hot_threads.go | 296 - .../v7/esapi/api.nodes.info.go | 253 - .../esapi/api.nodes.reload_secure_settings.go | 243 - .../v7/esapi/api.nodes.stats.go | 359 - .../v7/esapi/api.nodes.usage.go | 241 - .../go-elasticsearch/v7/esapi/api.ping.go | 196 - .../v7/esapi/api.put_script.go | 254 - .../v7/esapi/api.rank_eval.go | 274 - .../go-elasticsearch/v7/esapi/api.reindex.go | 313 - .../v7/esapi/api.reindex_rethrottle.go | 218 - .../v7/esapi/api.render_search_template.go | 228 - .../v7/esapi/api.scripts_painless_execute.go | 213 - .../go-elasticsearch/v7/esapi/api.scroll.go | 254 - .../go-elasticsearch/v7/esapi/api.search.go | 802 - .../v7/esapi/api.search_shards.go | 291 - .../v7/esapi/api.search_template.go | 405 - .../v7/esapi/api.shutdown.delete_node.go | 205 - .../v7/esapi/api.shutdown.get_node.go | 215 - .../v7/esapi/api.shutdown.put_node.go | 212 - .../esapi/api.snapshot.cleanup_repository.go | 231 - .../v7/esapi/api.snapshot.clone.go | 231 - .../v7/esapi/api.snapshot.create.go | 248 - .../esapi/api.snapshot.create_repository.go | 250 - .../v7/esapi/api.snapshot.delete.go | 219 - .../esapi/api.snapshot.delete_repository.go | 229 - .../v7/esapi/api.snapshot.get.go | 259 - .../v7/esapi/api.snapshot.get_repository.go | 240 - .../esapi/api.snapshot.repository_analyze.go | 336 - .../v7/esapi/api.snapshot.restore.go | 250 - .../v7/esapi/api.snapshot.status.go | 255 - .../esapi/api.snapshot.verify_repository.go | 231 - .../v7/esapi/api.tasks.cancel.go | 269 - .../v7/esapi/api.tasks.get.go | 232 - .../v7/esapi/api.tasks.list.go | 292 - .../v7/esapi/api.termvectors.go | 391 - .../go-elasticsearch/v7/esapi/api.update.go | 387 - .../v7/esapi/api.update_by_query.go | 689 - .../esapi/api.update_by_query_rethrottle.go | 218 - .../v7/esapi/api.xpack.async_search.delete.go | 201 - .../v7/esapi/api.xpack.async_search.get.go | 243 - .../v7/esapi/api.xpack.async_search.status.go | 203 - .../v7/esapi/api.xpack.async_search.submit.go | 762 - ...k.autoscaling.delete_autoscaling_policy.go | 203 - ...ck.autoscaling.get_autoscaling_capacity.go | 196 - ...ck.autoscaling.get_autoscaling_decision.go | 198 - ...pack.autoscaling.get_autoscaling_policy.go | 203 - ...pack.autoscaling.put_autoscaling_policy.go | 210 - .../api.xpack.cat.ml_data_frame_analytics.go | 323 - .../v7/esapi/api.xpack.cat.ml_datafeeds.go | 321 - .../v7/esapi/api.xpack.cat.ml_jobs.go | 334 - .../esapi/api.xpack.cat.ml_trained_models.go | 347 - .../v7/esapi/api.xpack.cat.transforms.go | 332 - ...pi.xpack.ccr.delete_auto_follow_pattern.go | 203 - .../v7/esapi/api.xpack.ccr.follow.go | 224 - .../v7/esapi/api.xpack.ccr.follow_info.go | 203 - .../v7/esapi/api.xpack.ccr.follow_stats.go | 203 - .../v7/esapi/api.xpack.ccr.forget_follower.go | 210 - .../api.xpack.ccr.get_auto_follow_pattern.go | 213 - ...api.xpack.ccr.pause_auto_follow_pattern.go | 205 - .../v7/esapi/api.xpack.ccr.pause_follow.go | 203 - .../api.xpack.ccr.put_auto_follow_pattern.go | 210 - ...pi.xpack.ccr.resume_auto_follow_pattern.go | 205 - .../v7/esapi/api.xpack.ccr.resume_follow.go | 218 - .../v7/esapi/api.xpack.ccr.stats.go | 196 - .../v7/esapi/api.xpack.ccr.unfollow.go | 203 - .../v7/esapi/api.xpack.close_point_in_time.go | 211 - ...e_transform_deprecated.delete_transform.go | 220 - ...rame_transform_deprecated.get_transform.go | 269 - ...ransform_deprecated.get_transform_stats.go | 248 - ..._transform_deprecated.preview_transform.go | 205 - ...rame_transform_deprecated.put_transform.go | 227 - ...me_transform_deprecated.start_transform.go | 222 - ...ame_transform_deprecated.stop_transform.go | 249 - ...e_transform_deprecated.update_transform.go | 229 - .../esapi/api.xpack.enrich.delete_policy.go | 203 - .../esapi/api.xpack.enrich.execute_policy.go | 220 - .../v7/esapi/api.xpack.enrich.get_policy.go | 213 - .../v7/esapi/api.xpack.enrich.put_policy.go | 210 - .../v7/esapi/api.xpack.enrich.stats.go | 196 - .../v7/esapi/api.xpack.eql.delete.go | 203 - .../v7/esapi/api.xpack.eql.get.go | 231 - .../v7/esapi/api.xpack.eql.get_status.go | 205 - .../v7/esapi/api.xpack.eql.search.go | 252 - .../v7/esapi/api.xpack.graph.explore.go | 259 - .../esapi/api.xpack.ilm.delete_lifecycle.go | 203 - .../esapi/api.xpack.ilm.explain_lifecycle.go | 231 - .../v7/esapi/api.xpack.ilm.get_lifecycle.go | 213 - .../v7/esapi/api.xpack.ilm.get_status.go | 196 - .../v7/esapi/api.xpack.ilm.move_to_step.go | 218 - .../v7/esapi/api.xpack.ilm.put_lifecycle.go | 218 - .../v7/esapi/api.xpack.ilm.remove_policy.go | 203 - .../v7/esapi/api.xpack.ilm.retry.go | 203 - .../v7/esapi/api.xpack.ilm.start.go | 196 - .../v7/esapi/api.xpack.ilm.stop.go | 196 - .../api.xpack.indices.create_data_stream.go | 201 - .../api.xpack.indices.data_streams_stats.go | 213 - .../api.xpack.indices.delete_data_stream.go | 215 - .../v7/esapi/api.xpack.indices.freeze.go | 282 - .../api.xpack.indices.get_data_stream.go | 225 - ...pi.xpack.indices.migrate_to_data_stream.go | 203 - .../api.xpack.indices.promote_data_stream.go | 203 - ...i.xpack.indices.reload_search_analyzers.go | 242 - .../v7/esapi/api.xpack.indices.unfreeze.go | 282 - .../v7/esapi/api.xpack.license.delete.go | 196 - .../v7/esapi/api.xpack.license.get.go | 224 - .../api.xpack.license.get_basic_status.go | 196 - .../api.xpack.license.get_trial_status.go | 196 - .../v7/esapi/api.xpack.license.post.go | 226 - .../api.xpack.license.post_start_basic.go | 211 - .../api.xpack.license.post_start_trial.go | 224 - .../api.xpack.logstash.delete_pipeline.go | 203 - .../esapi/api.xpack.logstash.get_pipeline.go | 203 - .../esapi/api.xpack.logstash.put_pipeline.go | 210 - .../esapi/api.xpack.migration.deprecations.go | 213 - .../v7/esapi/api.xpack.ml.close_job.go | 275 - .../v7/esapi/api.xpack.ml.delete_calendar.go | 203 - .../api.xpack.ml.delete_calendar_event.go | 208 - .../esapi/api.xpack.ml.delete_calendar_job.go | 208 - ...pi.xpack.ml.delete_data_frame_analytics.go | 234 - .../v7/esapi/api.xpack.ml.delete_datafeed.go | 218 - .../esapi/api.xpack.ml.delete_expired_data.go | 257 - .../v7/esapi/api.xpack.ml.delete_filter.go | 203 - .../v7/esapi/api.xpack.ml.delete_forecast.go | 247 - .../v7/esapi/api.xpack.ml.delete_job.go | 231 - .../api.xpack.ml.delete_model_snapshot.go | 208 - .../api.xpack.ml.delete_trained_model.go | 203 - ...api.xpack.ml.delete_trained_model_alias.go | 208 - .../api.xpack.ml.estimate_model_memory.go | 203 - .../esapi/api.xpack.ml.evaluate_data_frame.go | 203 - ...i.xpack.ml.explain_data_frame_analytics.go | 232 - .../esapi/api.xpack.ml.find_file_structure.go | 390 - .../v7/esapi/api.xpack.ml.flush_job.go | 287 - .../v7/esapi/api.xpack.ml.forecast.go | 246 - .../v7/esapi/api.xpack.ml.get_buckets.go | 355 - .../esapi/api.xpack.ml.get_calendar_events.go | 273 - .../v7/esapi/api.xpack.ml.get_calendars.go | 256 - .../v7/esapi/api.xpack.ml.get_categories.go | 278 - .../api.xpack.ml.get_data_frame_analytics.go | 269 - ...xpack.ml.get_data_frame_analytics_stats.go | 271 - .../esapi/api.xpack.ml.get_datafeed_stats.go | 243 - .../v7/esapi/api.xpack.ml.get_datafeeds.go | 254 - .../v7/esapi/api.xpack.ml.get_filters.go | 241 - .../v7/esapi/api.xpack.ml.get_influencers.go | 329 - .../v7/esapi/api.xpack.ml.get_job_stats.go | 243 - .../v7/esapi/api.xpack.ml.get_jobs.go | 254 - .../esapi/api.xpack.ml.get_model_snapshots.go | 314 - .../esapi/api.xpack.ml.get_overall_buckets.go | 329 - .../v7/esapi/api.xpack.ml.get_records.go | 329 - .../esapi/api.xpack.ml.get_trained_models.go | 319 - .../api.xpack.ml.get_trained_models_stats.go | 256 - .../v7/esapi/api.xpack.ml.info.go | 196 - .../v7/esapi/api.xpack.ml.open_job.go | 205 - .../api.xpack.ml.post_calendar_events.go | 212 - .../v7/esapi/api.xpack.ml.post_data.go | 239 - ...i.xpack.ml.preview_data_frame_analytics.go | 232 - .../v7/esapi/api.xpack.ml.preview_datafeed.go | 230 - .../v7/esapi/api.xpack.ml.put_calendar.go | 218 - .../v7/esapi/api.xpack.ml.put_calendar_job.go | 208 - .../api.xpack.ml.put_data_frame_analytics.go | 212 - .../v7/esapi/api.xpack.ml.put_datafeed.go | 264 - .../v7/esapi/api.xpack.ml.put_filter.go | 210 - .../v7/esapi/api.xpack.ml.put_job.go | 210 - .../esapi/api.xpack.ml.put_trained_model.go | 210 - .../api.xpack.ml.put_trained_model_alias.go | 223 - .../api.xpack.ml.revert_model_snapshot.go | 240 - .../v7/esapi/api.xpack.ml.set_upgrade_mode.go | 225 - ...api.xpack.ml.start_data_frame_analytics.go | 237 - .../v7/esapi/api.xpack.ml.start_datafeed.go | 261 - .../api.xpack.ml.stop_data_frame_analytics.go | 264 - .../v7/esapi/api.xpack.ml.stop_datafeed.go | 275 - ...pi.xpack.ml.update_data_frame_analytics.go | 214 - .../v7/esapi/api.xpack.ml.update_datafeed.go | 266 - .../v7/esapi/api.xpack.ml.update_filter.go | 212 - .../v7/esapi/api.xpack.ml.update_job.go | 212 - .../api.xpack.ml.update_model_snapshot.go | 217 - .../api.xpack.ml.upgrade_job_snapshot.go | 239 - .../v7/esapi/api.xpack.ml.validate.go | 203 - .../esapi/api.xpack.ml.validate_detector.go | 203 - .../v7/esapi/api.xpack.monitoring.bulk.go | 262 - .../v7/esapi/api.xpack.open_point_in_time.go | 278 - .../v7/esapi/api.xpack.rollup.delete_job.go | 205 - .../v7/esapi/api.xpack.rollup.get_jobs.go | 215 - .../esapi/api.xpack.rollup.get_rollup_caps.go | 215 - .../api.xpack.rollup.get_rollup_index_caps.go | 205 - .../v7/esapi/api.xpack.rollup.put_job.go | 212 - .../v7/esapi/api.xpack.rollup.rollup.go | 212 - .../esapi/api.xpack.rollup.rollup_search.go | 251 - .../v7/esapi/api.xpack.rollup.start_job.go | 207 - .../v7/esapi/api.xpack.rollup.stop_job.go | 236 - ....xpack.searchable_snapshots.cache_stats.go | 217 - ....xpack.searchable_snapshots.clear_cache.go | 262 - .../api.xpack.searchable_snapshots.mount.go | 257 - ...k.searchable_snapshots.repository_stats.go | 205 - .../api.xpack.searchable_snapshots.stats.go | 229 - .../esapi/api.xpack.security.authenticate.go | 196 - .../api.xpack.security.change_password.go | 236 - .../api.xpack.security.clear_api_key_cache.go | 205 - ....xpack.security.clear_cached_privileges.go | 205 - .../api.xpack.security.clear_cached_realms.go | 219 - .../api.xpack.security.clear_cached_roles.go | 205 - ...ck.security.clear_cached_service_tokens.go | 217 - .../api.xpack.security.create_api_key.go | 217 - ...api.xpack.security.create_service_token.go | 239 - .../api.xpack.security.delete_privileges.go | 220 - .../esapi/api.xpack.security.delete_role.go | 217 - .../api.xpack.security.delete_role_mapping.go | 217 - ...api.xpack.security.delete_service_token.go | 229 - .../esapi/api.xpack.security.delete_user.go | 217 - .../esapi/api.xpack.security.disable_user.go | 219 - .../esapi/api.xpack.security.enable_user.go | 219 - .../esapi/api.xpack.security.get_api_key.go | 263 - ...i.xpack.security.get_builtin_privileges.go | 196 - .../api.xpack.security.get_privileges.go | 226 - .../v7/esapi/api.xpack.security.get_role.go | 213 - .../api.xpack.security.get_role_mapping.go | 213 - ...api.xpack.security.get_service_accounts.go | 228 - ....xpack.security.get_service_credentials.go | 210 - .../v7/esapi/api.xpack.security.get_token.go | 203 - .../v7/esapi/api.xpack.security.get_user.go | 213 - .../api.xpack.security.get_user_privileges.go | 196 - .../esapi/api.xpack.security.grant_api_key.go | 217 - .../api.xpack.security.has_privileges.go | 222 - .../api.xpack.security.invalidate_api_key.go | 203 - .../api.xpack.security.invalidate_token.go | 203 - .../api.xpack.security.put_privileges.go | 217 - .../v7/esapi/api.xpack.security.put_role.go | 224 - .../api.xpack.security.put_role_mapping.go | 224 - .../v7/esapi/api.xpack.security.put_user.go | 224 - .../esapi/api.xpack.slm.delete_lifecycle.go | 203 - .../esapi/api.xpack.slm.execute_lifecycle.go | 205 - .../esapi/api.xpack.slm.execute_retention.go | 196 - .../v7/esapi/api.xpack.slm.get_lifecycle.go | 213 - .../v7/esapi/api.xpack.slm.get_stats.go | 196 - .../v7/esapi/api.xpack.slm.get_status.go | 196 - .../v7/esapi/api.xpack.slm.put_lifecycle.go | 218 - .../v7/esapi/api.xpack.slm.start.go | 196 - .../v7/esapi/api.xpack.slm.stop.go | 196 - .../v7/esapi/api.xpack.sql.clear_cursor.go | 203 - .../v7/esapi/api.xpack.sql.query.go | 217 - .../v7/esapi/api.xpack.sql.translate.go | 203 - .../v7/esapi/api.xpack.ssl.certificates.go | 196 - ...api.xpack.text_structure.find_structure.go | 388 - .../api.xpack.transform.delete_transform.go | 216 - .../api.xpack.transform.get_transform.go | 265 - ...api.xpack.transform.get_transform_stats.go | 244 - .../api.xpack.transform.preview_transform.go | 203 - .../api.xpack.transform.put_transform.go | 223 - .../api.xpack.transform.start_transform.go | 218 - .../api.xpack.transform.stop_transform.go | 271 - .../api.xpack.transform.update_transform.go | 225 - .../v7/esapi/api.xpack.watcher.ack_watch.go | 218 - .../esapi/api.xpack.watcher.activate_watch.go | 205 - .../api.xpack.watcher.deactivate_watch.go | 205 - .../esapi/api.xpack.watcher.delete_watch.go | 203 - .../esapi/api.xpack.watcher.execute_watch.go | 245 - .../v7/esapi/api.xpack.watcher.get_watch.go | 203 - .../v7/esapi/api.xpack.watcher.put_watch.go | 272 - .../esapi/api.xpack.watcher.query_watches.go | 211 - .../v7/esapi/api.xpack.watcher.start.go | 196 - .../v7/esapi/api.xpack.watcher.stats.go | 232 - .../v7/esapi/api.xpack.watcher.stop.go | 196 - .../v7/esapi/api.xpack.xpack.info.go | 224 - .../v7/esapi/api.xpack.xpack.usage.go | 211 - .../elastic/go-elasticsearch/v7/esapi/doc.go | 112 - .../go-elasticsearch/v7/esapi/esapi.go | 62 - .../v7/esapi/esapi.request.go | 44 - .../v7/esapi/esapi.response.go | 105 - .../v7/estransport/connection.go | 329 - .../v7/estransport/discovery.go | 218 - .../go-elasticsearch/v7/estransport/doc.go | 51 - .../v7/estransport/estransport.go | 512 - .../go-elasticsearch/v7/estransport/logger.go | 454 - .../v7/estransport/metaheader.go | 81 - .../v7/estransport/metrics.go | 194 - .../v7/esutil/bulk_indexer.go | 592 - .../elastic/go-elasticsearch/v7/esutil/doc.go | 22 - .../go-elasticsearch/v7/esutil/json_reader.go | 95 - .../v7/internal/version/version.go | 22 - .../emicklei/go-restful/v3/.gitignore | 71 - .../emicklei/go-restful/v3/.goconvey | 1 - .../emicklei/go-restful/v3/.travis.yml | 13 - .../emicklei/go-restful/v3/CHANGES.md | 372 - .../github.com/emicklei/go-restful/v3/LICENSE | 22 - .../emicklei/go-restful/v3/Makefile | 8 - .../emicklei/go-restful/v3/README.md | 110 - .../emicklei/go-restful/v3/SECURITY.md | 13 - .../github.com/emicklei/go-restful/v3/Srcfile | 1 - .../emicklei/go-restful/v3/bench_test.sh | 10 - .../emicklei/go-restful/v3/compress.go | 127 - .../go-restful/v3/compressor_cache.go | 103 - .../go-restful/v3/compressor_pools.go | 91 - .../emicklei/go-restful/v3/compressors.go | 54 - .../emicklei/go-restful/v3/constants.go | 30 - .../emicklei/go-restful/v3/container.go | 450 - .../emicklei/go-restful/v3/cors_filter.go | 193 - .../emicklei/go-restful/v3/coverage.sh | 2 - .../emicklei/go-restful/v3/curly.go | 173 - .../emicklei/go-restful/v3/curly_route.go | 54 - .../emicklei/go-restful/v3/custom_verb.go | 29 - .../github.com/emicklei/go-restful/v3/doc.go | 185 - .../go-restful/v3/entity_accessors.go | 162 - .../emicklei/go-restful/v3/extensions.go | 21 - .../emicklei/go-restful/v3/filter.go | 37 - .../github.com/emicklei/go-restful/v3/json.go | 11 - .../emicklei/go-restful/v3/jsoniter.go | 12 - .../emicklei/go-restful/v3/jsr311.go | 326 - .../emicklei/go-restful/v3/log/log.go | 34 - .../emicklei/go-restful/v3/logger.go | 32 - .../github.com/emicklei/go-restful/v3/mime.go | 50 - .../emicklei/go-restful/v3/options_filter.go | 34 - .../emicklei/go-restful/v3/parameter.go | 234 - .../emicklei/go-restful/v3/path_expression.go | 74 - .../emicklei/go-restful/v3/path_processor.go | 74 - .../emicklei/go-restful/v3/request.go | 132 - .../emicklei/go-restful/v3/response.go | 256 - .../emicklei/go-restful/v3/route.go | 178 - .../emicklei/go-restful/v3/route_builder.go | 376 - .../emicklei/go-restful/v3/route_reader.go | 66 - .../emicklei/go-restful/v3/router.go | 20 - .../emicklei/go-restful/v3/service_error.go | 32 - .../emicklei/go-restful/v3/web_service.go | 293 - .../go-restful/v3/web_service_container.go | 39 - vendor/github.com/go-logr/logr/.golangci.yaml | 29 - vendor/github.com/go-logr/logr/CHANGELOG.md | 6 - .../github.com/go-logr/logr/CONTRIBUTING.md | 17 - vendor/github.com/go-logr/logr/LICENSE | 201 - vendor/github.com/go-logr/logr/README.md | 282 - vendor/github.com/go-logr/logr/discard.go | 54 - vendor/github.com/go-logr/logr/logr.go | 510 - .../go-openapi/jsonpointer/.editorconfig | 26 - .../go-openapi/jsonpointer/.gitignore | 1 - .../go-openapi/jsonpointer/.travis.yml | 15 - .../go-openapi/jsonpointer/CODE_OF_CONDUCT.md | 74 - .../github.com/go-openapi/jsonpointer/LICENSE | 202 - .../go-openapi/jsonpointer/README.md | 15 - .../go-openapi/jsonpointer/pointer.go | 390 - .../go-openapi/jsonreference/.gitignore | 1 - .../go-openapi/jsonreference/.golangci.yml | 41 - .../go-openapi/jsonreference/.travis.yml | 24 - .../jsonreference/CODE_OF_CONDUCT.md | 74 - .../go-openapi/jsonreference/LICENSE | 202 - .../go-openapi/jsonreference/README.md | 15 - .../go-openapi/jsonreference/reference.go | 156 - .../github.com/go-openapi/swag/.editorconfig | 26 - .../github.com/go-openapi/swag/.gitattributes | 2 - vendor/github.com/go-openapi/swag/.gitignore | 4 - .../github.com/go-openapi/swag/.golangci.yml | 50 - .../go-openapi/swag/CODE_OF_CONDUCT.md | 74 - vendor/github.com/go-openapi/swag/LICENSE | 202 - vendor/github.com/go-openapi/swag/README.md | 21 - vendor/github.com/go-openapi/swag/convert.go | 208 - .../go-openapi/swag/convert_types.go | 730 - vendor/github.com/go-openapi/swag/doc.go | 32 - vendor/github.com/go-openapi/swag/file.go | 33 - vendor/github.com/go-openapi/swag/json.go | 312 - vendor/github.com/go-openapi/swag/loading.go | 120 - .../github.com/go-openapi/swag/name_lexem.go | 87 - vendor/github.com/go-openapi/swag/net.go | 38 - vendor/github.com/go-openapi/swag/path.go | 59 - .../github.com/go-openapi/swag/post_go18.go | 24 - .../github.com/go-openapi/swag/post_go19.go | 68 - vendor/github.com/go-openapi/swag/pre_go18.go | 24 - vendor/github.com/go-openapi/swag/pre_go19.go | 70 - vendor/github.com/go-openapi/swag/split.go | 262 - vendor/github.com/go-openapi/swag/util.go | 385 - vendor/github.com/go-openapi/swag/yaml.go | 246 - vendor/github.com/gogo/protobuf/AUTHORS | 15 - vendor/github.com/gogo/protobuf/CONTRIBUTORS | 23 - vendor/github.com/gogo/protobuf/LICENSE | 35 - .../github.com/gogo/protobuf/proto/Makefile | 43 - .../github.com/gogo/protobuf/proto/clone.go | 258 - .../gogo/protobuf/proto/custom_gogo.go | 39 - .../github.com/gogo/protobuf/proto/decode.go | 427 - .../gogo/protobuf/proto/deprecated.go | 63 - .../github.com/gogo/protobuf/proto/discard.go | 350 - .../gogo/protobuf/proto/duration.go | 100 - .../gogo/protobuf/proto/duration_gogo.go | 49 - .../github.com/gogo/protobuf/proto/encode.go | 205 - .../gogo/protobuf/proto/encode_gogo.go | 33 - .../github.com/gogo/protobuf/proto/equal.go | 300 - .../gogo/protobuf/proto/extensions.go | 605 - .../gogo/protobuf/proto/extensions_gogo.go | 389 - vendor/github.com/gogo/protobuf/proto/lib.go | 973 - .../gogo/protobuf/proto/lib_gogo.go | 50 - .../gogo/protobuf/proto/message_set.go | 181 - .../gogo/protobuf/proto/pointer_reflect.go | 357 - .../protobuf/proto/pointer_reflect_gogo.go | 59 - .../gogo/protobuf/proto/pointer_unsafe.go | 308 - .../protobuf/proto/pointer_unsafe_gogo.go | 56 - .../gogo/protobuf/proto/properties.go | 610 - .../gogo/protobuf/proto/properties_gogo.go | 36 - .../gogo/protobuf/proto/skip_gogo.go | 119 - .../gogo/protobuf/proto/table_marshal.go | 3009 - .../gogo/protobuf/proto/table_marshal_gogo.go | 388 - .../gogo/protobuf/proto/table_merge.go | 676 - .../gogo/protobuf/proto/table_unmarshal.go | 2249 - .../protobuf/proto/table_unmarshal_gogo.go | 385 - vendor/github.com/gogo/protobuf/proto/text.go | 930 - .../gogo/protobuf/proto/text_gogo.go | 57 - .../gogo/protobuf/proto/text_parser.go | 1018 - .../gogo/protobuf/proto/timestamp.go | 113 - .../gogo/protobuf/proto/timestamp_gogo.go | 49 - .../gogo/protobuf/proto/wrappers.go | 1888 - .../gogo/protobuf/proto/wrappers_gogo.go | 113 - .../gogo/protobuf/sortkeys/sortkeys.go | 101 - .../github.com/golang-jwt/jwt/v4/.gitignore | 4 - vendor/github.com/golang-jwt/jwt/v4/LICENSE | 9 - .../golang-jwt/jwt/v4/MIGRATION_GUIDE.md | 22 - vendor/github.com/golang-jwt/jwt/v4/README.md | 114 - .../golang-jwt/jwt/v4/VERSION_HISTORY.md | 135 - vendor/github.com/golang-jwt/jwt/v4/claims.go | 273 - vendor/github.com/golang-jwt/jwt/v4/doc.go | 4 - vendor/github.com/golang-jwt/jwt/v4/ecdsa.go | 142 - .../golang-jwt/jwt/v4/ecdsa_utils.go | 69 - .../github.com/golang-jwt/jwt/v4/ed25519.go | 85 - .../golang-jwt/jwt/v4/ed25519_utils.go | 64 - vendor/github.com/golang-jwt/jwt/v4/errors.go | 64 - vendor/github.com/golang-jwt/jwt/v4/hmac.go | 95 - .../golang-jwt/jwt/v4/map_claims.go | 148 - vendor/github.com/golang-jwt/jwt/v4/none.go | 52 - vendor/github.com/golang-jwt/jwt/v4/parser.go | 170 - .../golang-jwt/jwt/v4/parser_option.go | 29 - vendor/github.com/golang-jwt/jwt/v4/rsa.go | 101 - .../github.com/golang-jwt/jwt/v4/rsa_pss.go | 142 - .../github.com/golang-jwt/jwt/v4/rsa_utils.go | 105 - .../golang-jwt/jwt/v4/signing_method.go | 46 - .../golang-jwt/jwt/v4/staticcheck.conf | 1 - vendor/github.com/golang-jwt/jwt/v4/token.go | 131 - vendor/github.com/golang-jwt/jwt/v4/types.go | 127 - vendor/github.com/golang/protobuf/AUTHORS | 3 - .../github.com/golang/protobuf/CONTRIBUTORS | 3 - vendor/github.com/golang/protobuf/LICENSE | 28 - .../golang/protobuf/proto/buffer.go | 324 - .../golang/protobuf/proto/defaults.go | 63 - .../golang/protobuf/proto/deprecated.go | 113 - .../golang/protobuf/proto/discard.go | 58 - .../golang/protobuf/proto/extensions.go | 356 - .../golang/protobuf/proto/properties.go | 306 - .../github.com/golang/protobuf/proto/proto.go | 167 - .../golang/protobuf/proto/registry.go | 317 - .../golang/protobuf/proto/text_decode.go | 801 - .../golang/protobuf/proto/text_encode.go | 560 - .../github.com/golang/protobuf/proto/wire.go | 78 - .../golang/protobuf/proto/wrappers.go | 34 - .../github.com/golang/protobuf/ptypes/any.go | 179 - .../golang/protobuf/ptypes/any/any.pb.go | 62 - .../github.com/golang/protobuf/ptypes/doc.go | 10 - .../golang/protobuf/ptypes/duration.go | 76 - .../protobuf/ptypes/duration/duration.pb.go | 63 - .../golang/protobuf/ptypes/timestamp.go | 112 - .../protobuf/ptypes/timestamp/timestamp.pb.go | 64 - vendor/github.com/google/gnostic/LICENSE | 203 - .../google/gnostic/compiler/README.md | 4 - .../google/gnostic/compiler/context.go | 49 - .../google/gnostic/compiler/error.go | 70 - .../google/gnostic/compiler/extensions.go | 86 - .../google/gnostic/compiler/helpers.go | 397 - .../google/gnostic/compiler/main.go | 16 - .../google/gnostic/compiler/reader.go | 307 - .../google/gnostic/extensions/README.md | 13 - .../google/gnostic/extensions/extension.pb.go | 461 - .../google/gnostic/extensions/extension.proto | 97 - .../google/gnostic/extensions/extensions.go | 64 - .../google/gnostic/jsonschema/README.md | 4 - .../google/gnostic/jsonschema/base.go | 84 - .../google/gnostic/jsonschema/display.go | 229 - .../google/gnostic/jsonschema/models.go | 228 - .../google/gnostic/jsonschema/operations.go | 394 - .../google/gnostic/jsonschema/reader.go | 442 - .../google/gnostic/jsonschema/schema.json | 150 - .../google/gnostic/jsonschema/writer.go | 369 - .../google/gnostic/openapiv2/OpenAPIv2.go | 8820 -- .../google/gnostic/openapiv2/OpenAPIv2.pb.go | 7342 -- .../google/gnostic/openapiv2/OpenAPIv2.proto | 666 - .../google/gnostic/openapiv2/README.md | 14 - .../google/gnostic/openapiv2/document.go | 42 - .../google/gnostic/openapiv2/openapi-2.0.json | 1610 - .../google/gnostic/openapiv3/OpenAPIv3.go | 8633 -- .../google/gnostic/openapiv3/OpenAPIv3.pb.go | 8053 -- .../google/gnostic/openapiv3/OpenAPIv3.proto | 672 - .../google/gnostic/openapiv3/README.md | 21 - .../google/gnostic/openapiv3/document.go | 42 - .../google/gnostic/openapiv3/openapi-3.0.json | 1251 - .../google/gnostic/openapiv3/openapi-3.1.json | 1250 - vendor/github.com/google/go-cmp/LICENSE | 27 - .../github.com/google/go-cmp/cmp/compare.go | 667 - .../google/go-cmp/cmp/export_panic.go | 16 - .../google/go-cmp/cmp/export_unsafe.go | 36 - .../go-cmp/cmp/internal/diff/debug_disable.go | 18 - .../go-cmp/cmp/internal/diff/debug_enable.go | 123 - .../google/go-cmp/cmp/internal/diff/diff.go | 398 - .../google/go-cmp/cmp/internal/flags/flags.go | 9 - .../go-cmp/cmp/internal/function/func.go | 99 - .../google/go-cmp/cmp/internal/value/name.go | 164 - .../cmp/internal/value/pointer_purego.go | 34 - .../cmp/internal/value/pointer_unsafe.go | 37 - .../google/go-cmp/cmp/internal/value/sort.go | 106 - .../google/go-cmp/cmp/internal/value/zero.go | 48 - .../github.com/google/go-cmp/cmp/options.go | 552 - vendor/github.com/google/go-cmp/cmp/path.go | 378 - vendor/github.com/google/go-cmp/cmp/report.go | 54 - .../google/go-cmp/cmp/report_compare.go | 435 - .../google/go-cmp/cmp/report_references.go | 264 - .../google/go-cmp/cmp/report_reflect.go | 407 - .../google/go-cmp/cmp/report_slices.go | 613 - .../google/go-cmp/cmp/report_text.go | 431 - .../google/go-cmp/cmp/report_value.go | 121 - vendor/github.com/google/gofuzz/.travis.yml | 10 - .../github.com/google/gofuzz/CONTRIBUTING.md | 67 - vendor/github.com/google/gofuzz/LICENSE | 202 - vendor/github.com/google/gofuzz/README.md | 89 - .../google/gofuzz/bytesource/bytesource.go | 81 - vendor/github.com/google/gofuzz/doc.go | 18 - vendor/github.com/google/gofuzz/fuzz.go | 605 - vendor/github.com/google/uuid/.travis.yml | 9 - vendor/github.com/google/uuid/CONTRIBUTING.md | 10 - vendor/github.com/google/uuid/CONTRIBUTORS | 9 - vendor/github.com/google/uuid/LICENSE | 27 - vendor/github.com/google/uuid/README.md | 19 - vendor/github.com/google/uuid/dce.go | 80 - vendor/github.com/google/uuid/doc.go | 12 - vendor/github.com/google/uuid/hash.go | 53 - vendor/github.com/google/uuid/marshal.go | 38 - vendor/github.com/google/uuid/node.go | 90 - vendor/github.com/google/uuid/node_js.go | 12 - vendor/github.com/google/uuid/node_net.go | 33 - vendor/github.com/google/uuid/sql.go | 59 - vendor/github.com/google/uuid/time.go | 123 - vendor/github.com/google/uuid/util.go | 43 - vendor/github.com/google/uuid/uuid.go | 245 - vendor/github.com/google/uuid/version1.go | 44 - vendor/github.com/google/uuid/version4.go | 43 - vendor/github.com/huandu/xstrings/.gitignore | 24 - vendor/github.com/huandu/xstrings/.travis.yml | 7 - .../huandu/xstrings/CONTRIBUTING.md | 23 - vendor/github.com/huandu/xstrings/LICENSE | 22 - vendor/github.com/huandu/xstrings/README.md | 117 - vendor/github.com/huandu/xstrings/common.go | 21 - vendor/github.com/huandu/xstrings/convert.go | 590 - vendor/github.com/huandu/xstrings/count.go | 120 - vendor/github.com/huandu/xstrings/doc.go | 8 - vendor/github.com/huandu/xstrings/format.go | 169 - .../github.com/huandu/xstrings/manipulate.go | 216 - .../huandu/xstrings/stringbuilder.go | 7 - .../huandu/xstrings/stringbuilder_go110.go | 9 - .../github.com/huandu/xstrings/translate.go | 546 - .../github.com/imdario/mergo/.deepsource.toml | 12 - vendor/github.com/imdario/mergo/.gitignore | 33 - vendor/github.com/imdario/mergo/.travis.yml | 9 - .../imdario/mergo/CODE_OF_CONDUCT.md | 46 - vendor/github.com/imdario/mergo/LICENSE | 28 - vendor/github.com/imdario/mergo/README.md | 247 - vendor/github.com/imdario/mergo/doc.go | 143 - vendor/github.com/imdario/mergo/map.go | 178 - vendor/github.com/imdario/mergo/merge.go | 375 - vendor/github.com/imdario/mergo/mergo.go | 78 - .../inconshreveable/mousetrap/LICENSE | 201 - .../inconshreveable/mousetrap/README.md | 23 - .../inconshreveable/mousetrap/trap_others.go | 15 - .../inconshreveable/mousetrap/trap_windows.go | 98 - .../mousetrap/trap_windows_1.4.go | 46 - vendor/github.com/josharian/intern/README.md | 5 - vendor/github.com/josharian/intern/intern.go | 44 - vendor/github.com/josharian/intern/license.md | 21 - .../github.com/json-iterator/go/.codecov.yml | 3 - vendor/github.com/json-iterator/go/.gitignore | 4 - .../github.com/json-iterator/go/.travis.yml | 14 - vendor/github.com/json-iterator/go/Gopkg.lock | 21 - vendor/github.com/json-iterator/go/Gopkg.toml | 26 - vendor/github.com/json-iterator/go/LICENSE | 21 - vendor/github.com/json-iterator/go/README.md | 85 - vendor/github.com/json-iterator/go/adapter.go | 150 - vendor/github.com/json-iterator/go/any.go | 325 - .../github.com/json-iterator/go/any_array.go | 278 - .../github.com/json-iterator/go/any_bool.go | 137 - .../github.com/json-iterator/go/any_float.go | 83 - .../github.com/json-iterator/go/any_int32.go | 74 - .../github.com/json-iterator/go/any_int64.go | 74 - .../json-iterator/go/any_invalid.go | 82 - vendor/github.com/json-iterator/go/any_nil.go | 69 - .../github.com/json-iterator/go/any_number.go | 123 - .../github.com/json-iterator/go/any_object.go | 374 - vendor/github.com/json-iterator/go/any_str.go | 166 - .../github.com/json-iterator/go/any_uint32.go | 74 - .../github.com/json-iterator/go/any_uint64.go | 74 - vendor/github.com/json-iterator/go/build.sh | 12 - vendor/github.com/json-iterator/go/config.go | 375 - .../go/fuzzy_mode_convert_table.md | 7 - vendor/github.com/json-iterator/go/iter.go | 349 - .../github.com/json-iterator/go/iter_array.go | 64 - .../github.com/json-iterator/go/iter_float.go | 342 - .../github.com/json-iterator/go/iter_int.go | 346 - .../json-iterator/go/iter_object.go | 267 - .../github.com/json-iterator/go/iter_skip.go | 130 - .../json-iterator/go/iter_skip_sloppy.go | 163 - .../json-iterator/go/iter_skip_strict.go | 99 - .../github.com/json-iterator/go/iter_str.go | 215 - .../github.com/json-iterator/go/jsoniter.go | 18 - vendor/github.com/json-iterator/go/pool.go | 42 - vendor/github.com/json-iterator/go/reflect.go | 337 - .../json-iterator/go/reflect_array.go | 104 - .../json-iterator/go/reflect_dynamic.go | 70 - .../json-iterator/go/reflect_extension.go | 483 - .../json-iterator/go/reflect_json_number.go | 112 - .../go/reflect_json_raw_message.go | 76 - .../json-iterator/go/reflect_map.go | 346 - .../json-iterator/go/reflect_marshaler.go | 225 - .../json-iterator/go/reflect_native.go | 453 - .../json-iterator/go/reflect_optional.go | 129 - .../json-iterator/go/reflect_slice.go | 99 - .../go/reflect_struct_decoder.go | 1097 - .../go/reflect_struct_encoder.go | 211 - vendor/github.com/json-iterator/go/stream.go | 210 - .../json-iterator/go/stream_float.go | 111 - .../github.com/json-iterator/go/stream_int.go | 190 - .../github.com/json-iterator/go/stream_str.go | 372 - vendor/github.com/json-iterator/go/test.sh | 12 - vendor/github.com/mailru/easyjson/LICENSE | 7 - .../github.com/mailru/easyjson/buffer/pool.go | 278 - .../mailru/easyjson/jlexer/bytestostr.go | 24 - .../easyjson/jlexer/bytestostr_nounsafe.go | 13 - .../mailru/easyjson/jlexer/error.go | 15 - .../mailru/easyjson/jlexer/lexer.go | 1244 - .../mailru/easyjson/jwriter/writer.go | 405 - .../mitchellh/copystructure/LICENSE | 21 - .../mitchellh/copystructure/README.md | 21 - .../mitchellh/copystructure/copier_time.go | 15 - .../mitchellh/copystructure/copystructure.go | 631 - .../mitchellh/reflectwalk/.travis.yml | 1 - .../github.com/mitchellh/reflectwalk/LICENSE | 21 - .../mitchellh/reflectwalk/README.md | 6 - .../mitchellh/reflectwalk/location.go | 19 - .../mitchellh/reflectwalk/location_string.go | 16 - .../mitchellh/reflectwalk/reflectwalk.go | 420 - .../moby/spdystream/CONTRIBUTING.md | 13 - vendor/github.com/moby/spdystream/LICENSE | 202 - vendor/github.com/moby/spdystream/MAINTAINERS | 40 - vendor/github.com/moby/spdystream/NOTICE | 5 - vendor/github.com/moby/spdystream/README.md | 77 - .../github.com/moby/spdystream/connection.go | 972 - vendor/github.com/moby/spdystream/handlers.go | 52 - vendor/github.com/moby/spdystream/priority.go | 114 - .../moby/spdystream/spdy/dictionary.go | 203 - .../github.com/moby/spdystream/spdy/read.go | 364 - .../github.com/moby/spdystream/spdy/types.go | 291 - .../github.com/moby/spdystream/spdy/write.go | 334 - vendor/github.com/moby/spdystream/stream.go | 343 - vendor/github.com/moby/spdystream/utils.go | 32 - .../modern-go/concurrent/.gitignore | 1 - .../modern-go/concurrent/.travis.yml | 14 - .../github.com/modern-go/concurrent/LICENSE | 201 - .../github.com/modern-go/concurrent/README.md | 49 - .../modern-go/concurrent/executor.go | 14 - .../modern-go/concurrent/go_above_19.go | 15 - .../modern-go/concurrent/go_below_19.go | 33 - vendor/github.com/modern-go/concurrent/log.go | 13 - .../github.com/modern-go/concurrent/test.sh | 12 - .../concurrent/unbounded_executor.go | 119 - .../github.com/modern-go/reflect2/.gitignore | 2 - .../github.com/modern-go/reflect2/.travis.yml | 15 - .../github.com/modern-go/reflect2/Gopkg.lock | 9 - .../github.com/modern-go/reflect2/Gopkg.toml | 31 - vendor/github.com/modern-go/reflect2/LICENSE | 201 - .../github.com/modern-go/reflect2/README.md | 71 - .../modern-go/reflect2/go_above_118.go | 23 - .../modern-go/reflect2/go_above_19.go | 17 - .../modern-go/reflect2/go_below_118.go | 21 - .../github.com/modern-go/reflect2/reflect2.go | 300 - .../modern-go/reflect2/reflect2_amd64.s | 0 .../modern-go/reflect2/reflect2_kind.go | 30 - .../modern-go/reflect2/relfect2_386.s | 0 .../modern-go/reflect2/relfect2_amd64p32.s | 0 .../modern-go/reflect2/relfect2_arm.s | 0 .../modern-go/reflect2/relfect2_arm64.s | 0 .../modern-go/reflect2/relfect2_mips64x.s | 0 .../modern-go/reflect2/relfect2_mipsx.s | 0 .../modern-go/reflect2/relfect2_ppc64x.s | 0 .../modern-go/reflect2/relfect2_s390x.s | 0 .../modern-go/reflect2/safe_field.go | 58 - .../github.com/modern-go/reflect2/safe_map.go | 101 - .../modern-go/reflect2/safe_slice.go | 92 - .../modern-go/reflect2/safe_struct.go | 29 - .../modern-go/reflect2/safe_type.go | 78 - .../github.com/modern-go/reflect2/type_map.go | 70 - .../modern-go/reflect2/unsafe_array.go | 65 - .../modern-go/reflect2/unsafe_eface.go | 59 - .../modern-go/reflect2/unsafe_field.go | 74 - .../modern-go/reflect2/unsafe_iface.go | 64 - .../modern-go/reflect2/unsafe_link.go | 76 - .../modern-go/reflect2/unsafe_map.go | 130 - .../modern-go/reflect2/unsafe_ptr.go | 46 - .../modern-go/reflect2/unsafe_slice.go | 177 - .../modern-go/reflect2/unsafe_struct.go | 59 - .../modern-go/reflect2/unsafe_type.go | 85 - vendor/github.com/munnerz/goautoneg/LICENSE | 31 - vendor/github.com/munnerz/goautoneg/Makefile | 13 - .../github.com/munnerz/goautoneg/README.txt | 67 - .../github.com/munnerz/goautoneg/autoneg.go | 189 - .../openshift/custom-resource-status/LICENSE | 201 - .../conditions/v1/conditions.go | 104 - .../conditions/v1/doc.go | 9 - .../conditions/v1/types.go | 51 - .../conditions/v1/zz_generated.deepcopy.go | 23 - vendor/github.com/pborman/uuid/.travis.yml | 10 - .../github.com/pborman/uuid/CONTRIBUTING.md | 10 - vendor/github.com/pborman/uuid/CONTRIBUTORS | 1 - vendor/github.com/pborman/uuid/LICENSE | 27 - vendor/github.com/pborman/uuid/README.md | 15 - vendor/github.com/pborman/uuid/dce.go | 84 - vendor/github.com/pborman/uuid/doc.go | 13 - vendor/github.com/pborman/uuid/hash.go | 53 - vendor/github.com/pborman/uuid/marshal.go | 85 - vendor/github.com/pborman/uuid/node.go | 50 - vendor/github.com/pborman/uuid/sql.go | 68 - vendor/github.com/pborman/uuid/time.go | 57 - vendor/github.com/pborman/uuid/util.go | 32 - vendor/github.com/pborman/uuid/uuid.go | 162 - vendor/github.com/pborman/uuid/version1.go | 23 - vendor/github.com/pborman/uuid/version4.go | 26 - .../prometheus/client_golang/LICENSE | 201 - .../prometheus/client_golang/NOTICE | 23 - .../prometheus/client_golang/api/client.go | 156 - .../client_golang/api/prometheus/v1/api.go | 1460 - vendor/github.com/prometheus/common/LICENSE | 201 - vendor/github.com/prometheus/common/NOTICE | 5 - .../prometheus/common/model/alert.go | 136 - .../prometheus/common/model/fingerprinting.go | 105 - .../github.com/prometheus/common/model/fnv.go | 42 - .../prometheus/common/model/labels.go | 218 - .../prometheus/common/model/labelset.go | 169 - .../prometheus/common/model/metric.go | 102 - .../prometheus/common/model/model.go | 16 - .../prometheus/common/model/signature.go | 144 - .../prometheus/common/model/silence.go | 106 - .../prometheus/common/model/time.go | 340 - .../prometheus/common/model/value.go | 366 - .../prometheus/common/model/value_float.go | 100 - .../common/model/value_histogram.go | 178 - .../prometheus/common/model/value_type.go | 83 - vendor/github.com/satori/go.uuid/.travis.yml | 23 - vendor/github.com/satori/go.uuid/LICENSE | 20 - vendor/github.com/satori/go.uuid/README.md | 65 - vendor/github.com/satori/go.uuid/codec.go | 206 - vendor/github.com/satori/go.uuid/generator.go | 239 - vendor/github.com/satori/go.uuid/sql.go | 78 - vendor/github.com/satori/go.uuid/uuid.go | 161 - .../github.com/shopspring/decimal/.gitignore | 6 - .../github.com/shopspring/decimal/.travis.yml | 13 - .../shopspring/decimal/CHANGELOG.md | 19 - vendor/github.com/shopspring/decimal/LICENSE | 45 - .../github.com/shopspring/decimal/README.md | 130 - .../shopspring/decimal/decimal-go.go | 415 - .../github.com/shopspring/decimal/decimal.go | 1477 - .../github.com/shopspring/decimal/rounding.go | 119 - vendor/github.com/sirupsen/logrus/.gitignore | 4 - .../github.com/sirupsen/logrus/.golangci.yml | 40 - vendor/github.com/sirupsen/logrus/.travis.yml | 15 - .../github.com/sirupsen/logrus/CHANGELOG.md | 259 - vendor/github.com/sirupsen/logrus/LICENSE | 21 - vendor/github.com/sirupsen/logrus/README.md | 513 - vendor/github.com/sirupsen/logrus/alt_exit.go | 76 - .../github.com/sirupsen/logrus/appveyor.yml | 14 - .../github.com/sirupsen/logrus/buffer_pool.go | 52 - vendor/github.com/sirupsen/logrus/doc.go | 26 - vendor/github.com/sirupsen/logrus/entry.go | 431 - vendor/github.com/sirupsen/logrus/exported.go | 270 - .../github.com/sirupsen/logrus/formatter.go | 78 - vendor/github.com/sirupsen/logrus/hooks.go | 34 - .../sirupsen/logrus/json_formatter.go | 128 - vendor/github.com/sirupsen/logrus/logger.go | 404 - vendor/github.com/sirupsen/logrus/logrus.go | 186 - .../logrus/terminal_check_appengine.go | 11 - .../sirupsen/logrus/terminal_check_bsd.go | 13 - .../sirupsen/logrus/terminal_check_js.go | 7 - .../logrus/terminal_check_no_terminal.go | 11 - .../logrus/terminal_check_notappengine.go | 17 - .../sirupsen/logrus/terminal_check_solaris.go | 11 - .../sirupsen/logrus/terminal_check_unix.go | 13 - .../sirupsen/logrus/terminal_check_windows.go | 27 - .../sirupsen/logrus/text_formatter.go | 339 - vendor/github.com/sirupsen/logrus/writer.go | 70 - vendor/github.com/spf13/cast/.gitignore | 25 - vendor/github.com/spf13/cast/.travis.yml | 16 - vendor/github.com/spf13/cast/LICENSE | 21 - vendor/github.com/spf13/cast/Makefile | 40 - vendor/github.com/spf13/cast/README.md | 75 - vendor/github.com/spf13/cast/cast.go | 171 - vendor/github.com/spf13/cast/caste.go | 1249 - vendor/github.com/spf13/cobra/.gitignore | 39 - vendor/github.com/spf13/cobra/.golangci.yml | 62 - vendor/github.com/spf13/cobra/.mailmap | 3 - vendor/github.com/spf13/cobra/CONDUCT.md | 37 - vendor/github.com/spf13/cobra/CONTRIBUTING.md | 50 - vendor/github.com/spf13/cobra/LICENSE.txt | 174 - vendor/github.com/spf13/cobra/MAINTAINERS | 13 - vendor/github.com/spf13/cobra/Makefile | 35 - vendor/github.com/spf13/cobra/README.md | 112 - vendor/github.com/spf13/cobra/active_help.go | 63 - vendor/github.com/spf13/cobra/active_help.md | 157 - vendor/github.com/spf13/cobra/args.go | 131 - .../spf13/cobra/bash_completions.go | 712 - .../spf13/cobra/bash_completions.md | 93 - .../spf13/cobra/bash_completionsV2.go | 383 - vendor/github.com/spf13/cobra/cobra.go | 239 - vendor/github.com/spf13/cobra/command.go | 1810 - .../github.com/spf13/cobra/command_notwin.go | 20 - vendor/github.com/spf13/cobra/command_win.go | 41 - vendor/github.com/spf13/cobra/completions.go | 871 - .../spf13/cobra/fish_completions.go | 234 - .../spf13/cobra/fish_completions.md | 4 - vendor/github.com/spf13/cobra/flag_groups.go | 224 - .../spf13/cobra/powershell_completions.go | 310 - .../spf13/cobra/powershell_completions.md | 3 - .../spf13/cobra/projects_using_cobra.md | 60 - .../spf13/cobra/shell_completions.go | 98 - .../spf13/cobra/shell_completions.md | 568 - vendor/github.com/spf13/cobra/user_guide.md | 695 - .../github.com/spf13/cobra/zsh_completions.go | 301 - .../github.com/spf13/cobra/zsh_completions.md | 48 - vendor/github.com/spf13/pflag/.gitignore | 2 - vendor/github.com/spf13/pflag/.travis.yml | 22 - vendor/github.com/spf13/pflag/LICENSE | 28 - vendor/github.com/spf13/pflag/README.md | 296 - vendor/github.com/spf13/pflag/bool.go | 94 - vendor/github.com/spf13/pflag/bool_slice.go | 185 - vendor/github.com/spf13/pflag/bytes.go | 209 - vendor/github.com/spf13/pflag/count.go | 96 - vendor/github.com/spf13/pflag/duration.go | 86 - .../github.com/spf13/pflag/duration_slice.go | 166 - vendor/github.com/spf13/pflag/flag.go | 1239 - vendor/github.com/spf13/pflag/float32.go | 88 - .../github.com/spf13/pflag/float32_slice.go | 174 - vendor/github.com/spf13/pflag/float64.go | 84 - .../github.com/spf13/pflag/float64_slice.go | 166 - vendor/github.com/spf13/pflag/golangflag.go | 105 - vendor/github.com/spf13/pflag/int.go | 84 - vendor/github.com/spf13/pflag/int16.go | 88 - vendor/github.com/spf13/pflag/int32.go | 88 - vendor/github.com/spf13/pflag/int32_slice.go | 174 - vendor/github.com/spf13/pflag/int64.go | 84 - vendor/github.com/spf13/pflag/int64_slice.go | 166 - vendor/github.com/spf13/pflag/int8.go | 88 - vendor/github.com/spf13/pflag/int_slice.go | 158 - vendor/github.com/spf13/pflag/ip.go | 94 - vendor/github.com/spf13/pflag/ip_slice.go | 186 - vendor/github.com/spf13/pflag/ipmask.go | 122 - vendor/github.com/spf13/pflag/ipnet.go | 98 - vendor/github.com/spf13/pflag/string.go | 80 - vendor/github.com/spf13/pflag/string_array.go | 129 - vendor/github.com/spf13/pflag/string_slice.go | 163 - .../github.com/spf13/pflag/string_to_int.go | 149 - .../github.com/spf13/pflag/string_to_int64.go | 149 - .../spf13/pflag/string_to_string.go | 160 - vendor/github.com/spf13/pflag/uint.go | 88 - vendor/github.com/spf13/pflag/uint16.go | 88 - vendor/github.com/spf13/pflag/uint32.go | 88 - vendor/github.com/spf13/pflag/uint64.go | 88 - vendor/github.com/spf13/pflag/uint8.go | 88 - vendor/github.com/spf13/pflag/uint_slice.go | 168 - vendor/golang.org/x/crypto/AUTHORS | 3 - vendor/golang.org/x/crypto/CONTRIBUTORS | 3 - vendor/golang.org/x/crypto/LICENSE | 27 - vendor/golang.org/x/crypto/PATENTS | 22 - vendor/golang.org/x/crypto/bcrypt/base64.go | 35 - vendor/golang.org/x/crypto/bcrypt/bcrypt.go | 295 - vendor/golang.org/x/crypto/blowfish/block.go | 159 - vendor/golang.org/x/crypto/blowfish/cipher.go | 99 - vendor/golang.org/x/crypto/blowfish/const.go | 199 - vendor/golang.org/x/crypto/pbkdf2/pbkdf2.go | 77 - .../golang.org/x/crypto/pkcs12/bmp-string.go | 50 - vendor/golang.org/x/crypto/pkcs12/crypto.go | 131 - vendor/golang.org/x/crypto/pkcs12/errors.go | 23 - .../x/crypto/pkcs12/internal/rc2/rc2.go | 271 - vendor/golang.org/x/crypto/pkcs12/mac.go | 45 - vendor/golang.org/x/crypto/pkcs12/pbkdf.go | 170 - vendor/golang.org/x/crypto/pkcs12/pkcs12.go | 360 - vendor/golang.org/x/crypto/pkcs12/safebags.go | 57 - vendor/golang.org/x/crypto/scrypt/scrypt.go | 212 - vendor/golang.org/x/net/LICENSE | 27 - vendor/golang.org/x/net/PATENTS | 22 - vendor/golang.org/x/net/context/context.go | 56 - vendor/golang.org/x/net/context/go17.go | 73 - vendor/golang.org/x/net/context/go19.go | 21 - vendor/golang.org/x/net/context/pre_go17.go | 301 - vendor/golang.org/x/net/context/pre_go19.go | 110 - vendor/golang.org/x/net/http/httpguts/guts.go | 50 - .../golang.org/x/net/http/httpguts/httplex.go | 352 - vendor/golang.org/x/net/http2/.gitignore | 2 - vendor/golang.org/x/net/http2/Dockerfile | 51 - vendor/golang.org/x/net/http2/Makefile | 3 - vendor/golang.org/x/net/http2/ascii.go | 53 - vendor/golang.org/x/net/http2/ciphers.go | 641 - .../x/net/http2/client_conn_pool.go | 311 - vendor/golang.org/x/net/http2/databuffer.go | 146 - vendor/golang.org/x/net/http2/errors.go | 145 - vendor/golang.org/x/net/http2/flow.go | 120 - vendor/golang.org/x/net/http2/frame.go | 1658 - vendor/golang.org/x/net/http2/go111.go | 30 - vendor/golang.org/x/net/http2/go115.go | 27 - vendor/golang.org/x/net/http2/go118.go | 17 - vendor/golang.org/x/net/http2/gotrack.go | 170 - vendor/golang.org/x/net/http2/headermap.go | 105 - vendor/golang.org/x/net/http2/hpack/encode.go | 245 - vendor/golang.org/x/net/http2/hpack/hpack.go | 523 - .../golang.org/x/net/http2/hpack/huffman.go | 226 - .../x/net/http2/hpack/static_table.go | 188 - vendor/golang.org/x/net/http2/hpack/tables.go | 403 - vendor/golang.org/x/net/http2/http2.go | 385 - vendor/golang.org/x/net/http2/not_go111.go | 21 - vendor/golang.org/x/net/http2/not_go115.go | 31 - vendor/golang.org/x/net/http2/not_go118.go | 17 - vendor/golang.org/x/net/http2/pipe.go | 179 - vendor/golang.org/x/net/http2/server.go | 3238 - vendor/golang.org/x/net/http2/transport.go | 3152 - vendor/golang.org/x/net/http2/write.go | 370 - vendor/golang.org/x/net/http2/writesched.go | 250 - .../x/net/http2/writesched_priority.go | 451 - .../x/net/http2/writesched_random.go | 77 - vendor/golang.org/x/net/idna/go118.go | 14 - vendor/golang.org/x/net/idna/idna10.0.0.go | 770 - vendor/golang.org/x/net/idna/idna9.0.0.go | 718 - vendor/golang.org/x/net/idna/pre_go118.go | 12 - vendor/golang.org/x/net/idna/punycode.go | 217 - vendor/golang.org/x/net/idna/tables10.0.0.go | 4560 - vendor/golang.org/x/net/idna/tables11.0.0.go | 4654 -- vendor/golang.org/x/net/idna/tables12.0.0.go | 4734 -- vendor/golang.org/x/net/idna/tables13.0.0.go | 4840 -- vendor/golang.org/x/net/idna/tables9.0.0.go | 4487 - vendor/golang.org/x/net/idna/trie.go | 72 - vendor/golang.org/x/net/idna/trieval.go | 119 - .../golang.org/x/net/internal/socks/client.go | 168 - .../golang.org/x/net/internal/socks/socks.go | 317 - vendor/golang.org/x/net/proxy/dial.go | 54 - vendor/golang.org/x/net/proxy/direct.go | 31 - vendor/golang.org/x/net/proxy/per_host.go | 155 - vendor/golang.org/x/net/proxy/proxy.go | 149 - vendor/golang.org/x/net/proxy/socks5.go | 42 - vendor/golang.org/x/oauth2/.travis.yml | 13 - vendor/golang.org/x/oauth2/CONTRIBUTING.md | 26 - vendor/golang.org/x/oauth2/LICENSE | 27 - vendor/golang.org/x/oauth2/README.md | 36 - .../x/oauth2/authhandler/authhandler.go | 94 - .../golang.org/x/oauth2/google/appengine.go | 38 - .../x/oauth2/google/appengine_gen1.go | 78 - .../x/oauth2/google/appengine_gen2_flex.go | 28 - vendor/golang.org/x/oauth2/google/default.go | 225 - vendor/golang.org/x/oauth2/google/doc.go | 84 - vendor/golang.org/x/oauth2/google/error.go | 64 - vendor/golang.org/x/oauth2/google/google.go | 277 - .../google/internal/externalaccount/aws.go | 595 - .../externalaccount/basecredentials.go | 297 - .../internal/externalaccount/clientauth.go | 45 - .../google/internal/externalaccount/err.go | 18 - .../externalaccount/executablecredsource.go | 309 - .../externalaccount/filecredsource.go | 57 - .../internal/externalaccount/impersonate.go | 105 - .../internal/externalaccount/sts_exchange.go | 107 - .../internal/externalaccount/urlcredsource.go | 75 - vendor/golang.org/x/oauth2/google/jwt.go | 102 - vendor/golang.org/x/oauth2/google/sdk.go | 201 - .../x/oauth2/internal/client_appengine.go | 14 - vendor/golang.org/x/oauth2/internal/doc.go | 6 - vendor/golang.org/x/oauth2/internal/oauth2.go | 37 - vendor/golang.org/x/oauth2/internal/token.go | 292 - .../golang.org/x/oauth2/internal/transport.go | 33 - vendor/golang.org/x/oauth2/jws/jws.go | 182 - vendor/golang.org/x/oauth2/jwt/jwt.go | 185 - vendor/golang.org/x/oauth2/oauth2.go | 381 - vendor/golang.org/x/oauth2/token.go | 178 - vendor/golang.org/x/oauth2/transport.go | 89 - vendor/golang.org/x/sys/LICENSE | 27 - vendor/golang.org/x/sys/PATENTS | 22 - .../sys/internal/unsafeheader/unsafeheader.go | 30 - vendor/golang.org/x/sys/plan9/asm.s | 8 - vendor/golang.org/x/sys/plan9/asm_plan9_386.s | 30 - .../golang.org/x/sys/plan9/asm_plan9_amd64.s | 30 - vendor/golang.org/x/sys/plan9/asm_plan9_arm.s | 25 - vendor/golang.org/x/sys/plan9/const_plan9.go | 70 - vendor/golang.org/x/sys/plan9/dir_plan9.go | 212 - vendor/golang.org/x/sys/plan9/env_plan9.go | 31 - vendor/golang.org/x/sys/plan9/errors_plan9.go | 50 - vendor/golang.org/x/sys/plan9/mkall.sh | 150 - vendor/golang.org/x/sys/plan9/mkerrors.sh | 246 - .../golang.org/x/sys/plan9/mksysnum_plan9.sh | 23 - .../golang.org/x/sys/plan9/pwd_go15_plan9.go | 22 - vendor/golang.org/x/sys/plan9/pwd_plan9.go | 24 - vendor/golang.org/x/sys/plan9/race.go | 31 - vendor/golang.org/x/sys/plan9/race0.go | 26 - vendor/golang.org/x/sys/plan9/str.go | 23 - vendor/golang.org/x/sys/plan9/syscall.go | 110 - .../golang.org/x/sys/plan9/syscall_plan9.go | 361 - .../x/sys/plan9/zsyscall_plan9_386.go | 285 - .../x/sys/plan9/zsyscall_plan9_amd64.go | 285 - .../x/sys/plan9/zsyscall_plan9_arm.go | 285 - .../golang.org/x/sys/plan9/zsysnum_plan9.go | 49 - vendor/golang.org/x/sys/unix/.gitignore | 2 - vendor/golang.org/x/sys/unix/README.md | 184 - .../golang.org/x/sys/unix/affinity_linux.go | 86 - vendor/golang.org/x/sys/unix/aliases.go | 15 - vendor/golang.org/x/sys/unix/asm_aix_ppc64.s | 18 - vendor/golang.org/x/sys/unix/asm_bsd_386.s | 29 - vendor/golang.org/x/sys/unix/asm_bsd_amd64.s | 29 - vendor/golang.org/x/sys/unix/asm_bsd_arm.s | 29 - vendor/golang.org/x/sys/unix/asm_bsd_arm64.s | 29 - vendor/golang.org/x/sys/unix/asm_bsd_ppc64.s | 31 - .../golang.org/x/sys/unix/asm_bsd_riscv64.s | 29 - vendor/golang.org/x/sys/unix/asm_linux_386.s | 66 - .../golang.org/x/sys/unix/asm_linux_amd64.s | 58 - vendor/golang.org/x/sys/unix/asm_linux_arm.s | 57 - .../golang.org/x/sys/unix/asm_linux_arm64.s | 53 - .../golang.org/x/sys/unix/asm_linux_loong64.s | 54 - .../golang.org/x/sys/unix/asm_linux_mips64x.s | 57 - .../golang.org/x/sys/unix/asm_linux_mipsx.s | 55 - .../golang.org/x/sys/unix/asm_linux_ppc64x.s | 45 - .../golang.org/x/sys/unix/asm_linux_riscv64.s | 49 - .../golang.org/x/sys/unix/asm_linux_s390x.s | 57 - .../x/sys/unix/asm_openbsd_mips64.s | 30 - .../golang.org/x/sys/unix/asm_solaris_amd64.s | 18 - vendor/golang.org/x/sys/unix/asm_zos_s390x.s | 426 - .../golang.org/x/sys/unix/bluetooth_linux.go | 36 - vendor/golang.org/x/sys/unix/cap_freebsd.go | 196 - vendor/golang.org/x/sys/unix/constants.go | 14 - vendor/golang.org/x/sys/unix/dev_aix_ppc.go | 27 - vendor/golang.org/x/sys/unix/dev_aix_ppc64.go | 29 - vendor/golang.org/x/sys/unix/dev_darwin.go | 24 - vendor/golang.org/x/sys/unix/dev_dragonfly.go | 30 - vendor/golang.org/x/sys/unix/dev_freebsd.go | 30 - vendor/golang.org/x/sys/unix/dev_linux.go | 42 - vendor/golang.org/x/sys/unix/dev_netbsd.go | 29 - vendor/golang.org/x/sys/unix/dev_openbsd.go | 29 - vendor/golang.org/x/sys/unix/dev_zos.go | 29 - vendor/golang.org/x/sys/unix/dirent.go | 103 - vendor/golang.org/x/sys/unix/endian_big.go | 10 - vendor/golang.org/x/sys/unix/endian_little.go | 10 - vendor/golang.org/x/sys/unix/env_unix.go | 32 - vendor/golang.org/x/sys/unix/epoll_zos.go | 221 - vendor/golang.org/x/sys/unix/fcntl.go | 37 - vendor/golang.org/x/sys/unix/fcntl_darwin.go | 24 - .../x/sys/unix/fcntl_linux_32bit.go | 14 - vendor/golang.org/x/sys/unix/fdset.go | 30 - vendor/golang.org/x/sys/unix/fstatfs_zos.go | 164 - vendor/golang.org/x/sys/unix/gccgo.go | 60 - vendor/golang.org/x/sys/unix/gccgo_c.c | 45 - .../x/sys/unix/gccgo_linux_amd64.go | 21 - vendor/golang.org/x/sys/unix/ifreq_linux.go | 142 - vendor/golang.org/x/sys/unix/ioctl.go | 70 - vendor/golang.org/x/sys/unix/ioctl_linux.go | 233 - vendor/golang.org/x/sys/unix/ioctl_zos.go | 72 - vendor/golang.org/x/sys/unix/mkall.sh | 249 - vendor/golang.org/x/sys/unix/mkerrors.sh | 778 - vendor/golang.org/x/sys/unix/pagesize_unix.go | 16 - .../golang.org/x/sys/unix/pledge_openbsd.go | 163 - vendor/golang.org/x/sys/unix/ptrace_darwin.go | 18 - vendor/golang.org/x/sys/unix/ptrace_ios.go | 18 - vendor/golang.org/x/sys/unix/race.go | 31 - vendor/golang.org/x/sys/unix/race0.go | 26 - .../x/sys/unix/readdirent_getdents.go | 13 - .../x/sys/unix/readdirent_getdirentries.go | 20 - .../x/sys/unix/sockcmsg_dragonfly.go | 16 - .../golang.org/x/sys/unix/sockcmsg_linux.go | 85 - vendor/golang.org/x/sys/unix/sockcmsg_unix.go | 107 - .../x/sys/unix/sockcmsg_unix_other.go | 47 - vendor/golang.org/x/sys/unix/syscall.go | 87 - vendor/golang.org/x/sys/unix/syscall_aix.go | 599 - .../golang.org/x/sys/unix/syscall_aix_ppc.go | 54 - .../x/sys/unix/syscall_aix_ppc64.go | 85 - vendor/golang.org/x/sys/unix/syscall_bsd.go | 624 - .../golang.org/x/sys/unix/syscall_darwin.go | 827 - .../x/sys/unix/syscall_darwin_amd64.go | 52 - .../x/sys/unix/syscall_darwin_arm64.go | 52 - .../x/sys/unix/syscall_darwin_libSystem.go | 27 - .../x/sys/unix/syscall_dragonfly.go | 546 - .../x/sys/unix/syscall_dragonfly_amd64.go | 57 - .../golang.org/x/sys/unix/syscall_freebsd.go | 646 - .../x/sys/unix/syscall_freebsd_386.go | 65 - .../x/sys/unix/syscall_freebsd_amd64.go | 65 - .../x/sys/unix/syscall_freebsd_arm.go | 61 - .../x/sys/unix/syscall_freebsd_arm64.go | 61 - .../x/sys/unix/syscall_freebsd_riscv64.go | 61 - vendor/golang.org/x/sys/unix/syscall_hurd.go | 30 - .../golang.org/x/sys/unix/syscall_hurd_386.go | 29 - .../golang.org/x/sys/unix/syscall_illumos.go | 79 - vendor/golang.org/x/sys/unix/syscall_linux.go | 2510 - .../x/sys/unix/syscall_linux_386.go | 342 - .../x/sys/unix/syscall_linux_alarm.go | 14 - .../x/sys/unix/syscall_linux_amd64.go | 147 - .../x/sys/unix/syscall_linux_amd64_gc.go | 13 - .../x/sys/unix/syscall_linux_arm.go | 244 - .../x/sys/unix/syscall_linux_arm64.go | 195 - .../golang.org/x/sys/unix/syscall_linux_gc.go | 15 - .../x/sys/unix/syscall_linux_gc_386.go | 17 - .../x/sys/unix/syscall_linux_gc_arm.go | 14 - .../x/sys/unix/syscall_linux_gccgo_386.go | 31 - .../x/sys/unix/syscall_linux_gccgo_arm.go | 21 - .../x/sys/unix/syscall_linux_loong64.go | 222 - .../x/sys/unix/syscall_linux_mips64x.go | 191 - .../x/sys/unix/syscall_linux_mipsx.go | 203 - .../x/sys/unix/syscall_linux_ppc.go | 232 - .../x/sys/unix/syscall_linux_ppc64x.go | 118 - .../x/sys/unix/syscall_linux_riscv64.go | 180 - .../x/sys/unix/syscall_linux_s390x.go | 298 - .../x/sys/unix/syscall_linux_sparc64.go | 114 - .../golang.org/x/sys/unix/syscall_netbsd.go | 623 - .../x/sys/unix/syscall_netbsd_386.go | 38 - .../x/sys/unix/syscall_netbsd_amd64.go | 38 - .../x/sys/unix/syscall_netbsd_arm.go | 38 - .../x/sys/unix/syscall_netbsd_arm64.go | 38 - .../golang.org/x/sys/unix/syscall_openbsd.go | 391 - .../x/sys/unix/syscall_openbsd_386.go | 42 - .../x/sys/unix/syscall_openbsd_amd64.go | 42 - .../x/sys/unix/syscall_openbsd_arm.go | 42 - .../x/sys/unix/syscall_openbsd_arm64.go | 42 - .../x/sys/unix/syscall_openbsd_libc.go | 27 - .../x/sys/unix/syscall_openbsd_mips64.go | 39 - .../x/sys/unix/syscall_openbsd_ppc64.go | 42 - .../x/sys/unix/syscall_openbsd_riscv64.go | 42 - .../golang.org/x/sys/unix/syscall_solaris.go | 1136 - .../x/sys/unix/syscall_solaris_amd64.go | 28 - vendor/golang.org/x/sys/unix/syscall_unix.go | 589 - .../golang.org/x/sys/unix/syscall_unix_gc.go | 16 - .../x/sys/unix/syscall_unix_gc_ppc64x.go | 25 - .../x/sys/unix/syscall_zos_s390x.go | 1994 - vendor/golang.org/x/sys/unix/sysvshm_linux.go | 21 - vendor/golang.org/x/sys/unix/sysvshm_unix.go | 52 - .../x/sys/unix/sysvshm_unix_other.go | 14 - vendor/golang.org/x/sys/unix/timestruct.go | 77 - .../golang.org/x/sys/unix/unveil_openbsd.go | 42 - vendor/golang.org/x/sys/unix/xattr_bsd.go | 281 - .../golang.org/x/sys/unix/zerrors_aix_ppc.go | 1385 - .../x/sys/unix/zerrors_aix_ppc64.go | 1386 - .../x/sys/unix/zerrors_darwin_amd64.go | 1892 - .../x/sys/unix/zerrors_darwin_arm64.go | 1892 - .../x/sys/unix/zerrors_dragonfly_amd64.go | 1738 - .../x/sys/unix/zerrors_freebsd_386.go | 2043 - .../x/sys/unix/zerrors_freebsd_amd64.go | 2040 - .../x/sys/unix/zerrors_freebsd_arm.go | 2034 - .../x/sys/unix/zerrors_freebsd_arm64.go | 2034 - .../x/sys/unix/zerrors_freebsd_riscv64.go | 2148 - vendor/golang.org/x/sys/unix/zerrors_linux.go | 3479 - .../x/sys/unix/zerrors_linux_386.go | 829 - .../x/sys/unix/zerrors_linux_amd64.go | 829 - .../x/sys/unix/zerrors_linux_arm.go | 835 - .../x/sys/unix/zerrors_linux_arm64.go | 827 - .../x/sys/unix/zerrors_linux_loong64.go | 819 - .../x/sys/unix/zerrors_linux_mips.go | 836 - .../x/sys/unix/zerrors_linux_mips64.go | 836 - .../x/sys/unix/zerrors_linux_mips64le.go | 836 - .../x/sys/unix/zerrors_linux_mipsle.go | 836 - .../x/sys/unix/zerrors_linux_ppc.go | 888 - .../x/sys/unix/zerrors_linux_ppc64.go | 892 - .../x/sys/unix/zerrors_linux_ppc64le.go | 892 - .../x/sys/unix/zerrors_linux_riscv64.go | 816 - .../x/sys/unix/zerrors_linux_s390x.go | 891 - .../x/sys/unix/zerrors_linux_sparc64.go | 886 - .../x/sys/unix/zerrors_netbsd_386.go | 1780 - .../x/sys/unix/zerrors_netbsd_amd64.go | 1770 - .../x/sys/unix/zerrors_netbsd_arm.go | 1759 - .../x/sys/unix/zerrors_netbsd_arm64.go | 1770 - .../x/sys/unix/zerrors_openbsd_386.go | 1906 - .../x/sys/unix/zerrors_openbsd_amd64.go | 1906 - .../x/sys/unix/zerrors_openbsd_arm.go | 1906 - .../x/sys/unix/zerrors_openbsd_arm64.go | 1906 - .../x/sys/unix/zerrors_openbsd_mips64.go | 1906 - .../x/sys/unix/zerrors_openbsd_ppc64.go | 1905 - .../x/sys/unix/zerrors_openbsd_riscv64.go | 1904 - .../x/sys/unix/zerrors_solaris_amd64.go | 1557 - .../x/sys/unix/zerrors_zos_s390x.go | 860 - .../x/sys/unix/zptrace_armnn_linux.go | 42 - .../x/sys/unix/zptrace_linux_arm64.go | 17 - .../x/sys/unix/zptrace_mipsnn_linux.go | 51 - .../x/sys/unix/zptrace_mipsnnle_linux.go | 51 - .../x/sys/unix/zptrace_x86_linux.go | 81 - .../golang.org/x/sys/unix/zsyscall_aix_ppc.go | 1495 - .../x/sys/unix/zsyscall_aix_ppc64.go | 1453 - .../x/sys/unix/zsyscall_aix_ppc64_gc.go | 1199 - .../x/sys/unix/zsyscall_aix_ppc64_gccgo.go | 1078 - .../x/sys/unix/zsyscall_darwin_amd64.go | 2561 - .../x/sys/unix/zsyscall_darwin_amd64.s | 904 - .../x/sys/unix/zsyscall_darwin_arm64.go | 2561 - .../x/sys/unix/zsyscall_darwin_arm64.s | 904 - .../x/sys/unix/zsyscall_dragonfly_amd64.go | 1699 - .../x/sys/unix/zsyscall_freebsd_386.go | 1919 - .../x/sys/unix/zsyscall_freebsd_amd64.go | 1919 - .../x/sys/unix/zsyscall_freebsd_arm.go | 1919 - .../x/sys/unix/zsyscall_freebsd_arm64.go | 1919 - .../x/sys/unix/zsyscall_freebsd_riscv64.go | 1919 - .../x/sys/unix/zsyscall_illumos_amd64.go | 102 - .../golang.org/x/sys/unix/zsyscall_linux.go | 2184 - .../x/sys/unix/zsyscall_linux_386.go | 497 - .../x/sys/unix/zsyscall_linux_amd64.go | 664 - .../x/sys/unix/zsyscall_linux_arm.go | 612 - .../x/sys/unix/zsyscall_linux_arm64.go | 563 - .../x/sys/unix/zsyscall_linux_loong64.go | 487 - .../x/sys/unix/zsyscall_linux_mips.go | 664 - .../x/sys/unix/zsyscall_linux_mips64.go | 658 - .../x/sys/unix/zsyscall_linux_mips64le.go | 647 - .../x/sys/unix/zsyscall_linux_mipsle.go | 664 - .../x/sys/unix/zsyscall_linux_ppc.go | 669 - .../x/sys/unix/zsyscall_linux_ppc64.go | 715 - .../x/sys/unix/zsyscall_linux_ppc64le.go | 715 - .../x/sys/unix/zsyscall_linux_riscv64.go | 543 - .../x/sys/unix/zsyscall_linux_s390x.go | 506 - .../x/sys/unix/zsyscall_linux_sparc64.go | 659 - .../x/sys/unix/zsyscall_netbsd_386.go | 1870 - .../x/sys/unix/zsyscall_netbsd_amd64.go | 1870 - .../x/sys/unix/zsyscall_netbsd_arm.go | 1870 - .../x/sys/unix/zsyscall_netbsd_arm64.go | 1870 - .../x/sys/unix/zsyscall_openbsd_386.go | 2243 - .../x/sys/unix/zsyscall_openbsd_386.s | 669 - .../x/sys/unix/zsyscall_openbsd_amd64.go | 2243 - .../x/sys/unix/zsyscall_openbsd_amd64.s | 669 - .../x/sys/unix/zsyscall_openbsd_arm.go | 2243 - .../x/sys/unix/zsyscall_openbsd_arm.s | 669 - .../x/sys/unix/zsyscall_openbsd_arm64.go | 2243 - .../x/sys/unix/zsyscall_openbsd_arm64.s | 669 - .../x/sys/unix/zsyscall_openbsd_mips64.go | 2243 - .../x/sys/unix/zsyscall_openbsd_mips64.s | 669 - .../x/sys/unix/zsyscall_openbsd_ppc64.go | 2243 - .../x/sys/unix/zsyscall_openbsd_ppc64.s | 802 - .../x/sys/unix/zsyscall_openbsd_riscv64.go | 2243 - .../x/sys/unix/zsyscall_openbsd_riscv64.s | 669 - .../x/sys/unix/zsyscall_solaris_amd64.go | 2117 - .../x/sys/unix/zsyscall_zos_s390x.go | 1265 - .../x/sys/unix/zsysctl_openbsd_386.go | 281 - .../x/sys/unix/zsysctl_openbsd_amd64.go | 281 - .../x/sys/unix/zsysctl_openbsd_arm.go | 281 - .../x/sys/unix/zsysctl_openbsd_arm64.go | 281 - .../x/sys/unix/zsysctl_openbsd_mips64.go | 281 - .../x/sys/unix/zsysctl_openbsd_ppc64.go | 281 - .../x/sys/unix/zsysctl_openbsd_riscv64.go | 282 - .../x/sys/unix/zsysnum_darwin_amd64.go | 440 - .../x/sys/unix/zsysnum_darwin_arm64.go | 438 - .../x/sys/unix/zsysnum_dragonfly_amd64.go | 317 - .../x/sys/unix/zsysnum_freebsd_386.go | 394 - .../x/sys/unix/zsysnum_freebsd_amd64.go | 394 - .../x/sys/unix/zsysnum_freebsd_arm.go | 394 - .../x/sys/unix/zsysnum_freebsd_arm64.go | 394 - .../x/sys/unix/zsysnum_freebsd_riscv64.go | 394 - .../x/sys/unix/zsysnum_linux_386.go | 450 - .../x/sys/unix/zsysnum_linux_amd64.go | 372 - .../x/sys/unix/zsysnum_linux_arm.go | 414 - .../x/sys/unix/zsysnum_linux_arm64.go | 317 - .../x/sys/unix/zsysnum_linux_loong64.go | 311 - .../x/sys/unix/zsysnum_linux_mips.go | 434 - .../x/sys/unix/zsysnum_linux_mips64.go | 364 - .../x/sys/unix/zsysnum_linux_mips64le.go | 364 - .../x/sys/unix/zsysnum_linux_mipsle.go | 434 - .../x/sys/unix/zsysnum_linux_ppc.go | 441 - .../x/sys/unix/zsysnum_linux_ppc64.go | 413 - .../x/sys/unix/zsysnum_linux_ppc64le.go | 413 - .../x/sys/unix/zsysnum_linux_riscv64.go | 316 - .../x/sys/unix/zsysnum_linux_s390x.go | 378 - .../x/sys/unix/zsysnum_linux_sparc64.go | 392 - .../x/sys/unix/zsysnum_netbsd_386.go | 275 - .../x/sys/unix/zsysnum_netbsd_amd64.go | 275 - .../x/sys/unix/zsysnum_netbsd_arm.go | 275 - .../x/sys/unix/zsysnum_netbsd_arm64.go | 275 - .../x/sys/unix/zsysnum_openbsd_386.go | 220 - .../x/sys/unix/zsysnum_openbsd_amd64.go | 220 - .../x/sys/unix/zsysnum_openbsd_arm.go | 220 - .../x/sys/unix/zsysnum_openbsd_arm64.go | 219 - .../x/sys/unix/zsysnum_openbsd_mips64.go | 222 - .../x/sys/unix/zsysnum_openbsd_ppc64.go | 218 - .../x/sys/unix/zsysnum_openbsd_riscv64.go | 219 - .../x/sys/unix/zsysnum_zos_s390x.go | 2670 - .../golang.org/x/sys/unix/ztypes_aix_ppc.go | 354 - .../golang.org/x/sys/unix/ztypes_aix_ppc64.go | 358 - .../x/sys/unix/ztypes_darwin_amd64.go | 795 - .../x/sys/unix/ztypes_darwin_arm64.go | 795 - .../x/sys/unix/ztypes_dragonfly_amd64.go | 474 - .../x/sys/unix/ztypes_freebsd_386.go | 651 - .../x/sys/unix/ztypes_freebsd_amd64.go | 656 - .../x/sys/unix/ztypes_freebsd_arm.go | 642 - .../x/sys/unix/ztypes_freebsd_arm64.go | 636 - .../x/sys/unix/ztypes_freebsd_riscv64.go | 638 - vendor/golang.org/x/sys/unix/ztypes_linux.go | 5812 -- .../golang.org/x/sys/unix/ztypes_linux_386.go | 696 - .../x/sys/unix/ztypes_linux_amd64.go | 711 - .../golang.org/x/sys/unix/ztypes_linux_arm.go | 691 - .../x/sys/unix/ztypes_linux_arm64.go | 690 - .../x/sys/unix/ztypes_linux_loong64.go | 691 - .../x/sys/unix/ztypes_linux_mips.go | 696 - .../x/sys/unix/ztypes_linux_mips64.go | 693 - .../x/sys/unix/ztypes_linux_mips64le.go | 693 - .../x/sys/unix/ztypes_linux_mipsle.go | 696 - .../golang.org/x/sys/unix/ztypes_linux_ppc.go | 704 - .../x/sys/unix/ztypes_linux_ppc64.go | 699 - .../x/sys/unix/ztypes_linux_ppc64le.go | 699 - .../x/sys/unix/ztypes_linux_riscv64.go | 718 - .../x/sys/unix/ztypes_linux_s390x.go | 713 - .../x/sys/unix/ztypes_linux_sparc64.go | 694 - .../x/sys/unix/ztypes_netbsd_386.go | 586 - .../x/sys/unix/ztypes_netbsd_amd64.go | 594 - .../x/sys/unix/ztypes_netbsd_arm.go | 591 - .../x/sys/unix/ztypes_netbsd_arm64.go | 594 - .../x/sys/unix/ztypes_openbsd_386.go | 569 - .../x/sys/unix/ztypes_openbsd_amd64.go | 569 - .../x/sys/unix/ztypes_openbsd_arm.go | 576 - .../x/sys/unix/ztypes_openbsd_arm64.go | 569 - .../x/sys/unix/ztypes_openbsd_mips64.go | 569 - .../x/sys/unix/ztypes_openbsd_ppc64.go | 571 - .../x/sys/unix/ztypes_openbsd_riscv64.go | 571 - .../x/sys/unix/ztypes_solaris_amd64.go | 517 - .../golang.org/x/sys/unix/ztypes_zos_s390x.go | 415 - vendor/golang.org/x/sys/windows/aliases.go | 13 - .../golang.org/x/sys/windows/dll_windows.go | 416 - vendor/golang.org/x/sys/windows/empty.s | 9 - .../golang.org/x/sys/windows/env_windows.go | 54 - vendor/golang.org/x/sys/windows/eventlog.go | 21 - .../golang.org/x/sys/windows/exec_windows.go | 178 - .../x/sys/windows/memory_windows.go | 48 - vendor/golang.org/x/sys/windows/mkerrors.bash | 70 - .../x/sys/windows/mkknownfolderids.bash | 27 - vendor/golang.org/x/sys/windows/mksyscall.go | 10 - vendor/golang.org/x/sys/windows/race.go | 31 - vendor/golang.org/x/sys/windows/race0.go | 26 - .../x/sys/windows/security_windows.go | 1444 - vendor/golang.org/x/sys/windows/service.go | 247 - .../x/sys/windows/setupapi_windows.go | 1425 - vendor/golang.org/x/sys/windows/str.go | 23 - vendor/golang.org/x/sys/windows/syscall.go | 105 - .../x/sys/windows/syscall_windows.go | 1808 - .../golang.org/x/sys/windows/types_windows.go | 3345 - .../x/sys/windows/types_windows_386.go | 35 - .../x/sys/windows/types_windows_amd64.go | 34 - .../x/sys/windows/types_windows_arm.go | 35 - .../x/sys/windows/types_windows_arm64.go | 34 - .../x/sys/windows/zerrors_windows.go | 9468 --- .../x/sys/windows/zknownfolderids_windows.go | 149 - .../x/sys/windows/zsyscall_windows.go | 4336 - vendor/golang.org/x/term/CONTRIBUTING.md | 26 - vendor/golang.org/x/term/LICENSE | 27 - vendor/golang.org/x/term/PATENTS | 22 - vendor/golang.org/x/term/README.md | 19 - vendor/golang.org/x/term/codereview.cfg | 1 - vendor/golang.org/x/term/term.go | 60 - vendor/golang.org/x/term/term_plan9.go | 42 - vendor/golang.org/x/term/term_unix.go | 92 - vendor/golang.org/x/term/term_unix_bsd.go | 13 - vendor/golang.org/x/term/term_unix_other.go | 13 - vendor/golang.org/x/term/term_unsupported.go | 39 - vendor/golang.org/x/term/term_windows.go | 79 - vendor/golang.org/x/term/terminal.go | 986 - vendor/golang.org/x/text/LICENSE | 27 - vendor/golang.org/x/text/PATENTS | 22 - .../x/text/secure/bidirule/bidirule.go | 336 - .../x/text/secure/bidirule/bidirule10.0.0.go | 12 - .../x/text/secure/bidirule/bidirule9.0.0.go | 15 - .../golang.org/x/text/transform/transform.go | 709 - vendor/golang.org/x/text/unicode/bidi/bidi.go | 359 - .../golang.org/x/text/unicode/bidi/bracket.go | 335 - vendor/golang.org/x/text/unicode/bidi/core.go | 1071 - vendor/golang.org/x/text/unicode/bidi/prop.go | 206 - .../x/text/unicode/bidi/tables10.0.0.go | 1816 - .../x/text/unicode/bidi/tables11.0.0.go | 1888 - .../x/text/unicode/bidi/tables12.0.0.go | 1924 - .../x/text/unicode/bidi/tables13.0.0.go | 1956 - .../x/text/unicode/bidi/tables9.0.0.go | 1782 - .../golang.org/x/text/unicode/bidi/trieval.go | 48 - .../x/text/unicode/norm/composition.go | 512 - .../x/text/unicode/norm/forminfo.go | 279 - .../golang.org/x/text/unicode/norm/input.go | 109 - vendor/golang.org/x/text/unicode/norm/iter.go | 458 - .../x/text/unicode/norm/normalize.go | 610 - .../x/text/unicode/norm/readwriter.go | 125 - .../x/text/unicode/norm/tables10.0.0.go | 7658 -- .../x/text/unicode/norm/tables11.0.0.go | 7694 -- .../x/text/unicode/norm/tables12.0.0.go | 7711 -- .../x/text/unicode/norm/tables13.0.0.go | 7761 -- .../x/text/unicode/norm/tables9.0.0.go | 7638 -- .../x/text/unicode/norm/transform.go | 88 - vendor/golang.org/x/text/unicode/norm/trie.go | 54 - vendor/golang.org/x/text/width/kind_string.go | 28 - .../golang.org/x/text/width/tables10.0.0.go | 1329 - .../golang.org/x/text/width/tables11.0.0.go | 1341 - .../golang.org/x/text/width/tables12.0.0.go | 1361 - .../golang.org/x/text/width/tables13.0.0.go | 1362 - vendor/golang.org/x/text/width/tables9.0.0.go | 1297 - vendor/golang.org/x/text/width/transform.go | 239 - vendor/golang.org/x/text/width/trieval.go | 30 - vendor/golang.org/x/text/width/width.go | 206 - vendor/golang.org/x/time/AUTHORS | 3 - vendor/golang.org/x/time/CONTRIBUTORS | 3 - vendor/golang.org/x/time/LICENSE | 27 - vendor/golang.org/x/time/PATENTS | 22 - vendor/golang.org/x/time/rate/rate.go | 405 - .../google.golang.org/appengine/.travis.yml | 18 - .../appengine/CONTRIBUTING.md | 90 - vendor/google.golang.org/appengine/LICENSE | 202 - vendor/google.golang.org/appengine/README.md | 100 - .../google.golang.org/appengine/appengine.go | 135 - .../appengine/appengine_vm.go | 20 - vendor/google.golang.org/appengine/errors.go | 46 - .../google.golang.org/appengine/identity.go | 142 - .../appengine/internal/api.go | 678 - .../appengine/internal/api_classic.go | 169 - .../appengine/internal/api_common.go | 123 - .../appengine/internal/app_id.go | 28 - .../app_identity/app_identity_service.pb.go | 611 - .../app_identity/app_identity_service.proto | 64 - .../appengine/internal/base/api_base.pb.go | 308 - .../appengine/internal/base/api_base.proto | 33 - .../internal/datastore/datastore_v3.pb.go | 4367 - .../internal/datastore/datastore_v3.proto | 551 - .../appengine/internal/identity.go | 55 - .../appengine/internal/identity_classic.go | 61 - .../appengine/internal/identity_flex.go | 11 - .../appengine/internal/identity_vm.go | 134 - .../appengine/internal/internal.go | 110 - .../appengine/internal/log/log_service.pb.go | 1313 - .../appengine/internal/log/log_service.proto | 150 - .../appengine/internal/main.go | 16 - .../appengine/internal/main_common.go | 7 - .../appengine/internal/main_vm.go | 69 - .../appengine/internal/metadata.go | 60 - .../internal/modules/modules_service.pb.go | 786 - .../internal/modules/modules_service.proto | 80 - .../appengine/internal/net.go | 56 - .../appengine/internal/regen.sh | 40 - .../internal/remote_api/remote_api.pb.go | 361 - .../internal/remote_api/remote_api.proto | 44 - .../appengine/internal/transaction.go | 115 - .../internal/urlfetch/urlfetch_service.pb.go | 527 - .../internal/urlfetch/urlfetch_service.proto | 64 - .../google.golang.org/appengine/namespace.go | 25 - vendor/google.golang.org/appengine/timeout.go | 20 - .../appengine/travis_install.sh | 18 - .../appengine/travis_test.sh | 12 - .../appengine/urlfetch/urlfetch.go | 210 - vendor/google.golang.org/protobuf/LICENSE | 27 - vendor/google.golang.org/protobuf/PATENTS | 22 - .../protobuf/encoding/prototext/decode.go | 770 - .../protobuf/encoding/prototext/doc.go | 7 - .../protobuf/encoding/prototext/encode.go | 370 - .../protobuf/encoding/protowire/wire.go | 547 - .../protobuf/internal/descfmt/stringer.go | 318 - .../protobuf/internal/descopts/options.go | 29 - .../protobuf/internal/detrand/rand.go | 69 - .../internal/encoding/defval/default.go | 213 - .../encoding/messageset/messageset.go | 242 - .../protobuf/internal/encoding/tag/tag.go | 207 - .../protobuf/internal/encoding/text/decode.go | 686 - .../internal/encoding/text/decode_number.go | 211 - .../internal/encoding/text/decode_string.go | 161 - .../internal/encoding/text/decode_token.go | 373 - .../protobuf/internal/encoding/text/doc.go | 29 - .../protobuf/internal/encoding/text/encode.go | 270 - .../protobuf/internal/errors/errors.go | 89 - .../protobuf/internal/errors/is_go112.go | 40 - .../protobuf/internal/errors/is_go113.go | 13 - .../protobuf/internal/filedesc/build.go | 157 - .../protobuf/internal/filedesc/desc.go | 633 - .../protobuf/internal/filedesc/desc_init.go | 471 - .../protobuf/internal/filedesc/desc_lazy.go | 704 - .../protobuf/internal/filedesc/desc_list.go | 457 - .../internal/filedesc/desc_list_gen.go | 356 - .../protobuf/internal/filedesc/placeholder.go | 109 - .../protobuf/internal/filetype/build.go | 296 - .../protobuf/internal/flags/flags.go | 24 - .../internal/flags/proto_legacy_disable.go | 10 - .../internal/flags/proto_legacy_enable.go | 10 - .../protobuf/internal/genid/any_gen.go | 34 - .../protobuf/internal/genid/api_gen.go | 106 - .../protobuf/internal/genid/descriptor_gen.go | 871 - .../protobuf/internal/genid/doc.go | 11 - .../protobuf/internal/genid/duration_gen.go | 34 - .../protobuf/internal/genid/empty_gen.go | 19 - .../protobuf/internal/genid/field_mask_gen.go | 31 - .../protobuf/internal/genid/goname.go | 25 - .../protobuf/internal/genid/map_entry.go | 16 - .../internal/genid/source_context_gen.go | 31 - .../protobuf/internal/genid/struct_gen.go | 116 - .../protobuf/internal/genid/timestamp_gen.go | 34 - .../protobuf/internal/genid/type_gen.go | 184 - .../protobuf/internal/genid/wrappers.go | 13 - .../protobuf/internal/genid/wrappers_gen.go | 175 - .../protobuf/internal/impl/api_export.go | 177 - .../protobuf/internal/impl/checkinit.go | 141 - .../protobuf/internal/impl/codec_extension.go | 223 - .../protobuf/internal/impl/codec_field.go | 830 - .../protobuf/internal/impl/codec_gen.go | 5637 -- .../protobuf/internal/impl/codec_map.go | 388 - .../protobuf/internal/impl/codec_map_go111.go | 38 - .../protobuf/internal/impl/codec_map_go112.go | 12 - .../protobuf/internal/impl/codec_message.go | 217 - .../internal/impl/codec_messageset.go | 123 - .../protobuf/internal/impl/codec_reflect.go | 210 - .../protobuf/internal/impl/codec_tables.go | 557 - .../protobuf/internal/impl/codec_unsafe.go | 18 - .../protobuf/internal/impl/convert.go | 495 - .../protobuf/internal/impl/convert_list.go | 141 - .../protobuf/internal/impl/convert_map.go | 121 - .../protobuf/internal/impl/decode.go | 285 - .../protobuf/internal/impl/encode.go | 201 - .../protobuf/internal/impl/enum.go | 21 - .../protobuf/internal/impl/extension.go | 156 - .../protobuf/internal/impl/legacy_enum.go | 218 - .../protobuf/internal/impl/legacy_export.go | 92 - .../internal/impl/legacy_extension.go | 176 - .../protobuf/internal/impl/legacy_file.go | 81 - .../protobuf/internal/impl/legacy_message.go | 563 - .../protobuf/internal/impl/merge.go | 176 - .../protobuf/internal/impl/merge_gen.go | 209 - .../protobuf/internal/impl/message.go | 279 - .../protobuf/internal/impl/message_reflect.go | 463 - .../internal/impl/message_reflect_field.go | 543 - .../internal/impl/message_reflect_gen.go | 249 - .../protobuf/internal/impl/pointer_reflect.go | 179 - .../protobuf/internal/impl/pointer_unsafe.go | 175 - .../protobuf/internal/impl/validate.go | 576 - .../protobuf/internal/impl/weak.go | 74 - .../protobuf/internal/order/order.go | 89 - .../protobuf/internal/order/range.go | 115 - .../protobuf/internal/pragma/pragma.go | 29 - .../protobuf/internal/set/ints.go | 58 - .../protobuf/internal/strs/strings.go | 196 - .../protobuf/internal/strs/strings_pure.go | 28 - .../protobuf/internal/strs/strings_unsafe.go | 95 - .../protobuf/internal/version/version.go | 79 - .../protobuf/proto/checkinit.go | 71 - .../protobuf/proto/decode.go | 294 - .../protobuf/proto/decode_gen.go | 603 - .../google.golang.org/protobuf/proto/doc.go | 86 - .../protobuf/proto/encode.go | 322 - .../protobuf/proto/encode_gen.go | 97 - .../google.golang.org/protobuf/proto/equal.go | 57 - .../protobuf/proto/extension.go | 92 - .../google.golang.org/protobuf/proto/merge.go | 139 - .../protobuf/proto/messageset.go | 93 - .../google.golang.org/protobuf/proto/proto.go | 43 - .../protobuf/proto/proto_methods.go | 20 - .../protobuf/proto/proto_reflect.go | 20 - .../google.golang.org/protobuf/proto/reset.go | 43 - .../google.golang.org/protobuf/proto/size.go | 97 - .../protobuf/proto/size_gen.go | 55 - .../protobuf/proto/wrappers.go | 29 - .../protobuf/reflect/protodesc/desc.go | 276 - .../protobuf/reflect/protodesc/desc_init.go | 248 - .../reflect/protodesc/desc_resolve.go | 286 - .../reflect/protodesc/desc_validate.go | 374 - .../protobuf/reflect/protodesc/proto.go | 252 - .../protobuf/reflect/protoreflect/methods.go | 78 - .../protobuf/reflect/protoreflect/proto.go | 508 - .../protobuf/reflect/protoreflect/source.go | 129 - .../reflect/protoreflect/source_gen.go | 475 - .../protobuf/reflect/protoreflect/type.go | 666 - .../protobuf/reflect/protoreflect/value.go | 285 - .../reflect/protoreflect/value_equal.go | 168 - .../reflect/protoreflect/value_pure.go | 60 - .../reflect/protoreflect/value_union.go | 438 - .../reflect/protoreflect/value_unsafe.go | 99 - .../reflect/protoregistry/registry.go | 882 - .../protobuf/runtime/protoiface/legacy.go | 15 - .../protobuf/runtime/protoiface/methods.go | 168 - .../protobuf/runtime/protoimpl/impl.go | 44 - .../protobuf/runtime/protoimpl/version.go | 60 - .../types/descriptorpb/descriptor.pb.go | 4350 - .../protobuf/types/known/anypb/any.pb.go | 495 - .../types/known/durationpb/duration.pb.go | 374 - .../types/known/timestamppb/timestamp.pb.go | 383 - vendor/gopkg.in/inf.v0/LICENSE | 28 - vendor/gopkg.in/inf.v0/dec.go | 615 - vendor/gopkg.in/inf.v0/rounder.go | 145 - vendor/gopkg.in/yaml.v2/.travis.yml | 17 - vendor/gopkg.in/yaml.v2/LICENSE | 201 - vendor/gopkg.in/yaml.v2/LICENSE.libyaml | 31 - vendor/gopkg.in/yaml.v2/NOTICE | 13 - vendor/gopkg.in/yaml.v2/README.md | 133 - vendor/gopkg.in/yaml.v2/apic.go | 744 - vendor/gopkg.in/yaml.v2/decode.go | 815 - vendor/gopkg.in/yaml.v2/emitterc.go | 1685 - vendor/gopkg.in/yaml.v2/encode.go | 390 - vendor/gopkg.in/yaml.v2/parserc.go | 1095 - vendor/gopkg.in/yaml.v2/readerc.go | 412 - vendor/gopkg.in/yaml.v2/resolve.go | 258 - vendor/gopkg.in/yaml.v2/scannerc.go | 2711 - vendor/gopkg.in/yaml.v2/sorter.go | 113 - vendor/gopkg.in/yaml.v2/writerc.go | 26 - vendor/gopkg.in/yaml.v2/yaml.go | 478 - vendor/gopkg.in/yaml.v2/yamlh.go | 739 - vendor/gopkg.in/yaml.v2/yamlprivateh.go | 173 - vendor/gopkg.in/yaml.v3/LICENSE | 50 - vendor/gopkg.in/yaml.v3/NOTICE | 13 - vendor/gopkg.in/yaml.v3/README.md | 150 - vendor/gopkg.in/yaml.v3/apic.go | 747 - vendor/gopkg.in/yaml.v3/decode.go | 1000 - vendor/gopkg.in/yaml.v3/emitterc.go | 2020 - vendor/gopkg.in/yaml.v3/encode.go | 577 - vendor/gopkg.in/yaml.v3/parserc.go | 1258 - vendor/gopkg.in/yaml.v3/readerc.go | 434 - vendor/gopkg.in/yaml.v3/resolve.go | 326 - vendor/gopkg.in/yaml.v3/scannerc.go | 3038 - vendor/gopkg.in/yaml.v3/sorter.go | 134 - vendor/gopkg.in/yaml.v3/writerc.go | 48 - vendor/gopkg.in/yaml.v3/yaml.go | 698 - vendor/gopkg.in/yaml.v3/yamlh.go | 807 - vendor/gopkg.in/yaml.v3/yamlprivateh.go | 198 - vendor/k8s.io/api/LICENSE | 202 - vendor/k8s.io/api/admission/v1/doc.go | 23 - .../k8s.io/api/admission/v1/generated.pb.go | 1783 - .../k8s.io/api/admission/v1/generated.proto | 167 - vendor/k8s.io/api/admission/v1/register.go | 53 - vendor/k8s.io/api/admission/v1/types.go | 169 - .../v1/types_swagger_doc_generated.go | 78 - .../api/admission/v1/zz_generated.deepcopy.go | 142 - vendor/k8s.io/api/admission/v1beta1/doc.go | 24 - .../api/admission/v1beta1/generated.pb.go | 1783 - .../api/admission/v1beta1/generated.proto | 167 - .../k8s.io/api/admission/v1beta1/register.go | 53 - vendor/k8s.io/api/admission/v1beta1/types.go | 174 - .../v1beta1/types_swagger_doc_generated.go | 78 - .../v1beta1/zz_generated.deepcopy.go | 142 - .../zz_generated.prerelease-lifecycle.go | 50 - .../api/admissionregistration/v1/doc.go | 26 - .../admissionregistration/v1/generated.pb.go | 3414 - .../admissionregistration/v1/generated.proto | 479 - .../api/admissionregistration/v1/register.go | 56 - .../api/admissionregistration/v1/types.go | 561 - .../v1/types_swagger_doc_generated.go | 151 - .../v1/zz_generated.deepcopy.go | 397 - .../api/admissionregistration/v1beta1/doc.go | 27 - .../v1beta1/generated.pb.go | 3414 - .../v1beta1/generated.proto | 487 - .../admissionregistration/v1beta1/register.go | 56 - .../admissionregistration/v1beta1/types.go | 579 - .../v1beta1/types_swagger_doc_generated.go | 151 - .../v1beta1/zz_generated.deepcopy.go | 397 - .../zz_generated.prerelease-lifecycle.go | 122 - .../api/apiserverinternal/v1alpha1/doc.go | 25 - .../v1alpha1/generated.pb.go | 1700 - .../v1alpha1/generated.proto | 124 - .../apiserverinternal/v1alpha1/register.go | 48 - .../api/apiserverinternal/v1alpha1/types.go | 130 - .../v1alpha1/types_swagger_doc_generated.go | 95 - .../v1alpha1/zz_generated.deepcopy.go | 176 - vendor/k8s.io/api/apps/v1/doc.go | 21 - vendor/k8s.io/api/apps/v1/generated.pb.go | 8571 -- vendor/k8s.io/api/apps/v1/generated.proto | 777 - vendor/k8s.io/api/apps/v1/register.go | 60 - vendor/k8s.io/api/apps/v1/types.go | 926 - .../apps/v1/types_swagger_doc_generated.go | 383 - .../api/apps/v1/zz_generated.deepcopy.go | 804 - vendor/k8s.io/api/apps/v1beta1/doc.go | 22 - .../k8s.io/api/apps/v1beta1/generated.pb.go | 6547 -- .../k8s.io/api/apps/v1beta1/generated.proto | 530 - vendor/k8s.io/api/apps/v1beta1/register.go | 58 - vendor/k8s.io/api/apps/v1beta1/types.go | 661 - .../v1beta1/types_swagger_doc_generated.go | 287 - .../api/apps/v1beta1/zz_generated.deepcopy.go | 621 - .../zz_generated.prerelease-lifecycle.go | 218 - vendor/k8s.io/api/apps/v1beta2/doc.go | 22 - .../k8s.io/api/apps/v1beta2/generated.pb.go | 9338 --- .../k8s.io/api/apps/v1beta2/generated.proto | 819 - vendor/k8s.io/api/apps/v1beta2/register.go | 61 - vendor/k8s.io/api/apps/v1beta2/types.go | 1004 - .../v1beta2/types_swagger_doc_generated.go | 411 - .../api/apps/v1beta2/zz_generated.deepcopy.go | 871 - .../zz_generated.prerelease-lifecycle.go | 290 - vendor/k8s.io/api/authentication/v1/doc.go | 22 - .../api/authentication/v1/generated.pb.go | 2554 - .../api/authentication/v1/generated.proto | 188 - .../k8s.io/api/authentication/v1/register.go | 52 - vendor/k8s.io/api/authentication/v1/types.go | 199 - .../v1/types_swagger_doc_generated.go | 119 - .../v1/zz_generated.deepcopy.go | 245 - .../k8s.io/api/authentication/v1beta1/doc.go | 23 - .../authentication/v1beta1/generated.pb.go | 1543 - .../authentication/v1beta1/generated.proto | 120 - .../api/authentication/v1beta1/register.go | 51 - .../api/authentication/v1beta1/types.go | 115 - .../v1beta1/types_swagger_doc_generated.go | 75 - .../v1beta1/zz_generated.deepcopy.go | 153 - .../zz_generated.prerelease-lifecycle.go | 50 - vendor/k8s.io/api/authorization/v1/doc.go | 23 - .../api/authorization/v1/generated.pb.go | 4045 - .../api/authorization/v1/generated.proto | 281 - .../k8s.io/api/authorization/v1/register.go | 55 - vendor/k8s.io/api/authorization/v1/types.go | 277 - .../v1/types_swagger_doc_generated.go | 178 - .../authorization/v1/zz_generated.deepcopy.go | 386 - .../k8s.io/api/authorization/v1beta1/doc.go | 24 - .../api/authorization/v1beta1/generated.pb.go | 4045 - .../api/authorization/v1beta1/generated.proto | 281 - .../api/authorization/v1beta1/register.go | 55 - .../k8s.io/api/authorization/v1beta1/types.go | 289 - .../v1beta1/types_swagger_doc_generated.go | 178 - .../v1beta1/zz_generated.deepcopy.go | 386 - .../zz_generated.prerelease-lifecycle.go | 122 - vendor/k8s.io/api/autoscaling/v1/doc.go | 21 - .../k8s.io/api/autoscaling/v1/generated.pb.go | 6182 -- .../k8s.io/api/autoscaling/v1/generated.proto | 495 - vendor/k8s.io/api/autoscaling/v1/register.go | 53 - vendor/k8s.io/api/autoscaling/v1/types.go | 507 - .../v1/types_swagger_doc_generated.go | 276 - .../autoscaling/v1/zz_generated.deepcopy.go | 574 - vendor/k8s.io/api/autoscaling/v2/doc.go | 21 - .../k8s.io/api/autoscaling/v2/generated.pb.go | 6599 -- .../k8s.io/api/autoscaling/v2/generated.proto | 504 - vendor/k8s.io/api/autoscaling/v2/register.go | 50 - vendor/k8s.io/api/autoscaling/v2/types.go | 545 - .../v2/types_swagger_doc_generated.go | 299 - .../autoscaling/v2/zz_generated.deepcopy.go | 610 - vendor/k8s.io/api/autoscaling/v2beta1/doc.go | 22 - .../api/autoscaling/v2beta1/generated.pb.go | 5715 -- .../api/autoscaling/v2beta1/generated.proto | 476 - .../api/autoscaling/v2beta1/register.go | 52 - .../k8s.io/api/autoscaling/v2beta1/types.go | 488 - .../v2beta1/types_swagger_doc_generated.go | 247 - .../v2beta1/zz_generated.deepcopy.go | 525 - .../zz_generated.prerelease-lifecycle.go | 74 - vendor/k8s.io/api/autoscaling/v2beta2/doc.go | 22 - .../api/autoscaling/v2beta2/generated.pb.go | 6599 -- .../api/autoscaling/v2beta2/generated.proto | 494 - .../api/autoscaling/v2beta2/register.go | 50 - .../k8s.io/api/autoscaling/v2beta2/types.go | 541 - .../v2beta2/types_swagger_doc_generated.go | 297 - .../v2beta2/zz_generated.deepcopy.go | 610 - .../zz_generated.prerelease-lifecycle.go | 68 - vendor/k8s.io/api/batch/v1/doc.go | 21 - vendor/k8s.io/api/batch/v1/generated.pb.go | 4706 -- vendor/k8s.io/api/batch/v1/generated.proto | 486 - vendor/k8s.io/api/batch/v1/register.go | 54 - vendor/k8s.io/api/batch/v1/types.go | 586 - .../batch/v1/types_swagger_doc_generated.go | 210 - .../api/batch/v1/zz_generated.deepcopy.go | 483 - vendor/k8s.io/api/batch/v1beta1/doc.go | 22 - .../k8s.io/api/batch/v1beta1/generated.pb.go | 1825 - .../k8s.io/api/batch/v1beta1/generated.proto | 155 - vendor/k8s.io/api/batch/v1beta1/register.go | 53 - vendor/k8s.io/api/batch/v1beta1/types.go | 186 - .../v1beta1/types_swagger_doc_generated.go | 98 - .../batch/v1beta1/zz_generated.deepcopy.go | 204 - .../zz_generated.prerelease-lifecycle.go | 92 - vendor/k8s.io/api/certificates/v1/doc.go | 23 - .../api/certificates/v1/generated.pb.go | 2055 - .../api/certificates/v1/generated.proto | 248 - vendor/k8s.io/api/certificates/v1/register.go | 61 - vendor/k8s.io/api/certificates/v1/types.go | 309 - .../v1/types_swagger_doc_generated.go | 89 - .../certificates/v1/zz_generated.deepcopy.go | 204 - vendor/k8s.io/api/certificates/v1beta1/doc.go | 24 - .../api/certificates/v1beta1/generated.pb.go | 2061 - .../api/certificates/v1beta1/generated.proto | 199 - .../api/certificates/v1beta1/register.go | 59 - .../k8s.io/api/certificates/v1beta1/types.go | 261 - .../v1beta1/types_swagger_doc_generated.go | 78 - .../v1beta1/zz_generated.deepcopy.go | 209 - .../zz_generated.prerelease-lifecycle.go | 74 - vendor/k8s.io/api/coordination/v1/doc.go | 23 - .../api/coordination/v1/generated.pb.go | 967 - .../api/coordination/v1/generated.proto | 80 - vendor/k8s.io/api/coordination/v1/register.go | 53 - vendor/k8s.io/api/coordination/v1/types.go | 74 - .../v1/types_swagger_doc_generated.go | 63 - .../coordination/v1/zz_generated.deepcopy.go | 125 - vendor/k8s.io/api/coordination/v1beta1/doc.go | 24 - .../api/coordination/v1beta1/generated.pb.go | 967 - .../api/coordination/v1beta1/generated.proto | 80 - .../api/coordination/v1beta1/register.go | 53 - .../k8s.io/api/coordination/v1beta1/types.go | 80 - .../v1beta1/types_swagger_doc_generated.go | 63 - .../v1beta1/zz_generated.deepcopy.go | 125 - .../zz_generated.prerelease-lifecycle.go | 74 - .../api/core/v1/annotation_key_constants.go | 151 - vendor/k8s.io/api/core/v1/doc.go | 22 - vendor/k8s.io/api/core/v1/generated.pb.go | 68475 ---------------- vendor/k8s.io/api/core/v1/generated.proto | 5854 -- vendor/k8s.io/api/core/v1/lifecycle.go | 37 - vendor/k8s.io/api/core/v1/objectreference.go | 33 - vendor/k8s.io/api/core/v1/register.go | 99 - vendor/k8s.io/api/core/v1/resource.go | 59 - vendor/k8s.io/api/core/v1/taint.go | 39 - vendor/k8s.io/api/core/v1/toleration.go | 59 - vendor/k8s.io/api/core/v1/types.go | 6648 -- .../core/v1/types_swagger_doc_generated.go | 2555 - .../k8s.io/api/core/v1/well_known_labels.go | 70 - .../k8s.io/api/core/v1/well_known_taints.go | 52 - .../api/core/v1/zz_generated.deepcopy.go | 6050 -- vendor/k8s.io/api/discovery/v1/doc.go | 22 - .../k8s.io/api/discovery/v1/generated.pb.go | 2251 - .../k8s.io/api/discovery/v1/generated.proto | 197 - vendor/k8s.io/api/discovery/v1/register.go | 56 - vendor/k8s.io/api/discovery/v1/types.go | 196 - .../v1/types_swagger_doc_generated.go | 109 - .../api/discovery/v1/well_known_labels.go | 32 - .../api/discovery/v1/zz_generated.deepcopy.go | 258 - vendor/k8s.io/api/discovery/v1beta1/doc.go | 23 - .../api/discovery/v1beta1/generated.pb.go | 2205 - .../api/discovery/v1beta1/generated.proto | 200 - .../k8s.io/api/discovery/v1beta1/register.go | 56 - vendor/k8s.io/api/discovery/v1beta1/types.go | 205 - .../v1beta1/types_swagger_doc_generated.go | 108 - .../discovery/v1beta1/well_known_labels.go | 32 - .../v1beta1/zz_generated.deepcopy.go | 253 - .../zz_generated.prerelease-lifecycle.go | 74 - vendor/k8s.io/api/events/v1/doc.go | 23 - vendor/k8s.io/api/events/v1/generated.pb.go | 1397 - vendor/k8s.io/api/events/v1/generated.proto | 128 - vendor/k8s.io/api/events/v1/register.go | 53 - vendor/k8s.io/api/events/v1/types.go | 123 - .../events/v1/types_swagger_doc_generated.go | 73 - .../api/events/v1/zz_generated.deepcopy.go | 118 - vendor/k8s.io/api/events/v1beta1/doc.go | 24 - .../k8s.io/api/events/v1beta1/generated.pb.go | 1397 - .../k8s.io/api/events/v1beta1/generated.proto | 130 - vendor/k8s.io/api/events/v1beta1/register.go | 53 - vendor/k8s.io/api/events/v1beta1/types.go | 131 - .../v1beta1/types_swagger_doc_generated.go | 73 - .../events/v1beta1/zz_generated.deepcopy.go | 118 - .../zz_generated.prerelease-lifecycle.go | 58 - vendor/k8s.io/api/extensions/v1beta1/doc.go | 22 - .../api/extensions/v1beta1/generated.pb.go | 15459 ---- .../api/extensions/v1beta1/generated.proto | 1288 - .../k8s.io/api/extensions/v1beta1/register.go | 65 - vendor/k8s.io/api/extensions/v1beta1/types.go | 1605 - .../v1beta1/types_swagger_doc_generated.go | 670 - .../v1beta1/zz_generated.deepcopy.go | 1524 - .../zz_generated.prerelease-lifecycle.go | 350 - vendor/k8s.io/api/flowcontrol/v1alpha1/doc.go | 25 - .../api/flowcontrol/v1alpha1/generated.pb.go | 5368 -- .../api/flowcontrol/v1alpha1/generated.proto | 440 - .../api/flowcontrol/v1alpha1/register.go | 58 - .../k8s.io/api/flowcontrol/v1alpha1/types.go | 547 - .../v1alpha1/types_swagger_doc_generated.go | 261 - .../v1alpha1/zz_generated.deepcopy.go | 542 - .../zz_generated.prerelease-lifecycle.go | 122 - vendor/k8s.io/api/flowcontrol/v1beta1/doc.go | 25 - .../api/flowcontrol/v1beta1/generated.pb.go | 5367 -- .../api/flowcontrol/v1beta1/generated.proto | 440 - .../api/flowcontrol/v1beta1/register.go | 58 - .../k8s.io/api/flowcontrol/v1beta1/types.go | 583 - .../v1beta1/types_swagger_doc_generated.go | 261 - .../v1beta1/zz_generated.deepcopy.go | 542 - .../zz_generated.prerelease-lifecycle.go | 122 - vendor/k8s.io/api/flowcontrol/v1beta2/doc.go | 25 - .../api/flowcontrol/v1beta2/generated.pb.go | 5367 -- .../api/flowcontrol/v1beta2/generated.proto | 440 - .../api/flowcontrol/v1beta2/register.go | 58 - .../k8s.io/api/flowcontrol/v1beta2/types.go | 579 - .../v1beta2/types_swagger_doc_generated.go | 261 - .../v1beta2/zz_generated.deepcopy.go | 542 - .../zz_generated.prerelease-lifecycle.go | 94 - vendor/k8s.io/api/imagepolicy/v1alpha1/doc.go | 23 - .../api/imagepolicy/v1alpha1/generated.pb.go | 1375 - .../api/imagepolicy/v1alpha1/generated.proto | 88 - .../api/imagepolicy/v1alpha1/register.go | 51 - .../k8s.io/api/imagepolicy/v1alpha1/types.go | 82 - .../v1alpha1/types_swagger_doc_generated.go | 72 - .../v1alpha1/zz_generated.deepcopy.go | 121 - vendor/k8s.io/api/networking/v1/doc.go | 22 - .../k8s.io/api/networking/v1/generated.pb.go | 6090 -- .../k8s.io/api/networking/v1/generated.proto | 516 - vendor/k8s.io/api/networking/v1/register.go | 57 - vendor/k8s.io/api/networking/v1/types.go | 604 - .../v1/types_swagger_doc_generated.go | 286 - .../networking/v1/well_known_annotations.go | 25 - .../networking/v1/zz_generated.deepcopy.go | 685 - vendor/k8s.io/api/networking/v1alpha1/doc.go | 23 - .../api/networking/v1alpha1/generated.pb.go | 913 - .../api/networking/v1alpha1/generated.proto | 94 - .../api/networking/v1alpha1/register.go | 56 - .../k8s.io/api/networking/v1alpha1/types.go | 95 - .../v1alpha1/types_swagger_doc_generated.go | 62 - .../v1alpha1/zz_generated.deepcopy.go | 108 - .../zz_generated.prerelease-lifecycle.go | 58 - vendor/k8s.io/api/networking/v1beta1/doc.go | 23 - .../api/networking/v1beta1/generated.pb.go | 3485 - .../api/networking/v1beta1/generated.proto | 301 - .../k8s.io/api/networking/v1beta1/register.go | 58 - vendor/k8s.io/api/networking/v1beta1/types.go | 362 - .../v1beta1/types_swagger_doc_generated.go | 173 - .../v1beta1/well_known_annotations.go | 32 - .../v1beta1/zz_generated.deepcopy.go | 383 - .../zz_generated.prerelease-lifecycle.go | 122 - vendor/k8s.io/api/node/v1/doc.go | 23 - vendor/k8s.io/api/node/v1/generated.pb.go | 1400 - vendor/k8s.io/api/node/v1/generated.proto | 108 - vendor/k8s.io/api/node/v1/register.go | 52 - vendor/k8s.io/api/node/v1/types.go | 106 - .../node/v1/types_swagger_doc_generated.go | 71 - .../api/node/v1/zz_generated.deepcopy.go | 149 - vendor/k8s.io/api/node/v1alpha1/doc.go | 23 - .../k8s.io/api/node/v1alpha1/generated.pb.go | 1568 - .../k8s.io/api/node/v1alpha1/generated.proto | 118 - vendor/k8s.io/api/node/v1alpha1/register.go | 52 - vendor/k8s.io/api/node/v1alpha1/types.go | 116 - .../v1alpha1/types_swagger_doc_generated.go | 80 - .../node/v1alpha1/zz_generated.deepcopy.go | 166 - vendor/k8s.io/api/node/v1beta1/doc.go | 24 - .../k8s.io/api/node/v1beta1/generated.pb.go | 1400 - .../k8s.io/api/node/v1beta1/generated.proto | 108 - vendor/k8s.io/api/node/v1beta1/register.go | 52 - vendor/k8s.io/api/node/v1beta1/types.go | 110 - .../v1beta1/types_swagger_doc_generated.go | 71 - .../api/node/v1beta1/zz_generated.deepcopy.go | 149 - .../zz_generated.prerelease-lifecycle.go | 58 - vendor/k8s.io/api/policy/v1/doc.go | 24 - vendor/k8s.io/api/policy/v1/generated.pb.go | 1681 - vendor/k8s.io/api/policy/v1/generated.proto | 151 - vendor/k8s.io/api/policy/v1/register.go | 52 - vendor/k8s.io/api/policy/v1/types.go | 172 - .../policy/v1/types_swagger_doc_generated.go | 87 - .../api/policy/v1/zz_generated.deepcopy.go | 181 - vendor/k8s.io/api/policy/v1beta1/doc.go | 25 - .../k8s.io/api/policy/v1beta1/generated.pb.go | 5566 -- .../k8s.io/api/policy/v1beta1/generated.proto | 428 - vendor/k8s.io/api/policy/v1beta1/register.go | 56 - vendor/k8s.io/api/policy/v1beta1/types.go | 552 - .../v1beta1/types_swagger_doc_generated.go | 247 - .../policy/v1beta1/zz_generated.deepcopy.go | 548 - .../zz_generated.prerelease-lifecycle.go | 128 - vendor/k8s.io/api/rbac/v1/doc.go | 23 - vendor/k8s.io/api/rbac/v1/generated.pb.go | 3230 - vendor/k8s.io/api/rbac/v1/generated.proto | 201 - vendor/k8s.io/api/rbac/v1/register.go | 58 - vendor/k8s.io/api/rbac/v1/types.go | 239 - .../rbac/v1/types_swagger_doc_generated.go | 158 - .../api/rbac/v1/zz_generated.deepcopy.go | 390 - vendor/k8s.io/api/rbac/v1alpha1/doc.go | 23 - .../k8s.io/api/rbac/v1alpha1/generated.pb.go | 3232 - .../k8s.io/api/rbac/v1alpha1/generated.proto | 208 - vendor/k8s.io/api/rbac/v1alpha1/register.go | 58 - vendor/k8s.io/api/rbac/v1alpha1/types.go | 246 - .../v1alpha1/types_swagger_doc_generated.go | 158 - .../rbac/v1alpha1/zz_generated.deepcopy.go | 390 - vendor/k8s.io/api/rbac/v1beta1/doc.go | 24 - .../k8s.io/api/rbac/v1beta1/generated.pb.go | 3230 - .../k8s.io/api/rbac/v1beta1/generated.proto | 208 - vendor/k8s.io/api/rbac/v1beta1/register.go | 58 - vendor/k8s.io/api/rbac/v1beta1/types.go | 277 - .../v1beta1/types_swagger_doc_generated.go | 158 - .../api/rbac/v1beta1/zz_generated.deepcopy.go | 390 - .../zz_generated.prerelease-lifecycle.go | 218 - vendor/k8s.io/api/scheduling/v1/doc.go | 23 - .../k8s.io/api/scheduling/v1/generated.pb.go | 729 - .../k8s.io/api/scheduling/v1/generated.proto | 74 - vendor/k8s.io/api/scheduling/v1/register.go | 55 - vendor/k8s.io/api/scheduling/v1/types.go | 73 - .../v1/types_swagger_doc_generated.go | 53 - .../scheduling/v1/zz_generated.deepcopy.go | 91 - vendor/k8s.io/api/scheduling/v1alpha1/doc.go | 23 - .../api/scheduling/v1alpha1/generated.pb.go | 729 - .../api/scheduling/v1alpha1/generated.proto | 75 - .../api/scheduling/v1alpha1/register.go | 52 - .../k8s.io/api/scheduling/v1alpha1/types.go | 74 - .../v1alpha1/types_swagger_doc_generated.go | 53 - .../v1alpha1/zz_generated.deepcopy.go | 91 - vendor/k8s.io/api/scheduling/v1beta1/doc.go | 24 - .../api/scheduling/v1beta1/generated.pb.go | 730 - .../api/scheduling/v1beta1/generated.proto | 75 - .../k8s.io/api/scheduling/v1beta1/register.go | 52 - vendor/k8s.io/api/scheduling/v1beta1/types.go | 82 - .../v1beta1/types_swagger_doc_generated.go | 53 - .../v1beta1/zz_generated.deepcopy.go | 91 - .../zz_generated.prerelease-lifecycle.go | 74 - vendor/k8s.io/api/storage/v1/doc.go | 22 - vendor/k8s.io/api/storage/v1/generated.pb.go | 5426 -- vendor/k8s.io/api/storage/v1/generated.proto | 573 - vendor/k8s.io/api/storage/v1/register.go | 65 - vendor/k8s.io/api/storage/v1/types.go | 682 - .../storage/v1/types_swagger_doc_generated.go | 238 - .../api/storage/v1/zz_generated.deepcopy.go | 618 - vendor/k8s.io/api/storage/v1alpha1/doc.go | 23 - .../api/storage/v1alpha1/generated.pb.go | 2399 - .../api/storage/v1alpha1/generated.proto | 231 - .../k8s.io/api/storage/v1alpha1/register.go | 52 - vendor/k8s.io/api/storage/v1alpha1/types.go | 250 - .../v1alpha1/types_swagger_doc_generated.go | 116 - .../storage/v1alpha1/zz_generated.deepcopy.go | 256 - .../zz_generated.prerelease-lifecycle.go | 122 - vendor/k8s.io/api/storage/v1beta1/doc.go | 23 - .../api/storage/v1beta1/generated.pb.go | 5426 -- .../api/storage/v1beta1/generated.proto | 574 - vendor/k8s.io/api/storage/v1beta1/register.go | 65 - vendor/k8s.io/api/storage/v1beta1/types.go | 710 - .../v1beta1/types_swagger_doc_generated.go | 238 - .../storage/v1beta1/zz_generated.deepcopy.go | 618 - .../zz_generated.prerelease-lifecycle.go | 266 - vendor/k8s.io/apiextensions-apiserver/LICENSE | 202 - .../pkg/apis/apiextensions/deepcopy.go | 300 - .../pkg/apis/apiextensions/doc.go | 21 - .../pkg/apis/apiextensions/helpers.go | 257 - .../pkg/apis/apiextensions/register.go | 51 - .../pkg/apis/apiextensions/types.go | 422 - .../apis/apiextensions/types_jsonschema.go | 238 - .../apiextensions/v1/.import-restrictions | 5 - .../pkg/apis/apiextensions/v1/conversion.go | 215 - .../pkg/apis/apiextensions/v1/deepcopy.go | 260 - .../pkg/apis/apiextensions/v1/defaults.go | 61 - .../pkg/apis/apiextensions/v1/doc.go | 25 - .../pkg/apis/apiextensions/v1/generated.pb.go | 9257 --- .../pkg/apis/apiextensions/v1/generated.proto | 729 - .../pkg/apis/apiextensions/v1/marshal.go | 136 - .../pkg/apis/apiextensions/v1/register.go | 62 - .../pkg/apis/apiextensions/v1/types.go | 485 - .../apis/apiextensions/v1/types_jsonschema.go | 331 - .../v1/zz_generated.conversion.go | 1318 - .../apiextensions/v1/zz_generated.deepcopy.go | 705 - .../apiextensions/v1/zz_generated.defaults.go | 58 - .../apiextensions/zz_generated.deepcopy.go | 596 - vendor/k8s.io/apimachinery/LICENSE | 202 - .../apimachinery/pkg/api/equality/semantic.go | 49 - .../k8s.io/apimachinery/pkg/api/errors/OWNERS | 17 - .../k8s.io/apimachinery/pkg/api/errors/doc.go | 18 - .../apimachinery/pkg/api/errors/errors.go | 857 - .../k8s.io/apimachinery/pkg/api/meta/OWNERS | 14 - .../apimachinery/pkg/api/meta/conditions.go | 102 - .../k8s.io/apimachinery/pkg/api/meta/doc.go | 19 - .../apimachinery/pkg/api/meta/errors.go | 121 - .../pkg/api/meta/firsthit_restmapper.go | 105 - .../k8s.io/apimachinery/pkg/api/meta/help.go | 265 - .../apimachinery/pkg/api/meta/interfaces.go | 143 - .../k8s.io/apimachinery/pkg/api/meta/lazy.go | 112 - .../k8s.io/apimachinery/pkg/api/meta/meta.go | 643 - .../pkg/api/meta/multirestmapper.go | 220 - .../apimachinery/pkg/api/meta/priority.go | 230 - .../apimachinery/pkg/api/meta/restmapper.go | 529 - .../apimachinery/pkg/api/resource/OWNERS | 11 - .../apimachinery/pkg/api/resource/amount.go | 299 - .../pkg/api/resource/generated.pb.go | 114 - .../pkg/api/resource/generated.proto | 111 - .../apimachinery/pkg/api/resource/math.go | 310 - .../apimachinery/pkg/api/resource/quantity.go | 808 - .../pkg/api/resource/quantity_proto.go | 288 - .../pkg/api/resource/scale_int.go | 95 - .../apimachinery/pkg/api/resource/suffix.go | 198 - .../pkg/api/resource/zz_generated.deepcopy.go | 45 - .../pkg/apis/meta/internalversion/doc.go | 20 - .../pkg/apis/meta/internalversion/register.go | 88 - .../pkg/apis/meta/internalversion/types.go | 80 - .../zz_generated.conversion.go | 146 - .../internalversion/zz_generated.deepcopy.go | 97 - .../apimachinery/pkg/apis/meta/v1/OWNERS | 16 - .../pkg/apis/meta/v1/controller_ref.go | 65 - .../pkg/apis/meta/v1/conversion.go | 355 - .../apimachinery/pkg/apis/meta/v1/deepcopy.go | 46 - .../apimachinery/pkg/apis/meta/v1/doc.go | 24 - .../apimachinery/pkg/apis/meta/v1/duration.go | 65 - .../pkg/apis/meta/v1/generated.pb.go | 11530 --- .../pkg/apis/meta/v1/generated.proto | 1177 - .../pkg/apis/meta/v1/group_version.go | 157 - .../apimachinery/pkg/apis/meta/v1/helpers.go | 298 - .../apimachinery/pkg/apis/meta/v1/labels.go | 55 - .../apimachinery/pkg/apis/meta/v1/meta.go | 176 - .../pkg/apis/meta/v1/micro_time.go | 181 - .../pkg/apis/meta/v1/micro_time_fuzz.go | 40 - .../pkg/apis/meta/v1/micro_time_proto.go | 86 - .../apimachinery/pkg/apis/meta/v1/register.go | 107 - .../apimachinery/pkg/apis/meta/v1/time.go | 182 - .../pkg/apis/meta/v1/time_fuzz.go | 40 - .../pkg/apis/meta/v1/time_proto.go | 100 - .../apimachinery/pkg/apis/meta/v1/types.go | 1510 - .../meta/v1/types_swagger_doc_generated.go | 461 - .../pkg/apis/meta/v1/unstructured/helpers.go | 501 - .../apis/meta/v1/unstructured/unstructured.go | 484 - .../meta/v1/unstructured/unstructured_list.go | 210 - .../v1/unstructured/zz_generated.deepcopy.go | 56 - .../apimachinery/pkg/apis/meta/v1/watch.go | 89 - .../apis/meta/v1/zz_generated.conversion.go | 527 - .../pkg/apis/meta/v1/zz_generated.deepcopy.go | 1188 - .../pkg/apis/meta/v1/zz_generated.defaults.go | 33 - .../pkg/apis/meta/v1beta1/conversion.go | 46 - .../pkg/apis/meta/v1beta1/deepcopy.go | 17 - .../apimachinery/pkg/apis/meta/v1beta1/doc.go | 23 - .../pkg/apis/meta/v1beta1/generated.pb.go | 412 - .../pkg/apis/meta/v1beta1/generated.proto | 41 - .../pkg/apis/meta/v1beta1/register.go | 62 - .../pkg/apis/meta/v1beta1/types.go | 84 - .../v1beta1/types_swagger_doc_generated.go | 40 - .../meta/v1beta1/zz_generated.deepcopy.go | 60 - .../meta/v1beta1/zz_generated.defaults.go | 33 - .../apimachinery/pkg/conversion/converter.go | 225 - .../apimachinery/pkg/conversion/deep_equal.go | 47 - .../k8s.io/apimachinery/pkg/conversion/doc.go | 24 - .../apimachinery/pkg/conversion/helper.go | 39 - .../pkg/conversion/queryparams/convert.go | 194 - .../pkg/conversion/queryparams/doc.go | 19 - vendor/k8s.io/apimachinery/pkg/fields/doc.go | 19 - .../k8s.io/apimachinery/pkg/fields/fields.go | 62 - .../apimachinery/pkg/fields/requirements.go | 30 - .../apimachinery/pkg/fields/selector.go | 478 - vendor/k8s.io/apimachinery/pkg/labels/doc.go | 19 - .../k8s.io/apimachinery/pkg/labels/labels.go | 172 - .../apimachinery/pkg/labels/selector.go | 965 - .../pkg/labels/zz_generated.deepcopy.go | 43 - .../apimachinery/pkg/runtime/allocator.go | 76 - .../k8s.io/apimachinery/pkg/runtime/codec.go | 397 - .../apimachinery/pkg/runtime/codec_check.go | 56 - .../apimachinery/pkg/runtime/conversion.go | 196 - .../apimachinery/pkg/runtime/converter.go | 858 - vendor/k8s.io/apimachinery/pkg/runtime/doc.go | 51 - .../apimachinery/pkg/runtime/embedded.go | 149 - .../k8s.io/apimachinery/pkg/runtime/error.go | 172 - .../apimachinery/pkg/runtime/extension.go | 51 - .../apimachinery/pkg/runtime/generated.pb.go | 846 - .../apimachinery/pkg/runtime/generated.proto | 134 - .../k8s.io/apimachinery/pkg/runtime/helper.go | 259 - .../apimachinery/pkg/runtime/interfaces.go | 368 - .../k8s.io/apimachinery/pkg/runtime/mapper.go | 98 - .../apimachinery/pkg/runtime/negotiate.go | 113 - .../apimachinery/pkg/runtime/register.go | 31 - .../pkg/runtime/schema/generated.pb.go | 59 - .../pkg/runtime/schema/generated.proto | 26 - .../pkg/runtime/schema/group_version.go | 307 - .../pkg/runtime/schema/interfaces.go | 40 - .../k8s.io/apimachinery/pkg/runtime/scheme.go | 707 - .../pkg/runtime/scheme_builder.go | 48 - .../pkg/runtime/serializer/codec_factory.go | 339 - .../pkg/runtime/serializer/json/json.go | 351 - .../pkg/runtime/serializer/json/meta.go | 63 - .../runtime/serializer/negotiated_codec.go | 43 - .../pkg/runtime/serializer/protobuf/doc.go | 18 - .../runtime/serializer/protobuf/protobuf.go | 495 - .../serializer/recognizer/recognizer.go | 128 - .../runtime/serializer/streaming/streaming.go | 156 - .../serializer/versioning/versioning.go | 290 - .../pkg/runtime/swagger_doc_generator.go | 262 - .../k8s.io/apimachinery/pkg/runtime/types.go | 133 - .../apimachinery/pkg/runtime/types_proto.go | 89 - .../pkg/runtime/zz_generated.deepcopy.go | 76 - .../apimachinery/pkg/selection/operator.go | 33 - vendor/k8s.io/apimachinery/pkg/types/doc.go | 18 - .../apimachinery/pkg/types/namespacedname.go | 39 - .../k8s.io/apimachinery/pkg/types/nodename.go | 43 - vendor/k8s.io/apimachinery/pkg/types/patch.go | 29 - vendor/k8s.io/apimachinery/pkg/types/uid.go | 22 - .../apimachinery/pkg/util/cache/expiring.go | 192 - .../pkg/util/cache/lruexpirecache.go | 160 - .../k8s.io/apimachinery/pkg/util/diff/diff.go | 157 - .../apimachinery/pkg/util/errors/doc.go | 18 - .../apimachinery/pkg/util/errors/errors.go | 249 - .../apimachinery/pkg/util/framer/framer.go | 170 - .../apimachinery/pkg/util/httpstream/doc.go | 19 - .../pkg/util/httpstream/httpstream.go | 159 - .../pkg/util/httpstream/spdy/connection.go | 204 - .../pkg/util/httpstream/spdy/roundtripper.go | 366 - .../pkg/util/httpstream/spdy/upgrade.go | 120 - .../pkg/util/intstr/generated.pb.go | 369 - .../pkg/util/intstr/generated.proto | 43 - .../pkg/util/intstr/instr_fuzz.go | 43 - .../apimachinery/pkg/util/intstr/intstr.go | 227 - .../k8s.io/apimachinery/pkg/util/json/json.go | 121 - .../pkg/util/managedfields/extract.go | 108 - .../pkg/util/managedfields/gvkparser.go | 128 - .../pkg/util/naming/from_stack.go | 93 - .../k8s.io/apimachinery/pkg/util/net/http.go | 699 - .../apimachinery/pkg/util/net/interface.go | 500 - .../apimachinery/pkg/util/net/port_range.go | 149 - .../apimachinery/pkg/util/net/port_split.go | 78 - .../k8s.io/apimachinery/pkg/util/net/util.go | 57 - .../pkg/util/remotecommand/constants.go | 53 - .../apimachinery/pkg/util/runtime/runtime.go | 174 - .../k8s.io/apimachinery/pkg/util/sets/byte.go | 211 - .../k8s.io/apimachinery/pkg/util/sets/doc.go | 20 - .../apimachinery/pkg/util/sets/empty.go | 23 - .../k8s.io/apimachinery/pkg/util/sets/int.go | 211 - .../apimachinery/pkg/util/sets/int32.go | 211 - .../apimachinery/pkg/util/sets/int64.go | 211 - .../apimachinery/pkg/util/sets/string.go | 211 - .../pkg/util/validation/field/errors.go | 325 - .../pkg/util/validation/field/path.go | 117 - .../pkg/util/validation/validation.go | 504 - .../k8s.io/apimachinery/pkg/util/wait/doc.go | 19 - .../k8s.io/apimachinery/pkg/util/wait/wait.go | 757 - .../apimachinery/pkg/util/yaml/decoder.go | 397 - vendor/k8s.io/apimachinery/pkg/version/doc.go | 20 - .../apimachinery/pkg/version/helpers.go | 88 - .../k8s.io/apimachinery/pkg/version/types.go | 37 - vendor/k8s.io/apimachinery/pkg/watch/doc.go | 19 - .../k8s.io/apimachinery/pkg/watch/filter.go | 104 - vendor/k8s.io/apimachinery/pkg/watch/mux.go | 320 - .../apimachinery/pkg/watch/streamwatcher.go | 136 - vendor/k8s.io/apimachinery/pkg/watch/watch.go | 324 - .../pkg/watch/zz_generated.deepcopy.go | 41 - .../third_party/forked/golang/LICENSE | 27 - .../third_party/forked/golang/PATENTS | 22 - .../third_party/forked/golang/netutil/addr.go | 28 - .../forked/golang/reflect/deep_equal.go | 434 - vendor/k8s.io/client-go/LICENSE | 202 - .../v1/mutatingwebhook.go | 141 - .../v1/mutatingwebhookconfiguration.go | 252 - .../admissionregistration/v1/rule.go | 76 - .../v1/rulewithoperations.go | 84 - .../v1/servicereference.go | 66 - .../v1/validatingwebhook.go | 132 - .../v1/validatingwebhookconfiguration.go | 252 - .../v1/webhookclientconfig.go | 59 - .../v1beta1/mutatingwebhook.go | 141 - .../v1beta1/mutatingwebhookconfiguration.go | 252 - .../admissionregistration/v1beta1/rule.go | 76 - .../v1beta1/rulewithoperations.go | 84 - .../v1beta1/servicereference.go | 66 - .../v1beta1/validatingwebhook.go | 132 - .../v1beta1/validatingwebhookconfiguration.go | 252 - .../v1beta1/webhookclientconfig.go | 59 - .../v1alpha1/serverstorageversion.go | 59 - .../v1alpha1/storageversion.go | 256 - .../v1alpha1/storageversioncondition.go | 89 - .../v1alpha1/storageversionstatus.go | 67 - .../apps/v1/controllerrevision.go | 259 - .../applyconfigurations/apps/v1/daemonset.go | 258 - .../apps/v1/daemonsetcondition.go | 81 - .../apps/v1/daemonsetspec.go | 80 - .../apps/v1/daemonsetstatus.go | 125 - .../apps/v1/daemonsetupdatestrategy.go | 52 - .../applyconfigurations/apps/v1/deployment.go | 258 - .../apps/v1/deploymentcondition.go | 90 - .../apps/v1/deploymentspec.go | 107 - .../apps/v1/deploymentstatus.go | 107 - .../apps/v1/deploymentstrategy.go | 52 - .../applyconfigurations/apps/v1/replicaset.go | 258 - .../apps/v1/replicasetcondition.go | 81 - .../apps/v1/replicasetspec.go | 71 - .../apps/v1/replicasetstatus.go | 89 - .../apps/v1/rollingupdatedaemonset.go | 52 - .../apps/v1/rollingupdatedeployment.go | 52 - .../v1/rollingupdatestatefulsetstrategy.go | 52 - .../apps/v1/statefulset.go | 258 - .../apps/v1/statefulsetcondition.go | 81 - ...setpersistentvolumeclaimretentionpolicy.go | 52 - .../apps/v1/statefulsetspec.go | 131 - .../apps/v1/statefulsetstatus.go | 125 - .../apps/v1/statefulsetupdatestrategy.go | 52 - .../apps/v1beta1/controllerrevision.go | 259 - .../apps/v1beta1/deployment.go | 258 - .../apps/v1beta1/deploymentcondition.go | 90 - .../apps/v1beta1/deploymentspec.go | 116 - .../apps/v1beta1/deploymentstatus.go | 107 - .../apps/v1beta1/deploymentstrategy.go | 52 - .../apps/v1beta1/rollbackconfig.go | 39 - .../apps/v1beta1/rollingupdatedeployment.go | 52 - .../rollingupdatestatefulsetstrategy.go | 52 - .../apps/v1beta1/statefulset.go | 258 - .../apps/v1beta1/statefulsetcondition.go | 81 - ...setpersistentvolumeclaimretentionpolicy.go | 52 - .../apps/v1beta1/statefulsetspec.go | 131 - .../apps/v1beta1/statefulsetstatus.go | 125 - .../apps/v1beta1/statefulsetupdatestrategy.go | 52 - .../apps/v1beta2/controllerrevision.go | 259 - .../apps/v1beta2/daemonset.go | 258 - .../apps/v1beta2/daemonsetcondition.go | 81 - .../apps/v1beta2/daemonsetspec.go | 80 - .../apps/v1beta2/daemonsetstatus.go | 125 - .../apps/v1beta2/daemonsetupdatestrategy.go | 52 - .../apps/v1beta2/deployment.go | 258 - .../apps/v1beta2/deploymentcondition.go | 90 - .../apps/v1beta2/deploymentspec.go | 107 - .../apps/v1beta2/deploymentstatus.go | 107 - .../apps/v1beta2/deploymentstrategy.go | 52 - .../apps/v1beta2/replicaset.go | 258 - .../apps/v1beta2/replicasetcondition.go | 81 - .../apps/v1beta2/replicasetspec.go | 71 - .../apps/v1beta2/replicasetstatus.go | 89 - .../apps/v1beta2/rollingupdatedaemonset.go | 52 - .../apps/v1beta2/rollingupdatedeployment.go | 52 - .../rollingupdatestatefulsetstrategy.go | 52 - .../applyconfigurations/apps/v1beta2/scale.go | 218 - .../apps/v1beta2/statefulset.go | 258 - .../apps/v1beta2/statefulsetcondition.go | 81 - ...setpersistentvolumeclaimretentionpolicy.go | 52 - .../apps/v1beta2/statefulsetspec.go | 131 - .../apps/v1beta2/statefulsetstatus.go | 125 - .../apps/v1beta2/statefulsetupdatestrategy.go | 52 - .../v1/crossversionobjectreference.go | 57 - .../autoscaling/v1/horizontalpodautoscaler.go | 258 - .../v1/horizontalpodautoscalerspec.go | 66 - .../v1/horizontalpodautoscalerstatus.go | 79 - .../autoscaling/v1/scale.go | 217 - .../autoscaling/v1/scalespec.go | 39 - .../autoscaling/v1/scalestatus.go | 48 - .../v2/containerresourcemetricsource.go | 61 - .../v2/containerresourcemetricstatus.go | 61 - .../v2/crossversionobjectreference.go | 57 - .../autoscaling/v2/externalmetricsource.go | 48 - .../autoscaling/v2/externalmetricstatus.go | 48 - .../autoscaling/v2/horizontalpodautoscaler.go | 258 - .../v2/horizontalpodautoscalerbehavior.go | 48 - .../v2/horizontalpodautoscalercondition.go | 81 - .../v2/horizontalpodautoscalerspec.go | 80 - .../v2/horizontalpodautoscalerstatus.go | 98 - .../autoscaling/v2/hpascalingpolicy.go | 61 - .../autoscaling/v2/hpascalingrules.go | 66 - .../autoscaling/v2/metricidentifier.go | 52 - .../autoscaling/v2/metricspec.go | 88 - .../autoscaling/v2/metricstatus.go | 88 - .../autoscaling/v2/metrictarget.go | 71 - .../autoscaling/v2/metricvaluestatus.go | 61 - .../autoscaling/v2/objectmetricsource.go | 57 - .../autoscaling/v2/objectmetricstatus.go | 57 - .../autoscaling/v2/podresourcemetricsource.go | 52 - .../autoscaling/v2/podsmetricsource.go | 48 - .../autoscaling/v2/podsmetricstatus.go | 48 - .../autoscaling/v2/resourcemetricsource.go | 52 - .../autoscaling/v2/resourcemetricstatus.go | 52 - .../v2beta1/containerresourcemetricsource.go | 71 - .../v2beta1/containerresourcemetricstatus.go | 71 - .../v2beta1/crossversionobjectreference.go | 57 - .../v2beta1/externalmetricsource.go | 71 - .../v2beta1/externalmetricstatus.go | 71 - .../v2beta1/horizontalpodautoscaler.go | 258 - .../horizontalpodautoscalercondition.go | 81 - .../v2beta1/horizontalpodautoscalerspec.go | 71 - .../v2beta1/horizontalpodautoscalerstatus.go | 98 - .../autoscaling/v2beta1/metricspec.go | 88 - .../autoscaling/v2beta1/metricstatus.go | 88 - .../autoscaling/v2beta1/objectmetricsource.go | 80 - .../autoscaling/v2beta1/objectmetricstatus.go | 80 - .../autoscaling/v2beta1/podsmetricsource.go | 62 - .../autoscaling/v2beta1/podsmetricstatus.go | 62 - .../v2beta1/resourcemetricsource.go | 62 - .../v2beta1/resourcemetricstatus.go | 62 - .../v2beta2/containerresourcemetricsource.go | 61 - .../v2beta2/containerresourcemetricstatus.go | 61 - .../v2beta2/crossversionobjectreference.go | 57 - .../v2beta2/externalmetricsource.go | 48 - .../v2beta2/externalmetricstatus.go | 48 - .../v2beta2/horizontalpodautoscaler.go | 258 - .../horizontalpodautoscalerbehavior.go | 48 - .../horizontalpodautoscalercondition.go | 81 - .../v2beta2/horizontalpodautoscalerspec.go | 80 - .../v2beta2/horizontalpodautoscalerstatus.go | 98 - .../autoscaling/v2beta2/hpascalingpolicy.go | 61 - .../autoscaling/v2beta2/hpascalingrules.go | 66 - .../autoscaling/v2beta2/metricidentifier.go | 52 - .../autoscaling/v2beta2/metricspec.go | 88 - .../autoscaling/v2beta2/metricstatus.go | 88 - .../autoscaling/v2beta2/metrictarget.go | 71 - .../autoscaling/v2beta2/metricvaluestatus.go | 61 - .../autoscaling/v2beta2/objectmetricsource.go | 57 - .../autoscaling/v2beta2/objectmetricstatus.go | 57 - .../autoscaling/v2beta2/podsmetricsource.go | 48 - .../autoscaling/v2beta2/podsmetricstatus.go | 48 - .../v2beta2/resourcemetricsource.go | 52 - .../v2beta2/resourcemetricstatus.go | 52 - .../applyconfigurations/batch/v1/cronjob.go | 258 - .../batch/v1/cronjobspec.go | 106 - .../batch/v1/cronjobstatus.go | 67 - .../applyconfigurations/batch/v1/job.go | 258 - .../batch/v1/jobcondition.go | 90 - .../applyconfigurations/batch/v1/jobspec.go | 135 - .../applyconfigurations/batch/v1/jobstatus.go | 120 - .../batch/v1/jobtemplatespec.go | 188 - .../batch/v1/podfailurepolicy.go | 44 - .../podfailurepolicyonexitcodesrequirement.go | 63 - .../podfailurepolicyonpodconditionspattern.go | 52 - .../batch/v1/podfailurepolicyrule.go | 66 - .../batch/v1/uncountedterminatedpods.go | 56 - .../batch/v1beta1/cronjob.go | 258 - .../batch/v1beta1/cronjobspec.go | 106 - .../batch/v1beta1/cronjobstatus.go | 67 - .../batch/v1beta1/jobtemplatespec.go | 189 - .../v1/certificatesigningrequest.go | 256 - .../v1/certificatesigningrequestcondition.go | 90 - .../v1/certificatesigningrequestspec.go | 118 - .../v1/certificatesigningrequeststatus.go | 55 - .../v1beta1/certificatesigningrequest.go | 256 - .../certificatesigningrequestcondition.go | 90 - .../v1beta1/certificatesigningrequestspec.go | 118 - .../certificatesigningrequeststatus.go | 55 - .../coordination/v1/lease.go | 249 - .../coordination/v1/leasespec.go | 79 - .../coordination/v1beta1/lease.go | 249 - .../coordination/v1beta1/leasespec.go | 79 - .../applyconfigurations/core/v1/affinity.go | 57 - .../core/v1/attachedvolume.go | 52 - .../v1/awselasticblockstorevolumesource.go | 66 - .../core/v1/azurediskvolumesource.go | 88 - .../v1/azurefilepersistentvolumesource.go | 66 - .../core/v1/azurefilevolumesource.go | 57 - .../core/v1/capabilities.go | 56 - .../core/v1/cephfspersistentvolumesource.go | 86 - .../core/v1/cephfsvolumesource.go | 86 - .../core/v1/cinderpersistentvolumesource.go | 66 - .../core/v1/cindervolumesource.go | 66 - .../core/v1/clientipconfig.go | 39 - .../core/v1/componentcondition.go | 70 - .../core/v1/componentstatus.go | 252 - .../applyconfigurations/core/v1/configmap.go | 279 - .../core/v1/configmapenvsource.go | 48 - .../core/v1/configmapkeyselector.go | 57 - .../core/v1/configmapnodeconfigsource.go | 79 - .../core/v1/configmapprojection.go | 62 - .../core/v1/configmapvolumesource.go | 71 - .../applyconfigurations/core/v1/container.go | 261 - .../core/v1/containerimage.go | 50 - .../core/v1/containerport.go | 79 - .../core/v1/containerstate.go | 57 - .../core/v1/containerstaterunning.go | 43 - .../core/v1/containerstateterminated.go | 97 - .../core/v1/containerstatewaiting.go | 48 - .../core/v1/containerstatus.go | 111 - .../core/v1/csipersistentvolumesource.go | 126 - .../core/v1/csivolumesource.go | 81 - .../core/v1/daemonendpoint.go | 39 - .../core/v1/downwardapiprojection.go | 44 - .../core/v1/downwardapivolumefile.go | 66 - .../core/v1/downwardapivolumesource.go | 53 - .../core/v1/emptydirvolumesource.go | 53 - .../core/v1/endpointaddress.go | 66 - .../core/v1/endpointport.go | 70 - .../applyconfigurations/core/v1/endpoints.go | 254 - .../core/v1/endpointsubset.go | 72 - .../core/v1/envfromsource.go | 57 - .../applyconfigurations/core/v1/envvar.go | 57 - .../core/v1/envvarsource.go | 66 - .../core/v1/ephemeralcontainer.go | 249 - .../core/v1/ephemeralcontainercommon.go | 261 - .../core/v1/ephemeralvolumesource.go | 39 - .../applyconfigurations/core/v1/event.go | 366 - .../core/v1/eventseries.go | 52 - .../core/v1/eventsource.go | 48 - .../applyconfigurations/core/v1/execaction.go | 41 - .../core/v1/fcvolumesource.go | 79 - .../core/v1/flexpersistentvolumesource.go | 81 - .../core/v1/flexvolumesource.go | 81 - .../core/v1/flockervolumesource.go | 48 - .../core/v1/gcepersistentdiskvolumesource.go | 66 - .../core/v1/gitrepovolumesource.go | 57 - .../v1/glusterfspersistentvolumesource.go | 66 - .../core/v1/glusterfsvolumesource.go | 57 - .../applyconfigurations/core/v1/grpcaction.go | 48 - .../applyconfigurations/core/v1/hostalias.go | 50 - .../core/v1/hostpathvolumesource.go | 52 - .../core/v1/httpgetaction.go | 85 - .../applyconfigurations/core/v1/httpheader.go | 48 - .../core/v1/iscsipersistentvolumesource.go | 131 - .../core/v1/iscsivolumesource.go | 131 - .../applyconfigurations/core/v1/keytopath.go | 57 - .../applyconfigurations/core/v1/lifecycle.go | 48 - .../core/v1/lifecyclehandler.go | 57 - .../applyconfigurations/core/v1/limitrange.go | 249 - .../core/v1/limitrangeitem.go | 88 - .../core/v1/limitrangespec.go | 44 - .../core/v1/loadbalanceringress.go | 62 - .../core/v1/loadbalancerstatus.go | 44 - .../core/v1/localobjectreference.go | 39 - .../core/v1/localvolumesource.go | 48 - .../applyconfigurations/core/v1/namespace.go | 256 - .../core/v1/namespacecondition.go | 80 - .../core/v1/namespacespec.go | 45 - .../core/v1/namespacestatus.go | 57 - .../core/v1/nfsvolumesource.go | 57 - .../applyconfigurations/core/v1/node.go | 256 - .../core/v1/nodeaddress.go | 52 - .../core/v1/nodeaffinity.go | 53 - .../core/v1/nodecondition.go | 89 - .../core/v1/nodeconfigsource.go | 39 - .../core/v1/nodeconfigstatus.go | 66 - .../core/v1/nodedaemonendpoints.go | 39 - .../core/v1/nodeselector.go | 44 - .../core/v1/nodeselectorrequirement.go | 63 - .../core/v1/nodeselectorterm.go | 58 - .../applyconfigurations/core/v1/nodespec.go | 100 - .../applyconfigurations/core/v1/nodestatus.go | 155 - .../core/v1/nodesysteminfo.go | 120 - .../core/v1/objectfieldselector.go | 48 - .../core/v1/objectreference.go | 97 - .../core/v1/persistentvolume.go | 256 - .../core/v1/persistentvolumeclaim.go | 258 - .../core/v1/persistentvolumeclaimcondition.go | 89 - .../core/v1/persistentvolumeclaimspec.go | 109 - .../core/v1/persistentvolumeclaimstatus.go | 95 - .../core/v1/persistentvolumeclaimtemplate.go | 188 - .../v1/persistentvolumeclaimvolumesource.go | 48 - .../core/v1/persistentvolumesource.go | 228 - .../core/v1/persistentvolumespec.go | 287 - .../core/v1/persistentvolumestatus.go | 61 - .../v1/photonpersistentdiskvolumesource.go | 48 - .../applyconfigurations/core/v1/pod.go | 258 - .../core/v1/podaffinity.go | 58 - .../core/v1/podaffinityterm.go | 72 - .../core/v1/podantiaffinity.go | 58 - .../core/v1/podcondition.go | 89 - .../core/v1/poddnsconfig.go | 66 - .../core/v1/poddnsconfigoption.go | 48 - .../applyconfigurations/core/v1/podip.go | 39 - .../applyconfigurations/core/v1/podos.go | 43 - .../core/v1/podreadinessgate.go | 43 - .../core/v1/podsecuritycontext.go | 131 - .../applyconfigurations/core/v1/podspec.go | 418 - .../applyconfigurations/core/v1/podstatus.go | 177 - .../core/v1/podtemplate.go | 249 - .../core/v1/podtemplatespec.go | 188 - .../applyconfigurations/core/v1/portstatus.go | 61 - .../core/v1/portworxvolumesource.go | 57 - .../core/v1/preferredschedulingterm.go | 48 - .../applyconfigurations/core/v1/probe.go | 117 - .../core/v1/probehandler.go | 66 - .../core/v1/projectedvolumesource.go | 53 - .../core/v1/quobytevolumesource.go | 84 - .../core/v1/rbdpersistentvolumesource.go | 104 - .../core/v1/rbdvolumesource.go | 104 - .../core/v1/replicationcontroller.go | 258 - .../core/v1/replicationcontrollercondition.go | 80 - .../core/v1/replicationcontrollerspec.go | 72 - .../core/v1/replicationcontrollerstatus.go | 89 - .../core/v1/resourcefieldselector.go | 61 - .../core/v1/resourcequota.go | 258 - .../core/v1/resourcequotaspec.go | 63 - .../core/v1/resourcequotastatus.go | 52 - .../core/v1/resourcerequirements.go | 52 - .../core/v1/scaleiopersistentvolumesource.go | 120 - .../core/v1/scaleiovolumesource.go | 120 - .../v1/scopedresourceselectorrequirement.go | 63 - .../core/v1/scopeselector.go | 44 - .../core/v1/seccompprofile.go | 52 - .../applyconfigurations/core/v1/secret.go | 288 - .../core/v1/secretenvsource.go | 48 - .../core/v1/secretkeyselector.go | 57 - .../core/v1/secretprojection.go | 62 - .../core/v1/secretreference.go | 48 - .../core/v1/secretvolumesource.go | 71 - .../core/v1/securitycontext.go | 133 - .../core/v1/selinuxoptions.go | 66 - .../applyconfigurations/core/v1/service.go | 258 - .../core/v1/serviceaccount.go | 277 - .../core/v1/serviceaccounttokenprojection.go | 57 - .../core/v1/serviceport.go | 89 - .../core/v1/servicespec.go | 224 - .../core/v1/servicestatus.go | 57 - .../core/v1/sessionaffinityconfig.go | 39 - .../v1/storageospersistentvolumesource.go | 75 - .../core/v1/storageosvolumesource.go | 75 - .../applyconfigurations/core/v1/sysctl.go | 48 - .../applyconfigurations/core/v1/taint.go | 71 - .../core/v1/tcpsocketaction.go | 52 - .../applyconfigurations/core/v1/toleration.go | 79 - .../v1/topologyselectorlabelrequirement.go | 50 - .../core/v1/topologyselectorterm.go | 44 - .../core/v1/topologyspreadconstraint.go | 109 - .../core/v1/typedlocalobjectreference.go | 57 - .../applyconfigurations/core/v1/volume.go | 272 - .../core/v1/volumedevice.go | 48 - .../core/v1/volumemount.go | 88 - .../core/v1/volumenodeaffinity.go | 39 - .../core/v1/volumeprojection.go | 66 - .../core/v1/volumesource.go | 291 - .../core/v1/vspherevirtualdiskvolumesource.go | 66 - .../core/v1/weightedpodaffinityterm.go | 48 - .../core/v1/windowssecuritycontextoptions.go | 66 - .../discovery/v1/endpoint.go | 114 - .../discovery/v1/endpointconditions.go | 57 - .../discovery/v1/endpointhints.go | 44 - .../discovery/v1/endpointport.go | 70 - .../discovery/v1/endpointslice.go | 277 - .../discovery/v1/forzone.go | 39 - .../discovery/v1beta1/endpoint.go | 105 - .../discovery/v1beta1/endpointconditions.go | 57 - .../discovery/v1beta1/endpointhints.go | 44 - .../discovery/v1beta1/endpointport.go | 70 - .../discovery/v1beta1/endpointslice.go | 277 - .../discovery/v1beta1/forzone.go | 39 - .../applyconfigurations/events/v1/event.go | 367 - .../events/v1/eventseries.go | 52 - .../events/v1beta1/event.go | 367 - .../events/v1beta1/eventseries.go | 52 - .../extensions/v1beta1/allowedcsidriver.go | 39 - .../extensions/v1beta1/allowedflexvolume.go | 39 - .../extensions/v1beta1/allowedhostpath.go | 48 - .../extensions/v1beta1/daemonset.go | 258 - .../extensions/v1beta1/daemonsetcondition.go | 81 - .../extensions/v1beta1/daemonsetspec.go | 89 - .../extensions/v1beta1/daemonsetstatus.go | 125 - .../v1beta1/daemonsetupdatestrategy.go | 52 - .../extensions/v1beta1/deployment.go | 258 - .../extensions/v1beta1/deploymentcondition.go | 90 - .../extensions/v1beta1/deploymentspec.go | 116 - .../extensions/v1beta1/deploymentstatus.go | 107 - .../extensions/v1beta1/deploymentstrategy.go | 52 - .../v1beta1/fsgroupstrategyoptions.go | 57 - .../extensions/v1beta1/hostportrange.go | 48 - .../extensions/v1beta1/httpingresspath.go | 61 - .../v1beta1/httpingressrulevalue.go | 44 - .../extensions/v1beta1/idrange.go | 48 - .../extensions/v1beta1/ingress.go | 258 - .../extensions/v1beta1/ingressbackend.go | 62 - .../extensions/v1beta1/ingressrule.go | 48 - .../extensions/v1beta1/ingressrulevalue.go | 39 - .../extensions/v1beta1/ingressspec.go | 76 - .../extensions/v1beta1/ingressstatus.go | 43 - .../extensions/v1beta1/ingresstls.go | 50 - .../extensions/v1beta1/ipblock.go | 50 - .../extensions/v1beta1/networkpolicy.go | 258 - .../v1beta1/networkpolicyegressrule.go | 58 - .../v1beta1/networkpolicyingressrule.go | 58 - .../extensions/v1beta1/networkpolicypeer.go | 61 - .../extensions/v1beta1/networkpolicyport.go | 62 - .../extensions/v1beta1/networkpolicyspec.go | 83 - .../extensions/v1beta1/networkpolicystatus.go | 48 - .../extensions/v1beta1/podsecuritypolicy.go | 247 - .../v1beta1/podsecuritypolicyspec.go | 285 - .../extensions/v1beta1/replicaset.go | 258 - .../extensions/v1beta1/replicasetcondition.go | 81 - .../extensions/v1beta1/replicasetspec.go | 71 - .../extensions/v1beta1/replicasetstatus.go | 89 - .../extensions/v1beta1/rollbackconfig.go | 39 - .../v1beta1/rollingupdatedaemonset.go | 52 - .../v1beta1/rollingupdatedeployment.go | 52 - .../v1beta1/runasgroupstrategyoptions.go | 57 - .../v1beta1/runasuserstrategyoptions.go | 57 - .../v1beta1/runtimeclassstrategyoptions.go | 50 - .../extensions/v1beta1/scale.go | 218 - .../v1beta1/selinuxstrategyoptions.go | 53 - .../supplementalgroupsstrategyoptions.go | 57 - .../v1alpha1/flowdistinguishermethod.go | 43 - .../flowcontrol/v1alpha1/flowschema.go | 256 - .../v1alpha1/flowschemacondition.go | 80 - .../flowcontrol/v1alpha1/flowschemaspec.go | 71 - .../flowcontrol/v1alpha1/flowschemastatus.go | 44 - .../flowcontrol/v1alpha1/groupsubject.go | 39 - .../limitedprioritylevelconfiguration.go | 48 - .../flowcontrol/v1alpha1/limitresponse.go | 52 - .../v1alpha1/nonresourcepolicyrule.go | 52 - .../v1alpha1/policyruleswithsubjects.go | 72 - .../v1alpha1/prioritylevelconfiguration.go | 256 - .../prioritylevelconfigurationcondition.go | 80 - .../prioritylevelconfigurationreference.go | 39 - .../prioritylevelconfigurationspec.go | 52 - .../prioritylevelconfigurationstatus.go | 44 - .../v1alpha1/queuingconfiguration.go | 57 - .../v1alpha1/resourcepolicyrule.go | 83 - .../v1alpha1/serviceaccountsubject.go | 48 - .../flowcontrol/v1alpha1/subject.go | 70 - .../flowcontrol/v1alpha1/usersubject.go | 39 - .../v1beta1/flowdistinguishermethod.go | 43 - .../flowcontrol/v1beta1/flowschema.go | 256 - .../v1beta1/flowschemacondition.go | 80 - .../flowcontrol/v1beta1/flowschemaspec.go | 71 - .../flowcontrol/v1beta1/flowschemastatus.go | 44 - .../flowcontrol/v1beta1/groupsubject.go | 39 - .../limitedprioritylevelconfiguration.go | 48 - .../flowcontrol/v1beta1/limitresponse.go | 52 - .../v1beta1/nonresourcepolicyrule.go | 52 - .../v1beta1/policyruleswithsubjects.go | 72 - .../v1beta1/prioritylevelconfiguration.go | 256 - .../prioritylevelconfigurationcondition.go | 80 - .../prioritylevelconfigurationreference.go | 39 - .../v1beta1/prioritylevelconfigurationspec.go | 52 - .../prioritylevelconfigurationstatus.go | 44 - .../v1beta1/queuingconfiguration.go | 57 - .../flowcontrol/v1beta1/resourcepolicyrule.go | 83 - .../v1beta1/serviceaccountsubject.go | 48 - .../flowcontrol/v1beta1/subject.go | 70 - .../flowcontrol/v1beta1/usersubject.go | 39 - .../v1beta2/flowdistinguishermethod.go | 43 - .../flowcontrol/v1beta2/flowschema.go | 256 - .../v1beta2/flowschemacondition.go | 80 - .../flowcontrol/v1beta2/flowschemaspec.go | 71 - .../flowcontrol/v1beta2/flowschemastatus.go | 44 - .../flowcontrol/v1beta2/groupsubject.go | 39 - .../limitedprioritylevelconfiguration.go | 48 - .../flowcontrol/v1beta2/limitresponse.go | 52 - .../v1beta2/nonresourcepolicyrule.go | 52 - .../v1beta2/policyruleswithsubjects.go | 72 - .../v1beta2/prioritylevelconfiguration.go | 256 - .../prioritylevelconfigurationcondition.go | 80 - .../prioritylevelconfigurationreference.go | 39 - .../v1beta2/prioritylevelconfigurationspec.go | 52 - .../prioritylevelconfigurationstatus.go | 44 - .../v1beta2/queuingconfiguration.go | 57 - .../flowcontrol/v1beta2/resourcepolicyrule.go | 83 - .../v1beta2/serviceaccountsubject.go | 48 - .../flowcontrol/v1beta2/subject.go | 70 - .../flowcontrol/v1beta2/usersubject.go | 39 - .../applyconfigurations/internal/internal.go | 11775 --- .../applyconfigurations/meta/v1/condition.go | 88 - .../meta/v1/deleteoptions.go | 101 - .../meta/v1/labelselector.go | 59 - .../meta/v1/labelselectorrequirement.go | 63 - .../applyconfigurations/meta/v1/listmeta.go | 66 - .../meta/v1/managedfieldsentry.go | 97 - .../applyconfigurations/meta/v1/objectmeta.go | 171 - .../meta/v1/ownerreference.go | 88 - .../meta/v1/preconditions.go | 52 - .../applyconfigurations/meta/v1/typemeta.go | 48 - .../meta/v1/unstructured.go | 137 - .../networking/v1/httpingresspath.go | 61 - .../networking/v1/httpingressrulevalue.go | 44 - .../networking/v1/ingress.go | 258 - .../networking/v1/ingressbackend.go | 52 - .../networking/v1/ingressclass.go | 247 - .../v1/ingressclassparametersreference.go | 75 - .../networking/v1/ingressclassspec.go | 48 - .../networking/v1/ingressrule.go | 48 - .../networking/v1/ingressrulevalue.go | 39 - .../networking/v1/ingressservicebackend.go | 48 - .../networking/v1/ingressspec.go | 76 - .../networking/v1/ingressstatus.go | 43 - .../networking/v1/ingresstls.go | 50 - .../networking/v1/ipblock.go | 50 - .../networking/v1/networkpolicy.go | 258 - .../networking/v1/networkpolicyegressrule.go | 58 - .../networking/v1/networkpolicyingressrule.go | 58 - .../networking/v1/networkpolicypeer.go | 61 - .../networking/v1/networkpolicyport.go | 62 - .../networking/v1/networkpolicyspec.go | 83 - .../networking/v1/networkpolicystatus.go | 48 - .../networking/v1/servicebackendport.go | 48 - .../networking/v1alpha1/clustercidr.go | 247 - .../networking/v1alpha1/clustercidrspec.go | 70 - .../networking/v1beta1/httpingresspath.go | 61 - .../v1beta1/httpingressrulevalue.go | 44 - .../networking/v1beta1/ingress.go | 258 - .../networking/v1beta1/ingressbackend.go | 62 - .../networking/v1beta1/ingressclass.go | 247 - .../ingressclassparametersreference.go | 75 - .../networking/v1beta1/ingressclassspec.go | 48 - .../networking/v1beta1/ingressrule.go | 48 - .../networking/v1beta1/ingressrulevalue.go | 39 - .../networking/v1beta1/ingressspec.go | 76 - .../networking/v1beta1/ingressstatus.go | 43 - .../networking/v1beta1/ingresstls.go | 50 - .../applyconfigurations/node/v1/overhead.go | 43 - .../node/v1/runtimeclass.go | 265 - .../applyconfigurations/node/v1/scheduling.go | 63 - .../node/v1alpha1/overhead.go | 43 - .../node/v1alpha1/runtimeclass.go | 247 - .../node/v1alpha1/runtimeclassspec.go | 57 - .../node/v1alpha1/scheduling.go | 63 - .../node/v1beta1/overhead.go | 43 - .../node/v1beta1/runtimeclass.go | 265 - .../node/v1beta1/scheduling.go | 63 - .../applyconfigurations/policy/v1/eviction.go | 249 - .../policy/v1/poddisruptionbudget.go | 258 - .../policy/v1/poddisruptionbudgetspec.go | 62 - .../policy/v1/poddisruptionbudgetstatus.go | 109 - .../policy/v1beta1/allowedcsidriver.go | 39 - .../policy/v1beta1/allowedflexvolume.go | 39 - .../policy/v1beta1/allowedhostpath.go | 48 - .../policy/v1beta1/eviction.go | 249 - .../policy/v1beta1/fsgroupstrategyoptions.go | 57 - .../policy/v1beta1/hostportrange.go | 48 - .../policy/v1beta1/idrange.go | 48 - .../policy/v1beta1/poddisruptionbudget.go | 258 - .../policy/v1beta1/poddisruptionbudgetspec.go | 62 - .../v1beta1/poddisruptionbudgetstatus.go | 109 - .../policy/v1beta1/podsecuritypolicy.go | 247 - .../policy/v1beta1/podsecuritypolicyspec.go | 285 - .../v1beta1/runasgroupstrategyoptions.go | 57 - .../v1beta1/runasuserstrategyoptions.go | 57 - .../v1beta1/runtimeclassstrategyoptions.go | 50 - .../policy/v1beta1/selinuxstrategyoptions.go | 53 - .../supplementalgroupsstrategyoptions.go | 57 - .../rbac/v1/aggregationrule.go | 48 - .../rbac/v1/clusterrole.go | 261 - .../rbac/v1/clusterrolebinding.go | 261 - .../applyconfigurations/rbac/v1/policyrule.go | 85 - .../applyconfigurations/rbac/v1/role.go | 254 - .../rbac/v1/rolebinding.go | 263 - .../applyconfigurations/rbac/v1/roleref.go | 57 - .../applyconfigurations/rbac/v1/subject.go | 66 - .../rbac/v1alpha1/aggregationrule.go | 48 - .../rbac/v1alpha1/clusterrole.go | 261 - .../rbac/v1alpha1/clusterrolebinding.go | 261 - .../rbac/v1alpha1/policyrule.go | 85 - .../applyconfigurations/rbac/v1alpha1/role.go | 254 - .../rbac/v1alpha1/rolebinding.go | 263 - .../rbac/v1alpha1/roleref.go | 57 - .../rbac/v1alpha1/subject.go | 66 - .../rbac/v1beta1/aggregationrule.go | 48 - .../rbac/v1beta1/clusterrole.go | 261 - .../rbac/v1beta1/clusterrolebinding.go | 261 - .../rbac/v1beta1/policyrule.go | 85 - .../applyconfigurations/rbac/v1beta1/role.go | 254 - .../rbac/v1beta1/rolebinding.go | 263 - .../rbac/v1beta1/roleref.go | 57 - .../rbac/v1beta1/subject.go | 66 - .../scheduling/v1/priorityclass.go | 275 - .../scheduling/v1alpha1/priorityclass.go | 275 - .../scheduling/v1beta1/priorityclass.go | 275 - .../storage/v1/csidriver.go | 247 - .../storage/v1/csidriverspec.go | 113 - .../applyconfigurations/storage/v1/csinode.go | 247 - .../storage/v1/csinodedriver.go | 68 - .../storage/v1/csinodespec.go | 44 - .../storage/v1/csistoragecapacity.go | 277 - .../storage/v1/storageclass.go | 316 - .../storage/v1/tokenrequest.go | 48 - .../storage/v1/volumeattachment.go | 256 - .../storage/v1/volumeattachmentsource.go | 52 - .../storage/v1/volumeattachmentspec.go | 57 - .../storage/v1/volumeattachmentstatus.go | 72 - .../storage/v1/volumeerror.go | 52 - .../storage/v1/volumenoderesources.go | 39 - .../storage/v1alpha1/csistoragecapacity.go | 277 - .../storage/v1alpha1/volumeattachment.go | 256 - .../v1alpha1/volumeattachmentsource.go | 52 - .../storage/v1alpha1/volumeattachmentspec.go | 57 - .../v1alpha1/volumeattachmentstatus.go | 72 - .../storage/v1alpha1/volumeerror.go | 52 - .../storage/v1beta1/csidriver.go | 247 - .../storage/v1beta1/csidriverspec.go | 113 - .../storage/v1beta1/csinode.go | 247 - .../storage/v1beta1/csinodedriver.go | 68 - .../storage/v1beta1/csinodespec.go | 44 - .../storage/v1beta1/csistoragecapacity.go | 277 - .../storage/v1beta1/storageclass.go | 316 - .../storage/v1beta1/tokenrequest.go | 48 - .../storage/v1beta1/volumeattachment.go | 256 - .../storage/v1beta1/volumeattachmentsource.go | 52 - .../storage/v1beta1/volumeattachmentspec.go | 57 - .../storage/v1beta1/volumeattachmentstatus.go | 72 - .../storage/v1beta1/volumeerror.go | 52 - .../storage/v1beta1/volumenoderesources.go | 39 - .../client-go/discovery/discovery_client.go | 529 - vendor/k8s.io/client-go/discovery/doc.go | 19 - vendor/k8s.io/client-go/discovery/helper.go | 146 - vendor/k8s.io/client-go/dynamic/interface.go | 63 - vendor/k8s.io/client-go/dynamic/scheme.go | 108 - vendor/k8s.io/client-go/dynamic/simple.go | 388 - .../k8s.io/client-go/kubernetes/clientset.go | 706 - vendor/k8s.io/client-go/kubernetes/doc.go | 20 - vendor/k8s.io/client-go/kubernetes/import.go | 19 - .../k8s.io/client-go/kubernetes/scheme/doc.go | 20 - .../client-go/kubernetes/scheme/register.go | 146 - .../v1/admissionregistration_client.go | 112 - .../typed/admissionregistration/v1/doc.go | 20 - .../v1/generated_expansion.go | 23 - .../v1/mutatingwebhookconfiguration.go | 197 - .../v1/validatingwebhookconfiguration.go | 197 - .../v1beta1/admissionregistration_client.go | 112 - .../admissionregistration/v1beta1/doc.go | 20 - .../v1beta1/generated_expansion.go | 23 - .../v1beta1/mutatingwebhookconfiguration.go | 197 - .../v1beta1/validatingwebhookconfiguration.go | 197 - .../v1alpha1/apiserverinternal_client.go | 107 - .../typed/apiserverinternal/v1alpha1/doc.go | 20 - .../v1alpha1/generated_expansion.go | 21 - .../v1alpha1/storageversion.go | 243 - .../kubernetes/typed/apps/v1/apps_client.go | 127 - .../typed/apps/v1/controllerrevision.go | 208 - .../kubernetes/typed/apps/v1/daemonset.go | 256 - .../kubernetes/typed/apps/v1/deployment.go | 316 - .../client-go/kubernetes/typed/apps/v1/doc.go | 20 - .../typed/apps/v1/generated_expansion.go | 29 - .../kubernetes/typed/apps/v1/replicaset.go | 316 - .../kubernetes/typed/apps/v1/statefulset.go | 316 - .../typed/apps/v1beta1/apps_client.go | 117 - .../typed/apps/v1beta1/controllerrevision.go | 208 - .../typed/apps/v1beta1/deployment.go | 256 - .../kubernetes/typed/apps/v1beta1/doc.go | 20 - .../typed/apps/v1beta1/generated_expansion.go | 25 - .../typed/apps/v1beta1/statefulset.go | 256 - .../typed/apps/v1beta2/apps_client.go | 127 - .../typed/apps/v1beta2/controllerrevision.go | 208 - .../typed/apps/v1beta2/daemonset.go | 256 - .../typed/apps/v1beta2/deployment.go | 256 - .../kubernetes/typed/apps/v1beta2/doc.go | 20 - .../typed/apps/v1beta2/generated_expansion.go | 29 - .../typed/apps/v1beta2/replicaset.go | 256 - .../typed/apps/v1beta2/statefulset.go | 314 - .../v1/authentication_client.go | 107 - .../kubernetes/typed/authentication/v1/doc.go | 20 - .../authentication/v1/generated_expansion.go | 21 - .../typed/authentication/v1/tokenreview.go | 64 - .../v1beta1/authentication_client.go | 107 - .../typed/authentication/v1beta1/doc.go | 20 - .../v1beta1/generated_expansion.go | 21 - .../authentication/v1beta1/tokenreview.go | 64 - .../authorization/v1/authorization_client.go | 122 - .../kubernetes/typed/authorization/v1/doc.go | 20 - .../authorization/v1/generated_expansion.go | 27 - .../v1/localsubjectaccessreview.go | 67 - .../v1/selfsubjectaccessreview.go | 64 - .../v1/selfsubjectrulesreview.go | 64 - .../authorization/v1/subjectaccessreview.go | 64 - .../v1beta1/authorization_client.go | 122 - .../typed/authorization/v1beta1/doc.go | 20 - .../v1beta1/generated_expansion.go | 27 - .../v1beta1/localsubjectaccessreview.go | 67 - .../v1beta1/selfsubjectaccessreview.go | 64 - .../v1beta1/selfsubjectrulesreview.go | 64 - .../v1beta1/subjectaccessreview.go | 64 - .../autoscaling/v1/autoscaling_client.go | 107 - .../kubernetes/typed/autoscaling/v1/doc.go | 20 - .../autoscaling/v1/generated_expansion.go | 21 - .../autoscaling/v1/horizontalpodautoscaler.go | 256 - .../autoscaling/v2/autoscaling_client.go | 107 - .../kubernetes/typed/autoscaling/v2/doc.go | 20 - .../autoscaling/v2/generated_expansion.go | 21 - .../autoscaling/v2/horizontalpodautoscaler.go | 256 - .../autoscaling/v2beta1/autoscaling_client.go | 107 - .../typed/autoscaling/v2beta1/doc.go | 20 - .../v2beta1/generated_expansion.go | 21 - .../v2beta1/horizontalpodautoscaler.go | 256 - .../autoscaling/v2beta2/autoscaling_client.go | 107 - .../typed/autoscaling/v2beta2/doc.go | 20 - .../v2beta2/generated_expansion.go | 21 - .../v2beta2/horizontalpodautoscaler.go | 256 - .../kubernetes/typed/batch/v1/batch_client.go | 112 - .../kubernetes/typed/batch/v1/cronjob.go | 256 - .../kubernetes/typed/batch/v1/doc.go | 20 - .../typed/batch/v1/generated_expansion.go | 23 - .../kubernetes/typed/batch/v1/job.go | 256 - .../typed/batch/v1beta1/batch_client.go | 107 - .../kubernetes/typed/batch/v1beta1/cronjob.go | 256 - .../kubernetes/typed/batch/v1beta1/doc.go | 20 - .../batch/v1beta1/generated_expansion.go | 21 - .../certificates/v1/certificates_client.go | 107 - .../v1/certificatesigningrequest.go | 259 - .../kubernetes/typed/certificates/v1/doc.go | 20 - .../certificates/v1/generated_expansion.go | 21 - .../v1beta1/certificates_client.go | 107 - .../v1beta1/certificatesigningrequest.go | 243 - .../certificatesigningrequest_expansion.go | 42 - .../typed/certificates/v1beta1/doc.go | 20 - .../v1beta1/generated_expansion.go | 19 - .../coordination/v1/coordination_client.go | 107 - .../kubernetes/typed/coordination/v1/doc.go | 20 - .../coordination/v1/generated_expansion.go | 21 - .../kubernetes/typed/coordination/v1/lease.go | 208 - .../v1beta1/coordination_client.go | 107 - .../typed/coordination/v1beta1/doc.go | 20 - .../v1beta1/generated_expansion.go | 21 - .../typed/coordination/v1beta1/lease.go | 208 - .../typed/core/v1/componentstatus.go | 197 - .../kubernetes/typed/core/v1/configmap.go | 208 - .../kubernetes/typed/core/v1/core_client.go | 182 - .../client-go/kubernetes/typed/core/v1/doc.go | 20 - .../kubernetes/typed/core/v1/endpoints.go | 208 - .../kubernetes/typed/core/v1/event.go | 208 - .../typed/core/v1/event_expansion.go | 169 - .../typed/core/v1/generated_expansion.go | 41 - .../kubernetes/typed/core/v1/limitrange.go | 208 - .../kubernetes/typed/core/v1/namespace.go | 227 - .../typed/core/v1/namespace_expansion.go | 37 - .../kubernetes/typed/core/v1/node.go | 243 - .../typed/core/v1/node_expansion.go | 45 - .../typed/core/v1/persistentvolume.go | 243 - .../typed/core/v1/persistentvolumeclaim.go | 256 - .../client-go/kubernetes/typed/core/v1/pod.go | 273 - .../kubernetes/typed/core/v1/pod_expansion.go | 85 - .../kubernetes/typed/core/v1/podtemplate.go | 208 - .../typed/core/v1/replicationcontroller.go | 289 - .../kubernetes/typed/core/v1/resourcequota.go | 256 - .../kubernetes/typed/core/v1/secret.go | 208 - .../kubernetes/typed/core/v1/service.go | 239 - .../typed/core/v1/service_expansion.go | 41 - .../typed/core/v1/serviceaccount.go | 226 - .../typed/discovery/v1/discovery_client.go | 107 - .../kubernetes/typed/discovery/v1/doc.go | 20 - .../typed/discovery/v1/endpointslice.go | 208 - .../typed/discovery/v1/generated_expansion.go | 21 - .../discovery/v1beta1/discovery_client.go | 107 - .../kubernetes/typed/discovery/v1beta1/doc.go | 20 - .../typed/discovery/v1beta1/endpointslice.go | 208 - .../discovery/v1beta1/generated_expansion.go | 21 - .../kubernetes/typed/events/v1/doc.go | 20 - .../kubernetes/typed/events/v1/event.go | 208 - .../typed/events/v1/events_client.go | 107 - .../typed/events/v1/generated_expansion.go | 21 - .../kubernetes/typed/events/v1beta1/doc.go | 20 - .../kubernetes/typed/events/v1beta1/event.go | 208 - .../typed/events/v1beta1/event_expansion.go | 100 - .../typed/events/v1beta1/events_client.go | 107 - .../events/v1beta1/generated_expansion.go | 19 - .../typed/extensions/v1beta1/daemonset.go | 256 - .../typed/extensions/v1beta1/deployment.go | 314 - .../v1beta1/deployment_expansion.go | 35 - .../typed/extensions/v1beta1/doc.go | 20 - .../extensions/v1beta1/extensions_client.go | 132 - .../extensions/v1beta1/generated_expansion.go | 29 - .../typed/extensions/v1beta1/ingress.go | 256 - .../typed/extensions/v1beta1/networkpolicy.go | 256 - .../extensions/v1beta1/podsecuritypolicy.go | 197 - .../typed/extensions/v1beta1/replicaset.go | 314 - .../typed/flowcontrol/v1alpha1/doc.go | 20 - .../v1alpha1/flowcontrol_client.go | 112 - .../typed/flowcontrol/v1alpha1/flowschema.go | 243 - .../v1alpha1/generated_expansion.go | 23 - .../v1alpha1/prioritylevelconfiguration.go | 243 - .../typed/flowcontrol/v1beta1/doc.go | 20 - .../flowcontrol/v1beta1/flowcontrol_client.go | 112 - .../typed/flowcontrol/v1beta1/flowschema.go | 243 - .../v1beta1/generated_expansion.go | 23 - .../v1beta1/prioritylevelconfiguration.go | 243 - .../typed/flowcontrol/v1beta2/doc.go | 20 - .../flowcontrol/v1beta2/flowcontrol_client.go | 112 - .../typed/flowcontrol/v1beta2/flowschema.go | 243 - .../v1beta2/generated_expansion.go | 23 - .../v1beta2/prioritylevelconfiguration.go | 243 - .../kubernetes/typed/networking/v1/doc.go | 20 - .../networking/v1/generated_expansion.go | 25 - .../kubernetes/typed/networking/v1/ingress.go | 256 - .../typed/networking/v1/ingressclass.go | 197 - .../typed/networking/v1/networking_client.go | 117 - .../typed/networking/v1/networkpolicy.go | 256 - .../typed/networking/v1alpha1/clustercidr.go | 197 - .../typed/networking/v1alpha1/doc.go | 20 - .../v1alpha1/generated_expansion.go | 21 - .../networking/v1alpha1/networking_client.go | 107 - .../typed/networking/v1beta1/doc.go | 20 - .../networking/v1beta1/generated_expansion.go | 23 - .../typed/networking/v1beta1/ingress.go | 256 - .../typed/networking/v1beta1/ingressclass.go | 197 - .../networking/v1beta1/networking_client.go | 112 - .../client-go/kubernetes/typed/node/v1/doc.go | 20 - .../typed/node/v1/generated_expansion.go | 21 - .../kubernetes/typed/node/v1/node_client.go | 107 - .../kubernetes/typed/node/v1/runtimeclass.go | 197 - .../kubernetes/typed/node/v1alpha1/doc.go | 20 - .../node/v1alpha1/generated_expansion.go | 21 - .../typed/node/v1alpha1/node_client.go | 107 - .../typed/node/v1alpha1/runtimeclass.go | 197 - .../kubernetes/typed/node/v1beta1/doc.go | 20 - .../typed/node/v1beta1/generated_expansion.go | 21 - .../typed/node/v1beta1/node_client.go | 107 - .../typed/node/v1beta1/runtimeclass.go | 197 - .../kubernetes/typed/policy/v1/doc.go | 20 - .../kubernetes/typed/policy/v1/eviction.go | 48 - .../typed/policy/v1/eviction_expansion.go | 40 - .../typed/policy/v1/generated_expansion.go | 21 - .../typed/policy/v1/poddisruptionbudget.go | 256 - .../typed/policy/v1/policy_client.go | 112 - .../kubernetes/typed/policy/v1beta1/doc.go | 20 - .../typed/policy/v1beta1/eviction.go | 48 - .../policy/v1beta1/eviction_expansion.go | 40 - .../policy/v1beta1/generated_expansion.go | 23 - .../policy/v1beta1/poddisruptionbudget.go | 256 - .../typed/policy/v1beta1/podsecuritypolicy.go | 197 - .../typed/policy/v1beta1/policy_client.go | 117 - .../kubernetes/typed/rbac/v1/clusterrole.go | 197 - .../typed/rbac/v1/clusterrolebinding.go | 197 - .../client-go/kubernetes/typed/rbac/v1/doc.go | 20 - .../typed/rbac/v1/generated_expansion.go | 27 - .../kubernetes/typed/rbac/v1/rbac_client.go | 122 - .../kubernetes/typed/rbac/v1/role.go | 208 - .../kubernetes/typed/rbac/v1/rolebinding.go | 208 - .../typed/rbac/v1alpha1/clusterrole.go | 197 - .../typed/rbac/v1alpha1/clusterrolebinding.go | 197 - .../kubernetes/typed/rbac/v1alpha1/doc.go | 20 - .../rbac/v1alpha1/generated_expansion.go | 27 - .../typed/rbac/v1alpha1/rbac_client.go | 122 - .../kubernetes/typed/rbac/v1alpha1/role.go | 208 - .../typed/rbac/v1alpha1/rolebinding.go | 208 - .../typed/rbac/v1beta1/clusterrole.go | 197 - .../typed/rbac/v1beta1/clusterrolebinding.go | 197 - .../kubernetes/typed/rbac/v1beta1/doc.go | 20 - .../typed/rbac/v1beta1/generated_expansion.go | 27 - .../typed/rbac/v1beta1/rbac_client.go | 122 - .../kubernetes/typed/rbac/v1beta1/role.go | 208 - .../typed/rbac/v1beta1/rolebinding.go | 208 - .../kubernetes/typed/scheduling/v1/doc.go | 20 - .../scheduling/v1/generated_expansion.go | 21 - .../typed/scheduling/v1/priorityclass.go | 197 - .../typed/scheduling/v1/scheduling_client.go | 107 - .../typed/scheduling/v1alpha1/doc.go | 20 - .../v1alpha1/generated_expansion.go | 21 - .../scheduling/v1alpha1/priorityclass.go | 197 - .../scheduling/v1alpha1/scheduling_client.go | 107 - .../typed/scheduling/v1beta1/doc.go | 20 - .../scheduling/v1beta1/generated_expansion.go | 21 - .../typed/scheduling/v1beta1/priorityclass.go | 197 - .../scheduling/v1beta1/scheduling_client.go | 107 - .../kubernetes/typed/storage/v1/csidriver.go | 197 - .../kubernetes/typed/storage/v1/csinode.go | 197 - .../typed/storage/v1/csistoragecapacity.go | 208 - .../kubernetes/typed/storage/v1/doc.go | 20 - .../typed/storage/v1/generated_expansion.go | 29 - .../typed/storage/v1/storage_client.go | 127 - .../typed/storage/v1/storageclass.go | 197 - .../typed/storage/v1/volumeattachment.go | 243 - .../storage/v1alpha1/csistoragecapacity.go | 208 - .../kubernetes/typed/storage/v1alpha1/doc.go | 20 - .../storage/v1alpha1/generated_expansion.go | 23 - .../typed/storage/v1alpha1/storage_client.go | 112 - .../storage/v1alpha1/volumeattachment.go | 243 - .../typed/storage/v1beta1/csidriver.go | 197 - .../typed/storage/v1beta1/csinode.go | 197 - .../storage/v1beta1/csistoragecapacity.go | 208 - .../kubernetes/typed/storage/v1beta1/doc.go | 20 - .../storage/v1beta1/generated_expansion.go | 29 - .../typed/storage/v1beta1/storage_client.go | 127 - .../typed/storage/v1beta1/storageclass.go | 197 - .../typed/storage/v1beta1/volumeattachment.go | 243 - vendor/k8s.io/client-go/openapi/client.go | 64 - .../k8s.io/client-go/openapi/groupversion.go | 59 - .../pkg/apis/clientauthentication/OWNERS | 8 - .../pkg/apis/clientauthentication/doc.go | 20 - .../clientauthentication/install/install.go | 34 - .../pkg/apis/clientauthentication/register.go | 50 - .../pkg/apis/clientauthentication/types.go | 124 - .../pkg/apis/clientauthentication/v1/doc.go | 24 - .../apis/clientauthentication/v1/register.go | 55 - .../pkg/apis/clientauthentication/v1/types.go | 122 - .../v1/zz_generated.conversion.go | 205 - .../v1/zz_generated.deepcopy.go | 120 - .../v1/zz_generated.defaults.go | 33 - .../apis/clientauthentication/v1beta1/doc.go | 24 - .../clientauthentication/v1beta1/register.go | 55 - .../clientauthentication/v1beta1/types.go | 122 - .../v1beta1/zz_generated.conversion.go | 205 - .../v1beta1/zz_generated.deepcopy.go | 120 - .../v1beta1/zz_generated.defaults.go | 33 - .../zz_generated.deepcopy.go | 122 - vendor/k8s.io/client-go/pkg/version/base.go | 63 - vendor/k8s.io/client-go/pkg/version/doc.go | 21 - .../k8s.io/client-go/pkg/version/version.go | 42 - .../client-go/plugin/pkg/client/auth/OWNERS | 8 - .../plugin/pkg/client/auth/azure/README.md | 56 - .../plugin/pkg/client/auth/azure/azure.go | 477 - .../plugin/pkg/client/auth/exec/exec.go | 548 - .../plugin/pkg/client/auth/exec/metrics.go | 111 - .../plugin/pkg/client/auth/gcp/OWNERS | 8 - .../plugin/pkg/client/auth/gcp/gcp.go | 389 - .../plugin/pkg/client/auth/oidc/oidc.go | 380 - .../client/auth/openstack/openstack_stub.go | 36 - .../plugin/pkg/client/auth/plugins.go | 22 - .../pkg/client/auth/plugins_providers.go | 27 - vendor/k8s.io/client-go/rest/OWNERS | 14 - vendor/k8s.io/client-go/rest/client.go | 203 - vendor/k8s.io/client-go/rest/config.go | 675 - vendor/k8s.io/client-go/rest/exec.go | 84 - vendor/k8s.io/client-go/rest/plugin.go | 84 - vendor/k8s.io/client-go/rest/request.go | 1406 - vendor/k8s.io/client-go/rest/transport.go | 152 - vendor/k8s.io/client-go/rest/url_utils.go | 97 - vendor/k8s.io/client-go/rest/urlbackoff.go | 107 - vendor/k8s.io/client-go/rest/warnings.go | 147 - vendor/k8s.io/client-go/rest/watch/decoder.go | 72 - vendor/k8s.io/client-go/rest/watch/encoder.go | 56 - vendor/k8s.io/client-go/rest/with_retry.go | 361 - .../client-go/rest/zz_generated.deepcopy.go | 58 - .../third_party/forked/golang/LICENSE | 27 - .../third_party/forked/golang/PATENTS | 22 - .../forked/golang/template/exec.go | 52 - .../forked/golang/template/funcs.go | 177 - vendor/k8s.io/client-go/tools/auth/OWNERS | 8 - .../k8s.io/client-go/tools/auth/clientauth.go | 126 - vendor/k8s.io/client-go/tools/cache/OWNERS | 28 - .../client-go/tools/cache/controller.go | 495 - .../client-go/tools/cache/delta_fifo.go | 757 - vendor/k8s.io/client-go/tools/cache/doc.go | 24 - .../client-go/tools/cache/expiration_cache.go | 216 - .../tools/cache/expiration_cache_fakes.go | 57 - .../tools/cache/fake_custom_store.go | 102 - vendor/k8s.io/client-go/tools/cache/fifo.go | 374 - vendor/k8s.io/client-go/tools/cache/heap.go | 322 - vendor/k8s.io/client-go/tools/cache/index.go | 101 - .../k8s.io/client-go/tools/cache/listers.go | 183 - .../k8s.io/client-go/tools/cache/listwatch.go | 112 - .../client-go/tools/cache/mutation_cache.go | 262 - .../tools/cache/mutation_detector.go | 166 - .../k8s.io/client-go/tools/cache/reflector.go | 639 - .../tools/cache/reflector_metrics.go | 89 - .../tools/cache/retry_with_deadline.go | 78 - .../client-go/tools/cache/shared_informer.go | 855 - vendor/k8s.io/client-go/tools/cache/store.go | 276 - .../tools/cache/thread_safe_store.go | 332 - .../client-go/tools/cache/undelta_store.go | 89 - .../client-go/tools/clientcmd/api/doc.go | 19 - .../client-go/tools/clientcmd/api/helpers.go | 191 - .../tools/clientcmd/api/latest/latest.go | 61 - .../client-go/tools/clientcmd/api/register.go | 46 - .../client-go/tools/clientcmd/api/types.go | 370 - .../tools/clientcmd/api/v1/conversion.go | 174 - .../tools/clientcmd/api/v1/defaults.go | 37 - .../client-go/tools/clientcmd/api/v1/doc.go | 21 - .../tools/clientcmd/api/v1/register.go | 56 - .../client-go/tools/clientcmd/api/v1/types.go | 266 - .../api/v1/zz_generated.conversion.go | 456 - .../clientcmd/api/v1/zz_generated.deepcopy.go | 349 - .../clientcmd/api/v1/zz_generated.defaults.go | 43 - .../clientcmd/api/zz_generated.deepcopy.go | 328 - .../client-go/tools/clientcmd/auth_loaders.go | 111 - .../tools/clientcmd/client_config.go | 637 - .../client-go/tools/clientcmd/config.go | 500 - .../k8s.io/client-go/tools/clientcmd/doc.go | 37 - .../k8s.io/client-go/tools/clientcmd/flag.go | 49 - .../client-go/tools/clientcmd/helpers.go | 50 - .../client-go/tools/clientcmd/loader.go | 648 - .../tools/clientcmd/merged_client_builder.go | 172 - .../client-go/tools/clientcmd/overrides.go | 259 - .../client-go/tools/clientcmd/validation.go | 371 - vendor/k8s.io/client-go/tools/metrics/OWNERS | 5 - .../k8s.io/client-go/tools/metrics/metrics.go | 146 - vendor/k8s.io/client-go/tools/pager/pager.go | 250 - .../k8s.io/client-go/tools/reference/ref.go | 109 - .../client-go/tools/remotecommand/doc.go | 20 - .../tools/remotecommand/errorstream.go | 55 - .../client-go/tools/remotecommand/reader.go | 41 - .../tools/remotecommand/remotecommand.go | 142 - .../client-go/tools/remotecommand/resize.go | 33 - .../client-go/tools/remotecommand/v1.go | 160 - .../client-go/tools/remotecommand/v2.go | 200 - .../client-go/tools/remotecommand/v3.go | 111 - .../client-go/tools/remotecommand/v4.go | 119 - vendor/k8s.io/client-go/transport/OWNERS | 8 - vendor/k8s.io/client-go/transport/cache.go | 180 - .../client-go/transport/cert_rotation.go | 176 - vendor/k8s.io/client-go/transport/config.go | 166 - .../client-go/transport/round_trippers.go | 697 - .../k8s.io/client-go/transport/spdy/spdy.go | 103 - .../client-go/transport/token_source.go | 201 - .../k8s.io/client-go/transport/transport.go | 356 - vendor/k8s.io/client-go/util/cert/OWNERS | 8 - vendor/k8s.io/client-go/util/cert/cert.go | 208 - vendor/k8s.io/client-go/util/cert/csr.go | 75 - vendor/k8s.io/client-go/util/cert/io.go | 113 - vendor/k8s.io/client-go/util/cert/pem.go | 73 - .../client-go/util/cert/server_inspection.go | 102 - .../util/connrotation/connrotation.go | 133 - vendor/k8s.io/client-go/util/exec/exec.go | 52 - .../client-go/util/flowcontrol/backoff.go | 181 - .../client-go/util/flowcontrol/throttle.go | 192 - .../k8s.io/client-go/util/homedir/homedir.go | 92 - vendor/k8s.io/client-go/util/jsonpath/doc.go | 20 - .../client-go/util/jsonpath/jsonpath.go | 579 - vendor/k8s.io/client-go/util/jsonpath/node.go | 256 - .../k8s.io/client-go/util/jsonpath/parser.go | 527 - vendor/k8s.io/client-go/util/keyutil/OWNERS | 6 - vendor/k8s.io/client-go/util/keyutil/key.go | 323 - .../util/workqueue/default_rate_limiters.go | 238 - .../util/workqueue/delaying_queue.go | 282 - vendor/k8s.io/client-go/util/workqueue/doc.go | 26 - .../client-go/util/workqueue/metrics.go | 261 - .../client-go/util/workqueue/parallelizer.go | 101 - .../k8s.io/client-go/util/workqueue/queue.go | 285 - .../util/workqueue/rate_limiting_queue.go | 78 - vendor/k8s.io/klog/v2/.gitignore | 17 - vendor/k8s.io/klog/v2/CONTRIBUTING.md | 22 - vendor/k8s.io/klog/v2/LICENSE | 191 - vendor/k8s.io/klog/v2/OWNERS | 13 - vendor/k8s.io/klog/v2/README.md | 118 - vendor/k8s.io/klog/v2/RELEASE.md | 9 - vendor/k8s.io/klog/v2/SECURITY.md | 22 - vendor/k8s.io/klog/v2/SECURITY_CONTACTS | 20 - vendor/k8s.io/klog/v2/code-of-conduct.md | 3 - vendor/k8s.io/klog/v2/contextual.go | 185 - vendor/k8s.io/klog/v2/exit.go | 69 - vendor/k8s.io/klog/v2/imports.go | 38 - .../k8s.io/klog/v2/internal/buffer/buffer.go | 159 - .../k8s.io/klog/v2/internal/clock/README.md | 7 - vendor/k8s.io/klog/v2/internal/clock/clock.go | 178 - vendor/k8s.io/klog/v2/internal/dbg/dbg.go | 42 - .../klog/v2/internal/serialize/keyvalues.go | 253 - .../klog/v2/internal/severity/severity.go | 58 - vendor/k8s.io/klog/v2/k8s_references.go | 158 - vendor/k8s.io/klog/v2/klog.go | 1686 - vendor/k8s.io/klog/v2/klog_file.go | 130 - vendor/k8s.io/klog/v2/klog_file_others.go | 19 - vendor/k8s.io/klog/v2/klog_file_windows.go | 34 - vendor/k8s.io/klog/v2/klogr.go | 87 - vendor/k8s.io/kube-openapi/LICENSE | 202 - .../kube-openapi/pkg/builder3/util/util.go | 51 - .../k8s.io/kube-openapi/pkg/common/common.go | 320 - vendor/k8s.io/kube-openapi/pkg/common/doc.go | 19 - .../kube-openapi/pkg/common/interfaces.go | 88 - .../kube-openapi/pkg/handler3/handler.go | 291 - .../pkg/internal/handler/handler_cache.go | 57 - .../kube-openapi/pkg/openapiconv/convert.go | 322 - .../k8s.io/kube-openapi/pkg/schemaconv/smd.go | 471 - .../kube-openapi/pkg/schemamutation/walker.go | 519 - .../kube-openapi/pkg/spec3/component.go | 47 - .../k8s.io/kube-openapi/pkg/spec3/encoding.go | 64 - .../k8s.io/kube-openapi/pkg/spec3/example.go | 73 - .../pkg/spec3/external_documentation.go | 58 - .../k8s.io/kube-openapi/pkg/spec3/header.go | 90 - .../kube-openapi/pkg/spec3/media_type.go | 66 - .../kube-openapi/pkg/spec3/operation.go | 79 - .../kube-openapi/pkg/spec3/parameter.go | 94 - vendor/k8s.io/kube-openapi/pkg/spec3/path.go | 142 - .../kube-openapi/pkg/spec3/request_body.go | 73 - .../k8s.io/kube-openapi/pkg/spec3/response.go | 203 - .../pkg/spec3/security_requirement.go | 56 - .../kube-openapi/pkg/spec3/security_scheme.go | 118 - .../k8s.io/kube-openapi/pkg/spec3/server.go | 98 - vendor/k8s.io/kube-openapi/pkg/spec3/spec.go | 37 - .../k8s.io/kube-openapi/pkg/util/proto/OWNERS | 2 - .../k8s.io/kube-openapi/pkg/util/proto/doc.go | 19 - .../kube-openapi/pkg/util/proto/document.go | 362 - .../pkg/util/proto/document_v3.go | 324 - .../kube-openapi/pkg/util/proto/openapi.go | 285 - .../pkg/validation/spec/.gitignore | 2 - .../kube-openapi/pkg/validation/spec/LICENSE | 202 - .../pkg/validation/spec/contact_info.go | 24 - .../pkg/validation/spec/external_docs.go | 24 - .../pkg/validation/spec/gnostic.go | 1515 - .../pkg/validation/spec/header.go | 75 - .../kube-openapi/pkg/validation/spec/info.go | 174 - .../kube-openapi/pkg/validation/spec/items.go | 109 - .../pkg/validation/spec/license.go | 23 - .../pkg/validation/spec/operation.go | 96 - .../pkg/validation/spec/parameter.go | 111 - .../pkg/validation/spec/path_item.go | 74 - .../kube-openapi/pkg/validation/spec/paths.go | 85 - .../kube-openapi/pkg/validation/spec/ref.go | 167 - .../pkg/validation/spec/response.go | 78 - .../pkg/validation/spec/responses.go | 110 - .../pkg/validation/spec/schema.go | 513 - .../pkg/validation/spec/security_scheme.go | 64 - .../pkg/validation/spec/swagger.go | 286 - .../kube-openapi/pkg/validation/spec/tag.go | 59 - vendor/k8s.io/kubectl/LICENSE | 201 - vendor/k8s.io/kubectl/pkg/scheme/install.go | 82 - vendor/k8s.io/kubectl/pkg/scheme/scheme.go | 39 - vendor/k8s.io/utils/LICENSE | 202 - vendor/k8s.io/utils/buffer/ring_growing.go | 72 - vendor/k8s.io/utils/clock/README.md | 4 - vendor/k8s.io/utils/clock/clock.go | 178 - .../k8s.io/utils/clock/testing/fake_clock.go | 361 - .../clock/testing/simple_interval_clock.go | 44 - vendor/k8s.io/utils/integer/integer.go | 73 - .../third_party/forked/golang/LICENSE | 27 - .../third_party/forked/golang/PATENTS | 22 - .../third_party/forked/golang/net/ip.go | 236 - .../third_party/forked/golang/net/parse.go | 59 - vendor/k8s.io/utils/net/ipnet.go | 221 - vendor/k8s.io/utils/net/net.go | 213 - vendor/k8s.io/utils/net/parse.go | 33 - vendor/k8s.io/utils/net/port.go | 137 - vendor/k8s.io/utils/pointer/OWNERS | 10 - vendor/k8s.io/utils/pointer/README.md | 3 - vendor/k8s.io/utils/pointer/pointer.go | 300 - vendor/k8s.io/utils/strings/slices/slices.go | 82 - vendor/k8s.io/utils/trace/README.md | 67 - vendor/k8s.io/utils/trace/trace.go | 282 - vendor/kubevirt.io/api/LICENSE | 202 - vendor/kubevirt.io/api/core/register.go | 4 - .../api/core/v1/componentconfig.go | 48 - .../api/core/v1/deepcopy_generated.go | 5185 -- vendor/kubevirt.io/api/core/v1/defaults.go | 240 - vendor/kubevirt.io/api/core/v1/doc.go | 8 - vendor/kubevirt.io/api/core/v1/register.go | 121 - vendor/kubevirt.io/api/core/v1/sanitizers.go | 45 - vendor/kubevirt.io/api/core/v1/schema.go | 1432 - .../api/core/v1/schema_swagger_generated.go | 812 - vendor/kubevirt.io/api/core/v1/types.go | 2453 - .../api/core/v1/types_swagger_generated.go | 819 - .../api/core/v1/zz_generated.defaults.go | 566 - .../containerized-data-importer-api/LICENSE | 202 - .../pkg/apis/core/register.go | 6 - .../pkg/apis/core/v1beta1/doc.go | 6 - .../pkg/apis/core/v1beta1/register.go | 54 - .../pkg/apis/core/v1beta1/types.go | 804 - .../core/v1beta1/types_swagger_generated.go | 396 - .../pkg/apis/core/v1beta1/types_transfer.go | 134 - .../pkg/apis/core/v1beta1/utils.go | 61 - .../core/v1beta1/zz_generated.deepcopy.go | 1522 - .../api/LICENSE | 201 - .../api/types.go | 130 - vendor/modules.txt | 558 - vendor/sigs.k8s.io/json/CONTRIBUTING.md | 42 - vendor/sigs.k8s.io/json/LICENSE | 238 - vendor/sigs.k8s.io/json/Makefile | 35 - vendor/sigs.k8s.io/json/OWNERS | 6 - vendor/sigs.k8s.io/json/README.md | 40 - vendor/sigs.k8s.io/json/SECURITY.md | 22 - vendor/sigs.k8s.io/json/SECURITY_CONTACTS | 15 - vendor/sigs.k8s.io/json/code-of-conduct.md | 3 - vendor/sigs.k8s.io/json/doc.go | 17 - .../internal/golang/encoding/json/decode.go | 1437 - .../internal/golang/encoding/json/encode.go | 1419 - .../internal/golang/encoding/json/fold.go | 143 - .../internal/golang/encoding/json/fuzz.go | 42 - .../internal/golang/encoding/json/indent.go | 143 - .../golang/encoding/json/kubernetes_patch.go | 168 - .../internal/golang/encoding/json/scanner.go | 608 - .../internal/golang/encoding/json/stream.go | 519 - .../internal/golang/encoding/json/tables.go | 218 - .../internal/golang/encoding/json/tags.go | 38 - vendor/sigs.k8s.io/json/json.go | 150 - .../structured-merge-diff/v4/LICENSE | 201 - .../structured-merge-diff/v4/fieldpath/doc.go | 21 - .../v4/fieldpath/element.go | 317 - .../v4/fieldpath/fromvalue.go | 134 - .../v4/fieldpath/managers.go | 144 - .../v4/fieldpath/path.go | 118 - .../v4/fieldpath/pathelementmap.go | 85 - .../v4/fieldpath/serialize-pe.go | 168 - .../v4/fieldpath/serialize.go | 238 - .../structured-merge-diff/v4/fieldpath/set.go | 505 - .../structured-merge-diff/v4/schema/doc.go | 28 - .../v4/schema/elements.go | 374 - .../structured-merge-diff/v4/schema/equals.go | 202 - .../v4/schema/schemaschema.go | 164 - .../structured-merge-diff/v4/typed/doc.go | 18 - .../structured-merge-diff/v4/typed/helpers.go | 260 - .../structured-merge-diff/v4/typed/merge.go | 412 - .../structured-merge-diff/v4/typed/parser.go | 151 - .../v4/typed/reconcile_schema.go | 290 - .../structured-merge-diff/v4/typed/remove.go | 165 - .../v4/typed/tofieldset.go | 168 - .../structured-merge-diff/v4/typed/typed.go | 322 - .../structured-merge-diff/v4/typed/union.go | 276 - .../v4/typed/validate.go | 195 - .../v4/value/allocator.go | 203 - .../structured-merge-diff/v4/value/doc.go | 21 - .../structured-merge-diff/v4/value/fields.go | 97 - .../v4/value/jsontagutil.go | 91 - .../structured-merge-diff/v4/value/list.go | 139 - .../v4/value/listreflect.go | 98 - .../v4/value/listunstructured.go | 74 - .../structured-merge-diff/v4/value/map.go | 270 - .../v4/value/mapreflect.go | 209 - .../v4/value/mapunstructured.go | 190 - .../v4/value/reflectcache.go | 467 - .../structured-merge-diff/v4/value/scalar.go | 50 - .../v4/value/structreflect.go | 208 - .../structured-merge-diff/v4/value/value.go | 347 - .../v4/value/valuereflect.go | 294 - .../v4/value/valueunstructured.go | 178 - vendor/sigs.k8s.io/yaml/.gitignore | 24 - vendor/sigs.k8s.io/yaml/.travis.yml | 12 - vendor/sigs.k8s.io/yaml/CONTRIBUTING.md | 31 - vendor/sigs.k8s.io/yaml/LICENSE | 50 - vendor/sigs.k8s.io/yaml/OWNERS | 27 - vendor/sigs.k8s.io/yaml/README.md | 123 - vendor/sigs.k8s.io/yaml/RELEASE.md | 9 - vendor/sigs.k8s.io/yaml/SECURITY_CONTACTS | 17 - vendor/sigs.k8s.io/yaml/code-of-conduct.md | 3 - vendor/sigs.k8s.io/yaml/fields.go | 502 - vendor/sigs.k8s.io/yaml/yaml.go | 380 - vendor/sigs.k8s.io/yaml/yaml_go110.go | 14 - 3657 files changed, 1 insertion(+), 1223104 deletions(-) delete mode 100644 vendor/cloud.google.com/go/LICENSE delete mode 100644 vendor/cloud.google.com/go/compute/metadata/metadata.go delete mode 100644 vendor/cloud.google.com/go/compute/metadata/retry.go delete mode 100644 vendor/cloud.google.com/go/compute/metadata/retry_linux.go delete mode 100644 vendor/github.com/Azure/go-autorest/.gitignore delete mode 100644 vendor/github.com/Azure/go-autorest/CHANGELOG.md delete mode 100644 vendor/github.com/Azure/go-autorest/GNUmakefile delete mode 100644 vendor/github.com/Azure/go-autorest/Gopkg.lock delete mode 100644 vendor/github.com/Azure/go-autorest/Gopkg.toml delete mode 100644 vendor/github.com/Azure/go-autorest/LICENSE delete mode 100644 vendor/github.com/Azure/go-autorest/README.md delete mode 100644 vendor/github.com/Azure/go-autorest/autorest/LICENSE delete mode 100644 vendor/github.com/Azure/go-autorest/autorest/adal/LICENSE delete mode 100644 vendor/github.com/Azure/go-autorest/autorest/adal/README.md delete mode 100644 vendor/github.com/Azure/go-autorest/autorest/adal/config.go delete mode 100644 vendor/github.com/Azure/go-autorest/autorest/adal/devicetoken.go delete mode 100644 vendor/github.com/Azure/go-autorest/autorest/adal/go_mod_tidy_hack.go delete mode 100644 vendor/github.com/Azure/go-autorest/autorest/adal/persist.go delete mode 100644 vendor/github.com/Azure/go-autorest/autorest/adal/sender.go delete mode 100644 vendor/github.com/Azure/go-autorest/autorest/adal/token.go delete mode 100644 vendor/github.com/Azure/go-autorest/autorest/adal/token_1.13.go delete mode 100644 vendor/github.com/Azure/go-autorest/autorest/adal/token_legacy.go delete mode 100644 vendor/github.com/Azure/go-autorest/autorest/adal/version.go delete mode 100644 vendor/github.com/Azure/go-autorest/autorest/authorization.go delete mode 100644 vendor/github.com/Azure/go-autorest/autorest/authorization_sas.go delete mode 100644 vendor/github.com/Azure/go-autorest/autorest/authorization_storage.go delete mode 100644 vendor/github.com/Azure/go-autorest/autorest/autorest.go delete mode 100644 vendor/github.com/Azure/go-autorest/autorest/azure/async.go delete mode 100644 vendor/github.com/Azure/go-autorest/autorest/azure/azure.go delete mode 100644 vendor/github.com/Azure/go-autorest/autorest/azure/environments.go delete mode 100644 vendor/github.com/Azure/go-autorest/autorest/azure/metadata_environment.go delete mode 100644 vendor/github.com/Azure/go-autorest/autorest/azure/rp.go delete mode 100644 vendor/github.com/Azure/go-autorest/autorest/client.go delete mode 100644 vendor/github.com/Azure/go-autorest/autorest/date/LICENSE delete mode 100644 vendor/github.com/Azure/go-autorest/autorest/date/date.go delete mode 100644 vendor/github.com/Azure/go-autorest/autorest/date/go_mod_tidy_hack.go delete mode 100644 vendor/github.com/Azure/go-autorest/autorest/date/time.go delete mode 100644 vendor/github.com/Azure/go-autorest/autorest/date/timerfc1123.go delete mode 100644 vendor/github.com/Azure/go-autorest/autorest/date/unixtime.go delete mode 100644 vendor/github.com/Azure/go-autorest/autorest/date/utility.go delete mode 100644 vendor/github.com/Azure/go-autorest/autorest/error.go delete mode 100644 vendor/github.com/Azure/go-autorest/autorest/go_mod_tidy_hack.go delete mode 100644 vendor/github.com/Azure/go-autorest/autorest/preparer.go delete mode 100644 vendor/github.com/Azure/go-autorest/autorest/responder.go delete mode 100644 vendor/github.com/Azure/go-autorest/autorest/retriablerequest.go delete mode 100644 vendor/github.com/Azure/go-autorest/autorest/retriablerequest_1.7.go delete mode 100644 vendor/github.com/Azure/go-autorest/autorest/retriablerequest_1.8.go delete mode 100644 vendor/github.com/Azure/go-autorest/autorest/sender.go delete mode 100644 vendor/github.com/Azure/go-autorest/autorest/utility.go delete mode 100644 vendor/github.com/Azure/go-autorest/autorest/utility_1.13.go delete mode 100644 vendor/github.com/Azure/go-autorest/autorest/utility_legacy.go delete mode 100644 vendor/github.com/Azure/go-autorest/autorest/version.go delete mode 100644 vendor/github.com/Azure/go-autorest/azure-pipelines.yml delete mode 100644 vendor/github.com/Azure/go-autorest/doc.go delete mode 100644 vendor/github.com/Azure/go-autorest/logger/LICENSE delete mode 100644 vendor/github.com/Azure/go-autorest/logger/go_mod_tidy_hack.go delete mode 100644 vendor/github.com/Azure/go-autorest/logger/logger.go delete mode 100644 vendor/github.com/Azure/go-autorest/tracing/LICENSE delete mode 100644 vendor/github.com/Azure/go-autorest/tracing/go_mod_tidy_hack.go delete mode 100644 vendor/github.com/Azure/go-autorest/tracing/tracing.go delete mode 100644 vendor/github.com/Masterminds/goutils/.travis.yml delete mode 100644 vendor/github.com/Masterminds/goutils/CHANGELOG.md delete mode 100644 vendor/github.com/Masterminds/goutils/LICENSE.txt delete mode 100644 vendor/github.com/Masterminds/goutils/README.md delete mode 100644 vendor/github.com/Masterminds/goutils/appveyor.yml delete mode 100644 vendor/github.com/Masterminds/goutils/cryptorandomstringutils.go delete mode 100644 vendor/github.com/Masterminds/goutils/randomstringutils.go delete mode 100644 vendor/github.com/Masterminds/goutils/stringutils.go delete mode 100644 vendor/github.com/Masterminds/goutils/wordutils.go delete mode 100644 vendor/github.com/Masterminds/semver/v3/.gitignore delete mode 100644 vendor/github.com/Masterminds/semver/v3/.golangci.yml delete mode 100644 vendor/github.com/Masterminds/semver/v3/CHANGELOG.md delete mode 100644 vendor/github.com/Masterminds/semver/v3/LICENSE.txt delete mode 100644 vendor/github.com/Masterminds/semver/v3/Makefile delete mode 100644 vendor/github.com/Masterminds/semver/v3/README.md delete mode 100644 vendor/github.com/Masterminds/semver/v3/collection.go delete mode 100644 vendor/github.com/Masterminds/semver/v3/constraints.go delete mode 100644 vendor/github.com/Masterminds/semver/v3/doc.go delete mode 100644 vendor/github.com/Masterminds/semver/v3/fuzz.go delete mode 100644 vendor/github.com/Masterminds/semver/v3/version.go delete mode 100644 vendor/github.com/Masterminds/sprig/v3/.gitignore delete mode 100644 vendor/github.com/Masterminds/sprig/v3/CHANGELOG.md delete mode 100644 vendor/github.com/Masterminds/sprig/v3/LICENSE.txt delete mode 100644 vendor/github.com/Masterminds/sprig/v3/Makefile delete mode 100644 vendor/github.com/Masterminds/sprig/v3/README.md delete mode 100644 vendor/github.com/Masterminds/sprig/v3/crypto.go delete mode 100644 vendor/github.com/Masterminds/sprig/v3/date.go delete mode 100644 vendor/github.com/Masterminds/sprig/v3/defaults.go delete mode 100644 vendor/github.com/Masterminds/sprig/v3/dict.go delete mode 100644 vendor/github.com/Masterminds/sprig/v3/doc.go delete mode 100644 vendor/github.com/Masterminds/sprig/v3/functions.go delete mode 100644 vendor/github.com/Masterminds/sprig/v3/list.go delete mode 100644 vendor/github.com/Masterminds/sprig/v3/network.go delete mode 100644 vendor/github.com/Masterminds/sprig/v3/numeric.go delete mode 100644 vendor/github.com/Masterminds/sprig/v3/reflect.go delete mode 100644 vendor/github.com/Masterminds/sprig/v3/regex.go delete mode 100644 vendor/github.com/Masterminds/sprig/v3/semver.go delete mode 100644 vendor/github.com/Masterminds/sprig/v3/strings.go delete mode 100644 vendor/github.com/Masterminds/sprig/v3/url.go delete mode 100644 vendor/github.com/PuerkitoBio/purell/.gitignore delete mode 100644 vendor/github.com/PuerkitoBio/purell/.travis.yml delete mode 100644 vendor/github.com/PuerkitoBio/purell/LICENSE delete mode 100644 vendor/github.com/PuerkitoBio/purell/README.md delete mode 100644 vendor/github.com/PuerkitoBio/purell/purell.go delete mode 100644 vendor/github.com/PuerkitoBio/urlesc/.travis.yml delete mode 100644 vendor/github.com/PuerkitoBio/urlesc/LICENSE delete mode 100644 vendor/github.com/PuerkitoBio/urlesc/README.md delete mode 100644 vendor/github.com/PuerkitoBio/urlesc/urlesc.go delete mode 100644 vendor/github.com/davecgh/go-spew/LICENSE delete mode 100644 vendor/github.com/davecgh/go-spew/spew/bypass.go delete mode 100644 vendor/github.com/davecgh/go-spew/spew/bypasssafe.go delete mode 100644 vendor/github.com/davecgh/go-spew/spew/common.go delete mode 100644 vendor/github.com/davecgh/go-spew/spew/config.go delete mode 100644 vendor/github.com/davecgh/go-spew/spew/doc.go delete mode 100644 vendor/github.com/davecgh/go-spew/spew/dump.go delete mode 100644 vendor/github.com/davecgh/go-spew/spew/format.go delete mode 100644 vendor/github.com/davecgh/go-spew/spew/spew.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/.codecov.yml delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/.dockerignore delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/.gitignore delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/LICENSE delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/Makefile delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/README.md delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/doc.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/elasticsearch.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api._.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.bulk.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.aliases.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.allocation.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.count.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.fielddata.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.health.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.help.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.indices.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.master.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.nodeattrs.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.nodes.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.pending_tasks.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.plugins.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.recovery.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.repositories.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.segments.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.shards.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.snapshots.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.tasks.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.templates.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.thread_pool.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.clear_scroll.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.allocation_explain.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.delete_component_template.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.delete_voting_config_exclusions.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.exists_component_template.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.get_component_template.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.get_settings.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.health.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.pending_tasks.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.post_voting_config_exclusions.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.put_component_template.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.put_settings.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.remote_info.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.reroute.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.state.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.stats.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.count.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.create.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.dangling_indices.delete_dangling_index.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.dangling_indices.import_dangling_index.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.dangling_indices.list_dangling_indices.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.delete.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.delete_by_query.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.delete_by_query_rethrottle.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.delete_script.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.exists.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.exists_source.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.explain.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.features.get_features.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.features.reset_features.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.field_caps.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.fleet.global_checkpoints.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.get.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.get_script.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.get_script_context.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.get_script_languages.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.get_source.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.index.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.add_block.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.analyze.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.clear_cache.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.clone.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.close.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.create.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.delete.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.delete_alias.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.delete_index_template.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.delete_template.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.exists.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.exists_alias.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.exists_index_template.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.exists_template.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.exists_type.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.flush.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.flush_synced.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.forcemerge.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.get.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.get_alias.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.get_field_mapping.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.get_index_template.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.get_mapping.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.get_settings.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.get_template.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.get_upgrade.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.open.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.put_alias.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.put_index_template.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.put_mapping.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.put_settings.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.put_template.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.recovery.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.refresh.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.resolve_index.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.rollover.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.segments.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.shard_stores.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.shrink.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.simulate_index_template.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.simulate_template.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.split.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.stats.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.update_aliases.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.upgrade.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.validate_query.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.info.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.ingest.delete_pipeline.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.ingest.geo_ip_stats.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.ingest.get_pipeline.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.ingest.processor_grok.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.ingest.put_pipeline.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.ingest.simulate.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.mget.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.msearch.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.msearch_template.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.mtermvectors.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.nodes.hot_threads.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.nodes.info.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.nodes.reload_secure_settings.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.nodes.stats.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.nodes.usage.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.ping.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.put_script.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.rank_eval.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.reindex.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.reindex_rethrottle.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.render_search_template.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.scripts_painless_execute.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.scroll.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.search.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.search_shards.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.search_template.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.shutdown.delete_node.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.shutdown.get_node.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.shutdown.put_node.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.snapshot.cleanup_repository.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.snapshot.clone.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.snapshot.create.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.snapshot.create_repository.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.snapshot.delete.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.snapshot.delete_repository.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.snapshot.get.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.snapshot.get_repository.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.snapshot.repository_analyze.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.snapshot.restore.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.snapshot.status.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.snapshot.verify_repository.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.tasks.cancel.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.tasks.get.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.tasks.list.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.termvectors.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.update.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.update_by_query.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.update_by_query_rethrottle.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.async_search.delete.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.async_search.get.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.async_search.status.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.async_search.submit.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.autoscaling.delete_autoscaling_policy.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.autoscaling.get_autoscaling_capacity.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.autoscaling.get_autoscaling_decision.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.autoscaling.get_autoscaling_policy.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.autoscaling.put_autoscaling_policy.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.cat.ml_data_frame_analytics.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.cat.ml_datafeeds.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.cat.ml_jobs.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.cat.ml_trained_models.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.cat.transforms.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ccr.delete_auto_follow_pattern.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ccr.follow.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ccr.follow_info.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ccr.follow_stats.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ccr.forget_follower.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ccr.get_auto_follow_pattern.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ccr.pause_auto_follow_pattern.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ccr.pause_follow.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ccr.put_auto_follow_pattern.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ccr.resume_auto_follow_pattern.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ccr.resume_follow.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ccr.stats.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ccr.unfollow.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.close_point_in_time.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.data_frame_transform_deprecated.delete_transform.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.data_frame_transform_deprecated.get_transform.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.data_frame_transform_deprecated.get_transform_stats.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.data_frame_transform_deprecated.preview_transform.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.data_frame_transform_deprecated.put_transform.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.data_frame_transform_deprecated.start_transform.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.data_frame_transform_deprecated.stop_transform.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.data_frame_transform_deprecated.update_transform.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.enrich.delete_policy.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.enrich.execute_policy.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.enrich.get_policy.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.enrich.put_policy.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.enrich.stats.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.eql.delete.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.eql.get.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.eql.get_status.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.eql.search.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.graph.explore.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ilm.delete_lifecycle.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ilm.explain_lifecycle.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ilm.get_lifecycle.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ilm.get_status.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ilm.move_to_step.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ilm.put_lifecycle.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ilm.remove_policy.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ilm.retry.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ilm.start.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ilm.stop.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.indices.create_data_stream.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.indices.data_streams_stats.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.indices.delete_data_stream.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.indices.freeze.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.indices.get_data_stream.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.indices.migrate_to_data_stream.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.indices.promote_data_stream.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.indices.reload_search_analyzers.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.indices.unfreeze.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.license.delete.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.license.get.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.license.get_basic_status.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.license.get_trial_status.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.license.post.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.license.post_start_basic.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.license.post_start_trial.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.logstash.delete_pipeline.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.logstash.get_pipeline.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.logstash.put_pipeline.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.migration.deprecations.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.close_job.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.delete_calendar.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.delete_calendar_event.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.delete_calendar_job.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.delete_data_frame_analytics.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.delete_datafeed.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.delete_expired_data.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.delete_filter.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.delete_forecast.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.delete_job.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.delete_model_snapshot.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.delete_trained_model.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.delete_trained_model_alias.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.estimate_model_memory.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.evaluate_data_frame.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.explain_data_frame_analytics.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.find_file_structure.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.flush_job.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.forecast.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_buckets.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_calendar_events.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_calendars.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_categories.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_data_frame_analytics.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_data_frame_analytics_stats.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_datafeed_stats.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_datafeeds.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_filters.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_influencers.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_job_stats.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_jobs.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_model_snapshots.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_overall_buckets.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_records.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_trained_models.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_trained_models_stats.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.info.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.open_job.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.post_calendar_events.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.post_data.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.preview_data_frame_analytics.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.preview_datafeed.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.put_calendar.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.put_calendar_job.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.put_data_frame_analytics.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.put_datafeed.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.put_filter.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.put_job.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.put_trained_model.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.put_trained_model_alias.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.revert_model_snapshot.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.set_upgrade_mode.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.start_data_frame_analytics.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.start_datafeed.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.stop_data_frame_analytics.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.stop_datafeed.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.update_data_frame_analytics.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.update_datafeed.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.update_filter.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.update_job.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.update_model_snapshot.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.upgrade_job_snapshot.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.validate.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.validate_detector.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.monitoring.bulk.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.open_point_in_time.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.rollup.delete_job.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.rollup.get_jobs.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.rollup.get_rollup_caps.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.rollup.get_rollup_index_caps.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.rollup.put_job.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.rollup.rollup.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.rollup.rollup_search.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.rollup.start_job.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.rollup.stop_job.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.searchable_snapshots.cache_stats.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.searchable_snapshots.clear_cache.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.searchable_snapshots.mount.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.searchable_snapshots.repository_stats.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.searchable_snapshots.stats.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.authenticate.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.change_password.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.clear_api_key_cache.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.clear_cached_privileges.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.clear_cached_realms.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.clear_cached_roles.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.clear_cached_service_tokens.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.create_api_key.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.create_service_token.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.delete_privileges.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.delete_role.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.delete_role_mapping.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.delete_service_token.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.delete_user.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.disable_user.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.enable_user.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.get_api_key.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.get_builtin_privileges.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.get_privileges.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.get_role.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.get_role_mapping.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.get_service_accounts.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.get_service_credentials.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.get_token.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.get_user.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.get_user_privileges.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.grant_api_key.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.has_privileges.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.invalidate_api_key.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.invalidate_token.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.put_privileges.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.put_role.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.put_role_mapping.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.put_user.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.slm.delete_lifecycle.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.slm.execute_lifecycle.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.slm.execute_retention.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.slm.get_lifecycle.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.slm.get_stats.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.slm.get_status.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.slm.put_lifecycle.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.slm.start.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.slm.stop.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.sql.clear_cursor.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.sql.query.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.sql.translate.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ssl.certificates.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.text_structure.find_structure.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.transform.delete_transform.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.transform.get_transform.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.transform.get_transform_stats.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.transform.preview_transform.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.transform.put_transform.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.transform.start_transform.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.transform.stop_transform.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.transform.update_transform.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.watcher.ack_watch.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.watcher.activate_watch.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.watcher.deactivate_watch.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.watcher.delete_watch.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.watcher.execute_watch.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.watcher.get_watch.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.watcher.put_watch.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.watcher.query_watches.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.watcher.start.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.watcher.stats.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.watcher.stop.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.xpack.info.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.xpack.usage.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/doc.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/esapi.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/esapi.request.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esapi/esapi.response.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/estransport/connection.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/estransport/discovery.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/estransport/doc.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/estransport/estransport.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/estransport/logger.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/estransport/metaheader.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/estransport/metrics.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esutil/bulk_indexer.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esutil/doc.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/esutil/json_reader.go delete mode 100644 vendor/github.com/elastic/go-elasticsearch/v7/internal/version/version.go delete mode 100644 vendor/github.com/emicklei/go-restful/v3/.gitignore delete mode 100644 vendor/github.com/emicklei/go-restful/v3/.goconvey delete mode 100644 vendor/github.com/emicklei/go-restful/v3/.travis.yml delete mode 100644 vendor/github.com/emicklei/go-restful/v3/CHANGES.md delete mode 100644 vendor/github.com/emicklei/go-restful/v3/LICENSE delete mode 100644 vendor/github.com/emicklei/go-restful/v3/Makefile delete mode 100644 vendor/github.com/emicklei/go-restful/v3/README.md delete mode 100644 vendor/github.com/emicklei/go-restful/v3/SECURITY.md delete mode 100644 vendor/github.com/emicklei/go-restful/v3/Srcfile delete mode 100644 vendor/github.com/emicklei/go-restful/v3/bench_test.sh delete mode 100644 vendor/github.com/emicklei/go-restful/v3/compress.go delete mode 100644 vendor/github.com/emicklei/go-restful/v3/compressor_cache.go delete mode 100644 vendor/github.com/emicklei/go-restful/v3/compressor_pools.go delete mode 100644 vendor/github.com/emicklei/go-restful/v3/compressors.go delete mode 100644 vendor/github.com/emicklei/go-restful/v3/constants.go delete mode 100644 vendor/github.com/emicklei/go-restful/v3/container.go delete mode 100644 vendor/github.com/emicklei/go-restful/v3/cors_filter.go delete mode 100644 vendor/github.com/emicklei/go-restful/v3/coverage.sh delete mode 100644 vendor/github.com/emicklei/go-restful/v3/curly.go delete mode 100644 vendor/github.com/emicklei/go-restful/v3/curly_route.go delete mode 100644 vendor/github.com/emicklei/go-restful/v3/custom_verb.go delete mode 100644 vendor/github.com/emicklei/go-restful/v3/doc.go delete mode 100644 vendor/github.com/emicklei/go-restful/v3/entity_accessors.go delete mode 100644 vendor/github.com/emicklei/go-restful/v3/extensions.go delete mode 100644 vendor/github.com/emicklei/go-restful/v3/filter.go delete mode 100644 vendor/github.com/emicklei/go-restful/v3/json.go delete mode 100644 vendor/github.com/emicklei/go-restful/v3/jsoniter.go delete mode 100644 vendor/github.com/emicklei/go-restful/v3/jsr311.go delete mode 100644 vendor/github.com/emicklei/go-restful/v3/log/log.go delete mode 100644 vendor/github.com/emicklei/go-restful/v3/logger.go delete mode 100644 vendor/github.com/emicklei/go-restful/v3/mime.go delete mode 100644 vendor/github.com/emicklei/go-restful/v3/options_filter.go delete mode 100644 vendor/github.com/emicklei/go-restful/v3/parameter.go delete mode 100644 vendor/github.com/emicklei/go-restful/v3/path_expression.go delete mode 100644 vendor/github.com/emicklei/go-restful/v3/path_processor.go delete mode 100644 vendor/github.com/emicklei/go-restful/v3/request.go delete mode 100644 vendor/github.com/emicklei/go-restful/v3/response.go delete mode 100644 vendor/github.com/emicklei/go-restful/v3/route.go delete mode 100644 vendor/github.com/emicklei/go-restful/v3/route_builder.go delete mode 100644 vendor/github.com/emicklei/go-restful/v3/route_reader.go delete mode 100644 vendor/github.com/emicklei/go-restful/v3/router.go delete mode 100644 vendor/github.com/emicklei/go-restful/v3/service_error.go delete mode 100644 vendor/github.com/emicklei/go-restful/v3/web_service.go delete mode 100644 vendor/github.com/emicklei/go-restful/v3/web_service_container.go delete mode 100644 vendor/github.com/go-logr/logr/.golangci.yaml delete mode 100644 vendor/github.com/go-logr/logr/CHANGELOG.md delete mode 100644 vendor/github.com/go-logr/logr/CONTRIBUTING.md delete mode 100644 vendor/github.com/go-logr/logr/LICENSE delete mode 100644 vendor/github.com/go-logr/logr/README.md delete mode 100644 vendor/github.com/go-logr/logr/discard.go delete mode 100644 vendor/github.com/go-logr/logr/logr.go delete mode 100644 vendor/github.com/go-openapi/jsonpointer/.editorconfig delete mode 100644 vendor/github.com/go-openapi/jsonpointer/.gitignore delete mode 100644 vendor/github.com/go-openapi/jsonpointer/.travis.yml delete mode 100644 vendor/github.com/go-openapi/jsonpointer/CODE_OF_CONDUCT.md delete mode 100644 vendor/github.com/go-openapi/jsonpointer/LICENSE delete mode 100644 vendor/github.com/go-openapi/jsonpointer/README.md delete mode 100644 vendor/github.com/go-openapi/jsonpointer/pointer.go delete mode 100644 vendor/github.com/go-openapi/jsonreference/.gitignore delete mode 100644 vendor/github.com/go-openapi/jsonreference/.golangci.yml delete mode 100644 vendor/github.com/go-openapi/jsonreference/.travis.yml delete mode 100644 vendor/github.com/go-openapi/jsonreference/CODE_OF_CONDUCT.md delete mode 100644 vendor/github.com/go-openapi/jsonreference/LICENSE delete mode 100644 vendor/github.com/go-openapi/jsonreference/README.md delete mode 100644 vendor/github.com/go-openapi/jsonreference/reference.go delete mode 100644 vendor/github.com/go-openapi/swag/.editorconfig delete mode 100644 vendor/github.com/go-openapi/swag/.gitattributes delete mode 100644 vendor/github.com/go-openapi/swag/.gitignore delete mode 100644 vendor/github.com/go-openapi/swag/.golangci.yml delete mode 100644 vendor/github.com/go-openapi/swag/CODE_OF_CONDUCT.md delete mode 100644 vendor/github.com/go-openapi/swag/LICENSE delete mode 100644 vendor/github.com/go-openapi/swag/README.md delete mode 100644 vendor/github.com/go-openapi/swag/convert.go delete mode 100644 vendor/github.com/go-openapi/swag/convert_types.go delete mode 100644 vendor/github.com/go-openapi/swag/doc.go delete mode 100644 vendor/github.com/go-openapi/swag/file.go delete mode 100644 vendor/github.com/go-openapi/swag/json.go delete mode 100644 vendor/github.com/go-openapi/swag/loading.go delete mode 100644 vendor/github.com/go-openapi/swag/name_lexem.go delete mode 100644 vendor/github.com/go-openapi/swag/net.go delete mode 100644 vendor/github.com/go-openapi/swag/path.go delete mode 100644 vendor/github.com/go-openapi/swag/post_go18.go delete mode 100644 vendor/github.com/go-openapi/swag/post_go19.go delete mode 100644 vendor/github.com/go-openapi/swag/pre_go18.go delete mode 100644 vendor/github.com/go-openapi/swag/pre_go19.go delete mode 100644 vendor/github.com/go-openapi/swag/split.go delete mode 100644 vendor/github.com/go-openapi/swag/util.go delete mode 100644 vendor/github.com/go-openapi/swag/yaml.go delete mode 100644 vendor/github.com/gogo/protobuf/AUTHORS delete mode 100644 vendor/github.com/gogo/protobuf/CONTRIBUTORS delete mode 100644 vendor/github.com/gogo/protobuf/LICENSE delete mode 100644 vendor/github.com/gogo/protobuf/proto/Makefile delete mode 100644 vendor/github.com/gogo/protobuf/proto/clone.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/custom_gogo.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/decode.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/deprecated.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/discard.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/duration.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/duration_gogo.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/encode.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/encode_gogo.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/equal.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/extensions.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/extensions_gogo.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/lib.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/lib_gogo.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/message_set.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/pointer_reflect.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/pointer_reflect_gogo.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/pointer_unsafe.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/properties.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/properties_gogo.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/skip_gogo.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/table_marshal.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/table_marshal_gogo.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/table_merge.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/table_unmarshal.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/table_unmarshal_gogo.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/text.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/text_gogo.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/text_parser.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/timestamp.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/timestamp_gogo.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/wrappers.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/wrappers_gogo.go delete mode 100644 vendor/github.com/gogo/protobuf/sortkeys/sortkeys.go delete mode 100644 vendor/github.com/golang-jwt/jwt/v4/.gitignore delete mode 100644 vendor/github.com/golang-jwt/jwt/v4/LICENSE delete mode 100644 vendor/github.com/golang-jwt/jwt/v4/MIGRATION_GUIDE.md delete mode 100644 vendor/github.com/golang-jwt/jwt/v4/README.md delete mode 100644 vendor/github.com/golang-jwt/jwt/v4/VERSION_HISTORY.md delete mode 100644 vendor/github.com/golang-jwt/jwt/v4/claims.go delete mode 100644 vendor/github.com/golang-jwt/jwt/v4/doc.go delete mode 100644 vendor/github.com/golang-jwt/jwt/v4/ecdsa.go delete mode 100644 vendor/github.com/golang-jwt/jwt/v4/ecdsa_utils.go delete mode 100644 vendor/github.com/golang-jwt/jwt/v4/ed25519.go delete mode 100644 vendor/github.com/golang-jwt/jwt/v4/ed25519_utils.go delete mode 100644 vendor/github.com/golang-jwt/jwt/v4/errors.go delete mode 100644 vendor/github.com/golang-jwt/jwt/v4/hmac.go delete mode 100644 vendor/github.com/golang-jwt/jwt/v4/map_claims.go delete mode 100644 vendor/github.com/golang-jwt/jwt/v4/none.go delete mode 100644 vendor/github.com/golang-jwt/jwt/v4/parser.go delete mode 100644 vendor/github.com/golang-jwt/jwt/v4/parser_option.go delete mode 100644 vendor/github.com/golang-jwt/jwt/v4/rsa.go delete mode 100644 vendor/github.com/golang-jwt/jwt/v4/rsa_pss.go delete mode 100644 vendor/github.com/golang-jwt/jwt/v4/rsa_utils.go delete mode 100644 vendor/github.com/golang-jwt/jwt/v4/signing_method.go delete mode 100644 vendor/github.com/golang-jwt/jwt/v4/staticcheck.conf delete mode 100644 vendor/github.com/golang-jwt/jwt/v4/token.go delete mode 100644 vendor/github.com/golang-jwt/jwt/v4/types.go delete mode 100644 vendor/github.com/golang/protobuf/AUTHORS delete mode 100644 vendor/github.com/golang/protobuf/CONTRIBUTORS delete mode 100644 vendor/github.com/golang/protobuf/LICENSE delete mode 100644 vendor/github.com/golang/protobuf/proto/buffer.go delete mode 100644 vendor/github.com/golang/protobuf/proto/defaults.go delete mode 100644 vendor/github.com/golang/protobuf/proto/deprecated.go delete mode 100644 vendor/github.com/golang/protobuf/proto/discard.go delete mode 100644 vendor/github.com/golang/protobuf/proto/extensions.go delete mode 100644 vendor/github.com/golang/protobuf/proto/properties.go delete mode 100644 vendor/github.com/golang/protobuf/proto/proto.go delete mode 100644 vendor/github.com/golang/protobuf/proto/registry.go delete mode 100644 vendor/github.com/golang/protobuf/proto/text_decode.go delete mode 100644 vendor/github.com/golang/protobuf/proto/text_encode.go delete mode 100644 vendor/github.com/golang/protobuf/proto/wire.go delete mode 100644 vendor/github.com/golang/protobuf/proto/wrappers.go delete mode 100644 vendor/github.com/golang/protobuf/ptypes/any.go delete mode 100644 vendor/github.com/golang/protobuf/ptypes/any/any.pb.go delete mode 100644 vendor/github.com/golang/protobuf/ptypes/doc.go delete mode 100644 vendor/github.com/golang/protobuf/ptypes/duration.go delete mode 100644 vendor/github.com/golang/protobuf/ptypes/duration/duration.pb.go delete mode 100644 vendor/github.com/golang/protobuf/ptypes/timestamp.go delete mode 100644 vendor/github.com/golang/protobuf/ptypes/timestamp/timestamp.pb.go delete mode 100644 vendor/github.com/google/gnostic/LICENSE delete mode 100644 vendor/github.com/google/gnostic/compiler/README.md delete mode 100644 vendor/github.com/google/gnostic/compiler/context.go delete mode 100644 vendor/github.com/google/gnostic/compiler/error.go delete mode 100644 vendor/github.com/google/gnostic/compiler/extensions.go delete mode 100644 vendor/github.com/google/gnostic/compiler/helpers.go delete mode 100644 vendor/github.com/google/gnostic/compiler/main.go delete mode 100644 vendor/github.com/google/gnostic/compiler/reader.go delete mode 100644 vendor/github.com/google/gnostic/extensions/README.md delete mode 100644 vendor/github.com/google/gnostic/extensions/extension.pb.go delete mode 100644 vendor/github.com/google/gnostic/extensions/extension.proto delete mode 100644 vendor/github.com/google/gnostic/extensions/extensions.go delete mode 100644 vendor/github.com/google/gnostic/jsonschema/README.md delete mode 100644 vendor/github.com/google/gnostic/jsonschema/base.go delete mode 100644 vendor/github.com/google/gnostic/jsonschema/display.go delete mode 100644 vendor/github.com/google/gnostic/jsonschema/models.go delete mode 100644 vendor/github.com/google/gnostic/jsonschema/operations.go delete mode 100644 vendor/github.com/google/gnostic/jsonschema/reader.go delete mode 100644 vendor/github.com/google/gnostic/jsonschema/schema.json delete mode 100644 vendor/github.com/google/gnostic/jsonschema/writer.go delete mode 100644 vendor/github.com/google/gnostic/openapiv2/OpenAPIv2.go delete mode 100644 vendor/github.com/google/gnostic/openapiv2/OpenAPIv2.pb.go delete mode 100644 vendor/github.com/google/gnostic/openapiv2/OpenAPIv2.proto delete mode 100644 vendor/github.com/google/gnostic/openapiv2/README.md delete mode 100644 vendor/github.com/google/gnostic/openapiv2/document.go delete mode 100644 vendor/github.com/google/gnostic/openapiv2/openapi-2.0.json delete mode 100644 vendor/github.com/google/gnostic/openapiv3/OpenAPIv3.go delete mode 100644 vendor/github.com/google/gnostic/openapiv3/OpenAPIv3.pb.go delete mode 100644 vendor/github.com/google/gnostic/openapiv3/OpenAPIv3.proto delete mode 100644 vendor/github.com/google/gnostic/openapiv3/README.md delete mode 100644 vendor/github.com/google/gnostic/openapiv3/document.go delete mode 100644 vendor/github.com/google/gnostic/openapiv3/openapi-3.0.json delete mode 100644 vendor/github.com/google/gnostic/openapiv3/openapi-3.1.json delete mode 100644 vendor/github.com/google/go-cmp/LICENSE delete mode 100644 vendor/github.com/google/go-cmp/cmp/compare.go delete mode 100644 vendor/github.com/google/go-cmp/cmp/export_panic.go delete mode 100644 vendor/github.com/google/go-cmp/cmp/export_unsafe.go delete mode 100644 vendor/github.com/google/go-cmp/cmp/internal/diff/debug_disable.go delete mode 100644 vendor/github.com/google/go-cmp/cmp/internal/diff/debug_enable.go delete mode 100644 vendor/github.com/google/go-cmp/cmp/internal/diff/diff.go delete mode 100644 vendor/github.com/google/go-cmp/cmp/internal/flags/flags.go delete mode 100644 vendor/github.com/google/go-cmp/cmp/internal/function/func.go delete mode 100644 vendor/github.com/google/go-cmp/cmp/internal/value/name.go delete mode 100644 vendor/github.com/google/go-cmp/cmp/internal/value/pointer_purego.go delete mode 100644 vendor/github.com/google/go-cmp/cmp/internal/value/pointer_unsafe.go delete mode 100644 vendor/github.com/google/go-cmp/cmp/internal/value/sort.go delete mode 100644 vendor/github.com/google/go-cmp/cmp/internal/value/zero.go delete mode 100644 vendor/github.com/google/go-cmp/cmp/options.go delete mode 100644 vendor/github.com/google/go-cmp/cmp/path.go delete mode 100644 vendor/github.com/google/go-cmp/cmp/report.go delete mode 100644 vendor/github.com/google/go-cmp/cmp/report_compare.go delete mode 100644 vendor/github.com/google/go-cmp/cmp/report_references.go delete mode 100644 vendor/github.com/google/go-cmp/cmp/report_reflect.go delete mode 100644 vendor/github.com/google/go-cmp/cmp/report_slices.go delete mode 100644 vendor/github.com/google/go-cmp/cmp/report_text.go delete mode 100644 vendor/github.com/google/go-cmp/cmp/report_value.go delete mode 100644 vendor/github.com/google/gofuzz/.travis.yml delete mode 100644 vendor/github.com/google/gofuzz/CONTRIBUTING.md delete mode 100644 vendor/github.com/google/gofuzz/LICENSE delete mode 100644 vendor/github.com/google/gofuzz/README.md delete mode 100644 vendor/github.com/google/gofuzz/bytesource/bytesource.go delete mode 100644 vendor/github.com/google/gofuzz/doc.go delete mode 100644 vendor/github.com/google/gofuzz/fuzz.go delete mode 100644 vendor/github.com/google/uuid/.travis.yml delete mode 100644 vendor/github.com/google/uuid/CONTRIBUTING.md delete mode 100644 vendor/github.com/google/uuid/CONTRIBUTORS delete mode 100644 vendor/github.com/google/uuid/LICENSE delete mode 100644 vendor/github.com/google/uuid/README.md delete mode 100644 vendor/github.com/google/uuid/dce.go delete mode 100644 vendor/github.com/google/uuid/doc.go delete mode 100644 vendor/github.com/google/uuid/hash.go delete mode 100644 vendor/github.com/google/uuid/marshal.go delete mode 100644 vendor/github.com/google/uuid/node.go delete mode 100644 vendor/github.com/google/uuid/node_js.go delete mode 100644 vendor/github.com/google/uuid/node_net.go delete mode 100644 vendor/github.com/google/uuid/sql.go delete mode 100644 vendor/github.com/google/uuid/time.go delete mode 100644 vendor/github.com/google/uuid/util.go delete mode 100644 vendor/github.com/google/uuid/uuid.go delete mode 100644 vendor/github.com/google/uuid/version1.go delete mode 100644 vendor/github.com/google/uuid/version4.go delete mode 100644 vendor/github.com/huandu/xstrings/.gitignore delete mode 100644 vendor/github.com/huandu/xstrings/.travis.yml delete mode 100644 vendor/github.com/huandu/xstrings/CONTRIBUTING.md delete mode 100644 vendor/github.com/huandu/xstrings/LICENSE delete mode 100644 vendor/github.com/huandu/xstrings/README.md delete mode 100644 vendor/github.com/huandu/xstrings/common.go delete mode 100644 vendor/github.com/huandu/xstrings/convert.go delete mode 100644 vendor/github.com/huandu/xstrings/count.go delete mode 100644 vendor/github.com/huandu/xstrings/doc.go delete mode 100644 vendor/github.com/huandu/xstrings/format.go delete mode 100644 vendor/github.com/huandu/xstrings/manipulate.go delete mode 100644 vendor/github.com/huandu/xstrings/stringbuilder.go delete mode 100644 vendor/github.com/huandu/xstrings/stringbuilder_go110.go delete mode 100644 vendor/github.com/huandu/xstrings/translate.go delete mode 100644 vendor/github.com/imdario/mergo/.deepsource.toml delete mode 100644 vendor/github.com/imdario/mergo/.gitignore delete mode 100644 vendor/github.com/imdario/mergo/.travis.yml delete mode 100644 vendor/github.com/imdario/mergo/CODE_OF_CONDUCT.md delete mode 100644 vendor/github.com/imdario/mergo/LICENSE delete mode 100644 vendor/github.com/imdario/mergo/README.md delete mode 100644 vendor/github.com/imdario/mergo/doc.go delete mode 100644 vendor/github.com/imdario/mergo/map.go delete mode 100644 vendor/github.com/imdario/mergo/merge.go delete mode 100644 vendor/github.com/imdario/mergo/mergo.go delete mode 100644 vendor/github.com/inconshreveable/mousetrap/LICENSE delete mode 100644 vendor/github.com/inconshreveable/mousetrap/README.md delete mode 100644 vendor/github.com/inconshreveable/mousetrap/trap_others.go delete mode 100644 vendor/github.com/inconshreveable/mousetrap/trap_windows.go delete mode 100644 vendor/github.com/inconshreveable/mousetrap/trap_windows_1.4.go delete mode 100644 vendor/github.com/josharian/intern/README.md delete mode 100644 vendor/github.com/josharian/intern/intern.go delete mode 100644 vendor/github.com/josharian/intern/license.md delete mode 100644 vendor/github.com/json-iterator/go/.codecov.yml delete mode 100644 vendor/github.com/json-iterator/go/.gitignore delete mode 100644 vendor/github.com/json-iterator/go/.travis.yml delete mode 100644 vendor/github.com/json-iterator/go/Gopkg.lock delete mode 100644 vendor/github.com/json-iterator/go/Gopkg.toml delete mode 100644 vendor/github.com/json-iterator/go/LICENSE delete mode 100644 vendor/github.com/json-iterator/go/README.md delete mode 100644 vendor/github.com/json-iterator/go/adapter.go delete mode 100644 vendor/github.com/json-iterator/go/any.go delete mode 100644 vendor/github.com/json-iterator/go/any_array.go delete mode 100644 vendor/github.com/json-iterator/go/any_bool.go delete mode 100644 vendor/github.com/json-iterator/go/any_float.go delete mode 100644 vendor/github.com/json-iterator/go/any_int32.go delete mode 100644 vendor/github.com/json-iterator/go/any_int64.go delete mode 100644 vendor/github.com/json-iterator/go/any_invalid.go delete mode 100644 vendor/github.com/json-iterator/go/any_nil.go delete mode 100644 vendor/github.com/json-iterator/go/any_number.go delete mode 100644 vendor/github.com/json-iterator/go/any_object.go delete mode 100644 vendor/github.com/json-iterator/go/any_str.go delete mode 100644 vendor/github.com/json-iterator/go/any_uint32.go delete mode 100644 vendor/github.com/json-iterator/go/any_uint64.go delete mode 100644 vendor/github.com/json-iterator/go/build.sh delete mode 100644 vendor/github.com/json-iterator/go/config.go delete mode 100644 vendor/github.com/json-iterator/go/fuzzy_mode_convert_table.md delete mode 100644 vendor/github.com/json-iterator/go/iter.go delete mode 100644 vendor/github.com/json-iterator/go/iter_array.go delete mode 100644 vendor/github.com/json-iterator/go/iter_float.go delete mode 100644 vendor/github.com/json-iterator/go/iter_int.go delete mode 100644 vendor/github.com/json-iterator/go/iter_object.go delete mode 100644 vendor/github.com/json-iterator/go/iter_skip.go delete mode 100644 vendor/github.com/json-iterator/go/iter_skip_sloppy.go delete mode 100644 vendor/github.com/json-iterator/go/iter_skip_strict.go delete mode 100644 vendor/github.com/json-iterator/go/iter_str.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter.go delete mode 100644 vendor/github.com/json-iterator/go/pool.go delete mode 100644 vendor/github.com/json-iterator/go/reflect.go delete mode 100644 vendor/github.com/json-iterator/go/reflect_array.go delete mode 100644 vendor/github.com/json-iterator/go/reflect_dynamic.go delete mode 100644 vendor/github.com/json-iterator/go/reflect_extension.go delete mode 100644 vendor/github.com/json-iterator/go/reflect_json_number.go delete mode 100644 vendor/github.com/json-iterator/go/reflect_json_raw_message.go delete mode 100644 vendor/github.com/json-iterator/go/reflect_map.go delete mode 100644 vendor/github.com/json-iterator/go/reflect_marshaler.go delete mode 100644 vendor/github.com/json-iterator/go/reflect_native.go delete mode 100644 vendor/github.com/json-iterator/go/reflect_optional.go delete mode 100644 vendor/github.com/json-iterator/go/reflect_slice.go delete mode 100644 vendor/github.com/json-iterator/go/reflect_struct_decoder.go delete mode 100644 vendor/github.com/json-iterator/go/reflect_struct_encoder.go delete mode 100644 vendor/github.com/json-iterator/go/stream.go delete mode 100644 vendor/github.com/json-iterator/go/stream_float.go delete mode 100644 vendor/github.com/json-iterator/go/stream_int.go delete mode 100644 vendor/github.com/json-iterator/go/stream_str.go delete mode 100644 vendor/github.com/json-iterator/go/test.sh delete mode 100644 vendor/github.com/mailru/easyjson/LICENSE delete mode 100644 vendor/github.com/mailru/easyjson/buffer/pool.go delete mode 100644 vendor/github.com/mailru/easyjson/jlexer/bytestostr.go delete mode 100644 vendor/github.com/mailru/easyjson/jlexer/bytestostr_nounsafe.go delete mode 100644 vendor/github.com/mailru/easyjson/jlexer/error.go delete mode 100644 vendor/github.com/mailru/easyjson/jlexer/lexer.go delete mode 100644 vendor/github.com/mailru/easyjson/jwriter/writer.go delete mode 100644 vendor/github.com/mitchellh/copystructure/LICENSE delete mode 100644 vendor/github.com/mitchellh/copystructure/README.md delete mode 100644 vendor/github.com/mitchellh/copystructure/copier_time.go delete mode 100644 vendor/github.com/mitchellh/copystructure/copystructure.go delete mode 100644 vendor/github.com/mitchellh/reflectwalk/.travis.yml delete mode 100644 vendor/github.com/mitchellh/reflectwalk/LICENSE delete mode 100644 vendor/github.com/mitchellh/reflectwalk/README.md delete mode 100644 vendor/github.com/mitchellh/reflectwalk/location.go delete mode 100644 vendor/github.com/mitchellh/reflectwalk/location_string.go delete mode 100644 vendor/github.com/mitchellh/reflectwalk/reflectwalk.go delete mode 100644 vendor/github.com/moby/spdystream/CONTRIBUTING.md delete mode 100644 vendor/github.com/moby/spdystream/LICENSE delete mode 100644 vendor/github.com/moby/spdystream/MAINTAINERS delete mode 100644 vendor/github.com/moby/spdystream/NOTICE delete mode 100644 vendor/github.com/moby/spdystream/README.md delete mode 100644 vendor/github.com/moby/spdystream/connection.go delete mode 100644 vendor/github.com/moby/spdystream/handlers.go delete mode 100644 vendor/github.com/moby/spdystream/priority.go delete mode 100644 vendor/github.com/moby/spdystream/spdy/dictionary.go delete mode 100644 vendor/github.com/moby/spdystream/spdy/read.go delete mode 100644 vendor/github.com/moby/spdystream/spdy/types.go delete mode 100644 vendor/github.com/moby/spdystream/spdy/write.go delete mode 100644 vendor/github.com/moby/spdystream/stream.go delete mode 100644 vendor/github.com/moby/spdystream/utils.go delete mode 100644 vendor/github.com/modern-go/concurrent/.gitignore delete mode 100644 vendor/github.com/modern-go/concurrent/.travis.yml delete mode 100644 vendor/github.com/modern-go/concurrent/LICENSE delete mode 100644 vendor/github.com/modern-go/concurrent/README.md delete mode 100644 vendor/github.com/modern-go/concurrent/executor.go delete mode 100644 vendor/github.com/modern-go/concurrent/go_above_19.go delete mode 100644 vendor/github.com/modern-go/concurrent/go_below_19.go delete mode 100644 vendor/github.com/modern-go/concurrent/log.go delete mode 100644 vendor/github.com/modern-go/concurrent/test.sh delete mode 100644 vendor/github.com/modern-go/concurrent/unbounded_executor.go delete mode 100644 vendor/github.com/modern-go/reflect2/.gitignore delete mode 100644 vendor/github.com/modern-go/reflect2/.travis.yml delete mode 100644 vendor/github.com/modern-go/reflect2/Gopkg.lock delete mode 100644 vendor/github.com/modern-go/reflect2/Gopkg.toml delete mode 100644 vendor/github.com/modern-go/reflect2/LICENSE delete mode 100644 vendor/github.com/modern-go/reflect2/README.md delete mode 100644 vendor/github.com/modern-go/reflect2/go_above_118.go delete mode 100644 vendor/github.com/modern-go/reflect2/go_above_19.go delete mode 100644 vendor/github.com/modern-go/reflect2/go_below_118.go delete mode 100644 vendor/github.com/modern-go/reflect2/reflect2.go delete mode 100644 vendor/github.com/modern-go/reflect2/reflect2_amd64.s delete mode 100644 vendor/github.com/modern-go/reflect2/reflect2_kind.go delete mode 100644 vendor/github.com/modern-go/reflect2/relfect2_386.s delete mode 100644 vendor/github.com/modern-go/reflect2/relfect2_amd64p32.s delete mode 100644 vendor/github.com/modern-go/reflect2/relfect2_arm.s delete mode 100644 vendor/github.com/modern-go/reflect2/relfect2_arm64.s delete mode 100644 vendor/github.com/modern-go/reflect2/relfect2_mips64x.s delete mode 100644 vendor/github.com/modern-go/reflect2/relfect2_mipsx.s delete mode 100644 vendor/github.com/modern-go/reflect2/relfect2_ppc64x.s delete mode 100644 vendor/github.com/modern-go/reflect2/relfect2_s390x.s delete mode 100644 vendor/github.com/modern-go/reflect2/safe_field.go delete mode 100644 vendor/github.com/modern-go/reflect2/safe_map.go delete mode 100644 vendor/github.com/modern-go/reflect2/safe_slice.go delete mode 100644 vendor/github.com/modern-go/reflect2/safe_struct.go delete mode 100644 vendor/github.com/modern-go/reflect2/safe_type.go delete mode 100644 vendor/github.com/modern-go/reflect2/type_map.go delete mode 100644 vendor/github.com/modern-go/reflect2/unsafe_array.go delete mode 100644 vendor/github.com/modern-go/reflect2/unsafe_eface.go delete mode 100644 vendor/github.com/modern-go/reflect2/unsafe_field.go delete mode 100644 vendor/github.com/modern-go/reflect2/unsafe_iface.go delete mode 100644 vendor/github.com/modern-go/reflect2/unsafe_link.go delete mode 100644 vendor/github.com/modern-go/reflect2/unsafe_map.go delete mode 100644 vendor/github.com/modern-go/reflect2/unsafe_ptr.go delete mode 100644 vendor/github.com/modern-go/reflect2/unsafe_slice.go delete mode 100644 vendor/github.com/modern-go/reflect2/unsafe_struct.go delete mode 100644 vendor/github.com/modern-go/reflect2/unsafe_type.go delete mode 100644 vendor/github.com/munnerz/goautoneg/LICENSE delete mode 100644 vendor/github.com/munnerz/goautoneg/Makefile delete mode 100644 vendor/github.com/munnerz/goautoneg/README.txt delete mode 100644 vendor/github.com/munnerz/goautoneg/autoneg.go delete mode 100644 vendor/github.com/openshift/custom-resource-status/LICENSE delete mode 100644 vendor/github.com/openshift/custom-resource-status/conditions/v1/conditions.go delete mode 100644 vendor/github.com/openshift/custom-resource-status/conditions/v1/doc.go delete mode 100644 vendor/github.com/openshift/custom-resource-status/conditions/v1/types.go delete mode 100644 vendor/github.com/openshift/custom-resource-status/conditions/v1/zz_generated.deepcopy.go delete mode 100644 vendor/github.com/pborman/uuid/.travis.yml delete mode 100644 vendor/github.com/pborman/uuid/CONTRIBUTING.md delete mode 100644 vendor/github.com/pborman/uuid/CONTRIBUTORS delete mode 100644 vendor/github.com/pborman/uuid/LICENSE delete mode 100644 vendor/github.com/pborman/uuid/README.md delete mode 100644 vendor/github.com/pborman/uuid/dce.go delete mode 100644 vendor/github.com/pborman/uuid/doc.go delete mode 100644 vendor/github.com/pborman/uuid/hash.go delete mode 100644 vendor/github.com/pborman/uuid/marshal.go delete mode 100644 vendor/github.com/pborman/uuid/node.go delete mode 100644 vendor/github.com/pborman/uuid/sql.go delete mode 100644 vendor/github.com/pborman/uuid/time.go delete mode 100644 vendor/github.com/pborman/uuid/util.go delete mode 100644 vendor/github.com/pborman/uuid/uuid.go delete mode 100644 vendor/github.com/pborman/uuid/version1.go delete mode 100644 vendor/github.com/pborman/uuid/version4.go delete mode 100644 vendor/github.com/prometheus/client_golang/LICENSE delete mode 100644 vendor/github.com/prometheus/client_golang/NOTICE delete mode 100644 vendor/github.com/prometheus/client_golang/api/client.go delete mode 100644 vendor/github.com/prometheus/client_golang/api/prometheus/v1/api.go delete mode 100644 vendor/github.com/prometheus/common/LICENSE delete mode 100644 vendor/github.com/prometheus/common/NOTICE delete mode 100644 vendor/github.com/prometheus/common/model/alert.go delete mode 100644 vendor/github.com/prometheus/common/model/fingerprinting.go delete mode 100644 vendor/github.com/prometheus/common/model/fnv.go delete mode 100644 vendor/github.com/prometheus/common/model/labels.go delete mode 100644 vendor/github.com/prometheus/common/model/labelset.go delete mode 100644 vendor/github.com/prometheus/common/model/metric.go delete mode 100644 vendor/github.com/prometheus/common/model/model.go delete mode 100644 vendor/github.com/prometheus/common/model/signature.go delete mode 100644 vendor/github.com/prometheus/common/model/silence.go delete mode 100644 vendor/github.com/prometheus/common/model/time.go delete mode 100644 vendor/github.com/prometheus/common/model/value.go delete mode 100644 vendor/github.com/prometheus/common/model/value_float.go delete mode 100644 vendor/github.com/prometheus/common/model/value_histogram.go delete mode 100644 vendor/github.com/prometheus/common/model/value_type.go delete mode 100644 vendor/github.com/satori/go.uuid/.travis.yml delete mode 100644 vendor/github.com/satori/go.uuid/LICENSE delete mode 100644 vendor/github.com/satori/go.uuid/README.md delete mode 100644 vendor/github.com/satori/go.uuid/codec.go delete mode 100644 vendor/github.com/satori/go.uuid/generator.go delete mode 100644 vendor/github.com/satori/go.uuid/sql.go delete mode 100644 vendor/github.com/satori/go.uuid/uuid.go delete mode 100644 vendor/github.com/shopspring/decimal/.gitignore delete mode 100644 vendor/github.com/shopspring/decimal/.travis.yml delete mode 100644 vendor/github.com/shopspring/decimal/CHANGELOG.md delete mode 100644 vendor/github.com/shopspring/decimal/LICENSE delete mode 100644 vendor/github.com/shopspring/decimal/README.md delete mode 100644 vendor/github.com/shopspring/decimal/decimal-go.go delete mode 100644 vendor/github.com/shopspring/decimal/decimal.go delete mode 100644 vendor/github.com/shopspring/decimal/rounding.go delete mode 100644 vendor/github.com/sirupsen/logrus/.gitignore delete mode 100644 vendor/github.com/sirupsen/logrus/.golangci.yml delete mode 100644 vendor/github.com/sirupsen/logrus/.travis.yml delete mode 100644 vendor/github.com/sirupsen/logrus/CHANGELOG.md delete mode 100644 vendor/github.com/sirupsen/logrus/LICENSE delete mode 100644 vendor/github.com/sirupsen/logrus/README.md delete mode 100644 vendor/github.com/sirupsen/logrus/alt_exit.go delete mode 100644 vendor/github.com/sirupsen/logrus/appveyor.yml delete mode 100644 vendor/github.com/sirupsen/logrus/buffer_pool.go delete mode 100644 vendor/github.com/sirupsen/logrus/doc.go delete mode 100644 vendor/github.com/sirupsen/logrus/entry.go delete mode 100644 vendor/github.com/sirupsen/logrus/exported.go delete mode 100644 vendor/github.com/sirupsen/logrus/formatter.go delete mode 100644 vendor/github.com/sirupsen/logrus/hooks.go delete mode 100644 vendor/github.com/sirupsen/logrus/json_formatter.go delete mode 100644 vendor/github.com/sirupsen/logrus/logger.go delete mode 100644 vendor/github.com/sirupsen/logrus/logrus.go delete mode 100644 vendor/github.com/sirupsen/logrus/terminal_check_appengine.go delete mode 100644 vendor/github.com/sirupsen/logrus/terminal_check_bsd.go delete mode 100644 vendor/github.com/sirupsen/logrus/terminal_check_js.go delete mode 100644 vendor/github.com/sirupsen/logrus/terminal_check_no_terminal.go delete mode 100644 vendor/github.com/sirupsen/logrus/terminal_check_notappengine.go delete mode 100644 vendor/github.com/sirupsen/logrus/terminal_check_solaris.go delete mode 100644 vendor/github.com/sirupsen/logrus/terminal_check_unix.go delete mode 100644 vendor/github.com/sirupsen/logrus/terminal_check_windows.go delete mode 100644 vendor/github.com/sirupsen/logrus/text_formatter.go delete mode 100644 vendor/github.com/sirupsen/logrus/writer.go delete mode 100644 vendor/github.com/spf13/cast/.gitignore delete mode 100644 vendor/github.com/spf13/cast/.travis.yml delete mode 100644 vendor/github.com/spf13/cast/LICENSE delete mode 100644 vendor/github.com/spf13/cast/Makefile delete mode 100644 vendor/github.com/spf13/cast/README.md delete mode 100644 vendor/github.com/spf13/cast/cast.go delete mode 100644 vendor/github.com/spf13/cast/caste.go delete mode 100644 vendor/github.com/spf13/cobra/.gitignore delete mode 100644 vendor/github.com/spf13/cobra/.golangci.yml delete mode 100644 vendor/github.com/spf13/cobra/.mailmap delete mode 100644 vendor/github.com/spf13/cobra/CONDUCT.md delete mode 100644 vendor/github.com/spf13/cobra/CONTRIBUTING.md delete mode 100644 vendor/github.com/spf13/cobra/LICENSE.txt delete mode 100644 vendor/github.com/spf13/cobra/MAINTAINERS delete mode 100644 vendor/github.com/spf13/cobra/Makefile delete mode 100644 vendor/github.com/spf13/cobra/README.md delete mode 100644 vendor/github.com/spf13/cobra/active_help.go delete mode 100644 vendor/github.com/spf13/cobra/active_help.md delete mode 100644 vendor/github.com/spf13/cobra/args.go delete mode 100644 vendor/github.com/spf13/cobra/bash_completions.go delete mode 100644 vendor/github.com/spf13/cobra/bash_completions.md delete mode 100644 vendor/github.com/spf13/cobra/bash_completionsV2.go delete mode 100644 vendor/github.com/spf13/cobra/cobra.go delete mode 100644 vendor/github.com/spf13/cobra/command.go delete mode 100644 vendor/github.com/spf13/cobra/command_notwin.go delete mode 100644 vendor/github.com/spf13/cobra/command_win.go delete mode 100644 vendor/github.com/spf13/cobra/completions.go delete mode 100644 vendor/github.com/spf13/cobra/fish_completions.go delete mode 100644 vendor/github.com/spf13/cobra/fish_completions.md delete mode 100644 vendor/github.com/spf13/cobra/flag_groups.go delete mode 100644 vendor/github.com/spf13/cobra/powershell_completions.go delete mode 100644 vendor/github.com/spf13/cobra/powershell_completions.md delete mode 100644 vendor/github.com/spf13/cobra/projects_using_cobra.md delete mode 100644 vendor/github.com/spf13/cobra/shell_completions.go delete mode 100644 vendor/github.com/spf13/cobra/shell_completions.md delete mode 100644 vendor/github.com/spf13/cobra/user_guide.md delete mode 100644 vendor/github.com/spf13/cobra/zsh_completions.go delete mode 100644 vendor/github.com/spf13/cobra/zsh_completions.md delete mode 100644 vendor/github.com/spf13/pflag/.gitignore delete mode 100644 vendor/github.com/spf13/pflag/.travis.yml delete mode 100644 vendor/github.com/spf13/pflag/LICENSE delete mode 100644 vendor/github.com/spf13/pflag/README.md delete mode 100644 vendor/github.com/spf13/pflag/bool.go delete mode 100644 vendor/github.com/spf13/pflag/bool_slice.go delete mode 100644 vendor/github.com/spf13/pflag/bytes.go delete mode 100644 vendor/github.com/spf13/pflag/count.go delete mode 100644 vendor/github.com/spf13/pflag/duration.go delete mode 100644 vendor/github.com/spf13/pflag/duration_slice.go delete mode 100644 vendor/github.com/spf13/pflag/flag.go delete mode 100644 vendor/github.com/spf13/pflag/float32.go delete mode 100644 vendor/github.com/spf13/pflag/float32_slice.go delete mode 100644 vendor/github.com/spf13/pflag/float64.go delete mode 100644 vendor/github.com/spf13/pflag/float64_slice.go delete mode 100644 vendor/github.com/spf13/pflag/golangflag.go delete mode 100644 vendor/github.com/spf13/pflag/int.go delete mode 100644 vendor/github.com/spf13/pflag/int16.go delete mode 100644 vendor/github.com/spf13/pflag/int32.go delete mode 100644 vendor/github.com/spf13/pflag/int32_slice.go delete mode 100644 vendor/github.com/spf13/pflag/int64.go delete mode 100644 vendor/github.com/spf13/pflag/int64_slice.go delete mode 100644 vendor/github.com/spf13/pflag/int8.go delete mode 100644 vendor/github.com/spf13/pflag/int_slice.go delete mode 100644 vendor/github.com/spf13/pflag/ip.go delete mode 100644 vendor/github.com/spf13/pflag/ip_slice.go delete mode 100644 vendor/github.com/spf13/pflag/ipmask.go delete mode 100644 vendor/github.com/spf13/pflag/ipnet.go delete mode 100644 vendor/github.com/spf13/pflag/string.go delete mode 100644 vendor/github.com/spf13/pflag/string_array.go delete mode 100644 vendor/github.com/spf13/pflag/string_slice.go delete mode 100644 vendor/github.com/spf13/pflag/string_to_int.go delete mode 100644 vendor/github.com/spf13/pflag/string_to_int64.go delete mode 100644 vendor/github.com/spf13/pflag/string_to_string.go delete mode 100644 vendor/github.com/spf13/pflag/uint.go delete mode 100644 vendor/github.com/spf13/pflag/uint16.go delete mode 100644 vendor/github.com/spf13/pflag/uint32.go delete mode 100644 vendor/github.com/spf13/pflag/uint64.go delete mode 100644 vendor/github.com/spf13/pflag/uint8.go delete mode 100644 vendor/github.com/spf13/pflag/uint_slice.go delete mode 100644 vendor/golang.org/x/crypto/AUTHORS delete mode 100644 vendor/golang.org/x/crypto/CONTRIBUTORS delete mode 100644 vendor/golang.org/x/crypto/LICENSE delete mode 100644 vendor/golang.org/x/crypto/PATENTS delete mode 100644 vendor/golang.org/x/crypto/bcrypt/base64.go delete mode 100644 vendor/golang.org/x/crypto/bcrypt/bcrypt.go delete mode 100644 vendor/golang.org/x/crypto/blowfish/block.go delete mode 100644 vendor/golang.org/x/crypto/blowfish/cipher.go delete mode 100644 vendor/golang.org/x/crypto/blowfish/const.go delete mode 100644 vendor/golang.org/x/crypto/pbkdf2/pbkdf2.go delete mode 100644 vendor/golang.org/x/crypto/pkcs12/bmp-string.go delete mode 100644 vendor/golang.org/x/crypto/pkcs12/crypto.go delete mode 100644 vendor/golang.org/x/crypto/pkcs12/errors.go delete mode 100644 vendor/golang.org/x/crypto/pkcs12/internal/rc2/rc2.go delete mode 100644 vendor/golang.org/x/crypto/pkcs12/mac.go delete mode 100644 vendor/golang.org/x/crypto/pkcs12/pbkdf.go delete mode 100644 vendor/golang.org/x/crypto/pkcs12/pkcs12.go delete mode 100644 vendor/golang.org/x/crypto/pkcs12/safebags.go delete mode 100644 vendor/golang.org/x/crypto/scrypt/scrypt.go delete mode 100644 vendor/golang.org/x/net/LICENSE delete mode 100644 vendor/golang.org/x/net/PATENTS delete mode 100644 vendor/golang.org/x/net/context/context.go delete mode 100644 vendor/golang.org/x/net/context/go17.go delete mode 100644 vendor/golang.org/x/net/context/go19.go delete mode 100644 vendor/golang.org/x/net/context/pre_go17.go delete mode 100644 vendor/golang.org/x/net/context/pre_go19.go delete mode 100644 vendor/golang.org/x/net/http/httpguts/guts.go delete mode 100644 vendor/golang.org/x/net/http/httpguts/httplex.go delete mode 100644 vendor/golang.org/x/net/http2/.gitignore delete mode 100644 vendor/golang.org/x/net/http2/Dockerfile delete mode 100644 vendor/golang.org/x/net/http2/Makefile delete mode 100644 vendor/golang.org/x/net/http2/ascii.go delete mode 100644 vendor/golang.org/x/net/http2/ciphers.go delete mode 100644 vendor/golang.org/x/net/http2/client_conn_pool.go delete mode 100644 vendor/golang.org/x/net/http2/databuffer.go delete mode 100644 vendor/golang.org/x/net/http2/errors.go delete mode 100644 vendor/golang.org/x/net/http2/flow.go delete mode 100644 vendor/golang.org/x/net/http2/frame.go delete mode 100644 vendor/golang.org/x/net/http2/go111.go delete mode 100644 vendor/golang.org/x/net/http2/go115.go delete mode 100644 vendor/golang.org/x/net/http2/go118.go delete mode 100644 vendor/golang.org/x/net/http2/gotrack.go delete mode 100644 vendor/golang.org/x/net/http2/headermap.go delete mode 100644 vendor/golang.org/x/net/http2/hpack/encode.go delete mode 100644 vendor/golang.org/x/net/http2/hpack/hpack.go delete mode 100644 vendor/golang.org/x/net/http2/hpack/huffman.go delete mode 100644 vendor/golang.org/x/net/http2/hpack/static_table.go delete mode 100644 vendor/golang.org/x/net/http2/hpack/tables.go delete mode 100644 vendor/golang.org/x/net/http2/http2.go delete mode 100644 vendor/golang.org/x/net/http2/not_go111.go delete mode 100644 vendor/golang.org/x/net/http2/not_go115.go delete mode 100644 vendor/golang.org/x/net/http2/not_go118.go delete mode 100644 vendor/golang.org/x/net/http2/pipe.go delete mode 100644 vendor/golang.org/x/net/http2/server.go delete mode 100644 vendor/golang.org/x/net/http2/transport.go delete mode 100644 vendor/golang.org/x/net/http2/write.go delete mode 100644 vendor/golang.org/x/net/http2/writesched.go delete mode 100644 vendor/golang.org/x/net/http2/writesched_priority.go delete mode 100644 vendor/golang.org/x/net/http2/writesched_random.go delete mode 100644 vendor/golang.org/x/net/idna/go118.go delete mode 100644 vendor/golang.org/x/net/idna/idna10.0.0.go delete mode 100644 vendor/golang.org/x/net/idna/idna9.0.0.go delete mode 100644 vendor/golang.org/x/net/idna/pre_go118.go delete mode 100644 vendor/golang.org/x/net/idna/punycode.go delete mode 100644 vendor/golang.org/x/net/idna/tables10.0.0.go delete mode 100644 vendor/golang.org/x/net/idna/tables11.0.0.go delete mode 100644 vendor/golang.org/x/net/idna/tables12.0.0.go delete mode 100644 vendor/golang.org/x/net/idna/tables13.0.0.go delete mode 100644 vendor/golang.org/x/net/idna/tables9.0.0.go delete mode 100644 vendor/golang.org/x/net/idna/trie.go delete mode 100644 vendor/golang.org/x/net/idna/trieval.go delete mode 100644 vendor/golang.org/x/net/internal/socks/client.go delete mode 100644 vendor/golang.org/x/net/internal/socks/socks.go delete mode 100644 vendor/golang.org/x/net/proxy/dial.go delete mode 100644 vendor/golang.org/x/net/proxy/direct.go delete mode 100644 vendor/golang.org/x/net/proxy/per_host.go delete mode 100644 vendor/golang.org/x/net/proxy/proxy.go delete mode 100644 vendor/golang.org/x/net/proxy/socks5.go delete mode 100644 vendor/golang.org/x/oauth2/.travis.yml delete mode 100644 vendor/golang.org/x/oauth2/CONTRIBUTING.md delete mode 100644 vendor/golang.org/x/oauth2/LICENSE delete mode 100644 vendor/golang.org/x/oauth2/README.md delete mode 100644 vendor/golang.org/x/oauth2/authhandler/authhandler.go delete mode 100644 vendor/golang.org/x/oauth2/google/appengine.go delete mode 100644 vendor/golang.org/x/oauth2/google/appengine_gen1.go delete mode 100644 vendor/golang.org/x/oauth2/google/appengine_gen2_flex.go delete mode 100644 vendor/golang.org/x/oauth2/google/default.go delete mode 100644 vendor/golang.org/x/oauth2/google/doc.go delete mode 100644 vendor/golang.org/x/oauth2/google/error.go delete mode 100644 vendor/golang.org/x/oauth2/google/google.go delete mode 100644 vendor/golang.org/x/oauth2/google/internal/externalaccount/aws.go delete mode 100644 vendor/golang.org/x/oauth2/google/internal/externalaccount/basecredentials.go delete mode 100644 vendor/golang.org/x/oauth2/google/internal/externalaccount/clientauth.go delete mode 100644 vendor/golang.org/x/oauth2/google/internal/externalaccount/err.go delete mode 100644 vendor/golang.org/x/oauth2/google/internal/externalaccount/executablecredsource.go delete mode 100644 vendor/golang.org/x/oauth2/google/internal/externalaccount/filecredsource.go delete mode 100644 vendor/golang.org/x/oauth2/google/internal/externalaccount/impersonate.go delete mode 100644 vendor/golang.org/x/oauth2/google/internal/externalaccount/sts_exchange.go delete mode 100644 vendor/golang.org/x/oauth2/google/internal/externalaccount/urlcredsource.go delete mode 100644 vendor/golang.org/x/oauth2/google/jwt.go delete mode 100644 vendor/golang.org/x/oauth2/google/sdk.go delete mode 100644 vendor/golang.org/x/oauth2/internal/client_appengine.go delete mode 100644 vendor/golang.org/x/oauth2/internal/doc.go delete mode 100644 vendor/golang.org/x/oauth2/internal/oauth2.go delete mode 100644 vendor/golang.org/x/oauth2/internal/token.go delete mode 100644 vendor/golang.org/x/oauth2/internal/transport.go delete mode 100644 vendor/golang.org/x/oauth2/jws/jws.go delete mode 100644 vendor/golang.org/x/oauth2/jwt/jwt.go delete mode 100644 vendor/golang.org/x/oauth2/oauth2.go delete mode 100644 vendor/golang.org/x/oauth2/token.go delete mode 100644 vendor/golang.org/x/oauth2/transport.go delete mode 100644 vendor/golang.org/x/sys/LICENSE delete mode 100644 vendor/golang.org/x/sys/PATENTS delete mode 100644 vendor/golang.org/x/sys/internal/unsafeheader/unsafeheader.go delete mode 100644 vendor/golang.org/x/sys/plan9/asm.s delete mode 100644 vendor/golang.org/x/sys/plan9/asm_plan9_386.s delete mode 100644 vendor/golang.org/x/sys/plan9/asm_plan9_amd64.s delete mode 100644 vendor/golang.org/x/sys/plan9/asm_plan9_arm.s delete mode 100644 vendor/golang.org/x/sys/plan9/const_plan9.go delete mode 100644 vendor/golang.org/x/sys/plan9/dir_plan9.go delete mode 100644 vendor/golang.org/x/sys/plan9/env_plan9.go delete mode 100644 vendor/golang.org/x/sys/plan9/errors_plan9.go delete mode 100644 vendor/golang.org/x/sys/plan9/mkall.sh delete mode 100644 vendor/golang.org/x/sys/plan9/mkerrors.sh delete mode 100644 vendor/golang.org/x/sys/plan9/mksysnum_plan9.sh delete mode 100644 vendor/golang.org/x/sys/plan9/pwd_go15_plan9.go delete mode 100644 vendor/golang.org/x/sys/plan9/pwd_plan9.go delete mode 100644 vendor/golang.org/x/sys/plan9/race.go delete mode 100644 vendor/golang.org/x/sys/plan9/race0.go delete mode 100644 vendor/golang.org/x/sys/plan9/str.go delete mode 100644 vendor/golang.org/x/sys/plan9/syscall.go delete mode 100644 vendor/golang.org/x/sys/plan9/syscall_plan9.go delete mode 100644 vendor/golang.org/x/sys/plan9/zsyscall_plan9_386.go delete mode 100644 vendor/golang.org/x/sys/plan9/zsyscall_plan9_amd64.go delete mode 100644 vendor/golang.org/x/sys/plan9/zsyscall_plan9_arm.go delete mode 100644 vendor/golang.org/x/sys/plan9/zsysnum_plan9.go delete mode 100644 vendor/golang.org/x/sys/unix/.gitignore delete mode 100644 vendor/golang.org/x/sys/unix/README.md delete mode 100644 vendor/golang.org/x/sys/unix/affinity_linux.go delete mode 100644 vendor/golang.org/x/sys/unix/aliases.go delete mode 100644 vendor/golang.org/x/sys/unix/asm_aix_ppc64.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_bsd_386.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_bsd_amd64.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_bsd_arm.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_bsd_arm64.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_bsd_ppc64.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_bsd_riscv64.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_linux_386.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_linux_amd64.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_linux_arm.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_linux_arm64.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_linux_loong64.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_linux_mips64x.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_linux_mipsx.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_linux_riscv64.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_linux_s390x.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_openbsd_mips64.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_solaris_amd64.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_zos_s390x.s delete mode 100644 vendor/golang.org/x/sys/unix/bluetooth_linux.go delete mode 100644 vendor/golang.org/x/sys/unix/cap_freebsd.go delete mode 100644 vendor/golang.org/x/sys/unix/constants.go delete mode 100644 vendor/golang.org/x/sys/unix/dev_aix_ppc.go delete mode 100644 vendor/golang.org/x/sys/unix/dev_aix_ppc64.go delete mode 100644 vendor/golang.org/x/sys/unix/dev_darwin.go delete mode 100644 vendor/golang.org/x/sys/unix/dev_dragonfly.go delete mode 100644 vendor/golang.org/x/sys/unix/dev_freebsd.go delete mode 100644 vendor/golang.org/x/sys/unix/dev_linux.go delete mode 100644 vendor/golang.org/x/sys/unix/dev_netbsd.go delete mode 100644 vendor/golang.org/x/sys/unix/dev_openbsd.go delete mode 100644 vendor/golang.org/x/sys/unix/dev_zos.go delete mode 100644 vendor/golang.org/x/sys/unix/dirent.go delete mode 100644 vendor/golang.org/x/sys/unix/endian_big.go delete mode 100644 vendor/golang.org/x/sys/unix/endian_little.go delete mode 100644 vendor/golang.org/x/sys/unix/env_unix.go delete mode 100644 vendor/golang.org/x/sys/unix/epoll_zos.go delete mode 100644 vendor/golang.org/x/sys/unix/fcntl.go delete mode 100644 vendor/golang.org/x/sys/unix/fcntl_darwin.go delete mode 100644 vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go delete mode 100644 vendor/golang.org/x/sys/unix/fdset.go delete mode 100644 vendor/golang.org/x/sys/unix/fstatfs_zos.go delete mode 100644 vendor/golang.org/x/sys/unix/gccgo.go delete mode 100644 vendor/golang.org/x/sys/unix/gccgo_c.c delete mode 100644 vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/ifreq_linux.go delete mode 100644 vendor/golang.org/x/sys/unix/ioctl.go delete mode 100644 vendor/golang.org/x/sys/unix/ioctl_linux.go delete mode 100644 vendor/golang.org/x/sys/unix/ioctl_zos.go delete mode 100644 vendor/golang.org/x/sys/unix/mkall.sh delete mode 100644 vendor/golang.org/x/sys/unix/mkerrors.sh delete mode 100644 vendor/golang.org/x/sys/unix/pagesize_unix.go delete mode 100644 vendor/golang.org/x/sys/unix/pledge_openbsd.go delete mode 100644 vendor/golang.org/x/sys/unix/ptrace_darwin.go delete mode 100644 vendor/golang.org/x/sys/unix/ptrace_ios.go delete mode 100644 vendor/golang.org/x/sys/unix/race.go delete mode 100644 vendor/golang.org/x/sys/unix/race0.go delete mode 100644 vendor/golang.org/x/sys/unix/readdirent_getdents.go delete mode 100644 vendor/golang.org/x/sys/unix/readdirent_getdirentries.go delete mode 100644 vendor/golang.org/x/sys/unix/sockcmsg_dragonfly.go delete mode 100644 vendor/golang.org/x/sys/unix/sockcmsg_linux.go delete mode 100644 vendor/golang.org/x/sys/unix/sockcmsg_unix.go delete mode 100644 vendor/golang.org/x/sys/unix/sockcmsg_unix_other.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_aix.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_aix_ppc.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_bsd.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_darwin.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_dragonfly.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_freebsd.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_freebsd_386.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_freebsd_riscv64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_hurd.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_hurd_386.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_illumos.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_386.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_alarm.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_gc.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_gc_386.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_gc_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_gccgo_386.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_gccgo_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_loong64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_ppc.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_s390x.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_netbsd.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_netbsd_386.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_netbsd_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_openbsd.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_openbsd_386.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_openbsd_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_openbsd_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_openbsd_libc.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_openbsd_mips64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_openbsd_ppc64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_openbsd_riscv64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_solaris.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_unix.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_unix_gc.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_zos_s390x.go delete mode 100644 vendor/golang.org/x/sys/unix/sysvshm_linux.go delete mode 100644 vendor/golang.org/x/sys/unix/sysvshm_unix.go delete mode 100644 vendor/golang.org/x/sys/unix/sysvshm_unix_other.go delete mode 100644 vendor/golang.org/x/sys/unix/timestruct.go delete mode 100644 vendor/golang.org/x/sys/unix/unveil_openbsd.go delete mode 100644 vendor/golang.org/x/sys/unix/xattr_bsd.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_aix_ppc.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_aix_ppc64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_freebsd_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_freebsd_riscv64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_386.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_mips.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_netbsd_386.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_netbsd_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_netbsd_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_netbsd_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_openbsd_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_openbsd_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_openbsd_mips64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_openbsd_ppc64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_openbsd_riscv64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_solaris_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_zos_s390x.go delete mode 100644 vendor/golang.org/x/sys/unix/zptrace_armnn_linux.go delete mode 100644 vendor/golang.org/x/sys/unix/zptrace_linux_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zptrace_mipsnn_linux.go delete mode 100644 vendor/golang.org/x/sys/unix/zptrace_mipsnnle_linux.go delete mode 100644 vendor/golang.org/x/sys/unix/zptrace_x86_linux.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_freebsd_riscv64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_illumos_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_386.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_loong64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_ppc.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.s delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.s delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.s delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.s delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.s delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.s delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.s delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_zos_s390x.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysctl_openbsd_386.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysctl_openbsd_mips64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysctl_openbsd_ppc64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysctl_openbsd_riscv64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_darwin_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_freebsd_riscv64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_386.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_netbsd_386.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_netbsd_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_openbsd_386.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_openbsd_mips64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_openbsd_ppc64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_openbsd_riscv64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_zos_s390x.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_aix_ppc.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_aix_ppc64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_freebsd_riscv64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_386.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_loong64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_mips.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_netbsd_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_openbsd_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_openbsd_mips64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_openbsd_ppc64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_openbsd_riscv64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_zos_s390x.go delete mode 100644 vendor/golang.org/x/sys/windows/aliases.go delete mode 100644 vendor/golang.org/x/sys/windows/dll_windows.go delete mode 100644 vendor/golang.org/x/sys/windows/empty.s delete mode 100644 vendor/golang.org/x/sys/windows/env_windows.go delete mode 100644 vendor/golang.org/x/sys/windows/eventlog.go delete mode 100644 vendor/golang.org/x/sys/windows/exec_windows.go delete mode 100644 vendor/golang.org/x/sys/windows/memory_windows.go delete mode 100644 vendor/golang.org/x/sys/windows/mkerrors.bash delete mode 100644 vendor/golang.org/x/sys/windows/mkknownfolderids.bash delete mode 100644 vendor/golang.org/x/sys/windows/mksyscall.go delete mode 100644 vendor/golang.org/x/sys/windows/race.go delete mode 100644 vendor/golang.org/x/sys/windows/race0.go delete mode 100644 vendor/golang.org/x/sys/windows/security_windows.go delete mode 100644 vendor/golang.org/x/sys/windows/service.go delete mode 100644 vendor/golang.org/x/sys/windows/setupapi_windows.go delete mode 100644 vendor/golang.org/x/sys/windows/str.go delete mode 100644 vendor/golang.org/x/sys/windows/syscall.go delete mode 100644 vendor/golang.org/x/sys/windows/syscall_windows.go delete mode 100644 vendor/golang.org/x/sys/windows/types_windows.go delete mode 100644 vendor/golang.org/x/sys/windows/types_windows_386.go delete mode 100644 vendor/golang.org/x/sys/windows/types_windows_amd64.go delete mode 100644 vendor/golang.org/x/sys/windows/types_windows_arm.go delete mode 100644 vendor/golang.org/x/sys/windows/types_windows_arm64.go delete mode 100644 vendor/golang.org/x/sys/windows/zerrors_windows.go delete mode 100644 vendor/golang.org/x/sys/windows/zknownfolderids_windows.go delete mode 100644 vendor/golang.org/x/sys/windows/zsyscall_windows.go delete mode 100644 vendor/golang.org/x/term/CONTRIBUTING.md delete mode 100644 vendor/golang.org/x/term/LICENSE delete mode 100644 vendor/golang.org/x/term/PATENTS delete mode 100644 vendor/golang.org/x/term/README.md delete mode 100644 vendor/golang.org/x/term/codereview.cfg delete mode 100644 vendor/golang.org/x/term/term.go delete mode 100644 vendor/golang.org/x/term/term_plan9.go delete mode 100644 vendor/golang.org/x/term/term_unix.go delete mode 100644 vendor/golang.org/x/term/term_unix_bsd.go delete mode 100644 vendor/golang.org/x/term/term_unix_other.go delete mode 100644 vendor/golang.org/x/term/term_unsupported.go delete mode 100644 vendor/golang.org/x/term/term_windows.go delete mode 100644 vendor/golang.org/x/term/terminal.go delete mode 100644 vendor/golang.org/x/text/LICENSE delete mode 100644 vendor/golang.org/x/text/PATENTS delete mode 100644 vendor/golang.org/x/text/secure/bidirule/bidirule.go delete mode 100644 vendor/golang.org/x/text/secure/bidirule/bidirule10.0.0.go delete mode 100644 vendor/golang.org/x/text/secure/bidirule/bidirule9.0.0.go delete mode 100644 vendor/golang.org/x/text/transform/transform.go delete mode 100644 vendor/golang.org/x/text/unicode/bidi/bidi.go delete mode 100644 vendor/golang.org/x/text/unicode/bidi/bracket.go delete mode 100644 vendor/golang.org/x/text/unicode/bidi/core.go delete mode 100644 vendor/golang.org/x/text/unicode/bidi/prop.go delete mode 100644 vendor/golang.org/x/text/unicode/bidi/tables10.0.0.go delete mode 100644 vendor/golang.org/x/text/unicode/bidi/tables11.0.0.go delete mode 100644 vendor/golang.org/x/text/unicode/bidi/tables12.0.0.go delete mode 100644 vendor/golang.org/x/text/unicode/bidi/tables13.0.0.go delete mode 100644 vendor/golang.org/x/text/unicode/bidi/tables9.0.0.go delete mode 100644 vendor/golang.org/x/text/unicode/bidi/trieval.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/composition.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/forminfo.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/input.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/iter.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/normalize.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/readwriter.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/tables10.0.0.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/tables11.0.0.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/tables12.0.0.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/tables13.0.0.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/tables9.0.0.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/transform.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/trie.go delete mode 100644 vendor/golang.org/x/text/width/kind_string.go delete mode 100644 vendor/golang.org/x/text/width/tables10.0.0.go delete mode 100644 vendor/golang.org/x/text/width/tables11.0.0.go delete mode 100644 vendor/golang.org/x/text/width/tables12.0.0.go delete mode 100644 vendor/golang.org/x/text/width/tables13.0.0.go delete mode 100644 vendor/golang.org/x/text/width/tables9.0.0.go delete mode 100644 vendor/golang.org/x/text/width/transform.go delete mode 100644 vendor/golang.org/x/text/width/trieval.go delete mode 100644 vendor/golang.org/x/text/width/width.go delete mode 100644 vendor/golang.org/x/time/AUTHORS delete mode 100644 vendor/golang.org/x/time/CONTRIBUTORS delete mode 100644 vendor/golang.org/x/time/LICENSE delete mode 100644 vendor/golang.org/x/time/PATENTS delete mode 100644 vendor/golang.org/x/time/rate/rate.go delete mode 100644 vendor/google.golang.org/appengine/.travis.yml delete mode 100644 vendor/google.golang.org/appengine/CONTRIBUTING.md delete mode 100644 vendor/google.golang.org/appengine/LICENSE delete mode 100644 vendor/google.golang.org/appengine/README.md delete mode 100644 vendor/google.golang.org/appengine/appengine.go delete mode 100644 vendor/google.golang.org/appengine/appengine_vm.go delete mode 100644 vendor/google.golang.org/appengine/errors.go delete mode 100644 vendor/google.golang.org/appengine/identity.go delete mode 100644 vendor/google.golang.org/appengine/internal/api.go delete mode 100644 vendor/google.golang.org/appengine/internal/api_classic.go delete mode 100644 vendor/google.golang.org/appengine/internal/api_common.go delete mode 100644 vendor/google.golang.org/appengine/internal/app_id.go delete mode 100644 vendor/google.golang.org/appengine/internal/app_identity/app_identity_service.pb.go delete mode 100644 vendor/google.golang.org/appengine/internal/app_identity/app_identity_service.proto delete mode 100644 vendor/google.golang.org/appengine/internal/base/api_base.pb.go delete mode 100644 vendor/google.golang.org/appengine/internal/base/api_base.proto delete mode 100644 vendor/google.golang.org/appengine/internal/datastore/datastore_v3.pb.go delete mode 100644 vendor/google.golang.org/appengine/internal/datastore/datastore_v3.proto delete mode 100644 vendor/google.golang.org/appengine/internal/identity.go delete mode 100644 vendor/google.golang.org/appengine/internal/identity_classic.go delete mode 100644 vendor/google.golang.org/appengine/internal/identity_flex.go delete mode 100644 vendor/google.golang.org/appengine/internal/identity_vm.go delete mode 100644 vendor/google.golang.org/appengine/internal/internal.go delete mode 100644 vendor/google.golang.org/appengine/internal/log/log_service.pb.go delete mode 100644 vendor/google.golang.org/appengine/internal/log/log_service.proto delete mode 100644 vendor/google.golang.org/appengine/internal/main.go delete mode 100644 vendor/google.golang.org/appengine/internal/main_common.go delete mode 100644 vendor/google.golang.org/appengine/internal/main_vm.go delete mode 100644 vendor/google.golang.org/appengine/internal/metadata.go delete mode 100644 vendor/google.golang.org/appengine/internal/modules/modules_service.pb.go delete mode 100644 vendor/google.golang.org/appengine/internal/modules/modules_service.proto delete mode 100644 vendor/google.golang.org/appengine/internal/net.go delete mode 100644 vendor/google.golang.org/appengine/internal/regen.sh delete mode 100644 vendor/google.golang.org/appengine/internal/remote_api/remote_api.pb.go delete mode 100644 vendor/google.golang.org/appengine/internal/remote_api/remote_api.proto delete mode 100644 vendor/google.golang.org/appengine/internal/transaction.go delete mode 100644 vendor/google.golang.org/appengine/internal/urlfetch/urlfetch_service.pb.go delete mode 100644 vendor/google.golang.org/appengine/internal/urlfetch/urlfetch_service.proto delete mode 100644 vendor/google.golang.org/appengine/namespace.go delete mode 100644 vendor/google.golang.org/appengine/timeout.go delete mode 100644 vendor/google.golang.org/appengine/travis_install.sh delete mode 100644 vendor/google.golang.org/appengine/travis_test.sh delete mode 100644 vendor/google.golang.org/appengine/urlfetch/urlfetch.go delete mode 100644 vendor/google.golang.org/protobuf/LICENSE delete mode 100644 vendor/google.golang.org/protobuf/PATENTS delete mode 100644 vendor/google.golang.org/protobuf/encoding/prototext/decode.go delete mode 100644 vendor/google.golang.org/protobuf/encoding/prototext/doc.go delete mode 100644 vendor/google.golang.org/protobuf/encoding/prototext/encode.go delete mode 100644 vendor/google.golang.org/protobuf/encoding/protowire/wire.go delete mode 100644 vendor/google.golang.org/protobuf/internal/descfmt/stringer.go delete mode 100644 vendor/google.golang.org/protobuf/internal/descopts/options.go delete mode 100644 vendor/google.golang.org/protobuf/internal/detrand/rand.go delete mode 100644 vendor/google.golang.org/protobuf/internal/encoding/defval/default.go delete mode 100644 vendor/google.golang.org/protobuf/internal/encoding/messageset/messageset.go delete mode 100644 vendor/google.golang.org/protobuf/internal/encoding/tag/tag.go delete mode 100644 vendor/google.golang.org/protobuf/internal/encoding/text/decode.go delete mode 100644 vendor/google.golang.org/protobuf/internal/encoding/text/decode_number.go delete mode 100644 vendor/google.golang.org/protobuf/internal/encoding/text/decode_string.go delete mode 100644 vendor/google.golang.org/protobuf/internal/encoding/text/decode_token.go delete mode 100644 vendor/google.golang.org/protobuf/internal/encoding/text/doc.go delete mode 100644 vendor/google.golang.org/protobuf/internal/encoding/text/encode.go delete mode 100644 vendor/google.golang.org/protobuf/internal/errors/errors.go delete mode 100644 vendor/google.golang.org/protobuf/internal/errors/is_go112.go delete mode 100644 vendor/google.golang.org/protobuf/internal/errors/is_go113.go delete mode 100644 vendor/google.golang.org/protobuf/internal/filedesc/build.go delete mode 100644 vendor/google.golang.org/protobuf/internal/filedesc/desc.go delete mode 100644 vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go delete mode 100644 vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go delete mode 100644 vendor/google.golang.org/protobuf/internal/filedesc/desc_list.go delete mode 100644 vendor/google.golang.org/protobuf/internal/filedesc/desc_list_gen.go delete mode 100644 vendor/google.golang.org/protobuf/internal/filedesc/placeholder.go delete mode 100644 vendor/google.golang.org/protobuf/internal/filetype/build.go delete mode 100644 vendor/google.golang.org/protobuf/internal/flags/flags.go delete mode 100644 vendor/google.golang.org/protobuf/internal/flags/proto_legacy_disable.go delete mode 100644 vendor/google.golang.org/protobuf/internal/flags/proto_legacy_enable.go delete mode 100644 vendor/google.golang.org/protobuf/internal/genid/any_gen.go delete mode 100644 vendor/google.golang.org/protobuf/internal/genid/api_gen.go delete mode 100644 vendor/google.golang.org/protobuf/internal/genid/descriptor_gen.go delete mode 100644 vendor/google.golang.org/protobuf/internal/genid/doc.go delete mode 100644 vendor/google.golang.org/protobuf/internal/genid/duration_gen.go delete mode 100644 vendor/google.golang.org/protobuf/internal/genid/empty_gen.go delete mode 100644 vendor/google.golang.org/protobuf/internal/genid/field_mask_gen.go delete mode 100644 vendor/google.golang.org/protobuf/internal/genid/goname.go delete mode 100644 vendor/google.golang.org/protobuf/internal/genid/map_entry.go delete mode 100644 vendor/google.golang.org/protobuf/internal/genid/source_context_gen.go delete mode 100644 vendor/google.golang.org/protobuf/internal/genid/struct_gen.go delete mode 100644 vendor/google.golang.org/protobuf/internal/genid/timestamp_gen.go delete mode 100644 vendor/google.golang.org/protobuf/internal/genid/type_gen.go delete mode 100644 vendor/google.golang.org/protobuf/internal/genid/wrappers.go delete mode 100644 vendor/google.golang.org/protobuf/internal/genid/wrappers_gen.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/api_export.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/checkinit.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/codec_extension.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/codec_field.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/codec_gen.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/codec_map.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/codec_map_go111.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/codec_map_go112.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/codec_message.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/codec_messageset.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/codec_reflect.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/codec_tables.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/codec_unsafe.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/convert.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/convert_list.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/convert_map.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/decode.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/encode.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/enum.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/extension.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/legacy_enum.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/legacy_export.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/legacy_extension.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/legacy_file.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/legacy_message.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/merge.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/merge_gen.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/message.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/message_reflect.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/message_reflect_field.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/message_reflect_gen.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/pointer_reflect.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/pointer_unsafe.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/validate.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/weak.go delete mode 100644 vendor/google.golang.org/protobuf/internal/order/order.go delete mode 100644 vendor/google.golang.org/protobuf/internal/order/range.go delete mode 100644 vendor/google.golang.org/protobuf/internal/pragma/pragma.go delete mode 100644 vendor/google.golang.org/protobuf/internal/set/ints.go delete mode 100644 vendor/google.golang.org/protobuf/internal/strs/strings.go delete mode 100644 vendor/google.golang.org/protobuf/internal/strs/strings_pure.go delete mode 100644 vendor/google.golang.org/protobuf/internal/strs/strings_unsafe.go delete mode 100644 vendor/google.golang.org/protobuf/internal/version/version.go delete mode 100644 vendor/google.golang.org/protobuf/proto/checkinit.go delete mode 100644 vendor/google.golang.org/protobuf/proto/decode.go delete mode 100644 vendor/google.golang.org/protobuf/proto/decode_gen.go delete mode 100644 vendor/google.golang.org/protobuf/proto/doc.go delete mode 100644 vendor/google.golang.org/protobuf/proto/encode.go delete mode 100644 vendor/google.golang.org/protobuf/proto/encode_gen.go delete mode 100644 vendor/google.golang.org/protobuf/proto/equal.go delete mode 100644 vendor/google.golang.org/protobuf/proto/extension.go delete mode 100644 vendor/google.golang.org/protobuf/proto/merge.go delete mode 100644 vendor/google.golang.org/protobuf/proto/messageset.go delete mode 100644 vendor/google.golang.org/protobuf/proto/proto.go delete mode 100644 vendor/google.golang.org/protobuf/proto/proto_methods.go delete mode 100644 vendor/google.golang.org/protobuf/proto/proto_reflect.go delete mode 100644 vendor/google.golang.org/protobuf/proto/reset.go delete mode 100644 vendor/google.golang.org/protobuf/proto/size.go delete mode 100644 vendor/google.golang.org/protobuf/proto/size_gen.go delete mode 100644 vendor/google.golang.org/protobuf/proto/wrappers.go delete mode 100644 vendor/google.golang.org/protobuf/reflect/protodesc/desc.go delete mode 100644 vendor/google.golang.org/protobuf/reflect/protodesc/desc_init.go delete mode 100644 vendor/google.golang.org/protobuf/reflect/protodesc/desc_resolve.go delete mode 100644 vendor/google.golang.org/protobuf/reflect/protodesc/desc_validate.go delete mode 100644 vendor/google.golang.org/protobuf/reflect/protodesc/proto.go delete mode 100644 vendor/google.golang.org/protobuf/reflect/protoreflect/methods.go delete mode 100644 vendor/google.golang.org/protobuf/reflect/protoreflect/proto.go delete mode 100644 vendor/google.golang.org/protobuf/reflect/protoreflect/source.go delete mode 100644 vendor/google.golang.org/protobuf/reflect/protoreflect/source_gen.go delete mode 100644 vendor/google.golang.org/protobuf/reflect/protoreflect/type.go delete mode 100644 vendor/google.golang.org/protobuf/reflect/protoreflect/value.go delete mode 100644 vendor/google.golang.org/protobuf/reflect/protoreflect/value_equal.go delete mode 100644 vendor/google.golang.org/protobuf/reflect/protoreflect/value_pure.go delete mode 100644 vendor/google.golang.org/protobuf/reflect/protoreflect/value_union.go delete mode 100644 vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe.go delete mode 100644 vendor/google.golang.org/protobuf/reflect/protoregistry/registry.go delete mode 100644 vendor/google.golang.org/protobuf/runtime/protoiface/legacy.go delete mode 100644 vendor/google.golang.org/protobuf/runtime/protoiface/methods.go delete mode 100644 vendor/google.golang.org/protobuf/runtime/protoimpl/impl.go delete mode 100644 vendor/google.golang.org/protobuf/runtime/protoimpl/version.go delete mode 100644 vendor/google.golang.org/protobuf/types/descriptorpb/descriptor.pb.go delete mode 100644 vendor/google.golang.org/protobuf/types/known/anypb/any.pb.go delete mode 100644 vendor/google.golang.org/protobuf/types/known/durationpb/duration.pb.go delete mode 100644 vendor/google.golang.org/protobuf/types/known/timestamppb/timestamp.pb.go delete mode 100644 vendor/gopkg.in/inf.v0/LICENSE delete mode 100644 vendor/gopkg.in/inf.v0/dec.go delete mode 100644 vendor/gopkg.in/inf.v0/rounder.go delete mode 100644 vendor/gopkg.in/yaml.v2/.travis.yml delete mode 100644 vendor/gopkg.in/yaml.v2/LICENSE delete mode 100644 vendor/gopkg.in/yaml.v2/LICENSE.libyaml delete mode 100644 vendor/gopkg.in/yaml.v2/NOTICE delete mode 100644 vendor/gopkg.in/yaml.v2/README.md delete mode 100644 vendor/gopkg.in/yaml.v2/apic.go delete mode 100644 vendor/gopkg.in/yaml.v2/decode.go delete mode 100644 vendor/gopkg.in/yaml.v2/emitterc.go delete mode 100644 vendor/gopkg.in/yaml.v2/encode.go delete mode 100644 vendor/gopkg.in/yaml.v2/parserc.go delete mode 100644 vendor/gopkg.in/yaml.v2/readerc.go delete mode 100644 vendor/gopkg.in/yaml.v2/resolve.go delete mode 100644 vendor/gopkg.in/yaml.v2/scannerc.go delete mode 100644 vendor/gopkg.in/yaml.v2/sorter.go delete mode 100644 vendor/gopkg.in/yaml.v2/writerc.go delete mode 100644 vendor/gopkg.in/yaml.v2/yaml.go delete mode 100644 vendor/gopkg.in/yaml.v2/yamlh.go delete mode 100644 vendor/gopkg.in/yaml.v2/yamlprivateh.go delete mode 100644 vendor/gopkg.in/yaml.v3/LICENSE delete mode 100644 vendor/gopkg.in/yaml.v3/NOTICE delete mode 100644 vendor/gopkg.in/yaml.v3/README.md delete mode 100644 vendor/gopkg.in/yaml.v3/apic.go delete mode 100644 vendor/gopkg.in/yaml.v3/decode.go delete mode 100644 vendor/gopkg.in/yaml.v3/emitterc.go delete mode 100644 vendor/gopkg.in/yaml.v3/encode.go delete mode 100644 vendor/gopkg.in/yaml.v3/parserc.go delete mode 100644 vendor/gopkg.in/yaml.v3/readerc.go delete mode 100644 vendor/gopkg.in/yaml.v3/resolve.go delete mode 100644 vendor/gopkg.in/yaml.v3/scannerc.go delete mode 100644 vendor/gopkg.in/yaml.v3/sorter.go delete mode 100644 vendor/gopkg.in/yaml.v3/writerc.go delete mode 100644 vendor/gopkg.in/yaml.v3/yaml.go delete mode 100644 vendor/gopkg.in/yaml.v3/yamlh.go delete mode 100644 vendor/gopkg.in/yaml.v3/yamlprivateh.go delete mode 100644 vendor/k8s.io/api/LICENSE delete mode 100644 vendor/k8s.io/api/admission/v1/doc.go delete mode 100644 vendor/k8s.io/api/admission/v1/generated.pb.go delete mode 100644 vendor/k8s.io/api/admission/v1/generated.proto delete mode 100644 vendor/k8s.io/api/admission/v1/register.go delete mode 100644 vendor/k8s.io/api/admission/v1/types.go delete mode 100644 vendor/k8s.io/api/admission/v1/types_swagger_doc_generated.go delete mode 100644 vendor/k8s.io/api/admission/v1/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/api/admission/v1beta1/doc.go delete mode 100644 vendor/k8s.io/api/admission/v1beta1/generated.pb.go delete mode 100644 vendor/k8s.io/api/admission/v1beta1/generated.proto delete mode 100644 vendor/k8s.io/api/admission/v1beta1/register.go delete mode 100644 vendor/k8s.io/api/admission/v1beta1/types.go delete mode 100644 vendor/k8s.io/api/admission/v1beta1/types_swagger_doc_generated.go delete mode 100644 vendor/k8s.io/api/admission/v1beta1/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/api/admission/v1beta1/zz_generated.prerelease-lifecycle.go delete mode 100644 vendor/k8s.io/api/admissionregistration/v1/doc.go delete mode 100644 vendor/k8s.io/api/admissionregistration/v1/generated.pb.go delete mode 100644 vendor/k8s.io/api/admissionregistration/v1/generated.proto delete mode 100644 vendor/k8s.io/api/admissionregistration/v1/register.go delete mode 100644 vendor/k8s.io/api/admissionregistration/v1/types.go delete mode 100644 vendor/k8s.io/api/admissionregistration/v1/types_swagger_doc_generated.go delete mode 100644 vendor/k8s.io/api/admissionregistration/v1/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/api/admissionregistration/v1beta1/doc.go delete mode 100644 vendor/k8s.io/api/admissionregistration/v1beta1/generated.pb.go delete mode 100644 vendor/k8s.io/api/admissionregistration/v1beta1/generated.proto delete mode 100644 vendor/k8s.io/api/admissionregistration/v1beta1/register.go delete mode 100644 vendor/k8s.io/api/admissionregistration/v1beta1/types.go delete mode 100644 vendor/k8s.io/api/admissionregistration/v1beta1/types_swagger_doc_generated.go delete mode 100644 vendor/k8s.io/api/admissionregistration/v1beta1/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/api/admissionregistration/v1beta1/zz_generated.prerelease-lifecycle.go delete mode 100644 vendor/k8s.io/api/apiserverinternal/v1alpha1/doc.go delete mode 100644 vendor/k8s.io/api/apiserverinternal/v1alpha1/generated.pb.go delete mode 100644 vendor/k8s.io/api/apiserverinternal/v1alpha1/generated.proto delete mode 100644 vendor/k8s.io/api/apiserverinternal/v1alpha1/register.go delete mode 100644 vendor/k8s.io/api/apiserverinternal/v1alpha1/types.go delete mode 100644 vendor/k8s.io/api/apiserverinternal/v1alpha1/types_swagger_doc_generated.go delete mode 100644 vendor/k8s.io/api/apiserverinternal/v1alpha1/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/api/apps/v1/doc.go delete mode 100644 vendor/k8s.io/api/apps/v1/generated.pb.go delete mode 100644 vendor/k8s.io/api/apps/v1/generated.proto delete mode 100644 vendor/k8s.io/api/apps/v1/register.go delete mode 100644 vendor/k8s.io/api/apps/v1/types.go delete mode 100644 vendor/k8s.io/api/apps/v1/types_swagger_doc_generated.go delete mode 100644 vendor/k8s.io/api/apps/v1/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/api/apps/v1beta1/doc.go delete mode 100644 vendor/k8s.io/api/apps/v1beta1/generated.pb.go delete mode 100644 vendor/k8s.io/api/apps/v1beta1/generated.proto delete mode 100644 vendor/k8s.io/api/apps/v1beta1/register.go delete mode 100644 vendor/k8s.io/api/apps/v1beta1/types.go delete mode 100644 vendor/k8s.io/api/apps/v1beta1/types_swagger_doc_generated.go delete mode 100644 vendor/k8s.io/api/apps/v1beta1/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/api/apps/v1beta1/zz_generated.prerelease-lifecycle.go delete mode 100644 vendor/k8s.io/api/apps/v1beta2/doc.go delete mode 100644 vendor/k8s.io/api/apps/v1beta2/generated.pb.go delete mode 100644 vendor/k8s.io/api/apps/v1beta2/generated.proto delete mode 100644 vendor/k8s.io/api/apps/v1beta2/register.go delete mode 100644 vendor/k8s.io/api/apps/v1beta2/types.go delete mode 100644 vendor/k8s.io/api/apps/v1beta2/types_swagger_doc_generated.go delete mode 100644 vendor/k8s.io/api/apps/v1beta2/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/api/apps/v1beta2/zz_generated.prerelease-lifecycle.go delete mode 100644 vendor/k8s.io/api/authentication/v1/doc.go delete mode 100644 vendor/k8s.io/api/authentication/v1/generated.pb.go delete mode 100644 vendor/k8s.io/api/authentication/v1/generated.proto delete mode 100644 vendor/k8s.io/api/authentication/v1/register.go delete mode 100644 vendor/k8s.io/api/authentication/v1/types.go delete mode 100644 vendor/k8s.io/api/authentication/v1/types_swagger_doc_generated.go delete mode 100644 vendor/k8s.io/api/authentication/v1/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/api/authentication/v1beta1/doc.go delete mode 100644 vendor/k8s.io/api/authentication/v1beta1/generated.pb.go delete mode 100644 vendor/k8s.io/api/authentication/v1beta1/generated.proto delete mode 100644 vendor/k8s.io/api/authentication/v1beta1/register.go delete mode 100644 vendor/k8s.io/api/authentication/v1beta1/types.go delete mode 100644 vendor/k8s.io/api/authentication/v1beta1/types_swagger_doc_generated.go delete mode 100644 vendor/k8s.io/api/authentication/v1beta1/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/api/authentication/v1beta1/zz_generated.prerelease-lifecycle.go delete mode 100644 vendor/k8s.io/api/authorization/v1/doc.go delete mode 100644 vendor/k8s.io/api/authorization/v1/generated.pb.go delete mode 100644 vendor/k8s.io/api/authorization/v1/generated.proto delete mode 100644 vendor/k8s.io/api/authorization/v1/register.go delete mode 100644 vendor/k8s.io/api/authorization/v1/types.go delete mode 100644 vendor/k8s.io/api/authorization/v1/types_swagger_doc_generated.go delete mode 100644 vendor/k8s.io/api/authorization/v1/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/api/authorization/v1beta1/doc.go delete mode 100644 vendor/k8s.io/api/authorization/v1beta1/generated.pb.go delete mode 100644 vendor/k8s.io/api/authorization/v1beta1/generated.proto delete mode 100644 vendor/k8s.io/api/authorization/v1beta1/register.go delete mode 100644 vendor/k8s.io/api/authorization/v1beta1/types.go delete mode 100644 vendor/k8s.io/api/authorization/v1beta1/types_swagger_doc_generated.go delete mode 100644 vendor/k8s.io/api/authorization/v1beta1/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/api/authorization/v1beta1/zz_generated.prerelease-lifecycle.go delete mode 100644 vendor/k8s.io/api/autoscaling/v1/doc.go delete mode 100644 vendor/k8s.io/api/autoscaling/v1/generated.pb.go delete mode 100644 vendor/k8s.io/api/autoscaling/v1/generated.proto delete mode 100644 vendor/k8s.io/api/autoscaling/v1/register.go delete mode 100644 vendor/k8s.io/api/autoscaling/v1/types.go delete mode 100644 vendor/k8s.io/api/autoscaling/v1/types_swagger_doc_generated.go delete mode 100644 vendor/k8s.io/api/autoscaling/v1/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/api/autoscaling/v2/doc.go delete mode 100644 vendor/k8s.io/api/autoscaling/v2/generated.pb.go delete mode 100644 vendor/k8s.io/api/autoscaling/v2/generated.proto delete mode 100644 vendor/k8s.io/api/autoscaling/v2/register.go delete mode 100644 vendor/k8s.io/api/autoscaling/v2/types.go delete mode 100644 vendor/k8s.io/api/autoscaling/v2/types_swagger_doc_generated.go delete mode 100644 vendor/k8s.io/api/autoscaling/v2/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/api/autoscaling/v2beta1/doc.go delete mode 100644 vendor/k8s.io/api/autoscaling/v2beta1/generated.pb.go delete mode 100644 vendor/k8s.io/api/autoscaling/v2beta1/generated.proto delete mode 100644 vendor/k8s.io/api/autoscaling/v2beta1/register.go delete mode 100644 vendor/k8s.io/api/autoscaling/v2beta1/types.go delete mode 100644 vendor/k8s.io/api/autoscaling/v2beta1/types_swagger_doc_generated.go delete mode 100644 vendor/k8s.io/api/autoscaling/v2beta1/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/api/autoscaling/v2beta1/zz_generated.prerelease-lifecycle.go delete mode 100644 vendor/k8s.io/api/autoscaling/v2beta2/doc.go delete mode 100644 vendor/k8s.io/api/autoscaling/v2beta2/generated.pb.go delete mode 100644 vendor/k8s.io/api/autoscaling/v2beta2/generated.proto delete mode 100644 vendor/k8s.io/api/autoscaling/v2beta2/register.go delete mode 100644 vendor/k8s.io/api/autoscaling/v2beta2/types.go delete mode 100644 vendor/k8s.io/api/autoscaling/v2beta2/types_swagger_doc_generated.go delete mode 100644 vendor/k8s.io/api/autoscaling/v2beta2/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/api/autoscaling/v2beta2/zz_generated.prerelease-lifecycle.go delete mode 100644 vendor/k8s.io/api/batch/v1/doc.go delete mode 100644 vendor/k8s.io/api/batch/v1/generated.pb.go delete mode 100644 vendor/k8s.io/api/batch/v1/generated.proto delete mode 100644 vendor/k8s.io/api/batch/v1/register.go delete mode 100644 vendor/k8s.io/api/batch/v1/types.go delete mode 100644 vendor/k8s.io/api/batch/v1/types_swagger_doc_generated.go delete mode 100644 vendor/k8s.io/api/batch/v1/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/api/batch/v1beta1/doc.go delete mode 100644 vendor/k8s.io/api/batch/v1beta1/generated.pb.go delete mode 100644 vendor/k8s.io/api/batch/v1beta1/generated.proto delete mode 100644 vendor/k8s.io/api/batch/v1beta1/register.go delete mode 100644 vendor/k8s.io/api/batch/v1beta1/types.go delete mode 100644 vendor/k8s.io/api/batch/v1beta1/types_swagger_doc_generated.go delete mode 100644 vendor/k8s.io/api/batch/v1beta1/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/api/batch/v1beta1/zz_generated.prerelease-lifecycle.go delete mode 100644 vendor/k8s.io/api/certificates/v1/doc.go delete mode 100644 vendor/k8s.io/api/certificates/v1/generated.pb.go delete mode 100644 vendor/k8s.io/api/certificates/v1/generated.proto delete mode 100644 vendor/k8s.io/api/certificates/v1/register.go delete mode 100644 vendor/k8s.io/api/certificates/v1/types.go delete mode 100644 vendor/k8s.io/api/certificates/v1/types_swagger_doc_generated.go delete mode 100644 vendor/k8s.io/api/certificates/v1/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/api/certificates/v1beta1/doc.go delete mode 100644 vendor/k8s.io/api/certificates/v1beta1/generated.pb.go delete mode 100644 vendor/k8s.io/api/certificates/v1beta1/generated.proto delete mode 100644 vendor/k8s.io/api/certificates/v1beta1/register.go delete mode 100644 vendor/k8s.io/api/certificates/v1beta1/types.go delete mode 100644 vendor/k8s.io/api/certificates/v1beta1/types_swagger_doc_generated.go delete mode 100644 vendor/k8s.io/api/certificates/v1beta1/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/api/certificates/v1beta1/zz_generated.prerelease-lifecycle.go delete mode 100644 vendor/k8s.io/api/coordination/v1/doc.go delete mode 100644 vendor/k8s.io/api/coordination/v1/generated.pb.go delete mode 100644 vendor/k8s.io/api/coordination/v1/generated.proto delete mode 100644 vendor/k8s.io/api/coordination/v1/register.go delete mode 100644 vendor/k8s.io/api/coordination/v1/types.go delete mode 100644 vendor/k8s.io/api/coordination/v1/types_swagger_doc_generated.go delete mode 100644 vendor/k8s.io/api/coordination/v1/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/api/coordination/v1beta1/doc.go delete mode 100644 vendor/k8s.io/api/coordination/v1beta1/generated.pb.go delete mode 100644 vendor/k8s.io/api/coordination/v1beta1/generated.proto delete mode 100644 vendor/k8s.io/api/coordination/v1beta1/register.go delete mode 100644 vendor/k8s.io/api/coordination/v1beta1/types.go delete mode 100644 vendor/k8s.io/api/coordination/v1beta1/types_swagger_doc_generated.go delete mode 100644 vendor/k8s.io/api/coordination/v1beta1/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/api/coordination/v1beta1/zz_generated.prerelease-lifecycle.go delete mode 100644 vendor/k8s.io/api/core/v1/annotation_key_constants.go delete mode 100644 vendor/k8s.io/api/core/v1/doc.go delete mode 100644 vendor/k8s.io/api/core/v1/generated.pb.go delete mode 100644 vendor/k8s.io/api/core/v1/generated.proto delete mode 100644 vendor/k8s.io/api/core/v1/lifecycle.go delete mode 100644 vendor/k8s.io/api/core/v1/objectreference.go delete mode 100644 vendor/k8s.io/api/core/v1/register.go delete mode 100644 vendor/k8s.io/api/core/v1/resource.go delete mode 100644 vendor/k8s.io/api/core/v1/taint.go delete mode 100644 vendor/k8s.io/api/core/v1/toleration.go delete mode 100644 vendor/k8s.io/api/core/v1/types.go delete mode 100644 vendor/k8s.io/api/core/v1/types_swagger_doc_generated.go delete mode 100644 vendor/k8s.io/api/core/v1/well_known_labels.go delete mode 100644 vendor/k8s.io/api/core/v1/well_known_taints.go delete mode 100644 vendor/k8s.io/api/core/v1/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/api/discovery/v1/doc.go delete mode 100644 vendor/k8s.io/api/discovery/v1/generated.pb.go delete mode 100644 vendor/k8s.io/api/discovery/v1/generated.proto delete mode 100644 vendor/k8s.io/api/discovery/v1/register.go delete mode 100644 vendor/k8s.io/api/discovery/v1/types.go delete mode 100644 vendor/k8s.io/api/discovery/v1/types_swagger_doc_generated.go delete mode 100644 vendor/k8s.io/api/discovery/v1/well_known_labels.go delete mode 100644 vendor/k8s.io/api/discovery/v1/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/api/discovery/v1beta1/doc.go delete mode 100644 vendor/k8s.io/api/discovery/v1beta1/generated.pb.go delete mode 100644 vendor/k8s.io/api/discovery/v1beta1/generated.proto delete mode 100644 vendor/k8s.io/api/discovery/v1beta1/register.go delete mode 100644 vendor/k8s.io/api/discovery/v1beta1/types.go delete mode 100644 vendor/k8s.io/api/discovery/v1beta1/types_swagger_doc_generated.go delete mode 100644 vendor/k8s.io/api/discovery/v1beta1/well_known_labels.go delete mode 100644 vendor/k8s.io/api/discovery/v1beta1/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/api/discovery/v1beta1/zz_generated.prerelease-lifecycle.go delete mode 100644 vendor/k8s.io/api/events/v1/doc.go delete mode 100644 vendor/k8s.io/api/events/v1/generated.pb.go delete mode 100644 vendor/k8s.io/api/events/v1/generated.proto delete mode 100644 vendor/k8s.io/api/events/v1/register.go delete mode 100644 vendor/k8s.io/api/events/v1/types.go delete mode 100644 vendor/k8s.io/api/events/v1/types_swagger_doc_generated.go delete mode 100644 vendor/k8s.io/api/events/v1/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/api/events/v1beta1/doc.go delete mode 100644 vendor/k8s.io/api/events/v1beta1/generated.pb.go delete mode 100644 vendor/k8s.io/api/events/v1beta1/generated.proto delete mode 100644 vendor/k8s.io/api/events/v1beta1/register.go delete mode 100644 vendor/k8s.io/api/events/v1beta1/types.go delete mode 100644 vendor/k8s.io/api/events/v1beta1/types_swagger_doc_generated.go delete mode 100644 vendor/k8s.io/api/events/v1beta1/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/api/events/v1beta1/zz_generated.prerelease-lifecycle.go delete mode 100644 vendor/k8s.io/api/extensions/v1beta1/doc.go delete mode 100644 vendor/k8s.io/api/extensions/v1beta1/generated.pb.go delete mode 100644 vendor/k8s.io/api/extensions/v1beta1/generated.proto delete mode 100644 vendor/k8s.io/api/extensions/v1beta1/register.go delete mode 100644 vendor/k8s.io/api/extensions/v1beta1/types.go delete mode 100644 vendor/k8s.io/api/extensions/v1beta1/types_swagger_doc_generated.go delete mode 100644 vendor/k8s.io/api/extensions/v1beta1/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/api/extensions/v1beta1/zz_generated.prerelease-lifecycle.go delete mode 100644 vendor/k8s.io/api/flowcontrol/v1alpha1/doc.go delete mode 100644 vendor/k8s.io/api/flowcontrol/v1alpha1/generated.pb.go delete mode 100644 vendor/k8s.io/api/flowcontrol/v1alpha1/generated.proto delete mode 100644 vendor/k8s.io/api/flowcontrol/v1alpha1/register.go delete mode 100644 vendor/k8s.io/api/flowcontrol/v1alpha1/types.go delete mode 100644 vendor/k8s.io/api/flowcontrol/v1alpha1/types_swagger_doc_generated.go delete mode 100644 vendor/k8s.io/api/flowcontrol/v1alpha1/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/api/flowcontrol/v1alpha1/zz_generated.prerelease-lifecycle.go delete mode 100644 vendor/k8s.io/api/flowcontrol/v1beta1/doc.go delete mode 100644 vendor/k8s.io/api/flowcontrol/v1beta1/generated.pb.go delete mode 100644 vendor/k8s.io/api/flowcontrol/v1beta1/generated.proto delete mode 100644 vendor/k8s.io/api/flowcontrol/v1beta1/register.go delete mode 100644 vendor/k8s.io/api/flowcontrol/v1beta1/types.go delete mode 100644 vendor/k8s.io/api/flowcontrol/v1beta1/types_swagger_doc_generated.go delete mode 100644 vendor/k8s.io/api/flowcontrol/v1beta1/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/api/flowcontrol/v1beta1/zz_generated.prerelease-lifecycle.go delete mode 100644 vendor/k8s.io/api/flowcontrol/v1beta2/doc.go delete mode 100644 vendor/k8s.io/api/flowcontrol/v1beta2/generated.pb.go delete mode 100644 vendor/k8s.io/api/flowcontrol/v1beta2/generated.proto delete mode 100644 vendor/k8s.io/api/flowcontrol/v1beta2/register.go delete mode 100644 vendor/k8s.io/api/flowcontrol/v1beta2/types.go delete mode 100644 vendor/k8s.io/api/flowcontrol/v1beta2/types_swagger_doc_generated.go delete mode 100644 vendor/k8s.io/api/flowcontrol/v1beta2/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/api/flowcontrol/v1beta2/zz_generated.prerelease-lifecycle.go delete mode 100644 vendor/k8s.io/api/imagepolicy/v1alpha1/doc.go delete mode 100644 vendor/k8s.io/api/imagepolicy/v1alpha1/generated.pb.go delete mode 100644 vendor/k8s.io/api/imagepolicy/v1alpha1/generated.proto delete mode 100644 vendor/k8s.io/api/imagepolicy/v1alpha1/register.go delete mode 100644 vendor/k8s.io/api/imagepolicy/v1alpha1/types.go delete mode 100644 vendor/k8s.io/api/imagepolicy/v1alpha1/types_swagger_doc_generated.go delete mode 100644 vendor/k8s.io/api/imagepolicy/v1alpha1/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/api/networking/v1/doc.go delete mode 100644 vendor/k8s.io/api/networking/v1/generated.pb.go delete mode 100644 vendor/k8s.io/api/networking/v1/generated.proto delete mode 100644 vendor/k8s.io/api/networking/v1/register.go delete mode 100644 vendor/k8s.io/api/networking/v1/types.go delete mode 100644 vendor/k8s.io/api/networking/v1/types_swagger_doc_generated.go delete mode 100644 vendor/k8s.io/api/networking/v1/well_known_annotations.go delete mode 100644 vendor/k8s.io/api/networking/v1/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/api/networking/v1alpha1/doc.go delete mode 100644 vendor/k8s.io/api/networking/v1alpha1/generated.pb.go delete mode 100644 vendor/k8s.io/api/networking/v1alpha1/generated.proto delete mode 100644 vendor/k8s.io/api/networking/v1alpha1/register.go delete mode 100644 vendor/k8s.io/api/networking/v1alpha1/types.go delete mode 100644 vendor/k8s.io/api/networking/v1alpha1/types_swagger_doc_generated.go delete mode 100644 vendor/k8s.io/api/networking/v1alpha1/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/api/networking/v1alpha1/zz_generated.prerelease-lifecycle.go delete mode 100644 vendor/k8s.io/api/networking/v1beta1/doc.go delete mode 100644 vendor/k8s.io/api/networking/v1beta1/generated.pb.go delete mode 100644 vendor/k8s.io/api/networking/v1beta1/generated.proto delete mode 100644 vendor/k8s.io/api/networking/v1beta1/register.go delete mode 100644 vendor/k8s.io/api/networking/v1beta1/types.go delete mode 100644 vendor/k8s.io/api/networking/v1beta1/types_swagger_doc_generated.go delete mode 100644 vendor/k8s.io/api/networking/v1beta1/well_known_annotations.go delete mode 100644 vendor/k8s.io/api/networking/v1beta1/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/api/networking/v1beta1/zz_generated.prerelease-lifecycle.go delete mode 100644 vendor/k8s.io/api/node/v1/doc.go delete mode 100644 vendor/k8s.io/api/node/v1/generated.pb.go delete mode 100644 vendor/k8s.io/api/node/v1/generated.proto delete mode 100644 vendor/k8s.io/api/node/v1/register.go delete mode 100644 vendor/k8s.io/api/node/v1/types.go delete mode 100644 vendor/k8s.io/api/node/v1/types_swagger_doc_generated.go delete mode 100644 vendor/k8s.io/api/node/v1/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/api/node/v1alpha1/doc.go delete mode 100644 vendor/k8s.io/api/node/v1alpha1/generated.pb.go delete mode 100644 vendor/k8s.io/api/node/v1alpha1/generated.proto delete mode 100644 vendor/k8s.io/api/node/v1alpha1/register.go delete mode 100644 vendor/k8s.io/api/node/v1alpha1/types.go delete mode 100644 vendor/k8s.io/api/node/v1alpha1/types_swagger_doc_generated.go delete mode 100644 vendor/k8s.io/api/node/v1alpha1/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/api/node/v1beta1/doc.go delete mode 100644 vendor/k8s.io/api/node/v1beta1/generated.pb.go delete mode 100644 vendor/k8s.io/api/node/v1beta1/generated.proto delete mode 100644 vendor/k8s.io/api/node/v1beta1/register.go delete mode 100644 vendor/k8s.io/api/node/v1beta1/types.go delete mode 100644 vendor/k8s.io/api/node/v1beta1/types_swagger_doc_generated.go delete mode 100644 vendor/k8s.io/api/node/v1beta1/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/api/node/v1beta1/zz_generated.prerelease-lifecycle.go delete mode 100644 vendor/k8s.io/api/policy/v1/doc.go delete mode 100644 vendor/k8s.io/api/policy/v1/generated.pb.go delete mode 100644 vendor/k8s.io/api/policy/v1/generated.proto delete mode 100644 vendor/k8s.io/api/policy/v1/register.go delete mode 100644 vendor/k8s.io/api/policy/v1/types.go delete mode 100644 vendor/k8s.io/api/policy/v1/types_swagger_doc_generated.go delete mode 100644 vendor/k8s.io/api/policy/v1/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/api/policy/v1beta1/doc.go delete mode 100644 vendor/k8s.io/api/policy/v1beta1/generated.pb.go delete mode 100644 vendor/k8s.io/api/policy/v1beta1/generated.proto delete mode 100644 vendor/k8s.io/api/policy/v1beta1/register.go delete mode 100644 vendor/k8s.io/api/policy/v1beta1/types.go delete mode 100644 vendor/k8s.io/api/policy/v1beta1/types_swagger_doc_generated.go delete mode 100644 vendor/k8s.io/api/policy/v1beta1/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/api/policy/v1beta1/zz_generated.prerelease-lifecycle.go delete mode 100644 vendor/k8s.io/api/rbac/v1/doc.go delete mode 100644 vendor/k8s.io/api/rbac/v1/generated.pb.go delete mode 100644 vendor/k8s.io/api/rbac/v1/generated.proto delete mode 100644 vendor/k8s.io/api/rbac/v1/register.go delete mode 100644 vendor/k8s.io/api/rbac/v1/types.go delete mode 100644 vendor/k8s.io/api/rbac/v1/types_swagger_doc_generated.go delete mode 100644 vendor/k8s.io/api/rbac/v1/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/api/rbac/v1alpha1/doc.go delete mode 100644 vendor/k8s.io/api/rbac/v1alpha1/generated.pb.go delete mode 100644 vendor/k8s.io/api/rbac/v1alpha1/generated.proto delete mode 100644 vendor/k8s.io/api/rbac/v1alpha1/register.go delete mode 100644 vendor/k8s.io/api/rbac/v1alpha1/types.go delete mode 100644 vendor/k8s.io/api/rbac/v1alpha1/types_swagger_doc_generated.go delete mode 100644 vendor/k8s.io/api/rbac/v1alpha1/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/api/rbac/v1beta1/doc.go delete mode 100644 vendor/k8s.io/api/rbac/v1beta1/generated.pb.go delete mode 100644 vendor/k8s.io/api/rbac/v1beta1/generated.proto delete mode 100644 vendor/k8s.io/api/rbac/v1beta1/register.go delete mode 100644 vendor/k8s.io/api/rbac/v1beta1/types.go delete mode 100644 vendor/k8s.io/api/rbac/v1beta1/types_swagger_doc_generated.go delete mode 100644 vendor/k8s.io/api/rbac/v1beta1/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/api/rbac/v1beta1/zz_generated.prerelease-lifecycle.go delete mode 100644 vendor/k8s.io/api/scheduling/v1/doc.go delete mode 100644 vendor/k8s.io/api/scheduling/v1/generated.pb.go delete mode 100644 vendor/k8s.io/api/scheduling/v1/generated.proto delete mode 100644 vendor/k8s.io/api/scheduling/v1/register.go delete mode 100644 vendor/k8s.io/api/scheduling/v1/types.go delete mode 100644 vendor/k8s.io/api/scheduling/v1/types_swagger_doc_generated.go delete mode 100644 vendor/k8s.io/api/scheduling/v1/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/api/scheduling/v1alpha1/doc.go delete mode 100644 vendor/k8s.io/api/scheduling/v1alpha1/generated.pb.go delete mode 100644 vendor/k8s.io/api/scheduling/v1alpha1/generated.proto delete mode 100644 vendor/k8s.io/api/scheduling/v1alpha1/register.go delete mode 100644 vendor/k8s.io/api/scheduling/v1alpha1/types.go delete mode 100644 vendor/k8s.io/api/scheduling/v1alpha1/types_swagger_doc_generated.go delete mode 100644 vendor/k8s.io/api/scheduling/v1alpha1/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/api/scheduling/v1beta1/doc.go delete mode 100644 vendor/k8s.io/api/scheduling/v1beta1/generated.pb.go delete mode 100644 vendor/k8s.io/api/scheduling/v1beta1/generated.proto delete mode 100644 vendor/k8s.io/api/scheduling/v1beta1/register.go delete mode 100644 vendor/k8s.io/api/scheduling/v1beta1/types.go delete mode 100644 vendor/k8s.io/api/scheduling/v1beta1/types_swagger_doc_generated.go delete mode 100644 vendor/k8s.io/api/scheduling/v1beta1/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/api/scheduling/v1beta1/zz_generated.prerelease-lifecycle.go delete mode 100644 vendor/k8s.io/api/storage/v1/doc.go delete mode 100644 vendor/k8s.io/api/storage/v1/generated.pb.go delete mode 100644 vendor/k8s.io/api/storage/v1/generated.proto delete mode 100644 vendor/k8s.io/api/storage/v1/register.go delete mode 100644 vendor/k8s.io/api/storage/v1/types.go delete mode 100644 vendor/k8s.io/api/storage/v1/types_swagger_doc_generated.go delete mode 100644 vendor/k8s.io/api/storage/v1/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/api/storage/v1alpha1/doc.go delete mode 100644 vendor/k8s.io/api/storage/v1alpha1/generated.pb.go delete mode 100644 vendor/k8s.io/api/storage/v1alpha1/generated.proto delete mode 100644 vendor/k8s.io/api/storage/v1alpha1/register.go delete mode 100644 vendor/k8s.io/api/storage/v1alpha1/types.go delete mode 100644 vendor/k8s.io/api/storage/v1alpha1/types_swagger_doc_generated.go delete mode 100644 vendor/k8s.io/api/storage/v1alpha1/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/api/storage/v1alpha1/zz_generated.prerelease-lifecycle.go delete mode 100644 vendor/k8s.io/api/storage/v1beta1/doc.go delete mode 100644 vendor/k8s.io/api/storage/v1beta1/generated.pb.go delete mode 100644 vendor/k8s.io/api/storage/v1beta1/generated.proto delete mode 100644 vendor/k8s.io/api/storage/v1beta1/register.go delete mode 100644 vendor/k8s.io/api/storage/v1beta1/types.go delete mode 100644 vendor/k8s.io/api/storage/v1beta1/types_swagger_doc_generated.go delete mode 100644 vendor/k8s.io/api/storage/v1beta1/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/api/storage/v1beta1/zz_generated.prerelease-lifecycle.go delete mode 100644 vendor/k8s.io/apiextensions-apiserver/LICENSE delete mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/deepcopy.go delete mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/doc.go delete mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/helpers.go delete mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/register.go delete mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/types.go delete mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/types_jsonschema.go delete mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1/.import-restrictions delete mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1/conversion.go delete mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1/deepcopy.go delete mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1/defaults.go delete mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1/doc.go delete mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1/generated.pb.go delete mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1/generated.proto delete mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1/marshal.go delete mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1/register.go delete mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1/types.go delete mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1/types_jsonschema.go delete mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1/zz_generated.conversion.go delete mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1/zz_generated.defaults.go delete mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/apimachinery/LICENSE delete mode 100644 vendor/k8s.io/apimachinery/pkg/api/equality/semantic.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/api/errors/OWNERS delete mode 100644 vendor/k8s.io/apimachinery/pkg/api/errors/doc.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/api/errors/errors.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/api/meta/OWNERS delete mode 100644 vendor/k8s.io/apimachinery/pkg/api/meta/conditions.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/api/meta/doc.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/api/meta/errors.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/api/meta/firsthit_restmapper.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/api/meta/help.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/api/meta/interfaces.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/api/meta/lazy.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/api/meta/meta.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/api/meta/multirestmapper.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/api/meta/priority.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/api/meta/restmapper.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/api/resource/OWNERS delete mode 100644 vendor/k8s.io/apimachinery/pkg/api/resource/amount.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/api/resource/generated.pb.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/api/resource/generated.proto delete mode 100644 vendor/k8s.io/apimachinery/pkg/api/resource/math.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/api/resource/quantity.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/api/resource/quantity_proto.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/api/resource/scale_int.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/api/resource/suffix.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/api/resource/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/doc.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/register.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/types.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.conversion.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/OWNERS delete mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/controller_ref.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/conversion.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/deepcopy.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/doc.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/duration.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/generated.pb.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto delete mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/group_version.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/helpers.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/labels.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/meta.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time_fuzz.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time_proto.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/register.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/time.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/time_fuzz.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/time_proto.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types_swagger_doc_generated.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured_list.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/watch.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.conversion.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.defaults.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/conversion.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/deepcopy.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/doc.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/generated.pb.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/generated.proto delete mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/register.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/types.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/types_swagger_doc_generated.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/zz_generated.defaults.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/conversion/converter.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/conversion/deep_equal.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/conversion/doc.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/conversion/helper.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/conversion/queryparams/convert.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/conversion/queryparams/doc.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/fields/doc.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/fields/fields.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/fields/requirements.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/fields/selector.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/labels/doc.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/labels/labels.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/labels/selector.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/labels/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/allocator.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/codec.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/codec_check.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/conversion.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/converter.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/doc.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/embedded.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/error.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/extension.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/generated.pb.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/generated.proto delete mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/helper.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/interfaces.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/mapper.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/negotiate.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/register.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/schema/generated.pb.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/schema/generated.proto delete mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/schema/group_version.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/schema/interfaces.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/scheme.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/scheme_builder.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/serializer/codec_factory.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/serializer/json/json.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/serializer/json/meta.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/serializer/negotiated_codec.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/serializer/protobuf/doc.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/serializer/protobuf/protobuf.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/serializer/recognizer/recognizer.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/serializer/streaming/streaming.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/serializer/versioning/versioning.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/swagger_doc_generator.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/types.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/types_proto.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/selection/operator.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/types/doc.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/types/namespacedname.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/types/nodename.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/types/patch.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/types/uid.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/util/cache/expiring.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/util/cache/lruexpirecache.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/util/diff/diff.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/util/errors/doc.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/util/errors/errors.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/util/framer/framer.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/util/httpstream/doc.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/util/httpstream/httpstream.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/util/httpstream/spdy/connection.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/util/httpstream/spdy/roundtripper.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/util/httpstream/spdy/upgrade.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/util/intstr/generated.pb.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/util/intstr/generated.proto delete mode 100644 vendor/k8s.io/apimachinery/pkg/util/intstr/instr_fuzz.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/util/intstr/intstr.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/util/json/json.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/util/managedfields/extract.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/util/managedfields/gvkparser.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/util/naming/from_stack.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/util/net/http.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/util/net/interface.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/util/net/port_range.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/util/net/port_split.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/util/net/util.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/util/remotecommand/constants.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/util/sets/byte.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/util/sets/doc.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/util/sets/empty.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/util/sets/int.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/util/sets/int32.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/util/sets/int64.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/util/sets/string.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/util/validation/field/errors.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/util/validation/field/path.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/util/validation/validation.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/util/wait/doc.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/util/wait/wait.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/util/yaml/decoder.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/version/doc.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/version/helpers.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/version/types.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/watch/doc.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/watch/filter.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/watch/mux.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/watch/streamwatcher.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/watch/watch.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/watch/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/apimachinery/third_party/forked/golang/LICENSE delete mode 100644 vendor/k8s.io/apimachinery/third_party/forked/golang/PATENTS delete mode 100644 vendor/k8s.io/apimachinery/third_party/forked/golang/netutil/addr.go delete mode 100644 vendor/k8s.io/apimachinery/third_party/forked/golang/reflect/deep_equal.go delete mode 100644 vendor/k8s.io/client-go/LICENSE delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/mutatingwebhook.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/mutatingwebhookconfiguration.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/rule.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/rulewithoperations.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/servicereference.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/validatingwebhook.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/validatingwebhookconfiguration.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/webhookclientconfig.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/mutatingwebhook.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/mutatingwebhookconfiguration.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/rule.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/rulewithoperations.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/servicereference.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validatingwebhook.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validatingwebhookconfiguration.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/webhookclientconfig.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apiserverinternal/v1alpha1/serverstorageversion.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apiserverinternal/v1alpha1/storageversion.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apiserverinternal/v1alpha1/storageversioncondition.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apiserverinternal/v1alpha1/storageversionstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1/controllerrevision.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1/daemonset.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1/daemonsetcondition.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1/daemonsetspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1/daemonsetstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1/daemonsetupdatestrategy.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1/deployment.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1/deploymentcondition.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1/deploymentspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1/deploymentstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1/deploymentstrategy.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1/replicaset.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1/replicasetcondition.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1/replicasetspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1/replicasetstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1/rollingupdatedaemonset.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1/rollingupdatedeployment.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1/rollingupdatestatefulsetstrategy.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1/statefulset.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1/statefulsetcondition.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1/statefulsetpersistentvolumeclaimretentionpolicy.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1/statefulsetspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1/statefulsetstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1/statefulsetupdatestrategy.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/controllerrevision.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/deployment.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/deploymentcondition.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/deploymentspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/deploymentstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/deploymentstrategy.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/rollbackconfig.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/rollingupdatedeployment.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/rollingupdatestatefulsetstrategy.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/statefulset.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/statefulsetcondition.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/statefulsetpersistentvolumeclaimretentionpolicy.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/statefulsetspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/statefulsetstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/statefulsetupdatestrategy.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/controllerrevision.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/daemonset.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/daemonsetcondition.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/daemonsetspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/daemonsetstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/daemonsetupdatestrategy.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/deployment.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/deploymentcondition.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/deploymentspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/deploymentstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/deploymentstrategy.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/replicaset.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/replicasetcondition.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/replicasetspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/replicasetstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/rollingupdatedaemonset.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/rollingupdatedeployment.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/rollingupdatestatefulsetstrategy.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/scale.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/statefulset.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/statefulsetcondition.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/statefulsetpersistentvolumeclaimretentionpolicy.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/statefulsetspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/statefulsetstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/statefulsetupdatestrategy.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v1/crossversionobjectreference.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v1/horizontalpodautoscaler.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v1/horizontalpodautoscalerspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v1/horizontalpodautoscalerstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v1/scale.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v1/scalespec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v1/scalestatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/containerresourcemetricsource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/containerresourcemetricstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/crossversionobjectreference.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/externalmetricsource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/externalmetricstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/horizontalpodautoscaler.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/horizontalpodautoscalerbehavior.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/horizontalpodautoscalercondition.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/horizontalpodautoscalerspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/horizontalpodautoscalerstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/hpascalingpolicy.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/hpascalingrules.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/metricidentifier.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/metricspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/metricstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/metrictarget.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/metricvaluestatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/objectmetricsource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/objectmetricstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/podresourcemetricsource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/podsmetricsource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/podsmetricstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/resourcemetricsource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/resourcemetricstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/containerresourcemetricsource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/containerresourcemetricstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/crossversionobjectreference.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/externalmetricsource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/externalmetricstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/horizontalpodautoscaler.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/horizontalpodautoscalercondition.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/horizontalpodautoscalerspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/horizontalpodautoscalerstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/metricspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/metricstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/objectmetricsource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/objectmetricstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/podsmetricsource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/podsmetricstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/resourcemetricsource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/resourcemetricstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/containerresourcemetricsource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/containerresourcemetricstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/crossversionobjectreference.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/externalmetricsource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/externalmetricstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/horizontalpodautoscaler.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/horizontalpodautoscalerbehavior.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/horizontalpodautoscalercondition.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/horizontalpodautoscalerspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/horizontalpodautoscalerstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/hpascalingpolicy.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/hpascalingrules.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/metricidentifier.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/metricspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/metricstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/metrictarget.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/metricvaluestatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/objectmetricsource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/objectmetricstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/podsmetricsource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/podsmetricstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/resourcemetricsource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/resourcemetricstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/batch/v1/cronjob.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/batch/v1/cronjobspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/batch/v1/cronjobstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/batch/v1/job.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/batch/v1/jobcondition.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/batch/v1/jobspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/batch/v1/jobstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/batch/v1/jobtemplatespec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/batch/v1/podfailurepolicy.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/batch/v1/podfailurepolicyonexitcodesrequirement.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/batch/v1/podfailurepolicyonpodconditionspattern.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/batch/v1/podfailurepolicyrule.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/batch/v1/uncountedterminatedpods.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/batch/v1beta1/cronjob.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/batch/v1beta1/cronjobspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/batch/v1beta1/cronjobstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/batch/v1beta1/jobtemplatespec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/certificates/v1/certificatesigningrequest.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/certificates/v1/certificatesigningrequestcondition.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/certificates/v1/certificatesigningrequestspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/certificates/v1/certificatesigningrequeststatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/certificates/v1beta1/certificatesigningrequest.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/certificates/v1beta1/certificatesigningrequestcondition.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/certificates/v1beta1/certificatesigningrequestspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/certificates/v1beta1/certificatesigningrequeststatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/coordination/v1/lease.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/coordination/v1/leasespec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/coordination/v1beta1/lease.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/coordination/v1beta1/leasespec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/affinity.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/attachedvolume.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/awselasticblockstorevolumesource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/azurediskvolumesource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/azurefilepersistentvolumesource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/azurefilevolumesource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/capabilities.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/cephfspersistentvolumesource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/cephfsvolumesource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/cinderpersistentvolumesource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/cindervolumesource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/clientipconfig.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/componentcondition.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/componentstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/configmap.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/configmapenvsource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/configmapkeyselector.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/configmapnodeconfigsource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/configmapprojection.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/configmapvolumesource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/container.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/containerimage.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/containerport.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/containerstate.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/containerstaterunning.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/containerstateterminated.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/containerstatewaiting.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/containerstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/csipersistentvolumesource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/csivolumesource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/daemonendpoint.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/downwardapiprojection.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/downwardapivolumefile.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/downwardapivolumesource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/emptydirvolumesource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/endpointaddress.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/endpointport.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/endpoints.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/endpointsubset.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/envfromsource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/envvar.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/envvarsource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/ephemeralcontainer.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/ephemeralcontainercommon.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/ephemeralvolumesource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/event.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/eventseries.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/eventsource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/execaction.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/fcvolumesource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/flexpersistentvolumesource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/flexvolumesource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/flockervolumesource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/gcepersistentdiskvolumesource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/gitrepovolumesource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/glusterfspersistentvolumesource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/glusterfsvolumesource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/grpcaction.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/hostalias.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/hostpathvolumesource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/httpgetaction.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/httpheader.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/iscsipersistentvolumesource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/iscsivolumesource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/keytopath.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/lifecycle.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/lifecyclehandler.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/limitrange.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/limitrangeitem.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/limitrangespec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/loadbalanceringress.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/loadbalancerstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/localobjectreference.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/localvolumesource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/namespace.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/namespacecondition.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/namespacespec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/namespacestatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/nfsvolumesource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/node.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/nodeaddress.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/nodeaffinity.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/nodecondition.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/nodeconfigsource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/nodeconfigstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/nodedaemonendpoints.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/nodeselector.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/nodeselectorrequirement.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/nodeselectorterm.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/nodespec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/nodestatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/nodesysteminfo.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/objectfieldselector.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/objectreference.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/persistentvolume.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/persistentvolumeclaim.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/persistentvolumeclaimcondition.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/persistentvolumeclaimspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/persistentvolumeclaimstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/persistentvolumeclaimtemplate.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/persistentvolumeclaimvolumesource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/persistentvolumesource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/persistentvolumespec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/persistentvolumestatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/photonpersistentdiskvolumesource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/pod.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/podaffinity.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/podaffinityterm.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/podantiaffinity.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/podcondition.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/poddnsconfig.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/poddnsconfigoption.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/podip.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/podos.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/podreadinessgate.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/podsecuritycontext.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/podspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/podstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/podtemplate.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/podtemplatespec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/portstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/portworxvolumesource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/preferredschedulingterm.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/probe.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/probehandler.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/projectedvolumesource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/quobytevolumesource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/rbdpersistentvolumesource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/rbdvolumesource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/replicationcontroller.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/replicationcontrollercondition.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/replicationcontrollerspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/replicationcontrollerstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/resourcefieldselector.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/resourcequota.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/resourcequotaspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/resourcequotastatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/resourcerequirements.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/scaleiopersistentvolumesource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/scaleiovolumesource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/scopedresourceselectorrequirement.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/scopeselector.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/seccompprofile.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/secret.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/secretenvsource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/secretkeyselector.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/secretprojection.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/secretreference.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/secretvolumesource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/securitycontext.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/selinuxoptions.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/service.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/serviceaccount.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/serviceaccounttokenprojection.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/serviceport.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/servicespec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/servicestatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/sessionaffinityconfig.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/storageospersistentvolumesource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/storageosvolumesource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/sysctl.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/taint.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/tcpsocketaction.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/toleration.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/topologyselectorlabelrequirement.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/topologyselectorterm.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/topologyspreadconstraint.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/typedlocalobjectreference.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/volume.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/volumedevice.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/volumemount.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/volumenodeaffinity.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/volumeprojection.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/volumesource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/vspherevirtualdiskvolumesource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/weightedpodaffinityterm.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/windowssecuritycontextoptions.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/discovery/v1/endpoint.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/discovery/v1/endpointconditions.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/discovery/v1/endpointhints.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/discovery/v1/endpointport.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/discovery/v1/endpointslice.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/discovery/v1/forzone.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/discovery/v1beta1/endpoint.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/discovery/v1beta1/endpointconditions.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/discovery/v1beta1/endpointhints.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/discovery/v1beta1/endpointport.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/discovery/v1beta1/endpointslice.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/discovery/v1beta1/forzone.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/events/v1/event.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/events/v1/eventseries.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/events/v1beta1/event.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/events/v1beta1/eventseries.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/allowedcsidriver.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/allowedflexvolume.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/allowedhostpath.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/daemonset.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/daemonsetcondition.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/daemonsetspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/daemonsetstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/daemonsetupdatestrategy.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/deployment.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/deploymentcondition.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/deploymentspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/deploymentstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/deploymentstrategy.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/fsgroupstrategyoptions.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/hostportrange.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/httpingresspath.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/httpingressrulevalue.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/idrange.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/ingress.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/ingressbackend.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/ingressrule.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/ingressrulevalue.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/ingressspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/ingressstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/ingresstls.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/ipblock.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/networkpolicy.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/networkpolicyegressrule.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/networkpolicyingressrule.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/networkpolicypeer.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/networkpolicyport.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/networkpolicyspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/networkpolicystatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/podsecuritypolicy.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/podsecuritypolicyspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/replicaset.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/replicasetcondition.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/replicasetspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/replicasetstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/rollbackconfig.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/rollingupdatedaemonset.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/rollingupdatedeployment.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/runasgroupstrategyoptions.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/runasuserstrategyoptions.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/runtimeclassstrategyoptions.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/scale.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/selinuxstrategyoptions.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/supplementalgroupsstrategyoptions.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/flowdistinguishermethod.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/flowschema.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/flowschemacondition.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/flowschemaspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/flowschemastatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/groupsubject.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/limitedprioritylevelconfiguration.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/limitresponse.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/nonresourcepolicyrule.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/policyruleswithsubjects.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/prioritylevelconfiguration.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/prioritylevelconfigurationcondition.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/prioritylevelconfigurationreference.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/prioritylevelconfigurationspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/prioritylevelconfigurationstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/queuingconfiguration.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/resourcepolicyrule.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/serviceaccountsubject.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/subject.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/usersubject.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/flowdistinguishermethod.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/flowschema.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/flowschemacondition.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/flowschemaspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/flowschemastatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/groupsubject.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/limitedprioritylevelconfiguration.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/limitresponse.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/nonresourcepolicyrule.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/policyruleswithsubjects.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/prioritylevelconfiguration.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/prioritylevelconfigurationcondition.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/prioritylevelconfigurationreference.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/prioritylevelconfigurationspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/prioritylevelconfigurationstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/queuingconfiguration.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/resourcepolicyrule.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/serviceaccountsubject.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/subject.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/usersubject.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/flowdistinguishermethod.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/flowschema.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/flowschemacondition.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/flowschemaspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/flowschemastatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/groupsubject.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/limitedprioritylevelconfiguration.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/limitresponse.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/nonresourcepolicyrule.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/policyruleswithsubjects.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/prioritylevelconfiguration.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/prioritylevelconfigurationcondition.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/prioritylevelconfigurationreference.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/prioritylevelconfigurationspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/prioritylevelconfigurationstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/queuingconfiguration.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/resourcepolicyrule.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/serviceaccountsubject.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/subject.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/usersubject.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/internal/internal.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/meta/v1/condition.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/meta/v1/deleteoptions.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/meta/v1/labelselector.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/meta/v1/labelselectorrequirement.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/meta/v1/listmeta.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/meta/v1/managedfieldsentry.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/meta/v1/objectmeta.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/meta/v1/ownerreference.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/meta/v1/preconditions.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/meta/v1/typemeta.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/meta/v1/unstructured.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1/httpingresspath.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1/httpingressrulevalue.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1/ingress.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1/ingressbackend.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1/ingressclass.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1/ingressclassparametersreference.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1/ingressclassspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1/ingressrule.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1/ingressrulevalue.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1/ingressservicebackend.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1/ingressspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1/ingressstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1/ingresstls.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1/ipblock.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1/networkpolicy.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1/networkpolicyegressrule.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1/networkpolicyingressrule.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1/networkpolicypeer.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1/networkpolicyport.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1/networkpolicyspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1/networkpolicystatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1/servicebackendport.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1alpha1/clustercidr.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1alpha1/clustercidrspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/httpingresspath.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/httpingressrulevalue.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/ingress.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/ingressbackend.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/ingressclass.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/ingressclassparametersreference.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/ingressclassspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/ingressrule.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/ingressrulevalue.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/ingressspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/ingressstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/ingresstls.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/node/v1/overhead.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/node/v1/runtimeclass.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/node/v1/scheduling.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/node/v1alpha1/overhead.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/node/v1alpha1/runtimeclass.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/node/v1alpha1/runtimeclassspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/node/v1alpha1/scheduling.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/node/v1beta1/overhead.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/node/v1beta1/runtimeclass.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/node/v1beta1/scheduling.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/policy/v1/eviction.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/policy/v1/poddisruptionbudget.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/policy/v1/poddisruptionbudgetspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/policy/v1/poddisruptionbudgetstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/allowedcsidriver.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/allowedflexvolume.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/allowedhostpath.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/eviction.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/fsgroupstrategyoptions.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/hostportrange.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/idrange.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/poddisruptionbudget.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/poddisruptionbudgetspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/poddisruptionbudgetstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/podsecuritypolicy.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/podsecuritypolicyspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/runasgroupstrategyoptions.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/runasuserstrategyoptions.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/runtimeclassstrategyoptions.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/selinuxstrategyoptions.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/supplementalgroupsstrategyoptions.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/rbac/v1/aggregationrule.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/rbac/v1/clusterrole.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/rbac/v1/clusterrolebinding.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/rbac/v1/policyrule.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/rbac/v1/role.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/rbac/v1/rolebinding.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/rbac/v1/roleref.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/rbac/v1/subject.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/aggregationrule.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/clusterrole.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/clusterrolebinding.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/policyrule.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/role.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/rolebinding.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/roleref.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/subject.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/aggregationrule.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/clusterrole.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/clusterrolebinding.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/policyrule.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/role.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/rolebinding.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/roleref.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/subject.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/scheduling/v1/priorityclass.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha1/priorityclass.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/priorityclass.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1/csidriver.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1/csidriverspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1/csinode.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1/csinodedriver.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1/csinodespec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1/csistoragecapacity.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1/storageclass.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1/tokenrequest.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1/volumeattachment.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1/volumeattachmentsource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1/volumeattachmentspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1/volumeattachmentstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1/volumeerror.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1/volumenoderesources.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1alpha1/csistoragecapacity.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1alpha1/volumeattachment.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1alpha1/volumeattachmentsource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1alpha1/volumeattachmentspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1alpha1/volumeattachmentstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1alpha1/volumeerror.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/csidriver.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/csidriverspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/csinode.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/csinodedriver.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/csinodespec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/csistoragecapacity.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/storageclass.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/tokenrequest.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/volumeattachment.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/volumeattachmentsource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/volumeattachmentspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/volumeattachmentstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/volumeerror.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/volumenoderesources.go delete mode 100644 vendor/k8s.io/client-go/discovery/discovery_client.go delete mode 100644 vendor/k8s.io/client-go/discovery/doc.go delete mode 100644 vendor/k8s.io/client-go/discovery/helper.go delete mode 100644 vendor/k8s.io/client-go/dynamic/interface.go delete mode 100644 vendor/k8s.io/client-go/dynamic/scheme.go delete mode 100644 vendor/k8s.io/client-go/dynamic/simple.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/clientset.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/doc.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/import.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/scheme/doc.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/scheme/register.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/admissionregistration_client.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/doc.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/generated_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/mutatingwebhookconfiguration.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/validatingwebhookconfiguration.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1/admissionregistration_client.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1/doc.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1/generated_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1/mutatingwebhookconfiguration.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1/validatingwebhookconfiguration.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/apiserverinternal/v1alpha1/apiserverinternal_client.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/apiserverinternal/v1alpha1/doc.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/apiserverinternal/v1alpha1/generated_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/apiserverinternal/v1alpha1/storageversion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/apps/v1/apps_client.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/apps/v1/controllerrevision.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/apps/v1/daemonset.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/apps/v1/deployment.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/apps/v1/doc.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/apps/v1/generated_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/apps/v1/replicaset.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/apps/v1/statefulset.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/apps_client.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/controllerrevision.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/deployment.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/doc.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/generated_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/statefulset.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta2/apps_client.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta2/controllerrevision.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta2/daemonset.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta2/deployment.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta2/doc.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta2/generated_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta2/replicaset.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta2/statefulset.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/authentication/v1/authentication_client.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/authentication/v1/doc.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/authentication/v1/generated_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/authentication/v1/tokenreview.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/authentication/v1beta1/authentication_client.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/authentication/v1beta1/doc.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/authentication/v1beta1/generated_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/authentication/v1beta1/tokenreview.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/authorization/v1/authorization_client.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/authorization/v1/doc.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/authorization/v1/generated_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/authorization/v1/localsubjectaccessreview.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/authorization/v1/selfsubjectaccessreview.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/authorization/v1/selfsubjectrulesreview.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/authorization/v1/subjectaccessreview.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/authorization_client.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/doc.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/generated_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/localsubjectaccessreview.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/selfsubjectaccessreview.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/selfsubjectrulesreview.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/subjectaccessreview.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v1/autoscaling_client.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v1/doc.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v1/generated_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v1/horizontalpodautoscaler.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2/autoscaling_client.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2/doc.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2/generated_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2/horizontalpodautoscaler.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1/autoscaling_client.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1/doc.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1/generated_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1/horizontalpodautoscaler.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta2/autoscaling_client.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta2/doc.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta2/generated_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta2/horizontalpodautoscaler.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/batch/v1/batch_client.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/batch/v1/cronjob.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/batch/v1/doc.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/batch/v1/generated_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/batch/v1/job.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/batch/v1beta1/batch_client.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/batch/v1beta1/cronjob.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/batch/v1beta1/doc.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/batch/v1beta1/generated_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/certificates/v1/certificates_client.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/certificates/v1/certificatesigningrequest.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/certificates/v1/doc.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/certificates/v1/generated_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/certificates/v1beta1/certificates_client.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/certificates/v1beta1/certificatesigningrequest.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/certificates/v1beta1/certificatesigningrequest_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/certificates/v1beta1/doc.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/certificates/v1beta1/generated_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/coordination/v1/coordination_client.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/coordination/v1/doc.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/coordination/v1/generated_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/coordination/v1/lease.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/coordination/v1beta1/coordination_client.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/coordination/v1beta1/doc.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/coordination/v1beta1/generated_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/coordination/v1beta1/lease.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/core/v1/componentstatus.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/core/v1/configmap.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/core/v1/core_client.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/core/v1/doc.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/core/v1/endpoints.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/core/v1/event.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/core/v1/event_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/core/v1/generated_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/core/v1/limitrange.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/core/v1/namespace.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/core/v1/namespace_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/core/v1/node.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/core/v1/node_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/core/v1/persistentvolume.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/core/v1/persistentvolumeclaim.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/core/v1/pod.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/core/v1/pod_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/core/v1/podtemplate.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/core/v1/replicationcontroller.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/core/v1/resourcequota.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/core/v1/secret.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/core/v1/service.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/core/v1/service_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/core/v1/serviceaccount.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/discovery/v1/discovery_client.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/discovery/v1/doc.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/discovery/v1/endpointslice.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/discovery/v1/generated_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/discovery_client.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/doc.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/endpointslice.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/generated_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/events/v1/doc.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/events/v1/event.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/events/v1/events_client.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/events/v1/generated_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/events/v1beta1/doc.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/events/v1beta1/event.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/events/v1beta1/event_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/events/v1beta1/events_client.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/events/v1beta1/generated_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/daemonset.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/deployment.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/deployment_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/doc.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/extensions_client.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/generated_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/ingress.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/networkpolicy.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/podsecuritypolicy.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/replicaset.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1alpha1/doc.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1alpha1/flowcontrol_client.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1alpha1/flowschema.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1alpha1/generated_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1alpha1/prioritylevelconfiguration.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1/doc.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1/flowcontrol_client.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1/flowschema.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1/generated_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1/prioritylevelconfiguration.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta2/doc.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta2/flowcontrol_client.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta2/flowschema.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta2/generated_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta2/prioritylevelconfiguration.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/networking/v1/doc.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/networking/v1/generated_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/networking/v1/ingress.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/networking/v1/ingressclass.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/networking/v1/networking_client.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/networking/v1/networkpolicy.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/networking/v1alpha1/clustercidr.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/networking/v1alpha1/doc.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/networking/v1alpha1/generated_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/networking/v1alpha1/networking_client.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/networking/v1beta1/doc.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/networking/v1beta1/generated_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/networking/v1beta1/ingress.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/networking/v1beta1/ingressclass.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/networking/v1beta1/networking_client.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/node/v1/doc.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/node/v1/generated_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/node/v1/node_client.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/node/v1/runtimeclass.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/node/v1alpha1/doc.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/node/v1alpha1/generated_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/node/v1alpha1/node_client.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/node/v1alpha1/runtimeclass.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/node/v1beta1/doc.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/node/v1beta1/generated_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/node/v1beta1/node_client.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/node/v1beta1/runtimeclass.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/policy/v1/doc.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/policy/v1/eviction.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/policy/v1/eviction_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/policy/v1/generated_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/policy/v1/poddisruptionbudget.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/policy/v1/policy_client.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/policy/v1beta1/doc.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/policy/v1beta1/eviction.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/policy/v1beta1/eviction_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/policy/v1beta1/generated_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/policy/v1beta1/poddisruptionbudget.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/policy/v1beta1/podsecuritypolicy.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/policy/v1beta1/policy_client.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/rbac/v1/clusterrole.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/rbac/v1/clusterrolebinding.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/rbac/v1/doc.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/rbac/v1/generated_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/rbac/v1/rbac_client.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/rbac/v1/role.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/rbac/v1/rolebinding.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/clusterrole.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/clusterrolebinding.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/doc.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/generated_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/rbac_client.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/role.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/rolebinding.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/clusterrole.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/clusterrolebinding.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/doc.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/generated_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/rbac_client.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/role.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/rolebinding.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1/doc.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1/generated_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1/priorityclass.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1/scheduling_client.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1/doc.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1/generated_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1/priorityclass.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1/scheduling_client.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1beta1/doc.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1beta1/generated_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1beta1/priorityclass.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1beta1/scheduling_client.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/storage/v1/csidriver.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/storage/v1/csinode.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/storage/v1/csistoragecapacity.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/storage/v1/doc.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/storage/v1/generated_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/storage/v1/storage_client.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/storage/v1/storageclass.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/storage/v1/volumeattachment.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/storage/v1alpha1/csistoragecapacity.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/storage/v1alpha1/doc.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/storage/v1alpha1/generated_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/storage/v1alpha1/storage_client.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/storage/v1alpha1/volumeattachment.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1/csidriver.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1/csinode.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1/csistoragecapacity.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1/doc.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1/generated_expansion.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1/storage_client.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1/storageclass.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1/volumeattachment.go delete mode 100644 vendor/k8s.io/client-go/openapi/client.go delete mode 100644 vendor/k8s.io/client-go/openapi/groupversion.go delete mode 100644 vendor/k8s.io/client-go/pkg/apis/clientauthentication/OWNERS delete mode 100644 vendor/k8s.io/client-go/pkg/apis/clientauthentication/doc.go delete mode 100644 vendor/k8s.io/client-go/pkg/apis/clientauthentication/install/install.go delete mode 100644 vendor/k8s.io/client-go/pkg/apis/clientauthentication/register.go delete mode 100644 vendor/k8s.io/client-go/pkg/apis/clientauthentication/types.go delete mode 100644 vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1/doc.go delete mode 100644 vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1/register.go delete mode 100644 vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1/types.go delete mode 100644 vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1/zz_generated.conversion.go delete mode 100644 vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1/zz_generated.defaults.go delete mode 100644 vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1beta1/doc.go delete mode 100644 vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1beta1/register.go delete mode 100644 vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1beta1/types.go delete mode 100644 vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1beta1/zz_generated.conversion.go delete mode 100644 vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1beta1/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1beta1/zz_generated.defaults.go delete mode 100644 vendor/k8s.io/client-go/pkg/apis/clientauthentication/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/client-go/pkg/version/base.go delete mode 100644 vendor/k8s.io/client-go/pkg/version/doc.go delete mode 100644 vendor/k8s.io/client-go/pkg/version/version.go delete mode 100644 vendor/k8s.io/client-go/plugin/pkg/client/auth/OWNERS delete mode 100644 vendor/k8s.io/client-go/plugin/pkg/client/auth/azure/README.md delete mode 100644 vendor/k8s.io/client-go/plugin/pkg/client/auth/azure/azure.go delete mode 100644 vendor/k8s.io/client-go/plugin/pkg/client/auth/exec/exec.go delete mode 100644 vendor/k8s.io/client-go/plugin/pkg/client/auth/exec/metrics.go delete mode 100644 vendor/k8s.io/client-go/plugin/pkg/client/auth/gcp/OWNERS delete mode 100644 vendor/k8s.io/client-go/plugin/pkg/client/auth/gcp/gcp.go delete mode 100644 vendor/k8s.io/client-go/plugin/pkg/client/auth/oidc/oidc.go delete mode 100644 vendor/k8s.io/client-go/plugin/pkg/client/auth/openstack/openstack_stub.go delete mode 100644 vendor/k8s.io/client-go/plugin/pkg/client/auth/plugins.go delete mode 100644 vendor/k8s.io/client-go/plugin/pkg/client/auth/plugins_providers.go delete mode 100644 vendor/k8s.io/client-go/rest/OWNERS delete mode 100644 vendor/k8s.io/client-go/rest/client.go delete mode 100644 vendor/k8s.io/client-go/rest/config.go delete mode 100644 vendor/k8s.io/client-go/rest/exec.go delete mode 100644 vendor/k8s.io/client-go/rest/plugin.go delete mode 100644 vendor/k8s.io/client-go/rest/request.go delete mode 100644 vendor/k8s.io/client-go/rest/transport.go delete mode 100644 vendor/k8s.io/client-go/rest/url_utils.go delete mode 100644 vendor/k8s.io/client-go/rest/urlbackoff.go delete mode 100644 vendor/k8s.io/client-go/rest/warnings.go delete mode 100644 vendor/k8s.io/client-go/rest/watch/decoder.go delete mode 100644 vendor/k8s.io/client-go/rest/watch/encoder.go delete mode 100644 vendor/k8s.io/client-go/rest/with_retry.go delete mode 100644 vendor/k8s.io/client-go/rest/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/client-go/third_party/forked/golang/LICENSE delete mode 100644 vendor/k8s.io/client-go/third_party/forked/golang/PATENTS delete mode 100644 vendor/k8s.io/client-go/third_party/forked/golang/template/exec.go delete mode 100644 vendor/k8s.io/client-go/third_party/forked/golang/template/funcs.go delete mode 100644 vendor/k8s.io/client-go/tools/auth/OWNERS delete mode 100644 vendor/k8s.io/client-go/tools/auth/clientauth.go delete mode 100644 vendor/k8s.io/client-go/tools/cache/OWNERS delete mode 100644 vendor/k8s.io/client-go/tools/cache/controller.go delete mode 100644 vendor/k8s.io/client-go/tools/cache/delta_fifo.go delete mode 100644 vendor/k8s.io/client-go/tools/cache/doc.go delete mode 100644 vendor/k8s.io/client-go/tools/cache/expiration_cache.go delete mode 100644 vendor/k8s.io/client-go/tools/cache/expiration_cache_fakes.go delete mode 100644 vendor/k8s.io/client-go/tools/cache/fake_custom_store.go delete mode 100644 vendor/k8s.io/client-go/tools/cache/fifo.go delete mode 100644 vendor/k8s.io/client-go/tools/cache/heap.go delete mode 100644 vendor/k8s.io/client-go/tools/cache/index.go delete mode 100644 vendor/k8s.io/client-go/tools/cache/listers.go delete mode 100644 vendor/k8s.io/client-go/tools/cache/listwatch.go delete mode 100644 vendor/k8s.io/client-go/tools/cache/mutation_cache.go delete mode 100644 vendor/k8s.io/client-go/tools/cache/mutation_detector.go delete mode 100644 vendor/k8s.io/client-go/tools/cache/reflector.go delete mode 100644 vendor/k8s.io/client-go/tools/cache/reflector_metrics.go delete mode 100644 vendor/k8s.io/client-go/tools/cache/retry_with_deadline.go delete mode 100644 vendor/k8s.io/client-go/tools/cache/shared_informer.go delete mode 100644 vendor/k8s.io/client-go/tools/cache/store.go delete mode 100644 vendor/k8s.io/client-go/tools/cache/thread_safe_store.go delete mode 100644 vendor/k8s.io/client-go/tools/cache/undelta_store.go delete mode 100644 vendor/k8s.io/client-go/tools/clientcmd/api/doc.go delete mode 100644 vendor/k8s.io/client-go/tools/clientcmd/api/helpers.go delete mode 100644 vendor/k8s.io/client-go/tools/clientcmd/api/latest/latest.go delete mode 100644 vendor/k8s.io/client-go/tools/clientcmd/api/register.go delete mode 100644 vendor/k8s.io/client-go/tools/clientcmd/api/types.go delete mode 100644 vendor/k8s.io/client-go/tools/clientcmd/api/v1/conversion.go delete mode 100644 vendor/k8s.io/client-go/tools/clientcmd/api/v1/defaults.go delete mode 100644 vendor/k8s.io/client-go/tools/clientcmd/api/v1/doc.go delete mode 100644 vendor/k8s.io/client-go/tools/clientcmd/api/v1/register.go delete mode 100644 vendor/k8s.io/client-go/tools/clientcmd/api/v1/types.go delete mode 100644 vendor/k8s.io/client-go/tools/clientcmd/api/v1/zz_generated.conversion.go delete mode 100644 vendor/k8s.io/client-go/tools/clientcmd/api/v1/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/client-go/tools/clientcmd/api/v1/zz_generated.defaults.go delete mode 100644 vendor/k8s.io/client-go/tools/clientcmd/api/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/client-go/tools/clientcmd/auth_loaders.go delete mode 100644 vendor/k8s.io/client-go/tools/clientcmd/client_config.go delete mode 100644 vendor/k8s.io/client-go/tools/clientcmd/config.go delete mode 100644 vendor/k8s.io/client-go/tools/clientcmd/doc.go delete mode 100644 vendor/k8s.io/client-go/tools/clientcmd/flag.go delete mode 100644 vendor/k8s.io/client-go/tools/clientcmd/helpers.go delete mode 100644 vendor/k8s.io/client-go/tools/clientcmd/loader.go delete mode 100644 vendor/k8s.io/client-go/tools/clientcmd/merged_client_builder.go delete mode 100644 vendor/k8s.io/client-go/tools/clientcmd/overrides.go delete mode 100644 vendor/k8s.io/client-go/tools/clientcmd/validation.go delete mode 100644 vendor/k8s.io/client-go/tools/metrics/OWNERS delete mode 100644 vendor/k8s.io/client-go/tools/metrics/metrics.go delete mode 100644 vendor/k8s.io/client-go/tools/pager/pager.go delete mode 100644 vendor/k8s.io/client-go/tools/reference/ref.go delete mode 100644 vendor/k8s.io/client-go/tools/remotecommand/doc.go delete mode 100644 vendor/k8s.io/client-go/tools/remotecommand/errorstream.go delete mode 100644 vendor/k8s.io/client-go/tools/remotecommand/reader.go delete mode 100644 vendor/k8s.io/client-go/tools/remotecommand/remotecommand.go delete mode 100644 vendor/k8s.io/client-go/tools/remotecommand/resize.go delete mode 100644 vendor/k8s.io/client-go/tools/remotecommand/v1.go delete mode 100644 vendor/k8s.io/client-go/tools/remotecommand/v2.go delete mode 100644 vendor/k8s.io/client-go/tools/remotecommand/v3.go delete mode 100644 vendor/k8s.io/client-go/tools/remotecommand/v4.go delete mode 100644 vendor/k8s.io/client-go/transport/OWNERS delete mode 100644 vendor/k8s.io/client-go/transport/cache.go delete mode 100644 vendor/k8s.io/client-go/transport/cert_rotation.go delete mode 100644 vendor/k8s.io/client-go/transport/config.go delete mode 100644 vendor/k8s.io/client-go/transport/round_trippers.go delete mode 100644 vendor/k8s.io/client-go/transport/spdy/spdy.go delete mode 100644 vendor/k8s.io/client-go/transport/token_source.go delete mode 100644 vendor/k8s.io/client-go/transport/transport.go delete mode 100644 vendor/k8s.io/client-go/util/cert/OWNERS delete mode 100644 vendor/k8s.io/client-go/util/cert/cert.go delete mode 100644 vendor/k8s.io/client-go/util/cert/csr.go delete mode 100644 vendor/k8s.io/client-go/util/cert/io.go delete mode 100644 vendor/k8s.io/client-go/util/cert/pem.go delete mode 100644 vendor/k8s.io/client-go/util/cert/server_inspection.go delete mode 100644 vendor/k8s.io/client-go/util/connrotation/connrotation.go delete mode 100644 vendor/k8s.io/client-go/util/exec/exec.go delete mode 100644 vendor/k8s.io/client-go/util/flowcontrol/backoff.go delete mode 100644 vendor/k8s.io/client-go/util/flowcontrol/throttle.go delete mode 100644 vendor/k8s.io/client-go/util/homedir/homedir.go delete mode 100644 vendor/k8s.io/client-go/util/jsonpath/doc.go delete mode 100644 vendor/k8s.io/client-go/util/jsonpath/jsonpath.go delete mode 100644 vendor/k8s.io/client-go/util/jsonpath/node.go delete mode 100644 vendor/k8s.io/client-go/util/jsonpath/parser.go delete mode 100644 vendor/k8s.io/client-go/util/keyutil/OWNERS delete mode 100644 vendor/k8s.io/client-go/util/keyutil/key.go delete mode 100644 vendor/k8s.io/client-go/util/workqueue/default_rate_limiters.go delete mode 100644 vendor/k8s.io/client-go/util/workqueue/delaying_queue.go delete mode 100644 vendor/k8s.io/client-go/util/workqueue/doc.go delete mode 100644 vendor/k8s.io/client-go/util/workqueue/metrics.go delete mode 100644 vendor/k8s.io/client-go/util/workqueue/parallelizer.go delete mode 100644 vendor/k8s.io/client-go/util/workqueue/queue.go delete mode 100644 vendor/k8s.io/client-go/util/workqueue/rate_limiting_queue.go delete mode 100644 vendor/k8s.io/klog/v2/.gitignore delete mode 100644 vendor/k8s.io/klog/v2/CONTRIBUTING.md delete mode 100644 vendor/k8s.io/klog/v2/LICENSE delete mode 100644 vendor/k8s.io/klog/v2/OWNERS delete mode 100644 vendor/k8s.io/klog/v2/README.md delete mode 100644 vendor/k8s.io/klog/v2/RELEASE.md delete mode 100644 vendor/k8s.io/klog/v2/SECURITY.md delete mode 100644 vendor/k8s.io/klog/v2/SECURITY_CONTACTS delete mode 100644 vendor/k8s.io/klog/v2/code-of-conduct.md delete mode 100644 vendor/k8s.io/klog/v2/contextual.go delete mode 100644 vendor/k8s.io/klog/v2/exit.go delete mode 100644 vendor/k8s.io/klog/v2/imports.go delete mode 100644 vendor/k8s.io/klog/v2/internal/buffer/buffer.go delete mode 100644 vendor/k8s.io/klog/v2/internal/clock/README.md delete mode 100644 vendor/k8s.io/klog/v2/internal/clock/clock.go delete mode 100644 vendor/k8s.io/klog/v2/internal/dbg/dbg.go delete mode 100644 vendor/k8s.io/klog/v2/internal/serialize/keyvalues.go delete mode 100644 vendor/k8s.io/klog/v2/internal/severity/severity.go delete mode 100644 vendor/k8s.io/klog/v2/k8s_references.go delete mode 100644 vendor/k8s.io/klog/v2/klog.go delete mode 100644 vendor/k8s.io/klog/v2/klog_file.go delete mode 100644 vendor/k8s.io/klog/v2/klog_file_others.go delete mode 100644 vendor/k8s.io/klog/v2/klog_file_windows.go delete mode 100644 vendor/k8s.io/klog/v2/klogr.go delete mode 100644 vendor/k8s.io/kube-openapi/LICENSE delete mode 100644 vendor/k8s.io/kube-openapi/pkg/builder3/util/util.go delete mode 100644 vendor/k8s.io/kube-openapi/pkg/common/common.go delete mode 100644 vendor/k8s.io/kube-openapi/pkg/common/doc.go delete mode 100644 vendor/k8s.io/kube-openapi/pkg/common/interfaces.go delete mode 100644 vendor/k8s.io/kube-openapi/pkg/handler3/handler.go delete mode 100644 vendor/k8s.io/kube-openapi/pkg/internal/handler/handler_cache.go delete mode 100644 vendor/k8s.io/kube-openapi/pkg/openapiconv/convert.go delete mode 100644 vendor/k8s.io/kube-openapi/pkg/schemaconv/smd.go delete mode 100644 vendor/k8s.io/kube-openapi/pkg/schemamutation/walker.go delete mode 100644 vendor/k8s.io/kube-openapi/pkg/spec3/component.go delete mode 100644 vendor/k8s.io/kube-openapi/pkg/spec3/encoding.go delete mode 100644 vendor/k8s.io/kube-openapi/pkg/spec3/example.go delete mode 100644 vendor/k8s.io/kube-openapi/pkg/spec3/external_documentation.go delete mode 100644 vendor/k8s.io/kube-openapi/pkg/spec3/header.go delete mode 100644 vendor/k8s.io/kube-openapi/pkg/spec3/media_type.go delete mode 100644 vendor/k8s.io/kube-openapi/pkg/spec3/operation.go delete mode 100644 vendor/k8s.io/kube-openapi/pkg/spec3/parameter.go delete mode 100644 vendor/k8s.io/kube-openapi/pkg/spec3/path.go delete mode 100644 vendor/k8s.io/kube-openapi/pkg/spec3/request_body.go delete mode 100644 vendor/k8s.io/kube-openapi/pkg/spec3/response.go delete mode 100644 vendor/k8s.io/kube-openapi/pkg/spec3/security_requirement.go delete mode 100644 vendor/k8s.io/kube-openapi/pkg/spec3/security_scheme.go delete mode 100644 vendor/k8s.io/kube-openapi/pkg/spec3/server.go delete mode 100644 vendor/k8s.io/kube-openapi/pkg/spec3/spec.go delete mode 100644 vendor/k8s.io/kube-openapi/pkg/util/proto/OWNERS delete mode 100644 vendor/k8s.io/kube-openapi/pkg/util/proto/doc.go delete mode 100644 vendor/k8s.io/kube-openapi/pkg/util/proto/document.go delete mode 100644 vendor/k8s.io/kube-openapi/pkg/util/proto/document_v3.go delete mode 100644 vendor/k8s.io/kube-openapi/pkg/util/proto/openapi.go delete mode 100644 vendor/k8s.io/kube-openapi/pkg/validation/spec/.gitignore delete mode 100644 vendor/k8s.io/kube-openapi/pkg/validation/spec/LICENSE delete mode 100644 vendor/k8s.io/kube-openapi/pkg/validation/spec/contact_info.go delete mode 100644 vendor/k8s.io/kube-openapi/pkg/validation/spec/external_docs.go delete mode 100644 vendor/k8s.io/kube-openapi/pkg/validation/spec/gnostic.go delete mode 100644 vendor/k8s.io/kube-openapi/pkg/validation/spec/header.go delete mode 100644 vendor/k8s.io/kube-openapi/pkg/validation/spec/info.go delete mode 100644 vendor/k8s.io/kube-openapi/pkg/validation/spec/items.go delete mode 100644 vendor/k8s.io/kube-openapi/pkg/validation/spec/license.go delete mode 100644 vendor/k8s.io/kube-openapi/pkg/validation/spec/operation.go delete mode 100644 vendor/k8s.io/kube-openapi/pkg/validation/spec/parameter.go delete mode 100644 vendor/k8s.io/kube-openapi/pkg/validation/spec/path_item.go delete mode 100644 vendor/k8s.io/kube-openapi/pkg/validation/spec/paths.go delete mode 100644 vendor/k8s.io/kube-openapi/pkg/validation/spec/ref.go delete mode 100644 vendor/k8s.io/kube-openapi/pkg/validation/spec/response.go delete mode 100644 vendor/k8s.io/kube-openapi/pkg/validation/spec/responses.go delete mode 100644 vendor/k8s.io/kube-openapi/pkg/validation/spec/schema.go delete mode 100644 vendor/k8s.io/kube-openapi/pkg/validation/spec/security_scheme.go delete mode 100644 vendor/k8s.io/kube-openapi/pkg/validation/spec/swagger.go delete mode 100644 vendor/k8s.io/kube-openapi/pkg/validation/spec/tag.go delete mode 100644 vendor/k8s.io/kubectl/LICENSE delete mode 100644 vendor/k8s.io/kubectl/pkg/scheme/install.go delete mode 100644 vendor/k8s.io/kubectl/pkg/scheme/scheme.go delete mode 100644 vendor/k8s.io/utils/LICENSE delete mode 100644 vendor/k8s.io/utils/buffer/ring_growing.go delete mode 100644 vendor/k8s.io/utils/clock/README.md delete mode 100644 vendor/k8s.io/utils/clock/clock.go delete mode 100644 vendor/k8s.io/utils/clock/testing/fake_clock.go delete mode 100644 vendor/k8s.io/utils/clock/testing/simple_interval_clock.go delete mode 100644 vendor/k8s.io/utils/integer/integer.go delete mode 100644 vendor/k8s.io/utils/internal/third_party/forked/golang/LICENSE delete mode 100644 vendor/k8s.io/utils/internal/third_party/forked/golang/PATENTS delete mode 100644 vendor/k8s.io/utils/internal/third_party/forked/golang/net/ip.go delete mode 100644 vendor/k8s.io/utils/internal/third_party/forked/golang/net/parse.go delete mode 100644 vendor/k8s.io/utils/net/ipnet.go delete mode 100644 vendor/k8s.io/utils/net/net.go delete mode 100644 vendor/k8s.io/utils/net/parse.go delete mode 100644 vendor/k8s.io/utils/net/port.go delete mode 100644 vendor/k8s.io/utils/pointer/OWNERS delete mode 100644 vendor/k8s.io/utils/pointer/README.md delete mode 100644 vendor/k8s.io/utils/pointer/pointer.go delete mode 100644 vendor/k8s.io/utils/strings/slices/slices.go delete mode 100644 vendor/k8s.io/utils/trace/README.md delete mode 100644 vendor/k8s.io/utils/trace/trace.go delete mode 100644 vendor/kubevirt.io/api/LICENSE delete mode 100644 vendor/kubevirt.io/api/core/register.go delete mode 100644 vendor/kubevirt.io/api/core/v1/componentconfig.go delete mode 100644 vendor/kubevirt.io/api/core/v1/deepcopy_generated.go delete mode 100644 vendor/kubevirt.io/api/core/v1/defaults.go delete mode 100644 vendor/kubevirt.io/api/core/v1/doc.go delete mode 100644 vendor/kubevirt.io/api/core/v1/register.go delete mode 100644 vendor/kubevirt.io/api/core/v1/sanitizers.go delete mode 100644 vendor/kubevirt.io/api/core/v1/schema.go delete mode 100644 vendor/kubevirt.io/api/core/v1/schema_swagger_generated.go delete mode 100644 vendor/kubevirt.io/api/core/v1/types.go delete mode 100644 vendor/kubevirt.io/api/core/v1/types_swagger_generated.go delete mode 100644 vendor/kubevirt.io/api/core/v1/zz_generated.defaults.go delete mode 100644 vendor/kubevirt.io/containerized-data-importer-api/LICENSE delete mode 100644 vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/register.go delete mode 100644 vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1/doc.go delete mode 100644 vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1/register.go delete mode 100644 vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1/types.go delete mode 100644 vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1/types_swagger_generated.go delete mode 100644 vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1/types_transfer.go delete mode 100644 vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1/utils.go delete mode 100644 vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1/zz_generated.deepcopy.go delete mode 100644 vendor/kubevirt.io/controller-lifecycle-operator-sdk/api/LICENSE delete mode 100644 vendor/kubevirt.io/controller-lifecycle-operator-sdk/api/types.go delete mode 100644 vendor/modules.txt delete mode 100644 vendor/sigs.k8s.io/json/CONTRIBUTING.md delete mode 100644 vendor/sigs.k8s.io/json/LICENSE delete mode 100644 vendor/sigs.k8s.io/json/Makefile delete mode 100644 vendor/sigs.k8s.io/json/OWNERS delete mode 100644 vendor/sigs.k8s.io/json/README.md delete mode 100644 vendor/sigs.k8s.io/json/SECURITY.md delete mode 100644 vendor/sigs.k8s.io/json/SECURITY_CONTACTS delete mode 100644 vendor/sigs.k8s.io/json/code-of-conduct.md delete mode 100644 vendor/sigs.k8s.io/json/doc.go delete mode 100644 vendor/sigs.k8s.io/json/internal/golang/encoding/json/decode.go delete mode 100644 vendor/sigs.k8s.io/json/internal/golang/encoding/json/encode.go delete mode 100644 vendor/sigs.k8s.io/json/internal/golang/encoding/json/fold.go delete mode 100644 vendor/sigs.k8s.io/json/internal/golang/encoding/json/fuzz.go delete mode 100644 vendor/sigs.k8s.io/json/internal/golang/encoding/json/indent.go delete mode 100644 vendor/sigs.k8s.io/json/internal/golang/encoding/json/kubernetes_patch.go delete mode 100644 vendor/sigs.k8s.io/json/internal/golang/encoding/json/scanner.go delete mode 100644 vendor/sigs.k8s.io/json/internal/golang/encoding/json/stream.go delete mode 100644 vendor/sigs.k8s.io/json/internal/golang/encoding/json/tables.go delete mode 100644 vendor/sigs.k8s.io/json/internal/golang/encoding/json/tags.go delete mode 100644 vendor/sigs.k8s.io/json/json.go delete mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/LICENSE delete mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/fieldpath/doc.go delete mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/fieldpath/element.go delete mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/fieldpath/fromvalue.go delete mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/fieldpath/managers.go delete mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/fieldpath/path.go delete mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/fieldpath/pathelementmap.go delete mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/fieldpath/serialize-pe.go delete mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/fieldpath/serialize.go delete mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/fieldpath/set.go delete mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/schema/doc.go delete mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/schema/elements.go delete mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/schema/equals.go delete mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/schema/schemaschema.go delete mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/typed/doc.go delete mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/typed/helpers.go delete mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/typed/merge.go delete mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/typed/parser.go delete mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/typed/reconcile_schema.go delete mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/typed/remove.go delete mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/typed/tofieldset.go delete mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/typed/typed.go delete mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/typed/union.go delete mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/typed/validate.go delete mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/value/allocator.go delete mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/value/doc.go delete mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/value/fields.go delete mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/value/jsontagutil.go delete mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/value/list.go delete mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/value/listreflect.go delete mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/value/listunstructured.go delete mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/value/map.go delete mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/value/mapreflect.go delete mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/value/mapunstructured.go delete mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/value/reflectcache.go delete mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/value/scalar.go delete mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/value/structreflect.go delete mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/value/value.go delete mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/value/valuereflect.go delete mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/value/valueunstructured.go delete mode 100644 vendor/sigs.k8s.io/yaml/.gitignore delete mode 100644 vendor/sigs.k8s.io/yaml/.travis.yml delete mode 100644 vendor/sigs.k8s.io/yaml/CONTRIBUTING.md delete mode 100644 vendor/sigs.k8s.io/yaml/LICENSE delete mode 100644 vendor/sigs.k8s.io/yaml/OWNERS delete mode 100644 vendor/sigs.k8s.io/yaml/README.md delete mode 100644 vendor/sigs.k8s.io/yaml/RELEASE.md delete mode 100644 vendor/sigs.k8s.io/yaml/SECURITY_CONTACTS delete mode 100644 vendor/sigs.k8s.io/yaml/code-of-conduct.md delete mode 100644 vendor/sigs.k8s.io/yaml/fields.go delete mode 100644 vendor/sigs.k8s.io/yaml/yaml.go delete mode 100644 vendor/sigs.k8s.io/yaml/yaml_go110.go diff --git a/Makefile b/Makefile index 8b1053490..c254f38e8 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ build: $(BIN_PATH) $(BIN_PATH): $(SOURCES) @echo -e "\033[2mBuilding $(BIN_PATH)\033[0m" @echo "GOPATH=$(GOPATH)" - GOARCH=$(ARCH) CGO_ENABLED=$(CGO) go build -v -mod vendor -ldflags "-X $(KUBE_BURNER_VERSION).GitCommit=$(GIT_COMMIT) -X $(KUBE_BURNER_VERSION).BuildDate=$(BUILD_DATE) -X $(KUBE_BURNER_VERSION).Version=$(VERSION)" -o $(BIN_PATH) ./cmd/kube-burner + GOARCH=$(ARCH) CGO_ENABLED=$(CGO) go build -v -ldflags "-X $(KUBE_BURNER_VERSION).GitCommit=$(GIT_COMMIT) -X $(KUBE_BURNER_VERSION).BuildDate=$(BUILD_DATE) -X $(KUBE_BURNER_VERSION).Version=$(VERSION)" -o $(BIN_PATH) ./cmd/kube-burner lint: golangci-lint run @@ -49,13 +49,6 @@ lint: clean: test ! -e $(BIN_DIR) || rm -Rf $(BIN_PATH) -vendor: - go mod vendor - -deps-update: - go mod tidy - go mod vendor - install: cp $(BIN_PATH) /usr/bin/$(BIN_NAME) diff --git a/vendor/cloud.google.com/go/LICENSE b/vendor/cloud.google.com/go/LICENSE deleted file mode 100644 index d64569567..000000000 --- a/vendor/cloud.google.com/go/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/cloud.google.com/go/compute/metadata/metadata.go b/vendor/cloud.google.com/go/compute/metadata/metadata.go deleted file mode 100644 index b6e1f7b61..000000000 --- a/vendor/cloud.google.com/go/compute/metadata/metadata.go +++ /dev/null @@ -1,536 +0,0 @@ -// Copyright 2014 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package metadata provides access to Google Compute Engine (GCE) -// metadata and API service accounts. -// -// This package is a wrapper around the GCE metadata service, -// as documented at https://developers.google.com/compute/docs/metadata. -package metadata // import "cloud.google.com/go/compute/metadata" - -import ( - "context" - "encoding/json" - "fmt" - "io/ioutil" - "net" - "net/http" - "net/url" - "os" - "runtime" - "strings" - "sync" - "time" -) - -const ( - // metadataIP is the documented metadata server IP address. - metadataIP = "169.254.169.254" - - // metadataHostEnv is the environment variable specifying the - // GCE metadata hostname. If empty, the default value of - // metadataIP ("169.254.169.254") is used instead. - // This is variable name is not defined by any spec, as far as - // I know; it was made up for the Go package. - metadataHostEnv = "GCE_METADATA_HOST" - - userAgent = "gcloud-golang/0.1" -) - -type cachedValue struct { - k string - trim bool - mu sync.Mutex - v string -} - -var ( - projID = &cachedValue{k: "project/project-id", trim: true} - projNum = &cachedValue{k: "project/numeric-project-id", trim: true} - instID = &cachedValue{k: "instance/id", trim: true} -) - -var defaultClient = &Client{hc: &http.Client{ - Transport: &http.Transport{ - Dial: (&net.Dialer{ - Timeout: 2 * time.Second, - KeepAlive: 30 * time.Second, - }).Dial, - }, -}} - -// NotDefinedError is returned when requested metadata is not defined. -// -// The underlying string is the suffix after "/computeMetadata/v1/". -// -// This error is not returned if the value is defined to be the empty -// string. -type NotDefinedError string - -func (suffix NotDefinedError) Error() string { - return fmt.Sprintf("metadata: GCE metadata %q not defined", string(suffix)) -} - -func (c *cachedValue) get(cl *Client) (v string, err error) { - defer c.mu.Unlock() - c.mu.Lock() - if c.v != "" { - return c.v, nil - } - if c.trim { - v, err = cl.getTrimmed(c.k) - } else { - v, err = cl.Get(c.k) - } - if err == nil { - c.v = v - } - return -} - -var ( - onGCEOnce sync.Once - onGCE bool -) - -// OnGCE reports whether this process is running on Google Compute Engine. -func OnGCE() bool { - onGCEOnce.Do(initOnGCE) - return onGCE -} - -func initOnGCE() { - onGCE = testOnGCE() -} - -func testOnGCE() bool { - // The user explicitly said they're on GCE, so trust them. - if os.Getenv(metadataHostEnv) != "" { - return true - } - - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - - resc := make(chan bool, 2) - - // Try two strategies in parallel. - // See https://github.com/googleapis/google-cloud-go/issues/194 - go func() { - req, _ := http.NewRequest("GET", "http://"+metadataIP, nil) - req.Header.Set("User-Agent", userAgent) - res, err := defaultClient.hc.Do(req.WithContext(ctx)) - if err != nil { - resc <- false - return - } - defer res.Body.Close() - resc <- res.Header.Get("Metadata-Flavor") == "Google" - }() - - go func() { - addrs, err := net.DefaultResolver.LookupHost(ctx, "metadata.google.internal") - if err != nil || len(addrs) == 0 { - resc <- false - return - } - resc <- strsContains(addrs, metadataIP) - }() - - tryHarder := systemInfoSuggestsGCE() - if tryHarder { - res := <-resc - if res { - // The first strategy succeeded, so let's use it. - return true - } - // Wait for either the DNS or metadata server probe to - // contradict the other one and say we are running on - // GCE. Give it a lot of time to do so, since the system - // info already suggests we're running on a GCE BIOS. - timer := time.NewTimer(5 * time.Second) - defer timer.Stop() - select { - case res = <-resc: - return res - case <-timer.C: - // Too slow. Who knows what this system is. - return false - } - } - - // There's no hint from the system info that we're running on - // GCE, so use the first probe's result as truth, whether it's - // true or false. The goal here is to optimize for speed for - // users who are NOT running on GCE. We can't assume that - // either a DNS lookup or an HTTP request to a blackholed IP - // address is fast. Worst case this should return when the - // metaClient's Transport.ResponseHeaderTimeout or - // Transport.Dial.Timeout fires (in two seconds). - return <-resc -} - -// systemInfoSuggestsGCE reports whether the local system (without -// doing network requests) suggests that we're running on GCE. If this -// returns true, testOnGCE tries a bit harder to reach its metadata -// server. -func systemInfoSuggestsGCE() bool { - if runtime.GOOS != "linux" { - // We don't have any non-Linux clues available, at least yet. - return false - } - slurp, _ := ioutil.ReadFile("/sys/class/dmi/id/product_name") - name := strings.TrimSpace(string(slurp)) - return name == "Google" || name == "Google Compute Engine" -} - -// Subscribe calls Client.Subscribe on the default client. -func Subscribe(suffix string, fn func(v string, ok bool) error) error { - return defaultClient.Subscribe(suffix, fn) -} - -// Get calls Client.Get on the default client. -func Get(suffix string) (string, error) { return defaultClient.Get(suffix) } - -// ProjectID returns the current instance's project ID string. -func ProjectID() (string, error) { return defaultClient.ProjectID() } - -// NumericProjectID returns the current instance's numeric project ID. -func NumericProjectID() (string, error) { return defaultClient.NumericProjectID() } - -// InternalIP returns the instance's primary internal IP address. -func InternalIP() (string, error) { return defaultClient.InternalIP() } - -// ExternalIP returns the instance's primary external (public) IP address. -func ExternalIP() (string, error) { return defaultClient.ExternalIP() } - -// Email calls Client.Email on the default client. -func Email(serviceAccount string) (string, error) { return defaultClient.Email(serviceAccount) } - -// Hostname returns the instance's hostname. This will be of the form -// ".c..internal". -func Hostname() (string, error) { return defaultClient.Hostname() } - -// InstanceTags returns the list of user-defined instance tags, -// assigned when initially creating a GCE instance. -func InstanceTags() ([]string, error) { return defaultClient.InstanceTags() } - -// InstanceID returns the current VM's numeric instance ID. -func InstanceID() (string, error) { return defaultClient.InstanceID() } - -// InstanceName returns the current VM's instance ID string. -func InstanceName() (string, error) { return defaultClient.InstanceName() } - -// Zone returns the current VM's zone, such as "us-central1-b". -func Zone() (string, error) { return defaultClient.Zone() } - -// InstanceAttributes calls Client.InstanceAttributes on the default client. -func InstanceAttributes() ([]string, error) { return defaultClient.InstanceAttributes() } - -// ProjectAttributes calls Client.ProjectAttributes on the default client. -func ProjectAttributes() ([]string, error) { return defaultClient.ProjectAttributes() } - -// InstanceAttributeValue calls Client.InstanceAttributeValue on the default client. -func InstanceAttributeValue(attr string) (string, error) { - return defaultClient.InstanceAttributeValue(attr) -} - -// ProjectAttributeValue calls Client.ProjectAttributeValue on the default client. -func ProjectAttributeValue(attr string) (string, error) { - return defaultClient.ProjectAttributeValue(attr) -} - -// Scopes calls Client.Scopes on the default client. -func Scopes(serviceAccount string) ([]string, error) { return defaultClient.Scopes(serviceAccount) } - -func strsContains(ss []string, s string) bool { - for _, v := range ss { - if v == s { - return true - } - } - return false -} - -// A Client provides metadata. -type Client struct { - hc *http.Client -} - -// NewClient returns a Client that can be used to fetch metadata. -// Returns the client that uses the specified http.Client for HTTP requests. -// If nil is specified, returns the default client. -func NewClient(c *http.Client) *Client { - if c == nil { - return defaultClient - } - - return &Client{hc: c} -} - -// getETag returns a value from the metadata service as well as the associated ETag. -// This func is otherwise equivalent to Get. -func (c *Client) getETag(suffix string) (value, etag string, err error) { - ctx := context.TODO() - // Using a fixed IP makes it very difficult to spoof the metadata service in - // a container, which is an important use-case for local testing of cloud - // deployments. To enable spoofing of the metadata service, the environment - // variable GCE_METADATA_HOST is first inspected to decide where metadata - // requests shall go. - host := os.Getenv(metadataHostEnv) - if host == "" { - // Using 169.254.169.254 instead of "metadata" here because Go - // binaries built with the "netgo" tag and without cgo won't - // know the search suffix for "metadata" is - // ".google.internal", and this IP address is documented as - // being stable anyway. - host = metadataIP - } - suffix = strings.TrimLeft(suffix, "/") - u := "http://" + host + "/computeMetadata/v1/" + suffix - req, err := http.NewRequest("GET", u, nil) - if err != nil { - return "", "", err - } - req.Header.Set("Metadata-Flavor", "Google") - req.Header.Set("User-Agent", userAgent) - var res *http.Response - var reqErr error - retryer := newRetryer() - for { - res, reqErr = c.hc.Do(req) - var code int - if res != nil { - code = res.StatusCode - } - if delay, shouldRetry := retryer.Retry(code, reqErr); shouldRetry { - if err := sleep(ctx, delay); err != nil { - return "", "", err - } - continue - } - break - } - if reqErr != nil { - return "", "", nil - } - defer res.Body.Close() - if res.StatusCode == http.StatusNotFound { - return "", "", NotDefinedError(suffix) - } - all, err := ioutil.ReadAll(res.Body) - if err != nil { - return "", "", err - } - if res.StatusCode != 200 { - return "", "", &Error{Code: res.StatusCode, Message: string(all)} - } - return string(all), res.Header.Get("Etag"), nil -} - -// Get returns a value from the metadata service. -// The suffix is appended to "http://${GCE_METADATA_HOST}/computeMetadata/v1/". -// -// If the GCE_METADATA_HOST environment variable is not defined, a default of -// 169.254.169.254 will be used instead. -// -// If the requested metadata is not defined, the returned error will -// be of type NotDefinedError. -func (c *Client) Get(suffix string) (string, error) { - val, _, err := c.getETag(suffix) - return val, err -} - -func (c *Client) getTrimmed(suffix string) (s string, err error) { - s, err = c.Get(suffix) - s = strings.TrimSpace(s) - return -} - -func (c *Client) lines(suffix string) ([]string, error) { - j, err := c.Get(suffix) - if err != nil { - return nil, err - } - s := strings.Split(strings.TrimSpace(j), "\n") - for i := range s { - s[i] = strings.TrimSpace(s[i]) - } - return s, nil -} - -// ProjectID returns the current instance's project ID string. -func (c *Client) ProjectID() (string, error) { return projID.get(c) } - -// NumericProjectID returns the current instance's numeric project ID. -func (c *Client) NumericProjectID() (string, error) { return projNum.get(c) } - -// InstanceID returns the current VM's numeric instance ID. -func (c *Client) InstanceID() (string, error) { return instID.get(c) } - -// InternalIP returns the instance's primary internal IP address. -func (c *Client) InternalIP() (string, error) { - return c.getTrimmed("instance/network-interfaces/0/ip") -} - -// Email returns the email address associated with the service account. -// The account may be empty or the string "default" to use the instance's -// main account. -func (c *Client) Email(serviceAccount string) (string, error) { - if serviceAccount == "" { - serviceAccount = "default" - } - return c.getTrimmed("instance/service-accounts/" + serviceAccount + "/email") -} - -// ExternalIP returns the instance's primary external (public) IP address. -func (c *Client) ExternalIP() (string, error) { - return c.getTrimmed("instance/network-interfaces/0/access-configs/0/external-ip") -} - -// Hostname returns the instance's hostname. This will be of the form -// ".c..internal". -func (c *Client) Hostname() (string, error) { - return c.getTrimmed("instance/hostname") -} - -// InstanceTags returns the list of user-defined instance tags, -// assigned when initially creating a GCE instance. -func (c *Client) InstanceTags() ([]string, error) { - var s []string - j, err := c.Get("instance/tags") - if err != nil { - return nil, err - } - if err := json.NewDecoder(strings.NewReader(j)).Decode(&s); err != nil { - return nil, err - } - return s, nil -} - -// InstanceName returns the current VM's instance ID string. -func (c *Client) InstanceName() (string, error) { - return c.getTrimmed("instance/name") -} - -// Zone returns the current VM's zone, such as "us-central1-b". -func (c *Client) Zone() (string, error) { - zone, err := c.getTrimmed("instance/zone") - // zone is of the form "projects//zones/". - if err != nil { - return "", err - } - return zone[strings.LastIndex(zone, "/")+1:], nil -} - -// InstanceAttributes returns the list of user-defined attributes, -// assigned when initially creating a GCE VM instance. The value of an -// attribute can be obtained with InstanceAttributeValue. -func (c *Client) InstanceAttributes() ([]string, error) { return c.lines("instance/attributes/") } - -// ProjectAttributes returns the list of user-defined attributes -// applying to the project as a whole, not just this VM. The value of -// an attribute can be obtained with ProjectAttributeValue. -func (c *Client) ProjectAttributes() ([]string, error) { return c.lines("project/attributes/") } - -// InstanceAttributeValue returns the value of the provided VM -// instance attribute. -// -// If the requested attribute is not defined, the returned error will -// be of type NotDefinedError. -// -// InstanceAttributeValue may return ("", nil) if the attribute was -// defined to be the empty string. -func (c *Client) InstanceAttributeValue(attr string) (string, error) { - return c.Get("instance/attributes/" + attr) -} - -// ProjectAttributeValue returns the value of the provided -// project attribute. -// -// If the requested attribute is not defined, the returned error will -// be of type NotDefinedError. -// -// ProjectAttributeValue may return ("", nil) if the attribute was -// defined to be the empty string. -func (c *Client) ProjectAttributeValue(attr string) (string, error) { - return c.Get("project/attributes/" + attr) -} - -// Scopes returns the service account scopes for the given account. -// The account may be empty or the string "default" to use the instance's -// main account. -func (c *Client) Scopes(serviceAccount string) ([]string, error) { - if serviceAccount == "" { - serviceAccount = "default" - } - return c.lines("instance/service-accounts/" + serviceAccount + "/scopes") -} - -// Subscribe subscribes to a value from the metadata service. -// The suffix is appended to "http://${GCE_METADATA_HOST}/computeMetadata/v1/". -// The suffix may contain query parameters. -// -// Subscribe calls fn with the latest metadata value indicated by the provided -// suffix. If the metadata value is deleted, fn is called with the empty string -// and ok false. Subscribe blocks until fn returns a non-nil error or the value -// is deleted. Subscribe returns the error value returned from the last call to -// fn, which may be nil when ok == false. -func (c *Client) Subscribe(suffix string, fn func(v string, ok bool) error) error { - const failedSubscribeSleep = time.Second * 5 - - // First check to see if the metadata value exists at all. - val, lastETag, err := c.getETag(suffix) - if err != nil { - return err - } - - if err := fn(val, true); err != nil { - return err - } - - ok := true - if strings.ContainsRune(suffix, '?') { - suffix += "&wait_for_change=true&last_etag=" - } else { - suffix += "?wait_for_change=true&last_etag=" - } - for { - val, etag, err := c.getETag(suffix + url.QueryEscape(lastETag)) - if err != nil { - if _, deleted := err.(NotDefinedError); !deleted { - time.Sleep(failedSubscribeSleep) - continue // Retry on other errors. - } - ok = false - } - lastETag = etag - - if err := fn(val, ok); err != nil || !ok { - return err - } - } -} - -// Error contains an error response from the server. -type Error struct { - // Code is the HTTP response status code. - Code int - // Message is the server response message. - Message string -} - -func (e *Error) Error() string { - return fmt.Sprintf("compute: Received %d `%s`", e.Code, e.Message) -} diff --git a/vendor/cloud.google.com/go/compute/metadata/retry.go b/vendor/cloud.google.com/go/compute/metadata/retry.go deleted file mode 100644 index 0f18f3cda..000000000 --- a/vendor/cloud.google.com/go/compute/metadata/retry.go +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package metadata - -import ( - "context" - "io" - "math/rand" - "net/http" - "time" -) - -const ( - maxRetryAttempts = 5 -) - -var ( - syscallRetryable = func(err error) bool { return false } -) - -// defaultBackoff is basically equivalent to gax.Backoff without the need for -// the dependency. -type defaultBackoff struct { - max time.Duration - mul float64 - cur time.Duration -} - -func (b *defaultBackoff) Pause() time.Duration { - d := time.Duration(1 + rand.Int63n(int64(b.cur))) - b.cur = time.Duration(float64(b.cur) * b.mul) - if b.cur > b.max { - b.cur = b.max - } - return d -} - -// sleep is the equivalent of gax.Sleep without the need for the dependency. -func sleep(ctx context.Context, d time.Duration) error { - t := time.NewTimer(d) - select { - case <-ctx.Done(): - t.Stop() - return ctx.Err() - case <-t.C: - return nil - } -} - -func newRetryer() *metadataRetryer { - return &metadataRetryer{bo: &defaultBackoff{ - cur: 100 * time.Millisecond, - max: 30 * time.Second, - mul: 2, - }} -} - -type backoff interface { - Pause() time.Duration -} - -type metadataRetryer struct { - bo backoff - attempts int -} - -func (r *metadataRetryer) Retry(status int, err error) (time.Duration, bool) { - if status == http.StatusOK { - return 0, false - } - retryOk := shouldRetry(status, err) - if !retryOk { - return 0, false - } - if r.attempts == maxRetryAttempts { - return 0, false - } - r.attempts++ - return r.bo.Pause(), true -} - -func shouldRetry(status int, err error) bool { - if 500 <= status && status <= 599 { - return true - } - if err == io.ErrUnexpectedEOF { - return true - } - // Transient network errors should be retried. - if syscallRetryable(err) { - return true - } - if err, ok := err.(interface{ Temporary() bool }); ok { - if err.Temporary() { - return true - } - } - if err, ok := err.(interface{ Unwrap() error }); ok { - return shouldRetry(status, err.Unwrap()) - } - return false -} diff --git a/vendor/cloud.google.com/go/compute/metadata/retry_linux.go b/vendor/cloud.google.com/go/compute/metadata/retry_linux.go deleted file mode 100644 index bb412f891..000000000 --- a/vendor/cloud.google.com/go/compute/metadata/retry_linux.go +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//go:build linux -// +build linux - -package metadata - -import "syscall" - -func init() { - // Initialize syscallRetryable to return true on transient socket-level - // errors. These errors are specific to Linux. - syscallRetryable = func(err error) bool { return err == syscall.ECONNRESET || err == syscall.ECONNREFUSED } -} diff --git a/vendor/github.com/Azure/go-autorest/.gitignore b/vendor/github.com/Azure/go-autorest/.gitignore deleted file mode 100644 index 3350aaf70..000000000 --- a/vendor/github.com/Azure/go-autorest/.gitignore +++ /dev/null @@ -1,32 +0,0 @@ -# The standard Go .gitignore file follows. (Sourced from: github.com/github/gitignore/master/Go.gitignore) -# Compiled Object files, Static and Dynamic libs (Shared Objects) -*.o -*.a -*.so - -# Folders -_obj -_test -.DS_Store -.idea/ -.vscode/ - -# Architecture specific extensions/prefixes -*.[568vq] -[568vq].out - -*.cgo1.go -*.cgo2.c -_cgo_defun.c -_cgo_gotypes.go -_cgo_export.* - -_testmain.go - -*.exe -*.test -*.prof - -# go-autorest specific -vendor/ -autorest/azure/example/example diff --git a/vendor/github.com/Azure/go-autorest/CHANGELOG.md b/vendor/github.com/Azure/go-autorest/CHANGELOG.md deleted file mode 100644 index d1f596bfc..000000000 --- a/vendor/github.com/Azure/go-autorest/CHANGELOG.md +++ /dev/null @@ -1,1004 +0,0 @@ -# CHANGELOG - -## v14.2.0 - -- Added package comment to make `github.com/Azure/go-autorest` importable. - -## v14.1.1 - -### Bug Fixes - -- Change `x-ms-authorization-auxiliary` header value separator to comma. - -## v14.1.0 - -### New Features - -- Added `azure.SetEnvironment()` that will update the global environments map with the specified values. - -## v14.0.1 - -### Bug Fixes - -- Fix race condition when refreshing token. -- Fixed some tests to work with Go 1.14. - -## v14.0.0 - -## Breaking Changes - -- By default, the `DoRetryForStatusCodes` functions will no longer infinitely retry a request when the response returns an HTTP status code of 429 (StatusTooManyRequests). To opt in to the old behavior set `autorest.Count429AsRetry` to `false`. - -## New Features - -- Variable `autorest.Max429Delay` can be used to control the maximum delay between retries when a 429 is received with no `Retry-After` header. The default is zero which means there is no cap. - -## v13.4.0 - -## New Features - -- Added field `SendDecorators` to the `Client` type. This can be used to specify a custom chain of SendDecorators per client. -- Added method `Client.Send()` which includes logic for selecting the preferred chain of SendDecorators. - -## v13.3.3 - -### Bug Fixes - -- Fixed connection leak when retrying requests. -- Enabled exponential back-off with a 2-minute cap when retrying on 429. -- Fixed some cases where errors were inadvertently dropped. - -## v13.3.2 - -### Bug Fixes - -- Updated `autorest.AsStringSlice()` to convert slice elements to their string representation. - -## v13.3.1 - -- Updated external dependencies. - -### Bug Fixes - -## v13.3.0 - -### New Features - -- Added support for shared key and shared access signature token authorization. - - `autorest.NewSharedKeyAuthorizer()` and dependent types. - - `autorest.NewSASTokenAuthorizer()` and dependent types. -- Added `ServicePrincipalToken.SetCustomRefresh()` so a custom refresh function can be invoked when a token has expired. - -### Bug Fixes - -- Fixed `cli.AccessTokensPath()` to respect `AZURE_CONFIG_DIR` when set. -- Support parsing error messages in XML responses. - -## v13.2.0 - -### New Features - -- Added the following functions to replace their versions that don't take a context. - - `adal.InitiateDeviceAuthWithContext()` - - `adal.CheckForUserCompletionWithContext()` - - `adal.WaitForUserCompletionWithContext()` - -## v13.1.0 - -### New Features - -- Added support for MSI authentication on Azure App Service and Azure Functions. - -## v13.0.2 - -### Bug Fixes - -- Always retry a request even if the sender returns a non-nil error. - -## v13.0.1 - -## Bug Fixes - -- Fixed `autorest.WithQueryParameters()` so that it properly encodes multi-value query parameters. - -## v13.0.0 - -## Breaking Changes - -The `tracing` package has been rewritten to provide a common interface for consumers to wire in the tracing package of their choice. -What this means is that by default no tracing provider will be compiled into your program and setting the `AZURE_SDK_TRACING_ENABLED` -environment variable will have no effect. To enable this previous behavior you must now add the following import to your source file. -```go - import _ "github.com/Azure/go-autorest/tracing/opencensus" -``` -The APIs required by autorest-generated code have remained but some APIs have been removed and new ones added. -The following APIs and variables have been removed (the majority of them were moved to the `opencensus` package). -- tracing.Transport -- tracing.Enable() -- tracing.EnableWithAIForwarding() -- tracing.Disable() - -The following APIs and types have been added -- tracing.Tracer -- tracing.Register() - -To hook up a tracer simply call `tracing.Register()` passing in a type that satisfies the `tracing.Tracer` interface. - -## v12.4.3 - -### Bug Fixes - -- `autorest.MultiTenantServicePrincipalTokenAuthorizer` will now properly add its auxiliary bearer tokens. - -## v12.4.2 - -### Bug Fixes - -- Improvements to the fixes made in v12.4.1. - - Remove `override` stanza from Gopkg.toml and `replace` directive from go.mod as they don't apply when being consumed as a dependency. - - Switched to latest version of `ocagent` that still depends on protobuf v1.2. - - Add indirect dependencies to the `required` clause with matching `constraint` stanzas so that `dep` dependencies match go.sum. - -## v12.4.1 - -### Bug Fixes - -- Updated OpenCensus and OCAgent versions to versions that don't depend on v1.3+ of protobuf as it was breaking kubernetes. -- Pinned opencensus-proto to a version that's compatible with our versions of OpenCensus and OCAgent. - -## v12.4.0 - -### New Features - -- Added `autorest.WithPrepareDecorators` and `autorest.GetPrepareDecorators` for adding and retrieving a custom chain of PrepareDecorators to the provided context. - -## v12.3.0 - -### New Features - -- Support for multi-tenant via x-ms-authorization-auxiliary header has been added for client credentials with - secret scenario; this basically bundles multiple OAuthConfig and ServicePrincipalToken types into corresponding - MultiTenant* types along with a new authorizer that adds the primary and auxiliary token headers to the reqest. - The authenticaion helpers have been updated to support this scenario; if environment var AZURE_AUXILIARY_TENANT_IDS - is set with a semicolon delimited list of tenants the multi-tenant codepath will kick in to create the appropriate authorizer. - See `adal.NewMultiTenantOAuthConfig`, `adal.NewMultiTenantServicePrincipalToken` and `autorest.NewMultiTenantServicePrincipalTokenAuthorizer` - along with their supporting types and methods. -- Added `autorest.WithSendDecorators` and `autorest.GetSendDecorators` for adding and retrieving a custom chain of SendDecorators to the provided context. -- Added `autorest.DoRetryForStatusCodesWithCap` and `autorest.DelayForBackoffWithCap` to enforce an upper bound on the duration between retries. - -## v12.2.0 - -### New Features - -- Added `autorest.WithXML`, `autorest.AsMerge`, `autorest.WithBytes` preparer decorators. -- Added `autorest.ByUnmarshallingBytes` response decorator. -- Added `Response.IsHTTPStatus` and `Response.HasHTTPStatus` helper methods for inspecting HTTP status code in `autorest.Response` types. - -### Bug Fixes - -- `autorest.DelayWithRetryAfter` now supports HTTP-Dates in the `Retry-After` header and is not limited to just 429 status codes. - -## v12.1.0 - -### New Features - -- Added `to.ByteSlicePtr()`. -- Added blob/queue storage resource ID to `azure.ResourceIdentifier`. - -## v12.0.0 - -### Breaking Changes - -In preparation for modules the following deprecated content has been removed. - - - async.NewFuture() - - async.Future.Done() - - async.Future.WaitForCompletion() - - async.DoPollForAsynchronous() - - The `utils` package - - validation.NewErrorWithValidationError() - - The `version` package - -## v11.9.0 - -### New Features - -- Add `ResourceIdentifiers` field to `azure.Environment` containing resource IDs for public and sovereign clouds. - -## v11.8.0 - -### New Features - -- Added `autorest.NewClientWithOptions()` to support endpoints that require free renegotiation. - -## v11.7.1 - -### Bug Fixes - -- Fix missing support for http(s) proxy when using the default sender. - -## v11.7.0 - -### New Features - -- Added methods to obtain a ServicePrincipalToken on the various credential configuration types in the `auth` package. - -## v11.6.1 - -### Bug Fixes - -- Fix ACR DNS endpoint for government clouds. -- Add Cosmos DB DNS endpoints. -- Update dependencies to resolve build breaks in OpenCensus. - -## v11.6.0 - -### New Features - -- Added type `autorest.BasicAuthorizer` to support Basic authentication. - -## v11.5.2 - -### Bug Fixes - -- Fixed `GetTokenFromCLI` did not work with zsh. - -## v11.5.1 - -### Bug Fixes - -- In `Client.sender()` set the minimum TLS version on HTTP clients to 1.2. - -## v11.5.0 - -### New Features - -- The `auth` package has been refactored so that the environment and file settings are now available. -- The methods used in `auth.NewAuthorizerFromEnvironment()` are now exported so that custom authorization chains can be created. -- Added support for certificate authorization for file-based config. - -## v11.4.0 - -### New Features - -- Added `adal.AddToUserAgent()` so callers can append custom data to the user-agent header used for ADAL requests. -- Exported `adal.UserAgent()` for parity with `autorest.Client`. - -## v11.3.2 - -### Bug Fixes - -- In `Future.WaitForCompletionRef()` if the provided context has a deadline don't add the default deadline. - -## v11.3.1 - -### Bug Fixes - -- For an LRO PUT operation the final GET URL was incorrectly set to the Location polling header in some cases. - -## v11.3.0 - -### New Features - -- Added method `ServicePrincipalToken()` to `DeviceFlowConfig` type. - -## v11.2.8 - -### Bug Fixes - -- Deprecate content in the `version` package. The functionality has been superseded by content in the `autorest` package. - -## v11.2.7 - -### Bug Fixes - -- Fix environment variable name for enabling tracing from `AZURE_SDK_TRACING_ENABELD` to `AZURE_SDK_TRACING_ENABLED`. - Note that for backward compatibility reasons, both will work until the next major version release of the package. - -## v11.2.6 - -### Bug Fixes - -- If zero bytes are read from a polling response body don't attempt to unmarshal them. - -## v11.2.5 - -### Bug Fixes - -- Removed race condition in `autorest.DoRetryForStatusCodes`. - -## v11.2.4 - -### Bug Fixes - -- Function `cli.ProfilePath` now respects environment `AZURE_CONFIG_DIR` if available. - -## v11.2.1 - -NOTE: Versions of Go prior to 1.10 have been removed from CI as they no -longer work with golint. - -### Bug Fixes - -- Method `MSIConfig.Authorizer` now supports user-assigned identities. -- The adal package now reports its own user-agent string. - -## v11.2.0 - -### New Features - -- Added `tracing` package that enables instrumentation of HTTP and API calls. - Setting the env variable `AZURE_SDK_TRACING_ENABLED` or calling `tracing.Enable` - will start instrumenting the code for metrics and traces. - Additionally, setting the env variable `OCAGENT_TRACE_EXPORTER_ENDPOINT` or - calling `tracing.EnableWithAIForwarding` will start the instrumentation and connect to an - App Insights Local Forwarder that is needs to be running. Note that if the - AI Local Forwarder is not running tracking will still be enabled. - By default, instrumentation is disabled. Once enabled, instrumentation can also - be programatically disabled by calling `Disable`. -- Added `DoneWithContext` call for checking LRO status. `Done` has been deprecated. - -### Bug Fixes - -- Don't use the initial request's context for LRO polling. -- Don't override the `refreshLock` and the `http.Client` when unmarshalling `ServicePrincipalToken` if - it is already set. - -## v11.1.1 - -### Bug Fixes - -- When creating a future always include the polling tracker even if there's a failure; this allows the underlying response to be obtained by the caller. - -## v11.1.0 - -### New Features - -- Added `auth.NewAuthorizerFromCLI` to create an authorizer configured from the Azure 2.0 CLI. -- Added `adal.NewOAuthConfigWithAPIVersion` to create an OAuthConfig with the specified API version. - -## v11.0.1 - -### New Features - -- Added `x5c` header to client assertion for certificate Issuer+Subject Name authentication. - -## v11.0.0 - -### Breaking Changes - -- To handle differences between ADFS and AAD the following fields have had their types changed from `string` to `json.Number` - - ExpiresIn - - ExpiresOn - - NotBefore - -### New Features - -- Added `auth.NewAuthorizerFromFileWithResource` to create an authorizer from the config file with the specified resource. -- Setting a client's `PollingDuration` to zero will use the provided context to control a LRO's polling duration. - -## v10.15.5 - -### Bug Fixes - -- In `DoRetryForStatusCodes`, if a request's context is cancelled return the last response. - -## v10.15.4 - -### Bug Fixes - -- If a polling operation returns a failure status code return the associated error. - -## v10.15.3 - -### Bug Fixes - -- Initialize the polling URL and method for an LRO tracker on each iteration, favoring the Azure-AsyncOperation header. - -## v10.15.2 - -### Bug Fixes - -- Use fmt.Fprint when printing request/response so that any escape sequences aren't treated as format specifiers. - -## v10.15.1 - -### Bug Fixes - -- If an LRO API returns a `Failed` provisioning state in the initial response return an error at that point so the caller doesn't have to poll. -- For failed LROs without an OData v4 error include the response body in the error's `AdditionalInfo` field to aid in diagnosing the failure. - -## v10.15.0 - -### New Features - -- Add initial support for request/response logging via setting environment variables. - Setting `AZURE_GO_SDK_LOG_LEVEL` to `LogInfo` will log request/response - without their bodies. To include the bodies set the log level to `LogDebug`. - By default the logger writes to strerr, however it can also write to stdout or a file - if specified in `AZURE_GO_SDK_LOG_FILE`. Note that if the specified file - already exists it will be truncated. - IMPORTANT: by default the logger will redact the Authorization and Ocp-Apim-Subscription-Key - headers. Any other secrets will _not_ be redacted. - -## v10.14.0 - -### New Features - -- Added package version that contains version constants and user-agent data. - -### Bug Fixes - -- Add the user-agent to token requests. - -## v10.13.0 - -- Added support for additionalInfo in ServiceError type. - -## v10.12.0 - -### New Features - -- Added field ServicePrincipalToken.MaxMSIRefreshAttempts to configure the maximun number of attempts to refresh an MSI token. - -## v10.11.4 - -### Bug Fixes - -- If an LRO returns http.StatusOK on the initial response with no async headers return the response body from Future.GetResult(). -- If there is no "final GET URL" return an error from Future.GetResult(). - -## v10.11.3 - -### Bug Fixes - -- In IMDS retry logic, if we don't receive a response don't retry. - - Renamed the retry function so it's clear it's meant for IMDS only. -- For error response bodies that aren't OData-v4 compliant stick the raw JSON in the ServiceError.Details field so the information isn't lost. - - Also add the raw HTTP response to the DetailedResponse. -- Removed superfluous wrapping of response error in azure.DoRetryWithRegistration(). - -## v10.11.2 - -### Bug Fixes - -- Validation for integers handles int and int64 types. - -## v10.11.1 - -### Bug Fixes - -- Adding User information to authorization config as parsed from CLI cache. - -## v10.11.0 - -### New Features - -- Added NewServicePrincipalTokenFromManualTokenSecret for creating a new SPT using a manual token and secret -- Added method ServicePrincipalToken.MarshalTokenJSON() to marshall the inner Token - -## v10.10.0 - -### New Features - -- Most ServicePrincipalTokens can now be marshalled/unmarshall to/from JSON (ServicePrincipalCertificateSecret and ServicePrincipalMSISecret are not supported). -- Added method ServicePrincipalToken.SetRefreshCallbacks(). - -## v10.9.2 - -### Bug Fixes - -- Refreshing a refresh token obtained from a web app authorization code now works. - -## v10.9.1 - -### Bug Fixes - -- The retry logic for MSI token requests now uses exponential backoff per the guidelines. -- IsTemporaryNetworkError() will return true for errors that don't implement the net.Error interface. - -## v10.9.0 - -### Deprecated Methods - -| Old Method | New Method | -| -------------------------: | :---------------------------: | -| azure.NewFuture() | azure.NewFutureFromResponse() | -| Future.WaitForCompletion() | Future.WaitForCompletionRef() | - -### New Features - -- Added azure.NewFutureFromResponse() for creating a Future from the initial response from an async operation. -- Added Future.GetResult() for making the final GET call to retrieve the result from an async operation. - -### Bug Fixes - -- Some futures failed to return their results, this should now be fixed. - -## v10.8.2 - -### Bug Fixes - -- Add nil-gaurd to token retry logic. - -## v10.8.1 - -### Bug Fixes - -- Return a TokenRefreshError if the sender fails on the initial request. -- Don't retry on non-temporary network errors. - -## v10.8.0 - -- Added NewAuthorizerFromEnvironmentWithResource() helper function. - -## v10.7.0 - -### New Features - -- Added \*WithContext() methods to ADAL token refresh operations. - -## v10.6.2 - -- Fixed a bug on device authentication. - -## v10.6.1 - -- Added retries to MSI token get request. - -## v10.6.0 - -- Changed MSI token implementation. Now, the token endpoint is the IMDS endpoint. - -## v10.5.1 - -### Bug Fixes - -- `DeviceFlowConfig.Authorizer()` now prints the device code message when running `go test`. `-v` flag is required. - -## v10.5.0 - -### New Features - -- Added NewPollingRequestWithContext() for use with polling asynchronous operations. - -### Bug Fixes - -- Make retry logic use the request's context instead of the deprecated Cancel object. - -## v10.4.0 - -### New Features - -- Added helper for parsing Azure Resource ID's. -- Added deprecation message to utils.GetEnvVarOrExit() - -## v10.3.0 - -### New Features - -- Added EnvironmentFromURL method to load an Environment from a given URL. This function is particularly useful in the private and hybrid Cloud model, where one may define their own endpoints -- Added TokenAudience endpoint to Environment structure. This is useful in private and hybrid cloud models where TokenAudience endpoint can be different from ResourceManagerEndpoint - -## v10.2.0 - -### New Features - -- Added endpoints for batch management. - -## v10.1.3 - -### Bug Fixes - -- In Client.Do() invoke WithInspection() last so that it will inspect WithAuthorization(). -- Fixed authorization methods to invoke p.Prepare() first, aligning them with the other preparers. - -## v10.1.2 - -- Corrected comment for auth.NewAuthorizerFromFile() function. - -## v10.1.1 - -- Updated version number to match current release. - -## v10.1.0 - -### New Features - -- Expose the polling URL for futures. - -### Bug Fixes - -- Add validation.NewErrorWithValidationError back to prevent breaking changes (it is deprecated). - -## v10.0.0 - -### New Features - -- Added target and innererror fields to ServiceError to comply with OData v4 spec. -- The Done() method on futures will now return a ServiceError object when available (it used to return a partial value of such errors). -- Added helper methods for obtaining authorizers. -- Expose the polling URL for futures. - -### Bug Fixes - -- Switched from glide to dep for dependency management. -- Fixed unmarshaling of ServiceError for JSON bodies that don't conform to the OData spec. -- Fixed a race condition in token refresh. - -### Breaking Changes - -- The ServiceError.Details field type has been changed to match the OData v4 spec. -- Go v1.7 has been dropped from CI. -- API parameter validation failures will now return a unique error type validation.Error. -- The adal.Token type has been decomposed from adal.ServicePrincipalToken (this was necessary in order to fix the token refresh race). - -## v9.10.0 - -- Fix the Service Bus suffix in Azure public env -- Add Service Bus Endpoint (AAD ResourceURI) for use in [Azure Service Bus RBAC Preview](https://docs.microsoft.com/en-us/azure/service-bus-messaging/service-bus-role-based-access-control) - -## v9.9.0 - -### New Features - -- Added EventGridKeyAuthorizer for key authorization with event grid topics. - -### Bug Fixes - -- Fixed race condition when auto-refreshing service principal tokens. - -## v9.8.1 - -### Bug Fixes - -- Added http.StatusNoContent (204) to the list of expected status codes for long-running operations. -- Updated runtime version info so it's current. - -## v9.8.0 - -### New Features - -- Added type azure.AsyncOpIncompleteError to be returned from a future's Result() method when the operation has not completed. - -## v9.7.1 - -### Bug Fixes - -- Use correct AAD and Graph endpoints for US Gov environment. - -## v9.7.0 - -### New Features - -- Added support for application/octet-stream MIME types. - -## v9.6.1 - -### Bug Fixes - -- Ensure Authorization header is added to request when polling for registration status. - -## v9.6.0 - -### New Features - -- Added support for acquiring tokens via MSI with a user assigned identity. - -## v9.5.3 - -### Bug Fixes - -- Don't remove encoding of existing URL Query parameters when calling autorest.WithQueryParameters. -- Set correct Content Type when using autorest.WithFormData. - -## v9.5.2 - -### Bug Fixes - -- Check for nil \*http.Response before dereferencing it. - -## v9.5.1 - -### Bug Fixes - -- Don't count http.StatusTooManyRequests (429) against the retry cap. -- Use retry logic when SkipResourceProviderRegistration is set to true. - -## v9.5.0 - -### New Features - -- Added support for username + password, API key, authoriazation code and cognitive services authentication. -- Added field SkipResourceProviderRegistration to clients to provide a way to skip auto-registration of RPs. -- Added utility function AsStringSlice() to convert its parameters to a string slice. - -### Bug Fixes - -- When checking for authentication failures look at the error type not the status code as it could vary. - -## v9.4.2 - -### Bug Fixes - -- Validate parameters when creating credentials. -- Don't retry requests if the returned status is a 401 (http.StatusUnauthorized) as it will never succeed. - -## v9.4.1 - -### Bug Fixes - -- Update the AccessTokensPath() to read access tokens path through AZURE_ACCESS_TOKEN_FILE. If this - environment variable is not set, it will fall back to use default path set by Azure CLI. -- Use case-insensitive string comparison for polling states. - -## v9.4.0 - -### New Features - -- Added WaitForCompletion() to Future as a default polling implementation. - -### Bug Fixes - -- Method Future.Done() shouldn't update polling status for unexpected HTTP status codes. - -## v9.3.1 - -### Bug Fixes - -- DoRetryForStatusCodes will retry if sender.Do returns a non-nil error. - -## v9.3.0 - -### New Features - -- Added PollingMethod() to Future so callers know what kind of polling mechanism is used. -- Added azure.ChangeToGet() which transforms an http.Request into a GET (to be used with LROs). - -## v9.2.0 - -### New Features - -- Added support for custom Azure Stack endpoints. -- Added type azure.Future used to track the status of long-running operations. - -### Bug Fixes - -- Preserve the original error in DoRetryWithRegistration when registration fails. - -## v9.1.1 - -- Fixes a bug regarding the cookie jar on `autorest.Client.Sender`. - -## v9.1.0 - -### New Features - -- In cases where there is a non-empty error from the service, attempt to unmarshal it instead of uniformly calling it an "Unknown" error. -- Support for loading Azure CLI Authentication files. -- Automatically register your subscription with the Azure Resource Provider if it hadn't been previously. - -### Bug Fixes - -- RetriableRequest can now tolerate a ReadSeekable body being read but not reset. -- Adding missing Apache Headers - -## v9.0.0 - -> **IMPORTANT:** This release was intially labeled incorrectly as `v8.4.0`. From the time it was released, it should have been marked `v9.0.0` because it contains breaking changes to the MSI packages. We appologize for any inconvenience this causes. - -Adding MSI Endpoint Support and CLI token rehydration. - -## v8.3.1 - -Pick up bug fix in adal for MSI support. - -## v8.3.0 - -Updates to Error string formats for clarity. Also, adding a copy of the http.Response to errors for an improved debugging experience. - -## v8.2.0 - -### New Features - -- Add support for bearer authentication callbacks -- Support 429 response codes that include "Retry-After" header -- Support validation constraint "Pattern" for map keys - -### Bug Fixes - -- Make RetriableRequest work with multiple versions of Go - -## v8.1.1 - -Updates the RetriableRequest to take advantage of GetBody() added in Go 1.8. - -## v8.1.0 - -Adds RetriableRequest type for more efficient handling of retrying HTTP requests. - -## v8.0.0 - -ADAL refactored into its own package. -Support for UNIX time. - -## v7.3.1 - -- Version Testing now removed from production bits that are shipped with the library. - -## v7.3.0 - -- Exposing new `RespondDecorator`, `ByDiscardingBody`. This allows operations - to acknowledge that they do not need either the entire or a trailing portion - of accepts response body. In doing so, Go's http library can reuse HTTP - connections more readily. -- Adding `PrepareDecorator` to target custom BaseURLs. -- Adding ACR suffix to public cloud environment. -- Updating Glide dependencies. - -## v7.2.5 - -- Fixed the Active Directory endpoint for the China cloud. -- Removes UTF-8 BOM if present in response payload. -- Added telemetry. - -## v7.2.3 - -- Fixing bug in calls to `DelayForBackoff` that caused doubling of delay - duration. - -## v7.2.2 - -- autorest/azure: added ASM and ARM VM DNS suffixes. - -## v7.2.1 - -- fixed parsing of UTC times that are not RFC3339 conformant. - -## v7.2.0 - -- autorest/validation: Reformat validation error for better error message. - -## v7.1.0 - -- preparer: Added support for multipart formdata - WithMultiPartFormdata() -- preparer: Added support for sending file in request body - WithFile -- client: Added RetryDuration parameter. -- autorest/validation: new package for validation code for Azure Go SDK. - -## v7.0.7 - -- Add trailing / to endpoint -- azure: add EnvironmentFromName - -## v7.0.6 - -- Add retry logic for 408, 500, 502, 503 and 504 status codes. -- Change url path and query encoding logic. -- Fix DelayForBackoff for proper exponential delay. -- Add CookieJar in Client. - -## v7.0.5 - -- Add check to start polling only when status is in [200,201,202]. -- Refactoring for unchecked errors. -- azure/persist changes. -- Fix 'file in use' issue in renewing token in deviceflow. -- Store header RetryAfter for subsequent requests in polling. -- Add attribute details in service error. - -## v7.0.4 - -- Better error messages for long running operation failures - -## v7.0.3 - -- Corrected DoPollForAsynchronous to properly handle the initial response - -## v7.0.2 - -- Corrected DoPollForAsynchronous to continue using the polling method first discovered - -## v7.0.1 - -- Fixed empty JSON input error in ByUnmarshallingJSON -- Fixed polling support for GET calls -- Changed format name from TimeRfc1123 to TimeRFC1123 - -## v7.0.0 - -- Added ByCopying responder with supporting TeeReadCloser -- Rewrote Azure asynchronous handling -- Reverted to only unmarshalling JSON -- Corrected handling of RFC3339 time strings and added support for Rfc1123 time format - -The `json.Decoder` does not catch bad data as thoroughly as `json.Unmarshal`. Since -`encoding/json` successfully deserializes all core types, and extended types normally provide -their custom JSON serialization handlers, the code has been reverted back to using -`json.Unmarshal`. The original change to use `json.Decode` was made to reduce duplicate -code; there is no loss of function, and there is a gain in accuracy, by reverting. - -Additionally, Azure services indicate requests to be polled by multiple means. The existing code -only checked for one of those (that is, the presence of the `Azure-AsyncOperation` header). -The new code correctly covers all cases and aligns with the other Azure SDKs. - -## v6.1.0 - -- Introduced `date.ByUnmarshallingJSONDate` and `date.ByUnmarshallingJSONTime` to enable JSON encoded values. - -## v6.0.0 - -- Completely reworked the handling of polled and asynchronous requests -- Removed unnecessary routines -- Reworked `mocks.Sender` to replay a series of `http.Response` objects -- Added `PrepareDecorators` for primitive types (e.g., bool, int32) - -Handling polled and asynchronous requests is no longer part of `Client#Send`. Instead new -`SendDecorators` implement different styles of polled behavior. See`autorest.DoPollForStatusCodes` -and `azure.DoPollForAsynchronous` for examples. - -## v5.0.0 - -- Added new RespondDecorators unmarshalling primitive types -- Corrected application of inspection and authorization PrependDecorators - -## v4.0.0 - -- Added support for Azure long-running operations. -- Added cancelation support to all decorators and functions that may delay. -- Breaking: `DelayForBackoff` now accepts a channel, which may be nil. - -## v3.1.0 - -- Add support for OAuth Device Flow authorization. -- Add support for ServicePrincipalTokens that are backed by an existing token, rather than other secret material. -- Add helpers for persisting and restoring Tokens. -- Increased code coverage in the github.com/Azure/autorest/azure package - -## v3.0.0 - -- Breaking: `NewErrorWithError` no longer takes `statusCode int`. -- Breaking: `NewErrorWithStatusCode` is replaced with `NewErrorWithResponse`. -- Breaking: `Client#Send()` no longer takes `codes ...int` argument. -- Add: XML unmarshaling support with `ByUnmarshallingXML()` -- Stopped vending dependencies locally and switched to [Glide](https://github.com/Masterminds/glide). - Applications using this library should either use Glide or vendor dependencies locally some other way. -- Add: `azure.WithErrorUnlessStatusCode()` decorator to handle Azure errors. -- Fix: use `net/http.DefaultClient` as base client. -- Fix: Missing inspection for polling responses added. -- Add: CopyAndDecode helpers. -- Improved `./autorest/to` with `[]string` helpers. -- Removed golint suppressions in .travis.yml. - -## v2.1.0 - -- Added `StatusCode` to `Error` for more easily obtaining the HTTP Reponse StatusCode (if any) - -## v2.0.0 - -- Changed `to.StringMapPtr` method signature to return a pointer -- Changed `ServicePrincipalCertificateSecret` and `NewServicePrincipalTokenFromCertificate` to support generic certificate and private keys - -## v1.0.0 - -- Added Logging inspectors to trace http.Request / Response -- Added support for User-Agent header -- Changed WithHeader PrepareDecorator to use set vs. add -- Added JSON to error when unmarshalling fails -- Added Client#Send method -- Corrected case of "Azure" in package paths -- Added "to" helpers, Azure helpers, and improved ease-of-use -- Corrected golint issues - -## v1.0.1 - -- Added CHANGELOG.md - -## v1.1.0 - -- Added mechanism to retrieve a ServicePrincipalToken using a certificate-signed JWT -- Added an example of creating a certificate-based ServicePrincipal and retrieving an OAuth token using the certificate - -## v1.1.1 - -- Introduce godeps and vendor dependencies introduced in v1.1.1 diff --git a/vendor/github.com/Azure/go-autorest/GNUmakefile b/vendor/github.com/Azure/go-autorest/GNUmakefile deleted file mode 100644 index a434e73ac..000000000 --- a/vendor/github.com/Azure/go-autorest/GNUmakefile +++ /dev/null @@ -1,23 +0,0 @@ -DIR?=./autorest/ - -default: build - -build: fmt - go install $(DIR) - -test: - go test $(DIR) || exit 1 - -vet: - @echo "go vet ." - @go vet $(DIR)... ; if [ $$? -eq 1 ]; then \ - echo ""; \ - echo "Vet found suspicious constructs. Please check the reported constructs"; \ - echo "and fix them if necessary before submitting the code for review."; \ - exit 1; \ - fi - -fmt: - gofmt -w $(DIR) - -.PHONY: build test vet fmt diff --git a/vendor/github.com/Azure/go-autorest/Gopkg.lock b/vendor/github.com/Azure/go-autorest/Gopkg.lock deleted file mode 100644 index dc6e3e633..000000000 --- a/vendor/github.com/Azure/go-autorest/Gopkg.lock +++ /dev/null @@ -1,324 +0,0 @@ -# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. - - -[[projects]] - digest = "1:892e39e5c083d0943f1e80ab8351690f183c6a5ab24e1d280adcad424c26255e" - name = "contrib.go.opencensus.io/exporter/ocagent" - packages = ["."] - pruneopts = "UT" - revision = "a8a6f458bbc1d5042322ad1f9b65eeb0b69be9ea" - version = "v0.6.0" - -[[projects]] - digest = "1:8f5acd4d4462b5136af644d25101f0968a7a94ee90fcb2059cec5b7cc42e0b20" - name = "github.com/census-instrumentation/opencensus-proto" - packages = [ - "gen-go/agent/common/v1", - "gen-go/agent/metrics/v1", - "gen-go/agent/trace/v1", - "gen-go/metrics/v1", - "gen-go/resource/v1", - "gen-go/trace/v1", - ] - pruneopts = "UT" - revision = "d89fa54de508111353cb0b06403c00569be780d8" - version = "v0.2.1" - -[[projects]] - digest = "1:ffe9824d294da03b391f44e1ae8281281b4afc1bdaa9588c9097785e3af10cec" - name = "github.com/davecgh/go-spew" - packages = ["spew"] - pruneopts = "UT" - revision = "8991bc29aa16c548c550c7ff78260e27b9ab7c73" - version = "v1.1.1" - -[[projects]] - digest = "1:76dc72490af7174349349838f2fe118996381b31ea83243812a97e5a0fd5ed55" - name = "github.com/dgrijalva/jwt-go" - packages = ["."] - pruneopts = "UT" - revision = "06ea1031745cb8b3dab3f6a236daf2b0aa468b7e" - version = "v3.2.0" - -[[projects]] - digest = "1:cf0d2e435fd4ce45b789e93ef24b5f08e86be0e9807a16beb3694e2d8c9af965" - name = "github.com/dimchansky/utfbom" - packages = ["."] - pruneopts = "UT" - revision = "d2133a1ce379ef6fa992b0514a77146c60db9d1c" - version = "v1.1.0" - -[[projects]] - branch = "master" - digest = "1:b7cb6054d3dff43b38ad2e92492f220f57ae6087ee797dca298139776749ace8" - name = "github.com/golang/groupcache" - packages = ["lru"] - pruneopts = "UT" - revision = "611e8accdfc92c4187d399e95ce826046d4c8d73" - -[[projects]] - digest = "1:e3839df32927e8d3403cd5aa7253d966e8ff80fc8f10e2e35d146461cd83fcfa" - name = "github.com/golang/protobuf" - packages = [ - "descriptor", - "jsonpb", - "proto", - "protoc-gen-go/descriptor", - "ptypes", - "ptypes/any", - "ptypes/duration", - "ptypes/struct", - "ptypes/timestamp", - "ptypes/wrappers", - ] - pruneopts = "UT" - revision = "6c65a5562fc06764971b7c5d05c76c75e84bdbf7" - version = "v1.3.2" - -[[projects]] - digest = "1:c560cd79300fac84f124b96225181a637a70b60155919a3c36db50b7cca6b806" - name = "github.com/grpc-ecosystem/grpc-gateway" - packages = [ - "internal", - "runtime", - "utilities", - ] - pruneopts = "UT" - revision = "f7120437bb4f6c71f7f5076ad65a45310de2c009" - version = "v1.12.1" - -[[projects]] - digest = "1:5d231480e1c64a726869bc4142d270184c419749d34f167646baa21008eb0a79" - name = "github.com/mitchellh/go-homedir" - packages = ["."] - pruneopts = "UT" - revision = "af06845cf3004701891bf4fdb884bfe4920b3727" - version = "v1.1.0" - -[[projects]] - digest = "1:0028cb19b2e4c3112225cd871870f2d9cf49b9b4276531f03438a88e94be86fe" - name = "github.com/pmezard/go-difflib" - packages = ["difflib"] - pruneopts = "UT" - revision = "792786c7400a136282c1664665ae0a8db921c6c2" - version = "v1.0.0" - -[[projects]] - digest = "1:99d32780e5238c2621fff621123997c3e3cca96db8be13179013aea77dfab551" - name = "github.com/stretchr/testify" - packages = [ - "assert", - "require", - ] - pruneopts = "UT" - revision = "221dbe5ed46703ee255b1da0dec05086f5035f62" - version = "v1.4.0" - -[[projects]] - digest = "1:7c5e00383399fe13de0b4b65c9fdde16275407ce8ac02d867eafeaa916edcc71" - name = "go.opencensus.io" - packages = [ - ".", - "internal", - "internal/tagencoding", - "metric/metricdata", - "metric/metricproducer", - "plugin/ocgrpc", - "plugin/ochttp", - "plugin/ochttp/propagation/b3", - "plugin/ochttp/propagation/tracecontext", - "resource", - "stats", - "stats/internal", - "stats/view", - "tag", - "trace", - "trace/internal", - "trace/propagation", - "trace/tracestate", - ] - pruneopts = "UT" - revision = "aad2c527c5defcf89b5afab7f37274304195a6b2" - version = "v0.22.2" - -[[projects]] - branch = "master" - digest = "1:f604f5e2ee721b6757d962dfe7bab4f28aae50c456e39cfb2f3819762a44a6ae" - name = "golang.org/x/crypto" - packages = [ - "pkcs12", - "pkcs12/internal/rc2", - ] - pruneopts = "UT" - revision = "e9b2fee46413994441b28dfca259d911d963dfed" - -[[projects]] - branch = "master" - digest = "1:334b27eac455cb6567ea28cd424230b07b1a64334a2f861a8075ac26ce10af43" - name = "golang.org/x/lint" - packages = [ - ".", - "golint", - ] - pruneopts = "UT" - revision = "fdd1cda4f05fd1fd86124f0ef9ce31a0b72c8448" - -[[projects]] - branch = "master" - digest = "1:257a75d024975428ab9192bfc334c3490882f8cb21322ea5784ca8eca000a910" - name = "golang.org/x/net" - packages = [ - "http/httpguts", - "http2", - "http2/hpack", - "idna", - "internal/timeseries", - "trace", - ] - pruneopts = "UT" - revision = "1ddd1de85cb0337b623b740a609d35817d516a8d" - -[[projects]] - branch = "master" - digest = "1:382bb5a7fb4034db3b6a2d19e5a4a6bcf52f4750530603c01ca18a172fa3089b" - name = "golang.org/x/sync" - packages = ["semaphore"] - pruneopts = "UT" - revision = "cd5d95a43a6e21273425c7ae415d3df9ea832eeb" - -[[projects]] - branch = "master" - digest = "1:4da420ceda5f68e8d748aa2169d0ed44ffadb1bbd6537cf778a49563104189b8" - name = "golang.org/x/sys" - packages = ["unix"] - pruneopts = "UT" - revision = "ce4227a45e2eb77e5c847278dcc6a626742e2945" - -[[projects]] - digest = "1:8d8faad6b12a3a4c819a3f9618cb6ee1fa1cfc33253abeeea8b55336721e3405" - name = "golang.org/x/text" - packages = [ - "collate", - "collate/build", - "internal/colltab", - "internal/gen", - "internal/language", - "internal/language/compact", - "internal/tag", - "internal/triegen", - "internal/ucd", - "language", - "secure/bidirule", - "transform", - "unicode/bidi", - "unicode/cldr", - "unicode/norm", - "unicode/rangetable", - ] - pruneopts = "UT" - revision = "342b2e1fbaa52c93f31447ad2c6abc048c63e475" - version = "v0.3.2" - -[[projects]] - branch = "master" - digest = "1:4eb5ea8395fb60212dd58b92c9db80bab59d5e99c7435f9a6a0a528c373b60e7" - name = "golang.org/x/tools" - packages = [ - "go/ast/astutil", - "go/gcexportdata", - "go/internal/gcimporter", - "go/types/typeutil", - ] - pruneopts = "UT" - revision = "259af5ff87bdcd4abf2ecda8edc3f13f04f26a42" - -[[projects]] - digest = "1:964bb30febc27fabfbec4759fa530c6ec35e77a7c85fed90b9317ea39a054877" - name = "google.golang.org/api" - packages = ["support/bundler"] - pruneopts = "UT" - revision = "8a410c21381766a810817fd6200fce8838ecb277" - version = "v0.14.0" - -[[projects]] - branch = "master" - digest = "1:a8d5c2c6e746b3485e36908ab2a9e3d77b86b81f8156d88403c7d2b462431dfd" - name = "google.golang.org/genproto" - packages = [ - "googleapis/api/httpbody", - "googleapis/rpc/status", - "protobuf/field_mask", - ] - pruneopts = "UT" - revision = "51378566eb590fa106d1025ea12835a4416dda84" - -[[projects]] - digest = "1:b59ce3ddb11daeeccccc9cb3183b58ebf8e9a779f1c853308cd91612e817a301" - name = "google.golang.org/grpc" - packages = [ - ".", - "backoff", - "balancer", - "balancer/base", - "balancer/roundrobin", - "binarylog/grpc_binarylog_v1", - "codes", - "connectivity", - "credentials", - "credentials/internal", - "encoding", - "encoding/proto", - "grpclog", - "internal", - "internal/backoff", - "internal/balancerload", - "internal/binarylog", - "internal/buffer", - "internal/channelz", - "internal/envconfig", - "internal/grpcrand", - "internal/grpcsync", - "internal/resolver/dns", - "internal/resolver/passthrough", - "internal/syscall", - "internal/transport", - "keepalive", - "metadata", - "naming", - "peer", - "resolver", - "serviceconfig", - "stats", - "status", - "tap", - ] - pruneopts = "UT" - revision = "1a3960e4bd028ac0cec0a2afd27d7d8e67c11514" - version = "v1.25.1" - -[[projects]] - digest = "1:b75b3deb2bce8bc079e16bb2aecfe01eb80098f5650f9e93e5643ca8b7b73737" - name = "gopkg.in/yaml.v2" - packages = ["."] - pruneopts = "UT" - revision = "1f64d6156d11335c3f22d9330b0ad14fc1e789ce" - version = "v2.2.7" - -[solve-meta] - analyzer-name = "dep" - analyzer-version = 1 - input-imports = [ - "contrib.go.opencensus.io/exporter/ocagent", - "github.com/dgrijalva/jwt-go", - "github.com/dimchansky/utfbom", - "github.com/mitchellh/go-homedir", - "github.com/stretchr/testify/require", - "go.opencensus.io/plugin/ochttp", - "go.opencensus.io/plugin/ochttp/propagation/tracecontext", - "go.opencensus.io/stats/view", - "go.opencensus.io/trace", - "golang.org/x/crypto/pkcs12", - "golang.org/x/lint/golint", - ] - solver-name = "gps-cdcl" - solver-version = 1 diff --git a/vendor/github.com/Azure/go-autorest/Gopkg.toml b/vendor/github.com/Azure/go-autorest/Gopkg.toml deleted file mode 100644 index 1fc286596..000000000 --- a/vendor/github.com/Azure/go-autorest/Gopkg.toml +++ /dev/null @@ -1,59 +0,0 @@ -# Gopkg.toml example -# -# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html -# for detailed Gopkg.toml documentation. -# -# required = ["github.com/user/thing/cmd/thing"] -# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] -# -# [[constraint]] -# name = "github.com/user/project" -# version = "1.0.0" -# -# [[constraint]] -# name = "github.com/user/project2" -# branch = "dev" -# source = "github.com/myfork/project2" -# -# [[override]] -# name = "github.com/x/y" -# version = "2.4.0" -# -# [prune] -# non-go = false -# go-tests = true -# unused-packages = true - -required = ["golang.org/x/lint/golint"] - -[prune] - go-tests = true - unused-packages = true - -[[constraint]] - name = "contrib.go.opencensus.io/exporter/ocagent" - version = "0.6.0" - -[[constraint]] - name = "github.com/dgrijalva/jwt-go" - version = "3.2.0" - -[[constraint]] - name = "github.com/dimchansky/utfbom" - version = "1.1.0" - -[[constraint]] - name = "github.com/mitchellh/go-homedir" - version = "1.1.0" - -[[constraint]] - name = "github.com/stretchr/testify" - version = "1.3.0" - -[[constraint]] - name = "go.opencensus.io" - version = "0.22.0" - -[[constraint]] - branch = "master" - name = "golang.org/x/crypto" diff --git a/vendor/github.com/Azure/go-autorest/LICENSE b/vendor/github.com/Azure/go-autorest/LICENSE deleted file mode 100644 index b9d6a27ea..000000000 --- a/vendor/github.com/Azure/go-autorest/LICENSE +++ /dev/null @@ -1,191 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - Copyright 2015 Microsoft Corporation - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/github.com/Azure/go-autorest/README.md b/vendor/github.com/Azure/go-autorest/README.md deleted file mode 100644 index de1e19a44..000000000 --- a/vendor/github.com/Azure/go-autorest/README.md +++ /dev/null @@ -1,165 +0,0 @@ -# go-autorest - -[![GoDoc](https://godoc.org/github.com/Azure/go-autorest/autorest?status.png)](https://godoc.org/github.com/Azure/go-autorest/autorest) -[![Build Status](https://dev.azure.com/azure-sdk/public/_apis/build/status/go/Azure.go-autorest?branchName=master)](https://dev.azure.com/azure-sdk/public/_build/latest?definitionId=625&branchName=master) -[![Go Report Card](https://goreportcard.com/badge/Azure/go-autorest)](https://goreportcard.com/report/Azure/go-autorest) - -Package go-autorest provides an HTTP request client for use with [Autorest](https://github.com/Azure/autorest.go)-generated API client packages. - -An authentication client tested with Azure Active Directory (AAD) is also -provided in this repo in the package -`github.com/Azure/go-autorest/autorest/adal`. Despite its name, this package -is maintained only as part of the Azure Go SDK and is not related to other -"ADAL" libraries in [github.com/AzureAD](https://github.com/AzureAD). - -## Overview - -Package go-autorest implements an HTTP request pipeline suitable for use across -multiple goroutines and provides the shared routines used by packages generated -by [Autorest](https://github.com/Azure/autorest.go). - -The package breaks sending and responding to HTTP requests into three phases: Preparing, Sending, -and Responding. A typical pattern is: - -```go - req, err := Prepare(&http.Request{}, - token.WithAuthorization()) - - resp, err := Send(req, - WithLogging(logger), - DoErrorIfStatusCode(http.StatusInternalServerError), - DoCloseIfError(), - DoRetryForAttempts(5, time.Second)) - - err = Respond(resp, - ByDiscardingBody(), - ByClosing()) -``` - -Each phase relies on decorators to modify and / or manage processing. Decorators may first modify -and then pass the data along, pass the data first and then modify the result, or wrap themselves -around passing the data (such as a logger might do). Decorators run in the order provided. For -example, the following: - -```go - req, err := Prepare(&http.Request{}, - WithBaseURL("https://microsoft.com/"), - WithPath("a"), - WithPath("b"), - WithPath("c")) -``` - -will set the URL to: - -``` - https://microsoft.com/a/b/c -``` - -Preparers and Responders may be shared and re-used (assuming the underlying decorators support -sharing and re-use). Performant use is obtained by creating one or more Preparers and Responders -shared among multiple go-routines, and a single Sender shared among multiple sending go-routines, -all bound together by means of input / output channels. - -Decorators hold their passed state within a closure (such as the path components in the example -above). Be careful to share Preparers and Responders only in a context where such held state -applies. For example, it may not make sense to share a Preparer that applies a query string from a -fixed set of values. Similarly, sharing a Responder that reads the response body into a passed -struct (e.g., `ByUnmarshallingJson`) is likely incorrect. - -Errors raised by autorest objects and methods will conform to the `autorest.Error` interface. - -See the included examples for more detail. For details on the suggested use of this package by -generated clients, see the Client described below. - -## Helpers - -### Handling Swagger Dates - -The Swagger specification (https://swagger.io) that drives AutoRest -(https://github.com/Azure/autorest/) precisely defines two date forms: date and date-time. The -github.com/Azure/go-autorest/autorest/date package provides time.Time derivations to ensure correct -parsing and formatting. - -### Handling Empty Values - -In JSON, missing values have different semantics than empty values. This is especially true for -services using the HTTP PATCH verb. The JSON submitted with a PATCH request generally contains -only those values to modify. Missing values are to be left unchanged. Developers, then, require a -means to both specify an empty value and to leave the value out of the submitted JSON. - -The Go JSON package (`encoding/json`) supports the `omitempty` tag. When specified, it omits -empty values from the rendered JSON. Since Go defines default values for all base types (such as "" -for string and 0 for int) and provides no means to mark a value as actually empty, the JSON package -treats default values as meaning empty, omitting them from the rendered JSON. This means that, using -the Go base types encoded through the default JSON package, it is not possible to create JSON to -clear a value at the server. - -The workaround within the Go community is to use pointers to base types in lieu of base types within -structures that map to JSON. For example, instead of a value of type `string`, the workaround uses -`*string`. While this enables distinguishing empty values from those to be unchanged, creating -pointers to a base type (notably constant, in-line values) requires additional variables. This, for -example, - -```go - s := struct { - S *string - }{ S: &"foo" } -``` -fails, while, this - -```go - v := "foo" - s := struct { - S *string - }{ S: &v } -``` -succeeds. - -To ease using pointers, the subpackage `to` contains helpers that convert to and from pointers for -Go base types which have Swagger analogs. It also provides a helper that converts between -`map[string]string` and `map[string]*string`, enabling the JSON to specify that the value -associated with a key should be cleared. With the helpers, the previous example becomes - -```go - s := struct { - S *string - }{ S: to.StringPtr("foo") } -``` - -## Install - -```bash -go get github.com/Azure/go-autorest/autorest -go get github.com/Azure/go-autorest/autorest/azure -go get github.com/Azure/go-autorest/autorest/date -go get github.com/Azure/go-autorest/autorest/to -``` - -### Using with Go Modules -In [v12.0.1](https://github.com/Azure/go-autorest/pull/386), this repository introduced the following modules. - -- autorest/adal -- autorest/azure/auth -- autorest/azure/cli -- autorest/date -- autorest/mocks -- autorest/to -- autorest/validation -- autorest -- logger -- tracing - -Tagging cumulative SDK releases as a whole (e.g. `v12.3.0`) is still enabled to support consumers of this repo that have not yet migrated to modules. - -## License - -See LICENSE file. - ------ - -This project has adopted the [Microsoft Open Source Code of -Conduct](https://opensource.microsoft.com/codeofconduct/). For more information -see the [Code of Conduct -FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact -[opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional -questions or comments. diff --git a/vendor/github.com/Azure/go-autorest/autorest/LICENSE b/vendor/github.com/Azure/go-autorest/autorest/LICENSE deleted file mode 100644 index b9d6a27ea..000000000 --- a/vendor/github.com/Azure/go-autorest/autorest/LICENSE +++ /dev/null @@ -1,191 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - Copyright 2015 Microsoft Corporation - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/github.com/Azure/go-autorest/autorest/adal/LICENSE b/vendor/github.com/Azure/go-autorest/autorest/adal/LICENSE deleted file mode 100644 index b9d6a27ea..000000000 --- a/vendor/github.com/Azure/go-autorest/autorest/adal/LICENSE +++ /dev/null @@ -1,191 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - Copyright 2015 Microsoft Corporation - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/github.com/Azure/go-autorest/autorest/adal/README.md b/vendor/github.com/Azure/go-autorest/autorest/adal/README.md deleted file mode 100644 index b11eb0788..000000000 --- a/vendor/github.com/Azure/go-autorest/autorest/adal/README.md +++ /dev/null @@ -1,294 +0,0 @@ -# NOTE: This module will go out of support by March 31, 2023. For authenticating with Azure AD, use module [azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity) instead. For help migrating from `adal` to `azidentiy` please consult the [migration guide](https://aka.ms/azsdk/go/identity/migration). General information about the retirement of this and other legacy modules can be found [here](https://azure.microsoft.com/updates/support-for-azure-sdk-libraries-that-do-not-conform-to-our-current-azure-sdk-guidelines-will-be-retired-as-of-31-march-2023/). - -# Azure Active Directory authentication for Go - -This is a standalone package for authenticating with Azure Active -Directory from other Go libraries and applications, in particular the [Azure SDK -for Go](https://github.com/Azure/azure-sdk-for-go). - -Note: Despite the package's name it is not related to other "ADAL" libraries -maintained in the [github.com/AzureAD](https://github.com/AzureAD) org. Issues -should be opened in [this repo's](https://github.com/Azure/go-autorest/issues) -or [the SDK's](https://github.com/Azure/azure-sdk-for-go/issues) issue -trackers. - -## Install - -```bash -go get -u github.com/Azure/go-autorest/autorest/adal -``` - -## Usage - -An Active Directory application is required in order to use this library. An application can be registered in the [Azure Portal](https://portal.azure.com/) by following these [guidelines](https://docs.microsoft.com/azure/active-directory/develop/active-directory-integrating-applications) or using the [Azure CLI](https://github.com/Azure/azure-cli). - -### Register an Azure AD Application with secret - - -1. Register a new application with a `secret` credential - - ``` - az ad app create \ - --display-name example-app \ - --homepage https://example-app/home \ - --identifier-uris https://example-app/app \ - --password secret - ``` - -2. Create a service principal using the `Application ID` from previous step - - ``` - az ad sp create --id "Application ID" - ``` - - * Replace `Application ID` with `appId` from step 1. - -### Register an Azure AD Application with certificate - -1. Create a private key - - ``` - openssl genrsa -out "example-app.key" 2048 - ``` - -2. Create the certificate - - ``` - openssl req -new -key "example-app.key" -subj "/CN=example-app" -out "example-app.csr" - openssl x509 -req -in "example-app.csr" -signkey "example-app.key" -out "example-app.crt" -days 10000 - ``` - -3. Create the PKCS12 version of the certificate containing also the private key - - ``` - openssl pkcs12 -export -out "example-app.pfx" -inkey "example-app.key" -in "example-app.crt" -passout pass: - - ``` - -4. Register a new application with the certificate content form `example-app.crt` - - ``` - certificateContents="$(tail -n+2 "example-app.crt" | head -n-1)" - - az ad app create \ - --display-name example-app \ - --homepage https://example-app/home \ - --identifier-uris https://example-app/app \ - --key-usage Verify --end-date 2018-01-01 \ - --key-value "${certificateContents}" - ``` - -5. Create a service principal using the `Application ID` from previous step - - ``` - az ad sp create --id "APPLICATION_ID" - ``` - - * Replace `APPLICATION_ID` with `appId` from step 4. - - -### Grant the necessary permissions - -Azure relies on a Role-Based Access Control (RBAC) model to manage the access to resources at a fine-grained -level. There is a set of [pre-defined roles](https://docs.microsoft.com/azure/active-directory/role-based-access-built-in-roles) -which can be assigned to a service principal of an Azure AD application depending of your needs. - -``` -az role assignment create --assigner "SERVICE_PRINCIPAL_ID" --role "ROLE_NAME" -``` - -* Replace the `SERVICE_PRINCIPAL_ID` with the `appId` from previous step. -* Replace the `ROLE_NAME` with a role name of your choice. - -It is also possible to define custom role definitions. - -``` -az role definition create --role-definition role-definition.json -``` - -* Check [custom roles](https://docs.microsoft.com/azure/active-directory/role-based-access-control-custom-roles) for more details regarding the content of `role-definition.json` file. - - -### Acquire Access Token - -The common configuration used by all flows: - -```Go -const activeDirectoryEndpoint = "https://login.microsoftonline.com/" -tenantID := "TENANT_ID" -oauthConfig, err := adal.NewOAuthConfig(activeDirectoryEndpoint, tenantID) - -applicationID := "APPLICATION_ID" - -callback := func(token adal.Token) error { - // This is called after the token is acquired -} - -// The resource for which the token is acquired -resource := "https://management.core.windows.net/" -``` - -* Replace the `TENANT_ID` with your tenant ID. -* Replace the `APPLICATION_ID` with the value from previous section. - -#### Client Credentials - -```Go -applicationSecret := "APPLICATION_SECRET" - -spt, err := adal.NewServicePrincipalToken( - *oauthConfig, - appliationID, - applicationSecret, - resource, - callbacks...) -if err != nil { - return nil, err -} - -// Acquire a new access token -err = spt.Refresh() -if (err == nil) { - token := spt.Token -} -``` - -* Replace the `APPLICATION_SECRET` with the `password` value from previous section. - -#### Client Certificate - -```Go -certificatePath := "./example-app.pfx" - -certData, err := ioutil.ReadFile(certificatePath) -if err != nil { - return nil, fmt.Errorf("failed to read the certificate file (%s): %v", certificatePath, err) -} - -// Get the certificate and private key from pfx file -certificate, rsaPrivateKey, err := decodePkcs12(certData, "") -if err != nil { - return nil, fmt.Errorf("failed to decode pkcs12 certificate while creating spt: %v", err) -} - -spt, err := adal.NewServicePrincipalTokenFromCertificate( - *oauthConfig, - applicationID, - certificate, - rsaPrivateKey, - resource, - callbacks...) - -// Acquire a new access token -err = spt.Refresh() -if (err == nil) { - token := spt.Token -} -``` - -* Update the certificate path to point to the example-app.pfx file which was created in previous section. - - -#### Device Code - -```Go -oauthClient := &http.Client{} - -// Acquire the device code -deviceCode, err := adal.InitiateDeviceAuth( - oauthClient, - *oauthConfig, - applicationID, - resource) -if err != nil { - return nil, fmt.Errorf("Failed to start device auth flow: %s", err) -} - -// Display the authentication message -fmt.Println(*deviceCode.Message) - -// Wait here until the user is authenticated -token, err := adal.WaitForUserCompletion(oauthClient, deviceCode) -if err != nil { - return nil, fmt.Errorf("Failed to finish device auth flow: %s", err) -} - -spt, err := adal.NewServicePrincipalTokenFromManualToken( - *oauthConfig, - applicationID, - resource, - *token, - callbacks...) - -if (err == nil) { - token := spt.Token -} -``` - -#### Username password authenticate - -```Go -spt, err := adal.NewServicePrincipalTokenFromUsernamePassword( - *oauthConfig, - applicationID, - username, - password, - resource, - callbacks...) - -if (err == nil) { - token := spt.Token -} -``` - -#### Authorization code authenticate - -``` Go -spt, err := adal.NewServicePrincipalTokenFromAuthorizationCode( - *oauthConfig, - applicationID, - clientSecret, - authorizationCode, - redirectURI, - resource, - callbacks...) - -err = spt.Refresh() -if (err == nil) { - token := spt.Token -} -``` - -### Command Line Tool - -A command line tool is available in `cmd/adal.go` that can acquire a token for a given resource. It supports all flows mentioned above. - -``` -adal -h - -Usage of ./adal: - -applicationId string - application id - -certificatePath string - path to pk12/PFC application certificate - -mode string - authentication mode (device, secret, cert, refresh) (default "device") - -resource string - resource for which the token is requested - -secret string - application secret - -tenantId string - tenant id - -tokenCachePath string - location of oath token cache (default "/home/cgc/.adal/accessToken.json") -``` - -Example acquire a token for `https://management.core.windows.net/` using device code flow: - -``` -adal -mode device \ - -applicationId "APPLICATION_ID" \ - -tenantId "TENANT_ID" \ - -resource https://management.core.windows.net/ - -``` diff --git a/vendor/github.com/Azure/go-autorest/autorest/adal/config.go b/vendor/github.com/Azure/go-autorest/autorest/adal/config.go deleted file mode 100644 index fa5964742..000000000 --- a/vendor/github.com/Azure/go-autorest/autorest/adal/config.go +++ /dev/null @@ -1,151 +0,0 @@ -package adal - -// Copyright 2017 Microsoft Corporation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -import ( - "errors" - "fmt" - "net/url" -) - -const ( - activeDirectoryEndpointTemplate = "%s/oauth2/%s%s" -) - -// OAuthConfig represents the endpoints needed -// in OAuth operations -type OAuthConfig struct { - AuthorityEndpoint url.URL `json:"authorityEndpoint"` - AuthorizeEndpoint url.URL `json:"authorizeEndpoint"` - TokenEndpoint url.URL `json:"tokenEndpoint"` - DeviceCodeEndpoint url.URL `json:"deviceCodeEndpoint"` -} - -// IsZero returns true if the OAuthConfig object is zero-initialized. -func (oac OAuthConfig) IsZero() bool { - return oac == OAuthConfig{} -} - -func validateStringParam(param, name string) error { - if len(param) == 0 { - return fmt.Errorf("parameter '" + name + "' cannot be empty") - } - return nil -} - -// NewOAuthConfig returns an OAuthConfig with tenant specific urls -func NewOAuthConfig(activeDirectoryEndpoint, tenantID string) (*OAuthConfig, error) { - apiVer := "1.0" - return NewOAuthConfigWithAPIVersion(activeDirectoryEndpoint, tenantID, &apiVer) -} - -// NewOAuthConfigWithAPIVersion returns an OAuthConfig with tenant specific urls. -// If apiVersion is not nil the "api-version" query parameter will be appended to the endpoint URLs with the specified value. -func NewOAuthConfigWithAPIVersion(activeDirectoryEndpoint, tenantID string, apiVersion *string) (*OAuthConfig, error) { - if err := validateStringParam(activeDirectoryEndpoint, "activeDirectoryEndpoint"); err != nil { - return nil, err - } - api := "" - // it's legal for tenantID to be empty so don't validate it - if apiVersion != nil { - if err := validateStringParam(*apiVersion, "apiVersion"); err != nil { - return nil, err - } - api = fmt.Sprintf("?api-version=%s", *apiVersion) - } - u, err := url.Parse(activeDirectoryEndpoint) - if err != nil { - return nil, err - } - authorityURL, err := u.Parse(tenantID) - if err != nil { - return nil, err - } - authorizeURL, err := u.Parse(fmt.Sprintf(activeDirectoryEndpointTemplate, tenantID, "authorize", api)) - if err != nil { - return nil, err - } - tokenURL, err := u.Parse(fmt.Sprintf(activeDirectoryEndpointTemplate, tenantID, "token", api)) - if err != nil { - return nil, err - } - deviceCodeURL, err := u.Parse(fmt.Sprintf(activeDirectoryEndpointTemplate, tenantID, "devicecode", api)) - if err != nil { - return nil, err - } - - return &OAuthConfig{ - AuthorityEndpoint: *authorityURL, - AuthorizeEndpoint: *authorizeURL, - TokenEndpoint: *tokenURL, - DeviceCodeEndpoint: *deviceCodeURL, - }, nil -} - -// MultiTenantOAuthConfig provides endpoints for primary and aulixiary tenant IDs. -type MultiTenantOAuthConfig interface { - PrimaryTenant() *OAuthConfig - AuxiliaryTenants() []*OAuthConfig -} - -// OAuthOptions contains optional OAuthConfig creation arguments. -type OAuthOptions struct { - APIVersion string -} - -func (c OAuthOptions) apiVersion() string { - if c.APIVersion != "" { - return fmt.Sprintf("?api-version=%s", c.APIVersion) - } - return "1.0" -} - -// NewMultiTenantOAuthConfig creates an object that support multitenant OAuth configuration. -// See https://docs.microsoft.com/en-us/azure/azure-resource-manager/authenticate-multi-tenant for more information. -func NewMultiTenantOAuthConfig(activeDirectoryEndpoint, primaryTenantID string, auxiliaryTenantIDs []string, options OAuthOptions) (MultiTenantOAuthConfig, error) { - if len(auxiliaryTenantIDs) == 0 || len(auxiliaryTenantIDs) > 3 { - return nil, errors.New("must specify one to three auxiliary tenants") - } - mtCfg := multiTenantOAuthConfig{ - cfgs: make([]*OAuthConfig, len(auxiliaryTenantIDs)+1), - } - apiVer := options.apiVersion() - pri, err := NewOAuthConfigWithAPIVersion(activeDirectoryEndpoint, primaryTenantID, &apiVer) - if err != nil { - return nil, fmt.Errorf("failed to create OAuthConfig for primary tenant: %v", err) - } - mtCfg.cfgs[0] = pri - for i := range auxiliaryTenantIDs { - aux, err := NewOAuthConfig(activeDirectoryEndpoint, auxiliaryTenantIDs[i]) - if err != nil { - return nil, fmt.Errorf("failed to create OAuthConfig for tenant '%s': %v", auxiliaryTenantIDs[i], err) - } - mtCfg.cfgs[i+1] = aux - } - return mtCfg, nil -} - -type multiTenantOAuthConfig struct { - // first config in the slice is the primary tenant - cfgs []*OAuthConfig -} - -func (m multiTenantOAuthConfig) PrimaryTenant() *OAuthConfig { - return m.cfgs[0] -} - -func (m multiTenantOAuthConfig) AuxiliaryTenants() []*OAuthConfig { - return m.cfgs[1:] -} diff --git a/vendor/github.com/Azure/go-autorest/autorest/adal/devicetoken.go b/vendor/github.com/Azure/go-autorest/autorest/adal/devicetoken.go deleted file mode 100644 index 9daa4b58b..000000000 --- a/vendor/github.com/Azure/go-autorest/autorest/adal/devicetoken.go +++ /dev/null @@ -1,273 +0,0 @@ -package adal - -// Copyright 2017 Microsoft Corporation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/* - This file is largely based on rjw57/oauth2device's code, with the follow differences: - * scope -> resource, and only allow a single one - * receive "Message" in the DeviceCode struct and show it to users as the prompt - * azure-xplat-cli has the following behavior that this emulates: - - does not send client_secret during the token exchange - - sends resource again in the token exchange request -*/ - -import ( - "context" - "encoding/json" - "fmt" - "io/ioutil" - "net/http" - "net/url" - "strings" - "time" -) - -const ( - logPrefix = "autorest/adal/devicetoken:" -) - -var ( - // ErrDeviceGeneric represents an unknown error from the token endpoint when using device flow - ErrDeviceGeneric = fmt.Errorf("%s Error while retrieving OAuth token: Unknown Error", logPrefix) - - // ErrDeviceAccessDenied represents an access denied error from the token endpoint when using device flow - ErrDeviceAccessDenied = fmt.Errorf("%s Error while retrieving OAuth token: Access Denied", logPrefix) - - // ErrDeviceAuthorizationPending represents the server waiting on the user to complete the device flow - ErrDeviceAuthorizationPending = fmt.Errorf("%s Error while retrieving OAuth token: Authorization Pending", logPrefix) - - // ErrDeviceCodeExpired represents the server timing out and expiring the code during device flow - ErrDeviceCodeExpired = fmt.Errorf("%s Error while retrieving OAuth token: Code Expired", logPrefix) - - // ErrDeviceSlowDown represents the service telling us we're polling too often during device flow - ErrDeviceSlowDown = fmt.Errorf("%s Error while retrieving OAuth token: Slow Down", logPrefix) - - // ErrDeviceCodeEmpty represents an empty device code from the device endpoint while using device flow - ErrDeviceCodeEmpty = fmt.Errorf("%s Error while retrieving device code: Device Code Empty", logPrefix) - - // ErrOAuthTokenEmpty represents an empty OAuth token from the token endpoint when using device flow - ErrOAuthTokenEmpty = fmt.Errorf("%s Error while retrieving OAuth token: Token Empty", logPrefix) - - errCodeSendingFails = "Error occurred while sending request for Device Authorization Code" - errCodeHandlingFails = "Error occurred while handling response from the Device Endpoint" - errTokenSendingFails = "Error occurred while sending request with device code for a token" - errTokenHandlingFails = "Error occurred while handling response from the Token Endpoint (during device flow)" - errStatusNotOK = "Error HTTP status != 200" -) - -// DeviceCode is the object returned by the device auth endpoint -// It contains information to instruct the user to complete the auth flow -type DeviceCode struct { - DeviceCode *string `json:"device_code,omitempty"` - UserCode *string `json:"user_code,omitempty"` - VerificationURL *string `json:"verification_url,omitempty"` - ExpiresIn *int64 `json:"expires_in,string,omitempty"` - Interval *int64 `json:"interval,string,omitempty"` - - Message *string `json:"message"` // Azure specific - Resource string // store the following, stored when initiating, used when exchanging - OAuthConfig OAuthConfig - ClientID string -} - -// TokenError is the object returned by the token exchange endpoint -// when something is amiss -type TokenError struct { - Error *string `json:"error,omitempty"` - ErrorCodes []int `json:"error_codes,omitempty"` - ErrorDescription *string `json:"error_description,omitempty"` - Timestamp *string `json:"timestamp,omitempty"` - TraceID *string `json:"trace_id,omitempty"` -} - -// DeviceToken is the object return by the token exchange endpoint -// It can either look like a Token or an ErrorToken, so put both here -// and check for presence of "Error" to know if we are in error state -type deviceToken struct { - Token - TokenError -} - -// InitiateDeviceAuth initiates a device auth flow. It returns a DeviceCode -// that can be used with CheckForUserCompletion or WaitForUserCompletion. -// Deprecated: use InitiateDeviceAuthWithContext() instead. -func InitiateDeviceAuth(sender Sender, oauthConfig OAuthConfig, clientID, resource string) (*DeviceCode, error) { - return InitiateDeviceAuthWithContext(context.Background(), sender, oauthConfig, clientID, resource) -} - -// InitiateDeviceAuthWithContext initiates a device auth flow. It returns a DeviceCode -// that can be used with CheckForUserCompletion or WaitForUserCompletion. -func InitiateDeviceAuthWithContext(ctx context.Context, sender Sender, oauthConfig OAuthConfig, clientID, resource string) (*DeviceCode, error) { - v := url.Values{ - "client_id": []string{clientID}, - "resource": []string{resource}, - } - - s := v.Encode() - body := ioutil.NopCloser(strings.NewReader(s)) - - req, err := http.NewRequest(http.MethodPost, oauthConfig.DeviceCodeEndpoint.String(), body) - if err != nil { - return nil, fmt.Errorf("%s %s: %s", logPrefix, errCodeSendingFails, err.Error()) - } - - req.ContentLength = int64(len(s)) - req.Header.Set(contentType, mimeTypeFormPost) - resp, err := sender.Do(req.WithContext(ctx)) - if err != nil { - return nil, fmt.Errorf("%s %s: %s", logPrefix, errCodeSendingFails, err.Error()) - } - defer resp.Body.Close() - - rb, err := ioutil.ReadAll(resp.Body) - if err != nil { - return nil, fmt.Errorf("%s %s: %s", logPrefix, errCodeHandlingFails, err.Error()) - } - - if resp.StatusCode != http.StatusOK { - return nil, fmt.Errorf("%s %s: %s", logPrefix, errCodeHandlingFails, errStatusNotOK) - } - - if len(strings.Trim(string(rb), " ")) == 0 { - return nil, ErrDeviceCodeEmpty - } - - var code DeviceCode - err = json.Unmarshal(rb, &code) - if err != nil { - return nil, fmt.Errorf("%s %s: %s", logPrefix, errCodeHandlingFails, err.Error()) - } - - code.ClientID = clientID - code.Resource = resource - code.OAuthConfig = oauthConfig - - return &code, nil -} - -// CheckForUserCompletion takes a DeviceCode and checks with the Azure AD OAuth endpoint -// to see if the device flow has: been completed, timed out, or otherwise failed -// Deprecated: use CheckForUserCompletionWithContext() instead. -func CheckForUserCompletion(sender Sender, code *DeviceCode) (*Token, error) { - return CheckForUserCompletionWithContext(context.Background(), sender, code) -} - -// CheckForUserCompletionWithContext takes a DeviceCode and checks with the Azure AD OAuth endpoint -// to see if the device flow has: been completed, timed out, or otherwise failed -func CheckForUserCompletionWithContext(ctx context.Context, sender Sender, code *DeviceCode) (*Token, error) { - v := url.Values{ - "client_id": []string{code.ClientID}, - "code": []string{*code.DeviceCode}, - "grant_type": []string{OAuthGrantTypeDeviceCode}, - "resource": []string{code.Resource}, - } - - s := v.Encode() - body := ioutil.NopCloser(strings.NewReader(s)) - - req, err := http.NewRequest(http.MethodPost, code.OAuthConfig.TokenEndpoint.String(), body) - if err != nil { - return nil, fmt.Errorf("%s %s: %s", logPrefix, errTokenSendingFails, err.Error()) - } - - req.ContentLength = int64(len(s)) - req.Header.Set(contentType, mimeTypeFormPost) - resp, err := sender.Do(req.WithContext(ctx)) - if err != nil { - return nil, fmt.Errorf("%s %s: %s", logPrefix, errTokenSendingFails, err.Error()) - } - defer resp.Body.Close() - - rb, err := ioutil.ReadAll(resp.Body) - if err != nil { - return nil, fmt.Errorf("%s %s: %s", logPrefix, errTokenHandlingFails, err.Error()) - } - - if resp.StatusCode != http.StatusOK && len(strings.Trim(string(rb), " ")) == 0 { - return nil, fmt.Errorf("%s %s: %s", logPrefix, errTokenHandlingFails, errStatusNotOK) - } - if len(strings.Trim(string(rb), " ")) == 0 { - return nil, ErrOAuthTokenEmpty - } - - var token deviceToken - err = json.Unmarshal(rb, &token) - if err != nil { - return nil, fmt.Errorf("%s %s: %s", logPrefix, errTokenHandlingFails, err.Error()) - } - - if token.Error == nil { - return &token.Token, nil - } - - switch *token.Error { - case "authorization_pending": - return nil, ErrDeviceAuthorizationPending - case "slow_down": - return nil, ErrDeviceSlowDown - case "access_denied": - return nil, ErrDeviceAccessDenied - case "code_expired": - return nil, ErrDeviceCodeExpired - default: - // return a more meaningful error message if available - if token.ErrorDescription != nil { - return nil, fmt.Errorf("%s %s: %s", logPrefix, *token.Error, *token.ErrorDescription) - } - return nil, ErrDeviceGeneric - } -} - -// WaitForUserCompletion calls CheckForUserCompletion repeatedly until a token is granted or an error state occurs. -// This prevents the user from looping and checking against 'ErrDeviceAuthorizationPending'. -// Deprecated: use WaitForUserCompletionWithContext() instead. -func WaitForUserCompletion(sender Sender, code *DeviceCode) (*Token, error) { - return WaitForUserCompletionWithContext(context.Background(), sender, code) -} - -// WaitForUserCompletionWithContext calls CheckForUserCompletion repeatedly until a token is granted or an error -// state occurs. This prevents the user from looping and checking against 'ErrDeviceAuthorizationPending'. -func WaitForUserCompletionWithContext(ctx context.Context, sender Sender, code *DeviceCode) (*Token, error) { - intervalDuration := time.Duration(*code.Interval) * time.Second - waitDuration := intervalDuration - - for { - token, err := CheckForUserCompletionWithContext(ctx, sender, code) - - if err == nil { - return token, nil - } - - switch err { - case ErrDeviceSlowDown: - waitDuration += waitDuration - case ErrDeviceAuthorizationPending: - // noop - default: // everything else is "fatal" to us - return nil, err - } - - if waitDuration > (intervalDuration * 3) { - return nil, fmt.Errorf("%s Error waiting for user to complete device flow. Server told us to slow_down too much", logPrefix) - } - - select { - case <-time.After(waitDuration): - // noop - case <-ctx.Done(): - return nil, ctx.Err() - } - } -} diff --git a/vendor/github.com/Azure/go-autorest/autorest/adal/go_mod_tidy_hack.go b/vendor/github.com/Azure/go-autorest/autorest/adal/go_mod_tidy_hack.go deleted file mode 100644 index 647a61bb8..000000000 --- a/vendor/github.com/Azure/go-autorest/autorest/adal/go_mod_tidy_hack.go +++ /dev/null @@ -1,25 +0,0 @@ -//go:build modhack -// +build modhack - -package adal - -// Copyright 2017 Microsoft Corporation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// This file, and the github.com/Azure/go-autorest import, won't actually become part of -// the resultant binary. - -// Necessary for safely adding multi-module repo. -// See: https://github.com/golang/go/wiki/Modules#is-it-possible-to-add-a-module-to-a-multi-module-repository -import _ "github.com/Azure/go-autorest" diff --git a/vendor/github.com/Azure/go-autorest/autorest/adal/persist.go b/vendor/github.com/Azure/go-autorest/autorest/adal/persist.go deleted file mode 100644 index 2a974a39b..000000000 --- a/vendor/github.com/Azure/go-autorest/autorest/adal/persist.go +++ /dev/null @@ -1,135 +0,0 @@ -package adal - -// Copyright 2017 Microsoft Corporation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -import ( - "crypto/rsa" - "crypto/x509" - "encoding/json" - "errors" - "fmt" - "io/ioutil" - "os" - "path/filepath" - - "golang.org/x/crypto/pkcs12" -) - -var ( - // ErrMissingCertificate is returned when no local certificate is found in the provided PFX data. - ErrMissingCertificate = errors.New("adal: certificate missing") - - // ErrMissingPrivateKey is returned when no private key is found in the provided PFX data. - ErrMissingPrivateKey = errors.New("adal: private key missing") -) - -// LoadToken restores a Token object from a file located at 'path'. -func LoadToken(path string) (*Token, error) { - file, err := os.Open(path) - if err != nil { - return nil, fmt.Errorf("failed to open file (%s) while loading token: %v", path, err) - } - defer file.Close() - - var token Token - - dec := json.NewDecoder(file) - if err = dec.Decode(&token); err != nil { - return nil, fmt.Errorf("failed to decode contents of file (%s) into Token representation: %v", path, err) - } - return &token, nil -} - -// SaveToken persists an oauth token at the given location on disk. -// It moves the new file into place so it can safely be used to replace an existing file -// that maybe accessed by multiple processes. -func SaveToken(path string, mode os.FileMode, token Token) error { - dir := filepath.Dir(path) - err := os.MkdirAll(dir, os.ModePerm) - if err != nil { - return fmt.Errorf("failed to create directory (%s) to store token in: %v", dir, err) - } - - newFile, err := ioutil.TempFile(dir, "token") - if err != nil { - return fmt.Errorf("failed to create the temp file to write the token: %v", err) - } - tempPath := newFile.Name() - - if err := json.NewEncoder(newFile).Encode(token); err != nil { - return fmt.Errorf("failed to encode token to file (%s) while saving token: %v", tempPath, err) - } - if err := newFile.Close(); err != nil { - return fmt.Errorf("failed to close temp file %s: %v", tempPath, err) - } - - // Atomic replace to avoid multi-writer file corruptions - if err := os.Rename(tempPath, path); err != nil { - return fmt.Errorf("failed to move temporary token to desired output location. src=%s dst=%s: %v", tempPath, path, err) - } - if err := os.Chmod(path, mode); err != nil { - return fmt.Errorf("failed to chmod the token file %s: %v", path, err) - } - return nil -} - -// DecodePfxCertificateData extracts the x509 certificate and RSA private key from the provided PFX data. -// The PFX data must contain a private key along with a certificate whose public key matches that of the -// private key or an error is returned. -// If the private key is not password protected pass the empty string for password. -func DecodePfxCertificateData(pfxData []byte, password string) (*x509.Certificate, *rsa.PrivateKey, error) { - blocks, err := pkcs12.ToPEM(pfxData, password) - if err != nil { - return nil, nil, err - } - // first extract the private key - var priv *rsa.PrivateKey - for _, block := range blocks { - if block.Type == "PRIVATE KEY" { - priv, err = x509.ParsePKCS1PrivateKey(block.Bytes) - if err != nil { - return nil, nil, err - } - break - } - } - if priv == nil { - return nil, nil, ErrMissingPrivateKey - } - // now find the certificate with the matching public key of our private key - var cert *x509.Certificate - for _, block := range blocks { - if block.Type == "CERTIFICATE" { - pcert, err := x509.ParseCertificate(block.Bytes) - if err != nil { - return nil, nil, err - } - certKey, ok := pcert.PublicKey.(*rsa.PublicKey) - if !ok { - // keep looking - continue - } - if priv.E == certKey.E && priv.N.Cmp(certKey.N) == 0 { - // found a match - cert = pcert - break - } - } - } - if cert == nil { - return nil, nil, ErrMissingCertificate - } - return cert, priv, nil -} diff --git a/vendor/github.com/Azure/go-autorest/autorest/adal/sender.go b/vendor/github.com/Azure/go-autorest/autorest/adal/sender.go deleted file mode 100644 index eb649bce9..000000000 --- a/vendor/github.com/Azure/go-autorest/autorest/adal/sender.go +++ /dev/null @@ -1,101 +0,0 @@ -package adal - -// Copyright 2017 Microsoft Corporation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -import ( - "crypto/tls" - "net" - "net/http" - "net/http/cookiejar" - "sync" - "time" - - "github.com/Azure/go-autorest/tracing" -) - -const ( - contentType = "Content-Type" - mimeTypeFormPost = "application/x-www-form-urlencoded" -) - -// DO NOT ACCESS THIS DIRECTLY. go through sender() -var defaultSender Sender -var defaultSenderInit = &sync.Once{} - -// Sender is the interface that wraps the Do method to send HTTP requests. -// -// The standard http.Client conforms to this interface. -type Sender interface { - Do(*http.Request) (*http.Response, error) -} - -// SenderFunc is a method that implements the Sender interface. -type SenderFunc func(*http.Request) (*http.Response, error) - -// Do implements the Sender interface on SenderFunc. -func (sf SenderFunc) Do(r *http.Request) (*http.Response, error) { - return sf(r) -} - -// SendDecorator takes and possibly decorates, by wrapping, a Sender. Decorators may affect the -// http.Request and pass it along or, first, pass the http.Request along then react to the -// http.Response result. -type SendDecorator func(Sender) Sender - -// CreateSender creates, decorates, and returns, as a Sender, the default http.Client. -func CreateSender(decorators ...SendDecorator) Sender { - return DecorateSender(sender(), decorators...) -} - -// DecorateSender accepts a Sender and a, possibly empty, set of SendDecorators, which is applies to -// the Sender. Decorators are applied in the order received, but their affect upon the request -// depends on whether they are a pre-decorator (change the http.Request and then pass it along) or a -// post-decorator (pass the http.Request along and react to the results in http.Response). -func DecorateSender(s Sender, decorators ...SendDecorator) Sender { - for _, decorate := range decorators { - s = decorate(s) - } - return s -} - -func sender() Sender { - // note that we can't init defaultSender in init() since it will - // execute before calling code has had a chance to enable tracing - defaultSenderInit.Do(func() { - // copied from http.DefaultTransport with a TLS minimum version. - transport := &http.Transport{ - Proxy: http.ProxyFromEnvironment, - DialContext: (&net.Dialer{ - Timeout: 30 * time.Second, - KeepAlive: 30 * time.Second, - }).DialContext, - ForceAttemptHTTP2: true, - MaxIdleConns: 100, - IdleConnTimeout: 90 * time.Second, - TLSHandshakeTimeout: 10 * time.Second, - ExpectContinueTimeout: 1 * time.Second, - TLSClientConfig: &tls.Config{ - MinVersion: tls.VersionTLS12, - }, - } - var roundTripper http.RoundTripper = transport - if tracing.IsEnabled() { - roundTripper = tracing.NewTransport(transport) - } - j, _ := cookiejar.New(nil) - defaultSender = &http.Client{Jar: j, Transport: roundTripper} - }) - return defaultSender -} diff --git a/vendor/github.com/Azure/go-autorest/autorest/adal/token.go b/vendor/github.com/Azure/go-autorest/autorest/adal/token.go deleted file mode 100644 index 1a9c8ab53..000000000 --- a/vendor/github.com/Azure/go-autorest/autorest/adal/token.go +++ /dev/null @@ -1,1396 +0,0 @@ -package adal - -// Copyright 2017 Microsoft Corporation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -import ( - "context" - "crypto/rand" - "crypto/rsa" - "crypto/sha1" - "crypto/x509" - "encoding/base64" - "encoding/json" - "errors" - "fmt" - "io" - "io/ioutil" - "math" - "net/http" - "net/url" - "os" - "strconv" - "strings" - "sync" - "time" - - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/logger" - "github.com/golang-jwt/jwt/v4" -) - -const ( - defaultRefresh = 5 * time.Minute - - // OAuthGrantTypeDeviceCode is the "grant_type" identifier used in device flow - OAuthGrantTypeDeviceCode = "device_code" - - // OAuthGrantTypeClientCredentials is the "grant_type" identifier used in credential flows - OAuthGrantTypeClientCredentials = "client_credentials" - - // OAuthGrantTypeUserPass is the "grant_type" identifier used in username and password auth flows - OAuthGrantTypeUserPass = "password" - - // OAuthGrantTypeRefreshToken is the "grant_type" identifier used in refresh token flows - OAuthGrantTypeRefreshToken = "refresh_token" - - // OAuthGrantTypeAuthorizationCode is the "grant_type" identifier used in authorization code flows - OAuthGrantTypeAuthorizationCode = "authorization_code" - - // metadataHeader is the header required by MSI extension - metadataHeader = "Metadata" - - // msiEndpoint is the well known endpoint for getting MSI authentications tokens - msiEndpoint = "http://169.254.169.254/metadata/identity/oauth2/token" - - // the API version to use for the MSI endpoint - msiAPIVersion = "2018-02-01" - - // the default number of attempts to refresh an MSI authentication token - defaultMaxMSIRefreshAttempts = 5 - - // asMSIEndpointEnv is the environment variable used to store the endpoint on App Service and Functions - msiEndpointEnv = "MSI_ENDPOINT" - - // asMSISecretEnv is the environment variable used to store the request secret on App Service and Functions - msiSecretEnv = "MSI_SECRET" - - // the API version to use for the legacy App Service MSI endpoint - appServiceAPIVersion2017 = "2017-09-01" - - // secret header used when authenticating against app service MSI endpoint - secretHeader = "Secret" - - // the format for expires_on in UTC with AM/PM - expiresOnDateFormatPM = "1/2/2006 15:04:05 PM +00:00" - - // the format for expires_on in UTC without AM/PM - expiresOnDateFormat = "1/2/2006 15:04:05 +00:00" -) - -// OAuthTokenProvider is an interface which should be implemented by an access token retriever -type OAuthTokenProvider interface { - OAuthToken() string -} - -// MultitenantOAuthTokenProvider provides tokens used for multi-tenant authorization. -type MultitenantOAuthTokenProvider interface { - PrimaryOAuthToken() string - AuxiliaryOAuthTokens() []string -} - -// TokenRefreshError is an interface used by errors returned during token refresh. -type TokenRefreshError interface { - error - Response() *http.Response -} - -// Refresher is an interface for token refresh functionality -type Refresher interface { - Refresh() error - RefreshExchange(resource string) error - EnsureFresh() error -} - -// RefresherWithContext is an interface for token refresh functionality -type RefresherWithContext interface { - RefreshWithContext(ctx context.Context) error - RefreshExchangeWithContext(ctx context.Context, resource string) error - EnsureFreshWithContext(ctx context.Context) error -} - -// TokenRefreshCallback is the type representing callbacks that will be called after -// a successful token refresh -type TokenRefreshCallback func(Token) error - -// TokenRefresh is a type representing a custom callback to refresh a token -type TokenRefresh func(ctx context.Context, resource string) (*Token, error) - -// Token encapsulates the access token used to authorize Azure requests. -// https://docs.microsoft.com/en-us/azure/active-directory/develop/v1-oauth2-client-creds-grant-flow#service-to-service-access-token-response -type Token struct { - AccessToken string `json:"access_token"` - RefreshToken string `json:"refresh_token"` - - ExpiresIn json.Number `json:"expires_in"` - ExpiresOn json.Number `json:"expires_on"` - NotBefore json.Number `json:"not_before"` - - Resource string `json:"resource"` - Type string `json:"token_type"` -} - -func newToken() Token { - return Token{ - ExpiresIn: "0", - ExpiresOn: "0", - NotBefore: "0", - } -} - -// IsZero returns true if the token object is zero-initialized. -func (t Token) IsZero() bool { - return t == Token{} -} - -// Expires returns the time.Time when the Token expires. -func (t Token) Expires() time.Time { - s, err := t.ExpiresOn.Float64() - if err != nil { - s = -3600 - } - - expiration := date.NewUnixTimeFromSeconds(s) - - return time.Time(expiration).UTC() -} - -// IsExpired returns true if the Token is expired, false otherwise. -func (t Token) IsExpired() bool { - return t.WillExpireIn(0) -} - -// WillExpireIn returns true if the Token will expire after the passed time.Duration interval -// from now, false otherwise. -func (t Token) WillExpireIn(d time.Duration) bool { - return !t.Expires().After(time.Now().Add(d)) -} - -//OAuthToken return the current access token -func (t *Token) OAuthToken() string { - return t.AccessToken -} - -// ServicePrincipalSecret is an interface that allows various secret mechanism to fill the form -// that is submitted when acquiring an oAuth token. -type ServicePrincipalSecret interface { - SetAuthenticationValues(spt *ServicePrincipalToken, values *url.Values) error -} - -// ServicePrincipalNoSecret represents a secret type that contains no secret -// meaning it is not valid for fetching a fresh token. This is used by Manual -type ServicePrincipalNoSecret struct { -} - -// SetAuthenticationValues is a method of the interface ServicePrincipalSecret -// It only returns an error for the ServicePrincipalNoSecret type -func (noSecret *ServicePrincipalNoSecret) SetAuthenticationValues(spt *ServicePrincipalToken, v *url.Values) error { - return fmt.Errorf("Manually created ServicePrincipalToken does not contain secret material to retrieve a new access token") -} - -// MarshalJSON implements the json.Marshaler interface. -func (noSecret ServicePrincipalNoSecret) MarshalJSON() ([]byte, error) { - type tokenType struct { - Type string `json:"type"` - } - return json.Marshal(tokenType{ - Type: "ServicePrincipalNoSecret", - }) -} - -// ServicePrincipalTokenSecret implements ServicePrincipalSecret for client_secret type authorization. -type ServicePrincipalTokenSecret struct { - ClientSecret string `json:"value"` -} - -// SetAuthenticationValues is a method of the interface ServicePrincipalSecret. -// It will populate the form submitted during oAuth Token Acquisition using the client_secret. -func (tokenSecret *ServicePrincipalTokenSecret) SetAuthenticationValues(spt *ServicePrincipalToken, v *url.Values) error { - v.Set("client_secret", tokenSecret.ClientSecret) - return nil -} - -// MarshalJSON implements the json.Marshaler interface. -func (tokenSecret ServicePrincipalTokenSecret) MarshalJSON() ([]byte, error) { - type tokenType struct { - Type string `json:"type"` - Value string `json:"value"` - } - return json.Marshal(tokenType{ - Type: "ServicePrincipalTokenSecret", - Value: tokenSecret.ClientSecret, - }) -} - -// ServicePrincipalCertificateSecret implements ServicePrincipalSecret for generic RSA cert auth with signed JWTs. -type ServicePrincipalCertificateSecret struct { - Certificate *x509.Certificate - PrivateKey *rsa.PrivateKey -} - -// SignJwt returns the JWT signed with the certificate's private key. -func (secret *ServicePrincipalCertificateSecret) SignJwt(spt *ServicePrincipalToken) (string, error) { - hasher := sha1.New() - _, err := hasher.Write(secret.Certificate.Raw) - if err != nil { - return "", err - } - - thumbprint := base64.URLEncoding.EncodeToString(hasher.Sum(nil)) - - // The jti (JWT ID) claim provides a unique identifier for the JWT. - jti := make([]byte, 20) - _, err = rand.Read(jti) - if err != nil { - return "", err - } - - token := jwt.New(jwt.SigningMethodRS256) - token.Header["x5t"] = thumbprint - x5c := []string{base64.StdEncoding.EncodeToString(secret.Certificate.Raw)} - token.Header["x5c"] = x5c - token.Claims = jwt.MapClaims{ - "aud": spt.inner.OauthConfig.TokenEndpoint.String(), - "iss": spt.inner.ClientID, - "sub": spt.inner.ClientID, - "jti": base64.URLEncoding.EncodeToString(jti), - "nbf": time.Now().Unix(), - "exp": time.Now().Add(24 * time.Hour).Unix(), - } - - signedString, err := token.SignedString(secret.PrivateKey) - return signedString, err -} - -// SetAuthenticationValues is a method of the interface ServicePrincipalSecret. -// It will populate the form submitted during oAuth Token Acquisition using a JWT signed with a certificate. -func (secret *ServicePrincipalCertificateSecret) SetAuthenticationValues(spt *ServicePrincipalToken, v *url.Values) error { - jwt, err := secret.SignJwt(spt) - if err != nil { - return err - } - - v.Set("client_assertion", jwt) - v.Set("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer") - return nil -} - -// MarshalJSON implements the json.Marshaler interface. -func (secret ServicePrincipalCertificateSecret) MarshalJSON() ([]byte, error) { - return nil, errors.New("marshalling ServicePrincipalCertificateSecret is not supported") -} - -// ServicePrincipalMSISecret implements ServicePrincipalSecret for machines running the MSI Extension. -type ServicePrincipalMSISecret struct { - msiType msiType - clientResourceID string -} - -// SetAuthenticationValues is a method of the interface ServicePrincipalSecret. -func (msiSecret *ServicePrincipalMSISecret) SetAuthenticationValues(spt *ServicePrincipalToken, v *url.Values) error { - return nil -} - -// MarshalJSON implements the json.Marshaler interface. -func (msiSecret ServicePrincipalMSISecret) MarshalJSON() ([]byte, error) { - return nil, errors.New("marshalling ServicePrincipalMSISecret is not supported") -} - -// ServicePrincipalUsernamePasswordSecret implements ServicePrincipalSecret for username and password auth. -type ServicePrincipalUsernamePasswordSecret struct { - Username string `json:"username"` - Password string `json:"password"` -} - -// SetAuthenticationValues is a method of the interface ServicePrincipalSecret. -func (secret *ServicePrincipalUsernamePasswordSecret) SetAuthenticationValues(spt *ServicePrincipalToken, v *url.Values) error { - v.Set("username", secret.Username) - v.Set("password", secret.Password) - return nil -} - -// MarshalJSON implements the json.Marshaler interface. -func (secret ServicePrincipalUsernamePasswordSecret) MarshalJSON() ([]byte, error) { - type tokenType struct { - Type string `json:"type"` - Username string `json:"username"` - Password string `json:"password"` - } - return json.Marshal(tokenType{ - Type: "ServicePrincipalUsernamePasswordSecret", - Username: secret.Username, - Password: secret.Password, - }) -} - -// ServicePrincipalAuthorizationCodeSecret implements ServicePrincipalSecret for authorization code auth. -type ServicePrincipalAuthorizationCodeSecret struct { - ClientSecret string `json:"value"` - AuthorizationCode string `json:"authCode"` - RedirectURI string `json:"redirect"` -} - -// SetAuthenticationValues is a method of the interface ServicePrincipalSecret. -func (secret *ServicePrincipalAuthorizationCodeSecret) SetAuthenticationValues(spt *ServicePrincipalToken, v *url.Values) error { - v.Set("code", secret.AuthorizationCode) - v.Set("client_secret", secret.ClientSecret) - v.Set("redirect_uri", secret.RedirectURI) - return nil -} - -// MarshalJSON implements the json.Marshaler interface. -func (secret ServicePrincipalAuthorizationCodeSecret) MarshalJSON() ([]byte, error) { - type tokenType struct { - Type string `json:"type"` - Value string `json:"value"` - AuthCode string `json:"authCode"` - Redirect string `json:"redirect"` - } - return json.Marshal(tokenType{ - Type: "ServicePrincipalAuthorizationCodeSecret", - Value: secret.ClientSecret, - AuthCode: secret.AuthorizationCode, - Redirect: secret.RedirectURI, - }) -} - -// ServicePrincipalFederatedSecret implements ServicePrincipalSecret for Federated JWTs. -type ServicePrincipalFederatedSecret struct { - jwt string -} - -// SetAuthenticationValues is a method of the interface ServicePrincipalSecret. -// It will populate the form submitted during OAuth Token Acquisition using a JWT signed by an OIDC issuer. -func (secret *ServicePrincipalFederatedSecret) SetAuthenticationValues(spt *ServicePrincipalToken, v *url.Values) error { - - v.Set("client_assertion", secret.jwt) - v.Set("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer") - return nil -} - -// MarshalJSON implements the json.Marshaler interface. -func (secret ServicePrincipalFederatedSecret) MarshalJSON() ([]byte, error) { - return nil, errors.New("marshalling ServicePrincipalFederatedSecret is not supported") -} - -// ServicePrincipalToken encapsulates a Token created for a Service Principal. -type ServicePrincipalToken struct { - inner servicePrincipalToken - refreshLock *sync.RWMutex - sender Sender - customRefreshFunc TokenRefresh - refreshCallbacks []TokenRefreshCallback - // MaxMSIRefreshAttempts is the maximum number of attempts to refresh an MSI token. - // Settings this to a value less than 1 will use the default value. - MaxMSIRefreshAttempts int -} - -// MarshalTokenJSON returns the marshalled inner token. -func (spt ServicePrincipalToken) MarshalTokenJSON() ([]byte, error) { - return json.Marshal(spt.inner.Token) -} - -// SetRefreshCallbacks replaces any existing refresh callbacks with the specified callbacks. -func (spt *ServicePrincipalToken) SetRefreshCallbacks(callbacks []TokenRefreshCallback) { - spt.refreshCallbacks = callbacks -} - -// SetCustomRefreshFunc sets a custom refresh function used to refresh the token. -func (spt *ServicePrincipalToken) SetCustomRefreshFunc(customRefreshFunc TokenRefresh) { - spt.customRefreshFunc = customRefreshFunc -} - -// MarshalJSON implements the json.Marshaler interface. -func (spt ServicePrincipalToken) MarshalJSON() ([]byte, error) { - return json.Marshal(spt.inner) -} - -// UnmarshalJSON implements the json.Unmarshaler interface. -func (spt *ServicePrincipalToken) UnmarshalJSON(data []byte) error { - // need to determine the token type - raw := map[string]interface{}{} - err := json.Unmarshal(data, &raw) - if err != nil { - return err - } - secret := raw["secret"].(map[string]interface{}) - switch secret["type"] { - case "ServicePrincipalNoSecret": - spt.inner.Secret = &ServicePrincipalNoSecret{} - case "ServicePrincipalTokenSecret": - spt.inner.Secret = &ServicePrincipalTokenSecret{} - case "ServicePrincipalCertificateSecret": - return errors.New("unmarshalling ServicePrincipalCertificateSecret is not supported") - case "ServicePrincipalMSISecret": - return errors.New("unmarshalling ServicePrincipalMSISecret is not supported") - case "ServicePrincipalUsernamePasswordSecret": - spt.inner.Secret = &ServicePrincipalUsernamePasswordSecret{} - case "ServicePrincipalAuthorizationCodeSecret": - spt.inner.Secret = &ServicePrincipalAuthorizationCodeSecret{} - case "ServicePrincipalFederatedSecret": - return errors.New("unmarshalling ServicePrincipalFederatedSecret is not supported") - default: - return fmt.Errorf("unrecognized token type '%s'", secret["type"]) - } - err = json.Unmarshal(data, &spt.inner) - if err != nil { - return err - } - // Don't override the refreshLock or the sender if those have been already set. - if spt.refreshLock == nil { - spt.refreshLock = &sync.RWMutex{} - } - if spt.sender == nil { - spt.sender = sender() - } - return nil -} - -// internal type used for marshalling/unmarshalling -type servicePrincipalToken struct { - Token Token `json:"token"` - Secret ServicePrincipalSecret `json:"secret"` - OauthConfig OAuthConfig `json:"oauth"` - ClientID string `json:"clientID"` - Resource string `json:"resource"` - AutoRefresh bool `json:"autoRefresh"` - RefreshWithin time.Duration `json:"refreshWithin"` -} - -func validateOAuthConfig(oac OAuthConfig) error { - if oac.IsZero() { - return fmt.Errorf("parameter 'oauthConfig' cannot be zero-initialized") - } - return nil -} - -// NewServicePrincipalTokenWithSecret create a ServicePrincipalToken using the supplied ServicePrincipalSecret implementation. -func NewServicePrincipalTokenWithSecret(oauthConfig OAuthConfig, id string, resource string, secret ServicePrincipalSecret, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) { - if err := validateOAuthConfig(oauthConfig); err != nil { - return nil, err - } - if err := validateStringParam(id, "id"); err != nil { - return nil, err - } - if err := validateStringParam(resource, "resource"); err != nil { - return nil, err - } - if secret == nil { - return nil, fmt.Errorf("parameter 'secret' cannot be nil") - } - spt := &ServicePrincipalToken{ - inner: servicePrincipalToken{ - Token: newToken(), - OauthConfig: oauthConfig, - Secret: secret, - ClientID: id, - Resource: resource, - AutoRefresh: true, - RefreshWithin: defaultRefresh, - }, - refreshLock: &sync.RWMutex{}, - sender: sender(), - refreshCallbacks: callbacks, - } - return spt, nil -} - -// NewServicePrincipalTokenFromManualToken creates a ServicePrincipalToken using the supplied token -func NewServicePrincipalTokenFromManualToken(oauthConfig OAuthConfig, clientID string, resource string, token Token, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) { - if err := validateOAuthConfig(oauthConfig); err != nil { - return nil, err - } - if err := validateStringParam(clientID, "clientID"); err != nil { - return nil, err - } - if err := validateStringParam(resource, "resource"); err != nil { - return nil, err - } - if token.IsZero() { - return nil, fmt.Errorf("parameter 'token' cannot be zero-initialized") - } - spt, err := NewServicePrincipalTokenWithSecret( - oauthConfig, - clientID, - resource, - &ServicePrincipalNoSecret{}, - callbacks...) - if err != nil { - return nil, err - } - - spt.inner.Token = token - - return spt, nil -} - -// NewServicePrincipalTokenFromManualTokenSecret creates a ServicePrincipalToken using the supplied token and secret -func NewServicePrincipalTokenFromManualTokenSecret(oauthConfig OAuthConfig, clientID string, resource string, token Token, secret ServicePrincipalSecret, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) { - if err := validateOAuthConfig(oauthConfig); err != nil { - return nil, err - } - if err := validateStringParam(clientID, "clientID"); err != nil { - return nil, err - } - if err := validateStringParam(resource, "resource"); err != nil { - return nil, err - } - if secret == nil { - return nil, fmt.Errorf("parameter 'secret' cannot be nil") - } - if token.IsZero() { - return nil, fmt.Errorf("parameter 'token' cannot be zero-initialized") - } - spt, err := NewServicePrincipalTokenWithSecret( - oauthConfig, - clientID, - resource, - secret, - callbacks...) - if err != nil { - return nil, err - } - - spt.inner.Token = token - - return spt, nil -} - -// NewServicePrincipalToken creates a ServicePrincipalToken from the supplied Service Principal -// credentials scoped to the named resource. -func NewServicePrincipalToken(oauthConfig OAuthConfig, clientID string, secret string, resource string, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) { - if err := validateOAuthConfig(oauthConfig); err != nil { - return nil, err - } - if err := validateStringParam(clientID, "clientID"); err != nil { - return nil, err - } - if err := validateStringParam(secret, "secret"); err != nil { - return nil, err - } - if err := validateStringParam(resource, "resource"); err != nil { - return nil, err - } - return NewServicePrincipalTokenWithSecret( - oauthConfig, - clientID, - resource, - &ServicePrincipalTokenSecret{ - ClientSecret: secret, - }, - callbacks..., - ) -} - -// NewServicePrincipalTokenFromCertificate creates a ServicePrincipalToken from the supplied pkcs12 bytes. -func NewServicePrincipalTokenFromCertificate(oauthConfig OAuthConfig, clientID string, certificate *x509.Certificate, privateKey *rsa.PrivateKey, resource string, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) { - if err := validateOAuthConfig(oauthConfig); err != nil { - return nil, err - } - if err := validateStringParam(clientID, "clientID"); err != nil { - return nil, err - } - if err := validateStringParam(resource, "resource"); err != nil { - return nil, err - } - if certificate == nil { - return nil, fmt.Errorf("parameter 'certificate' cannot be nil") - } - if privateKey == nil { - return nil, fmt.Errorf("parameter 'privateKey' cannot be nil") - } - return NewServicePrincipalTokenWithSecret( - oauthConfig, - clientID, - resource, - &ServicePrincipalCertificateSecret{ - PrivateKey: privateKey, - Certificate: certificate, - }, - callbacks..., - ) -} - -// NewServicePrincipalTokenFromUsernamePassword creates a ServicePrincipalToken from the username and password. -func NewServicePrincipalTokenFromUsernamePassword(oauthConfig OAuthConfig, clientID string, username string, password string, resource string, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) { - if err := validateOAuthConfig(oauthConfig); err != nil { - return nil, err - } - if err := validateStringParam(clientID, "clientID"); err != nil { - return nil, err - } - if err := validateStringParam(username, "username"); err != nil { - return nil, err - } - if err := validateStringParam(password, "password"); err != nil { - return nil, err - } - if err := validateStringParam(resource, "resource"); err != nil { - return nil, err - } - return NewServicePrincipalTokenWithSecret( - oauthConfig, - clientID, - resource, - &ServicePrincipalUsernamePasswordSecret{ - Username: username, - Password: password, - }, - callbacks..., - ) -} - -// NewServicePrincipalTokenFromAuthorizationCode creates a ServicePrincipalToken from the -func NewServicePrincipalTokenFromAuthorizationCode(oauthConfig OAuthConfig, clientID string, clientSecret string, authorizationCode string, redirectURI string, resource string, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) { - - if err := validateOAuthConfig(oauthConfig); err != nil { - return nil, err - } - if err := validateStringParam(clientID, "clientID"); err != nil { - return nil, err - } - if err := validateStringParam(clientSecret, "clientSecret"); err != nil { - return nil, err - } - if err := validateStringParam(authorizationCode, "authorizationCode"); err != nil { - return nil, err - } - if err := validateStringParam(redirectURI, "redirectURI"); err != nil { - return nil, err - } - if err := validateStringParam(resource, "resource"); err != nil { - return nil, err - } - - return NewServicePrincipalTokenWithSecret( - oauthConfig, - clientID, - resource, - &ServicePrincipalAuthorizationCodeSecret{ - ClientSecret: clientSecret, - AuthorizationCode: authorizationCode, - RedirectURI: redirectURI, - }, - callbacks..., - ) -} - -// NewServicePrincipalTokenFromFederatedToken creates a ServicePrincipalToken from the supplied federated OIDC JWT. -func NewServicePrincipalTokenFromFederatedToken(oauthConfig OAuthConfig, clientID string, jwt string, resource string, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) { - if err := validateOAuthConfig(oauthConfig); err != nil { - return nil, err - } - if err := validateStringParam(clientID, "clientID"); err != nil { - return nil, err - } - if err := validateStringParam(resource, "resource"); err != nil { - return nil, err - } - if jwt == "" { - return nil, fmt.Errorf("parameter 'jwt' cannot be empty") - } - return NewServicePrincipalTokenWithSecret( - oauthConfig, - clientID, - resource, - &ServicePrincipalFederatedSecret{ - jwt: jwt, - }, - callbacks..., - ) -} - -type msiType int - -const ( - msiTypeUnavailable msiType = iota - msiTypeAppServiceV20170901 - msiTypeCloudShell - msiTypeIMDS -) - -func (m msiType) String() string { - switch m { - case msiTypeAppServiceV20170901: - return "AppServiceV20170901" - case msiTypeCloudShell: - return "CloudShell" - case msiTypeIMDS: - return "IMDS" - default: - return fmt.Sprintf("unhandled MSI type %d", m) - } -} - -// returns the MSI type and endpoint, or an error -func getMSIType() (msiType, string, error) { - if endpointEnvVar := os.Getenv(msiEndpointEnv); endpointEnvVar != "" { - // if the env var MSI_ENDPOINT is set - if secretEnvVar := os.Getenv(msiSecretEnv); secretEnvVar != "" { - // if BOTH the env vars MSI_ENDPOINT and MSI_SECRET are set the msiType is AppService - return msiTypeAppServiceV20170901, endpointEnvVar, nil - } - // if ONLY the env var MSI_ENDPOINT is set the msiType is CloudShell - return msiTypeCloudShell, endpointEnvVar, nil - } - // if MSI_ENDPOINT is NOT set assume the msiType is IMDS - return msiTypeIMDS, msiEndpoint, nil -} - -// GetMSIVMEndpoint gets the MSI endpoint on Virtual Machines. -// NOTE: this always returns the IMDS endpoint, it does not work for app services or cloud shell. -// Deprecated: NewServicePrincipalTokenFromMSI() and variants will automatically detect the endpoint. -func GetMSIVMEndpoint() (string, error) { - return msiEndpoint, nil -} - -// GetMSIAppServiceEndpoint get the MSI endpoint for App Service and Functions. -// It will return an error when not running in an app service/functions environment. -// Deprecated: NewServicePrincipalTokenFromMSI() and variants will automatically detect the endpoint. -func GetMSIAppServiceEndpoint() (string, error) { - msiType, endpoint, err := getMSIType() - if err != nil { - return "", err - } - switch msiType { - case msiTypeAppServiceV20170901: - return endpoint, nil - default: - return "", fmt.Errorf("%s is not app service environment", msiType) - } -} - -// GetMSIEndpoint get the appropriate MSI endpoint depending on the runtime environment -// Deprecated: NewServicePrincipalTokenFromMSI() and variants will automatically detect the endpoint. -func GetMSIEndpoint() (string, error) { - _, endpoint, err := getMSIType() - return endpoint, err -} - -// NewServicePrincipalTokenFromMSI creates a ServicePrincipalToken via the MSI VM Extension. -// It will use the system assigned identity when creating the token. -// msiEndpoint - empty string, or pass a non-empty string to override the default value. -// Deprecated: use NewServicePrincipalTokenFromManagedIdentity() instead. -func NewServicePrincipalTokenFromMSI(msiEndpoint, resource string, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) { - return newServicePrincipalTokenFromMSI(msiEndpoint, resource, "", "", callbacks...) -} - -// NewServicePrincipalTokenFromMSIWithUserAssignedID creates a ServicePrincipalToken via the MSI VM Extension. -// It will use the clientID of specified user assigned identity when creating the token. -// msiEndpoint - empty string, or pass a non-empty string to override the default value. -// Deprecated: use NewServicePrincipalTokenFromManagedIdentity() instead. -func NewServicePrincipalTokenFromMSIWithUserAssignedID(msiEndpoint, resource string, userAssignedID string, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) { - if err := validateStringParam(userAssignedID, "userAssignedID"); err != nil { - return nil, err - } - return newServicePrincipalTokenFromMSI(msiEndpoint, resource, userAssignedID, "", callbacks...) -} - -// NewServicePrincipalTokenFromMSIWithIdentityResourceID creates a ServicePrincipalToken via the MSI VM Extension. -// It will use the azure resource id of user assigned identity when creating the token. -// msiEndpoint - empty string, or pass a non-empty string to override the default value. -// Deprecated: use NewServicePrincipalTokenFromManagedIdentity() instead. -func NewServicePrincipalTokenFromMSIWithIdentityResourceID(msiEndpoint, resource string, identityResourceID string, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) { - if err := validateStringParam(identityResourceID, "identityResourceID"); err != nil { - return nil, err - } - return newServicePrincipalTokenFromMSI(msiEndpoint, resource, "", identityResourceID, callbacks...) -} - -// ManagedIdentityOptions contains optional values for configuring managed identity authentication. -type ManagedIdentityOptions struct { - // ClientID is the user-assigned identity to use during authentication. - // It is mutually exclusive with IdentityResourceID. - ClientID string - - // IdentityResourceID is the resource ID of the user-assigned identity to use during authentication. - // It is mutually exclusive with ClientID. - IdentityResourceID string -} - -// NewServicePrincipalTokenFromManagedIdentity creates a ServicePrincipalToken using a managed identity. -// It supports the following managed identity environments. -// - App Service Environment (API version 2017-09-01 only) -// - Cloud shell -// - IMDS with a system or user assigned identity -func NewServicePrincipalTokenFromManagedIdentity(resource string, options *ManagedIdentityOptions, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) { - if options == nil { - options = &ManagedIdentityOptions{} - } - return newServicePrincipalTokenFromMSI("", resource, options.ClientID, options.IdentityResourceID, callbacks...) -} - -func newServicePrincipalTokenFromMSI(msiEndpoint, resource, userAssignedID, identityResourceID string, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) { - if err := validateStringParam(resource, "resource"); err != nil { - return nil, err - } - if userAssignedID != "" && identityResourceID != "" { - return nil, errors.New("cannot specify userAssignedID and identityResourceID") - } - msiType, endpoint, err := getMSIType() - if err != nil { - logger.Instance.Writef(logger.LogError, "Error determining managed identity environment: %v\n", err) - return nil, err - } - logger.Instance.Writef(logger.LogInfo, "Managed identity environment is %s, endpoint is %s\n", msiType, endpoint) - if msiEndpoint != "" { - endpoint = msiEndpoint - logger.Instance.Writef(logger.LogInfo, "Managed identity custom endpoint is %s\n", endpoint) - } - msiEndpointURL, err := url.Parse(endpoint) - if err != nil { - return nil, err - } - // cloud shell sends its data in the request body - if msiType != msiTypeCloudShell { - v := url.Values{} - v.Set("resource", resource) - clientIDParam := "client_id" - switch msiType { - case msiTypeAppServiceV20170901: - clientIDParam = "clientid" - v.Set("api-version", appServiceAPIVersion2017) - break - case msiTypeIMDS: - v.Set("api-version", msiAPIVersion) - } - if userAssignedID != "" { - v.Set(clientIDParam, userAssignedID) - } else if identityResourceID != "" { - v.Set("mi_res_id", identityResourceID) - } - msiEndpointURL.RawQuery = v.Encode() - } - - spt := &ServicePrincipalToken{ - inner: servicePrincipalToken{ - Token: newToken(), - OauthConfig: OAuthConfig{ - TokenEndpoint: *msiEndpointURL, - }, - Secret: &ServicePrincipalMSISecret{ - msiType: msiType, - clientResourceID: identityResourceID, - }, - Resource: resource, - AutoRefresh: true, - RefreshWithin: defaultRefresh, - ClientID: userAssignedID, - }, - refreshLock: &sync.RWMutex{}, - sender: sender(), - refreshCallbacks: callbacks, - MaxMSIRefreshAttempts: defaultMaxMSIRefreshAttempts, - } - - return spt, nil -} - -// internal type that implements TokenRefreshError -type tokenRefreshError struct { - message string - resp *http.Response -} - -// Error implements the error interface which is part of the TokenRefreshError interface. -func (tre tokenRefreshError) Error() string { - return tre.message -} - -// Response implements the TokenRefreshError interface, it returns the raw HTTP response from the refresh operation. -func (tre tokenRefreshError) Response() *http.Response { - return tre.resp -} - -func newTokenRefreshError(message string, resp *http.Response) TokenRefreshError { - return tokenRefreshError{message: message, resp: resp} -} - -// EnsureFresh will refresh the token if it will expire within the refresh window (as set by -// RefreshWithin) and autoRefresh flag is on. This method is safe for concurrent use. -func (spt *ServicePrincipalToken) EnsureFresh() error { - return spt.EnsureFreshWithContext(context.Background()) -} - -// EnsureFreshWithContext will refresh the token if it will expire within the refresh window (as set by -// RefreshWithin) and autoRefresh flag is on. This method is safe for concurrent use. -func (spt *ServicePrincipalToken) EnsureFreshWithContext(ctx context.Context) error { - // must take the read lock when initially checking the token's expiration - if spt.inner.AutoRefresh && spt.Token().WillExpireIn(spt.inner.RefreshWithin) { - // take the write lock then check again to see if the token was already refreshed - spt.refreshLock.Lock() - defer spt.refreshLock.Unlock() - if spt.inner.Token.WillExpireIn(spt.inner.RefreshWithin) { - return spt.refreshInternal(ctx, spt.inner.Resource) - } - } - return nil -} - -// InvokeRefreshCallbacks calls any TokenRefreshCallbacks that were added to the SPT during initialization -func (spt *ServicePrincipalToken) InvokeRefreshCallbacks(token Token) error { - if spt.refreshCallbacks != nil { - for _, callback := range spt.refreshCallbacks { - err := callback(spt.inner.Token) - if err != nil { - return fmt.Errorf("adal: TokenRefreshCallback handler failed. Error = '%v'", err) - } - } - } - return nil -} - -// Refresh obtains a fresh token for the Service Principal. -// This method is safe for concurrent use. -func (spt *ServicePrincipalToken) Refresh() error { - return spt.RefreshWithContext(context.Background()) -} - -// RefreshWithContext obtains a fresh token for the Service Principal. -// This method is safe for concurrent use. -func (spt *ServicePrincipalToken) RefreshWithContext(ctx context.Context) error { - spt.refreshLock.Lock() - defer spt.refreshLock.Unlock() - return spt.refreshInternal(ctx, spt.inner.Resource) -} - -// RefreshExchange refreshes the token, but for a different resource. -// This method is safe for concurrent use. -func (spt *ServicePrincipalToken) RefreshExchange(resource string) error { - return spt.RefreshExchangeWithContext(context.Background(), resource) -} - -// RefreshExchangeWithContext refreshes the token, but for a different resource. -// This method is safe for concurrent use. -func (spt *ServicePrincipalToken) RefreshExchangeWithContext(ctx context.Context, resource string) error { - spt.refreshLock.Lock() - defer spt.refreshLock.Unlock() - return spt.refreshInternal(ctx, resource) -} - -func (spt *ServicePrincipalToken) getGrantType() string { - switch spt.inner.Secret.(type) { - case *ServicePrincipalUsernamePasswordSecret: - return OAuthGrantTypeUserPass - case *ServicePrincipalAuthorizationCodeSecret: - return OAuthGrantTypeAuthorizationCode - default: - return OAuthGrantTypeClientCredentials - } -} - -func (spt *ServicePrincipalToken) refreshInternal(ctx context.Context, resource string) error { - if spt.customRefreshFunc != nil { - token, err := spt.customRefreshFunc(ctx, resource) - if err != nil { - return err - } - spt.inner.Token = *token - return spt.InvokeRefreshCallbacks(spt.inner.Token) - } - req, err := http.NewRequest(http.MethodPost, spt.inner.OauthConfig.TokenEndpoint.String(), nil) - if err != nil { - return fmt.Errorf("adal: Failed to build the refresh request. Error = '%v'", err) - } - req.Header.Add("User-Agent", UserAgent()) - req = req.WithContext(ctx) - var resp *http.Response - authBodyFilter := func(b []byte) []byte { - if logger.Level() != logger.LogAuth { - return []byte("**REDACTED** authentication body") - } - return b - } - if msiSecret, ok := spt.inner.Secret.(*ServicePrincipalMSISecret); ok { - switch msiSecret.msiType { - case msiTypeAppServiceV20170901: - req.Method = http.MethodGet - req.Header.Set("secret", os.Getenv(msiSecretEnv)) - break - case msiTypeCloudShell: - req.Header.Set("Metadata", "true") - data := url.Values{} - data.Set("resource", spt.inner.Resource) - if spt.inner.ClientID != "" { - data.Set("client_id", spt.inner.ClientID) - } else if msiSecret.clientResourceID != "" { - data.Set("msi_res_id", msiSecret.clientResourceID) - } - req.Body = ioutil.NopCloser(strings.NewReader(data.Encode())) - req.Header.Set("Content-Type", "application/x-www-form-urlencoded") - break - case msiTypeIMDS: - req.Method = http.MethodGet - req.Header.Set("Metadata", "true") - break - } - logger.Instance.WriteRequest(req, logger.Filter{Body: authBodyFilter}) - resp, err = retryForIMDS(spt.sender, req, spt.MaxMSIRefreshAttempts) - } else { - v := url.Values{} - v.Set("client_id", spt.inner.ClientID) - v.Set("resource", resource) - - if spt.inner.Token.RefreshToken != "" { - v.Set("grant_type", OAuthGrantTypeRefreshToken) - v.Set("refresh_token", spt.inner.Token.RefreshToken) - // web apps must specify client_secret when refreshing tokens - // see https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-protocols-oauth-code#refreshing-the-access-tokens - if spt.getGrantType() == OAuthGrantTypeAuthorizationCode { - err := spt.inner.Secret.SetAuthenticationValues(spt, &v) - if err != nil { - return err - } - } - } else { - v.Set("grant_type", spt.getGrantType()) - err := spt.inner.Secret.SetAuthenticationValues(spt, &v) - if err != nil { - return err - } - } - - s := v.Encode() - body := ioutil.NopCloser(strings.NewReader(s)) - req.ContentLength = int64(len(s)) - req.Header.Set(contentType, mimeTypeFormPost) - req.Body = body - logger.Instance.WriteRequest(req, logger.Filter{Body: authBodyFilter}) - resp, err = spt.sender.Do(req) - } - - // don't return a TokenRefreshError here; this will allow retry logic to apply - if err != nil { - return fmt.Errorf("adal: Failed to execute the refresh request. Error = '%v'", err) - } else if resp == nil { - return fmt.Errorf("adal: received nil response and error") - } - - logger.Instance.WriteResponse(resp, logger.Filter{Body: authBodyFilter}) - defer resp.Body.Close() - rb, err := ioutil.ReadAll(resp.Body) - - if resp.StatusCode != http.StatusOK { - if err != nil { - return newTokenRefreshError(fmt.Sprintf("adal: Refresh request failed. Status Code = '%d'. Failed reading response body: %v Endpoint %s", resp.StatusCode, err, req.URL.String()), resp) - } - return newTokenRefreshError(fmt.Sprintf("adal: Refresh request failed. Status Code = '%d'. Response body: %s Endpoint %s", resp.StatusCode, string(rb), req.URL.String()), resp) - } - - // for the following error cases don't return a TokenRefreshError. the operation succeeded - // but some transient failure happened during deserialization. by returning a generic error - // the retry logic will kick in (we don't retry on TokenRefreshError). - - if err != nil { - return fmt.Errorf("adal: Failed to read a new service principal token during refresh. Error = '%v'", err) - } - if len(strings.Trim(string(rb), " ")) == 0 { - return fmt.Errorf("adal: Empty service principal token received during refresh") - } - token := struct { - AccessToken string `json:"access_token"` - RefreshToken string `json:"refresh_token"` - - // AAD returns expires_in as a string, ADFS returns it as an int - ExpiresIn json.Number `json:"expires_in"` - // expires_on can be in three formats, a UTC time stamp, or the number of seconds as a string *or* int. - ExpiresOn interface{} `json:"expires_on"` - NotBefore json.Number `json:"not_before"` - - Resource string `json:"resource"` - Type string `json:"token_type"` - }{} - // return a TokenRefreshError in the follow error cases as the token is in an unexpected format - err = json.Unmarshal(rb, &token) - if err != nil { - return newTokenRefreshError(fmt.Sprintf("adal: Failed to unmarshal the service principal token during refresh. Error = '%v' JSON = '%s'", err, string(rb)), resp) - } - expiresOn := json.Number("") - // ADFS doesn't include the expires_on field - if token.ExpiresOn != nil { - if expiresOn, err = parseExpiresOn(token.ExpiresOn); err != nil { - return newTokenRefreshError(fmt.Sprintf("adal: failed to parse expires_on: %v value '%s'", err, token.ExpiresOn), resp) - } - } - spt.inner.Token.AccessToken = token.AccessToken - spt.inner.Token.RefreshToken = token.RefreshToken - spt.inner.Token.ExpiresIn = token.ExpiresIn - spt.inner.Token.ExpiresOn = expiresOn - spt.inner.Token.NotBefore = token.NotBefore - spt.inner.Token.Resource = token.Resource - spt.inner.Token.Type = token.Type - - return spt.InvokeRefreshCallbacks(spt.inner.Token) -} - -// converts expires_on to the number of seconds -func parseExpiresOn(s interface{}) (json.Number, error) { - // the JSON unmarshaler treats JSON numbers unmarshaled into an interface{} as float64 - asFloat64, ok := s.(float64) - if ok { - // this is the number of seconds as int case - return json.Number(strconv.FormatInt(int64(asFloat64), 10)), nil - } - asStr, ok := s.(string) - if !ok { - return "", fmt.Errorf("unexpected expires_on type %T", s) - } - // convert the expiration date to the number of seconds from the unix epoch - timeToDuration := func(t time.Time) json.Number { - return json.Number(strconv.FormatInt(t.UTC().Unix(), 10)) - } - if _, err := json.Number(asStr).Int64(); err == nil { - // this is the number of seconds case, no conversion required - return json.Number(asStr), nil - } else if eo, err := time.Parse(expiresOnDateFormatPM, asStr); err == nil { - return timeToDuration(eo), nil - } else if eo, err := time.Parse(expiresOnDateFormat, asStr); err == nil { - return timeToDuration(eo), nil - } else { - // unknown format - return json.Number(""), err - } -} - -// retry logic specific to retrieving a token from the IMDS endpoint -func retryForIMDS(sender Sender, req *http.Request, maxAttempts int) (resp *http.Response, err error) { - // copied from client.go due to circular dependency - retries := []int{ - http.StatusRequestTimeout, // 408 - http.StatusTooManyRequests, // 429 - http.StatusInternalServerError, // 500 - http.StatusBadGateway, // 502 - http.StatusServiceUnavailable, // 503 - http.StatusGatewayTimeout, // 504 - } - // extra retry status codes specific to IMDS - retries = append(retries, - http.StatusNotFound, - http.StatusGone, - // all remaining 5xx - http.StatusNotImplemented, - http.StatusHTTPVersionNotSupported, - http.StatusVariantAlsoNegotiates, - http.StatusInsufficientStorage, - http.StatusLoopDetected, - http.StatusNotExtended, - http.StatusNetworkAuthenticationRequired) - - // see https://docs.microsoft.com/en-us/azure/active-directory/managed-service-identity/how-to-use-vm-token#retry-guidance - - const maxDelay time.Duration = 60 * time.Second - - attempt := 0 - delay := time.Duration(0) - - // maxAttempts is user-specified, ensure that its value is greater than zero else no request will be made - if maxAttempts < 1 { - maxAttempts = defaultMaxMSIRefreshAttempts - } - - for attempt < maxAttempts { - if resp != nil && resp.Body != nil { - io.Copy(ioutil.Discard, resp.Body) - resp.Body.Close() - } - resp, err = sender.Do(req) - // we want to retry if err is not nil or the status code is in the list of retry codes - if err == nil && !responseHasStatusCode(resp, retries...) { - return - } - - // perform exponential backoff with a cap. - // must increment attempt before calculating delay. - attempt++ - // the base value of 2 is the "delta backoff" as specified in the guidance doc - delay += (time.Duration(math.Pow(2, float64(attempt))) * time.Second) - if delay > maxDelay { - delay = maxDelay - } - - select { - case <-time.After(delay): - // intentionally left blank - case <-req.Context().Done(): - err = req.Context().Err() - return - } - } - return -} - -func responseHasStatusCode(resp *http.Response, codes ...int) bool { - if resp != nil { - for _, i := range codes { - if i == resp.StatusCode { - return true - } - } - } - return false -} - -// SetAutoRefresh enables or disables automatic refreshing of stale tokens. -func (spt *ServicePrincipalToken) SetAutoRefresh(autoRefresh bool) { - spt.inner.AutoRefresh = autoRefresh -} - -// SetRefreshWithin sets the interval within which if the token will expire, EnsureFresh will -// refresh the token. -func (spt *ServicePrincipalToken) SetRefreshWithin(d time.Duration) { - spt.inner.RefreshWithin = d - return -} - -// SetSender sets the http.Client used when obtaining the Service Principal token. An -// undecorated http.Client is used by default. -func (spt *ServicePrincipalToken) SetSender(s Sender) { spt.sender = s } - -// OAuthToken implements the OAuthTokenProvider interface. It returns the current access token. -func (spt *ServicePrincipalToken) OAuthToken() string { - spt.refreshLock.RLock() - defer spt.refreshLock.RUnlock() - return spt.inner.Token.OAuthToken() -} - -// Token returns a copy of the current token. -func (spt *ServicePrincipalToken) Token() Token { - spt.refreshLock.RLock() - defer spt.refreshLock.RUnlock() - return spt.inner.Token -} - -// MultiTenantServicePrincipalToken contains tokens for multi-tenant authorization. -type MultiTenantServicePrincipalToken struct { - PrimaryToken *ServicePrincipalToken - AuxiliaryTokens []*ServicePrincipalToken -} - -// PrimaryOAuthToken returns the primary authorization token. -func (mt *MultiTenantServicePrincipalToken) PrimaryOAuthToken() string { - return mt.PrimaryToken.OAuthToken() -} - -// AuxiliaryOAuthTokens returns one to three auxiliary authorization tokens. -func (mt *MultiTenantServicePrincipalToken) AuxiliaryOAuthTokens() []string { - tokens := make([]string, len(mt.AuxiliaryTokens)) - for i := range mt.AuxiliaryTokens { - tokens[i] = mt.AuxiliaryTokens[i].OAuthToken() - } - return tokens -} - -// NewMultiTenantServicePrincipalToken creates a new MultiTenantServicePrincipalToken with the specified credentials and resource. -func NewMultiTenantServicePrincipalToken(multiTenantCfg MultiTenantOAuthConfig, clientID string, secret string, resource string) (*MultiTenantServicePrincipalToken, error) { - if err := validateStringParam(clientID, "clientID"); err != nil { - return nil, err - } - if err := validateStringParam(secret, "secret"); err != nil { - return nil, err - } - if err := validateStringParam(resource, "resource"); err != nil { - return nil, err - } - auxTenants := multiTenantCfg.AuxiliaryTenants() - m := MultiTenantServicePrincipalToken{ - AuxiliaryTokens: make([]*ServicePrincipalToken, len(auxTenants)), - } - primary, err := NewServicePrincipalToken(*multiTenantCfg.PrimaryTenant(), clientID, secret, resource) - if err != nil { - return nil, fmt.Errorf("failed to create SPT for primary tenant: %v", err) - } - m.PrimaryToken = primary - for i := range auxTenants { - aux, err := NewServicePrincipalToken(*auxTenants[i], clientID, secret, resource) - if err != nil { - return nil, fmt.Errorf("failed to create SPT for auxiliary tenant: %v", err) - } - m.AuxiliaryTokens[i] = aux - } - return &m, nil -} - -// NewMultiTenantServicePrincipalTokenFromCertificate creates a new MultiTenantServicePrincipalToken with the specified certificate credentials and resource. -func NewMultiTenantServicePrincipalTokenFromCertificate(multiTenantCfg MultiTenantOAuthConfig, clientID string, certificate *x509.Certificate, privateKey *rsa.PrivateKey, resource string) (*MultiTenantServicePrincipalToken, error) { - if err := validateStringParam(clientID, "clientID"); err != nil { - return nil, err - } - if err := validateStringParam(resource, "resource"); err != nil { - return nil, err - } - if certificate == nil { - return nil, fmt.Errorf("parameter 'certificate' cannot be nil") - } - if privateKey == nil { - return nil, fmt.Errorf("parameter 'privateKey' cannot be nil") - } - auxTenants := multiTenantCfg.AuxiliaryTenants() - m := MultiTenantServicePrincipalToken{ - AuxiliaryTokens: make([]*ServicePrincipalToken, len(auxTenants)), - } - primary, err := NewServicePrincipalTokenWithSecret( - *multiTenantCfg.PrimaryTenant(), - clientID, - resource, - &ServicePrincipalCertificateSecret{ - PrivateKey: privateKey, - Certificate: certificate, - }, - ) - if err != nil { - return nil, fmt.Errorf("failed to create SPT for primary tenant: %v", err) - } - m.PrimaryToken = primary - for i := range auxTenants { - aux, err := NewServicePrincipalTokenWithSecret( - *auxTenants[i], - clientID, - resource, - &ServicePrincipalCertificateSecret{ - PrivateKey: privateKey, - Certificate: certificate, - }, - ) - if err != nil { - return nil, fmt.Errorf("failed to create SPT for auxiliary tenant: %v", err) - } - m.AuxiliaryTokens[i] = aux - } - return &m, nil -} - -// MSIAvailable returns true if the MSI endpoint is available for authentication. -func MSIAvailable(ctx context.Context, s Sender) bool { - msiType, _, err := getMSIType() - - if err != nil { - return false - } - - if msiType != msiTypeIMDS { - return true - } - - if s == nil { - s = sender() - } - - resp, err := getMSIEndpoint(ctx, s) - - if err == nil { - resp.Body.Close() - } - - return err == nil -} diff --git a/vendor/github.com/Azure/go-autorest/autorest/adal/token_1.13.go b/vendor/github.com/Azure/go-autorest/autorest/adal/token_1.13.go deleted file mode 100644 index 89190a421..000000000 --- a/vendor/github.com/Azure/go-autorest/autorest/adal/token_1.13.go +++ /dev/null @@ -1,76 +0,0 @@ -//go:build go1.13 -// +build go1.13 - -// Copyright 2017 Microsoft Corporation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package adal - -import ( - "context" - "fmt" - "net/http" - "time" -) - -func getMSIEndpoint(ctx context.Context, sender Sender) (*http.Response, error) { - tempCtx, cancel := context.WithTimeout(ctx, 2*time.Second) - defer cancel() - // http.NewRequestWithContext() was added in Go 1.13 - req, _ := http.NewRequestWithContext(tempCtx, http.MethodGet, msiEndpoint, nil) - q := req.URL.Query() - q.Add("api-version", msiAPIVersion) - req.URL.RawQuery = q.Encode() - return sender.Do(req) -} - -// EnsureFreshWithContext will refresh the token if it will expire within the refresh window (as set by -// RefreshWithin) and autoRefresh flag is on. This method is safe for concurrent use. -func (mt *MultiTenantServicePrincipalToken) EnsureFreshWithContext(ctx context.Context) error { - if err := mt.PrimaryToken.EnsureFreshWithContext(ctx); err != nil { - return fmt.Errorf("failed to refresh primary token: %w", err) - } - for _, aux := range mt.AuxiliaryTokens { - if err := aux.EnsureFreshWithContext(ctx); err != nil { - return fmt.Errorf("failed to refresh auxiliary token: %w", err) - } - } - return nil -} - -// RefreshWithContext obtains a fresh token for the Service Principal. -func (mt *MultiTenantServicePrincipalToken) RefreshWithContext(ctx context.Context) error { - if err := mt.PrimaryToken.RefreshWithContext(ctx); err != nil { - return fmt.Errorf("failed to refresh primary token: %w", err) - } - for _, aux := range mt.AuxiliaryTokens { - if err := aux.RefreshWithContext(ctx); err != nil { - return fmt.Errorf("failed to refresh auxiliary token: %w", err) - } - } - return nil -} - -// RefreshExchangeWithContext refreshes the token, but for a different resource. -func (mt *MultiTenantServicePrincipalToken) RefreshExchangeWithContext(ctx context.Context, resource string) error { - if err := mt.PrimaryToken.RefreshExchangeWithContext(ctx, resource); err != nil { - return fmt.Errorf("failed to refresh primary token: %w", err) - } - for _, aux := range mt.AuxiliaryTokens { - if err := aux.RefreshExchangeWithContext(ctx, resource); err != nil { - return fmt.Errorf("failed to refresh auxiliary token: %w", err) - } - } - return nil -} diff --git a/vendor/github.com/Azure/go-autorest/autorest/adal/token_legacy.go b/vendor/github.com/Azure/go-autorest/autorest/adal/token_legacy.go deleted file mode 100644 index 27ec4efad..000000000 --- a/vendor/github.com/Azure/go-autorest/autorest/adal/token_legacy.go +++ /dev/null @@ -1,75 +0,0 @@ -//go:build !go1.13 -// +build !go1.13 - -// Copyright 2017 Microsoft Corporation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package adal - -import ( - "context" - "net/http" - "time" -) - -func getMSIEndpoint(ctx context.Context, sender Sender) (*http.Response, error) { - tempCtx, cancel := context.WithTimeout(ctx, 2*time.Second) - defer cancel() - req, _ := http.NewRequest(http.MethodGet, msiEndpoint, nil) - req = req.WithContext(tempCtx) - q := req.URL.Query() - q.Add("api-version", msiAPIVersion) - req.URL.RawQuery = q.Encode() - return sender.Do(req) -} - -// EnsureFreshWithContext will refresh the token if it will expire within the refresh window (as set by -// RefreshWithin) and autoRefresh flag is on. This method is safe for concurrent use. -func (mt *MultiTenantServicePrincipalToken) EnsureFreshWithContext(ctx context.Context) error { - if err := mt.PrimaryToken.EnsureFreshWithContext(ctx); err != nil { - return err - } - for _, aux := range mt.AuxiliaryTokens { - if err := aux.EnsureFreshWithContext(ctx); err != nil { - return err - } - } - return nil -} - -// RefreshWithContext obtains a fresh token for the Service Principal. -func (mt *MultiTenantServicePrincipalToken) RefreshWithContext(ctx context.Context) error { - if err := mt.PrimaryToken.RefreshWithContext(ctx); err != nil { - return err - } - for _, aux := range mt.AuxiliaryTokens { - if err := aux.RefreshWithContext(ctx); err != nil { - return err - } - } - return nil -} - -// RefreshExchangeWithContext refreshes the token, but for a different resource. -func (mt *MultiTenantServicePrincipalToken) RefreshExchangeWithContext(ctx context.Context, resource string) error { - if err := mt.PrimaryToken.RefreshExchangeWithContext(ctx, resource); err != nil { - return err - } - for _, aux := range mt.AuxiliaryTokens { - if err := aux.RefreshExchangeWithContext(ctx, resource); err != nil { - return err - } - } - return nil -} diff --git a/vendor/github.com/Azure/go-autorest/autorest/adal/version.go b/vendor/github.com/Azure/go-autorest/autorest/adal/version.go deleted file mode 100644 index c867b3484..000000000 --- a/vendor/github.com/Azure/go-autorest/autorest/adal/version.go +++ /dev/null @@ -1,45 +0,0 @@ -package adal - -import ( - "fmt" - "runtime" -) - -// Copyright 2017 Microsoft Corporation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -const number = "v1.0.0" - -var ( - ua = fmt.Sprintf("Go/%s (%s-%s) go-autorest/adal/%s", - runtime.Version(), - runtime.GOARCH, - runtime.GOOS, - number, - ) -) - -// UserAgent returns a string containing the Go version, system architecture and OS, and the adal version. -func UserAgent() string { - return ua -} - -// AddToUserAgent adds an extension to the current user agent -func AddToUserAgent(extension string) error { - if extension != "" { - ua = fmt.Sprintf("%s %s", ua, extension) - return nil - } - return fmt.Errorf("Extension was empty, User Agent remained as '%s'", ua) -} diff --git a/vendor/github.com/Azure/go-autorest/autorest/authorization.go b/vendor/github.com/Azure/go-autorest/autorest/authorization.go deleted file mode 100644 index 1226c4111..000000000 --- a/vendor/github.com/Azure/go-autorest/autorest/authorization.go +++ /dev/null @@ -1,353 +0,0 @@ -package autorest - -// Copyright 2017 Microsoft Corporation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -import ( - "crypto/tls" - "encoding/base64" - "fmt" - "net/http" - "net/url" - "strings" - - "github.com/Azure/go-autorest/autorest/adal" -) - -const ( - bearerChallengeHeader = "Www-Authenticate" - bearer = "Bearer" - tenantID = "tenantID" - apiKeyAuthorizerHeader = "Ocp-Apim-Subscription-Key" - bingAPISdkHeader = "X-BingApis-SDK-Client" - golangBingAPISdkHeaderValue = "Go-SDK" - authorization = "Authorization" - basic = "Basic" -) - -// Authorizer is the interface that provides a PrepareDecorator used to supply request -// authorization. Most often, the Authorizer decorator runs last so it has access to the full -// state of the formed HTTP request. -type Authorizer interface { - WithAuthorization() PrepareDecorator -} - -// NullAuthorizer implements a default, "do nothing" Authorizer. -type NullAuthorizer struct{} - -// WithAuthorization returns a PrepareDecorator that does nothing. -func (na NullAuthorizer) WithAuthorization() PrepareDecorator { - return WithNothing() -} - -// APIKeyAuthorizer implements API Key authorization. -type APIKeyAuthorizer struct { - headers map[string]interface{} - queryParameters map[string]interface{} -} - -// NewAPIKeyAuthorizerWithHeaders creates an ApiKeyAuthorizer with headers. -func NewAPIKeyAuthorizerWithHeaders(headers map[string]interface{}) *APIKeyAuthorizer { - return NewAPIKeyAuthorizer(headers, nil) -} - -// NewAPIKeyAuthorizerWithQueryParameters creates an ApiKeyAuthorizer with query parameters. -func NewAPIKeyAuthorizerWithQueryParameters(queryParameters map[string]interface{}) *APIKeyAuthorizer { - return NewAPIKeyAuthorizer(nil, queryParameters) -} - -// NewAPIKeyAuthorizer creates an ApiKeyAuthorizer with headers. -func NewAPIKeyAuthorizer(headers map[string]interface{}, queryParameters map[string]interface{}) *APIKeyAuthorizer { - return &APIKeyAuthorizer{headers: headers, queryParameters: queryParameters} -} - -// WithAuthorization returns a PrepareDecorator that adds an HTTP headers and Query Parameters. -func (aka *APIKeyAuthorizer) WithAuthorization() PrepareDecorator { - return func(p Preparer) Preparer { - return DecoratePreparer(p, WithHeaders(aka.headers), WithQueryParameters(aka.queryParameters)) - } -} - -// CognitiveServicesAuthorizer implements authorization for Cognitive Services. -type CognitiveServicesAuthorizer struct { - subscriptionKey string -} - -// NewCognitiveServicesAuthorizer is -func NewCognitiveServicesAuthorizer(subscriptionKey string) *CognitiveServicesAuthorizer { - return &CognitiveServicesAuthorizer{subscriptionKey: subscriptionKey} -} - -// WithAuthorization is -func (csa *CognitiveServicesAuthorizer) WithAuthorization() PrepareDecorator { - headers := make(map[string]interface{}) - headers[apiKeyAuthorizerHeader] = csa.subscriptionKey - headers[bingAPISdkHeader] = golangBingAPISdkHeaderValue - - return NewAPIKeyAuthorizerWithHeaders(headers).WithAuthorization() -} - -// BearerAuthorizer implements the bearer authorization -type BearerAuthorizer struct { - tokenProvider adal.OAuthTokenProvider -} - -// NewBearerAuthorizer crates a BearerAuthorizer using the given token provider -func NewBearerAuthorizer(tp adal.OAuthTokenProvider) *BearerAuthorizer { - return &BearerAuthorizer{tokenProvider: tp} -} - -// WithAuthorization returns a PrepareDecorator that adds an HTTP Authorization header whose -// value is "Bearer " followed by the token. -// -// By default, the token will be automatically refreshed through the Refresher interface. -func (ba *BearerAuthorizer) WithAuthorization() PrepareDecorator { - return func(p Preparer) Preparer { - return PreparerFunc(func(r *http.Request) (*http.Request, error) { - r, err := p.Prepare(r) - if err == nil { - // the ordering is important here, prefer RefresherWithContext if available - if refresher, ok := ba.tokenProvider.(adal.RefresherWithContext); ok { - err = refresher.EnsureFreshWithContext(r.Context()) - } else if refresher, ok := ba.tokenProvider.(adal.Refresher); ok { - err = refresher.EnsureFresh() - } - if err != nil { - var resp *http.Response - if tokError, ok := err.(adal.TokenRefreshError); ok { - resp = tokError.Response() - } - return r, NewErrorWithError(err, "azure.BearerAuthorizer", "WithAuthorization", resp, - "Failed to refresh the Token for request to %s", r.URL) - } - return Prepare(r, WithHeader(headerAuthorization, fmt.Sprintf("Bearer %s", ba.tokenProvider.OAuthToken()))) - } - return r, err - }) - } -} - -// TokenProvider returns OAuthTokenProvider so that it can be used for authorization outside the REST. -func (ba *BearerAuthorizer) TokenProvider() adal.OAuthTokenProvider { - return ba.tokenProvider -} - -// BearerAuthorizerCallbackFunc is the authentication callback signature. -type BearerAuthorizerCallbackFunc func(tenantID, resource string) (*BearerAuthorizer, error) - -// BearerAuthorizerCallback implements bearer authorization via a callback. -type BearerAuthorizerCallback struct { - sender Sender - callback BearerAuthorizerCallbackFunc -} - -// NewBearerAuthorizerCallback creates a bearer authorization callback. The callback -// is invoked when the HTTP request is submitted. -func NewBearerAuthorizerCallback(s Sender, callback BearerAuthorizerCallbackFunc) *BearerAuthorizerCallback { - if s == nil { - s = sender(tls.RenegotiateNever) - } - return &BearerAuthorizerCallback{sender: s, callback: callback} -} - -// WithAuthorization returns a PrepareDecorator that adds an HTTP Authorization header whose value -// is "Bearer " followed by the token. The BearerAuthorizer is obtained via a user-supplied callback. -// -// By default, the token will be automatically refreshed through the Refresher interface. -func (bacb *BearerAuthorizerCallback) WithAuthorization() PrepareDecorator { - return func(p Preparer) Preparer { - return PreparerFunc(func(r *http.Request) (*http.Request, error) { - r, err := p.Prepare(r) - if err == nil { - // make a copy of the request and remove the body as it's not - // required and avoids us having to create a copy of it. - rCopy := *r - removeRequestBody(&rCopy) - - resp, err := bacb.sender.Do(&rCopy) - if err != nil { - return r, err - } - DrainResponseBody(resp) - if resp.StatusCode == 401 && hasBearerChallenge(resp.Header) { - bc, err := newBearerChallenge(resp.Header) - if err != nil { - return r, err - } - if bacb.callback != nil { - ba, err := bacb.callback(bc.values[tenantID], bc.values["resource"]) - if err != nil { - return r, err - } - return Prepare(r, ba.WithAuthorization()) - } - } - } - return r, err - }) - } -} - -// returns true if the HTTP response contains a bearer challenge -func hasBearerChallenge(header http.Header) bool { - authHeader := header.Get(bearerChallengeHeader) - if len(authHeader) == 0 || strings.Index(authHeader, bearer) < 0 { - return false - } - return true -} - -type bearerChallenge struct { - values map[string]string -} - -func newBearerChallenge(header http.Header) (bc bearerChallenge, err error) { - challenge := strings.TrimSpace(header.Get(bearerChallengeHeader)) - trimmedChallenge := challenge[len(bearer)+1:] - - // challenge is a set of key=value pairs that are comma delimited - pairs := strings.Split(trimmedChallenge, ",") - if len(pairs) < 1 { - err = fmt.Errorf("challenge '%s' contains no pairs", challenge) - return bc, err - } - - bc.values = make(map[string]string) - for i := range pairs { - trimmedPair := strings.TrimSpace(pairs[i]) - pair := strings.Split(trimmedPair, "=") - if len(pair) == 2 { - // remove the enclosing quotes - key := strings.Trim(pair[0], "\"") - value := strings.Trim(pair[1], "\"") - - switch key { - case "authorization", "authorization_uri": - // strip the tenant ID from the authorization URL - asURL, err := url.Parse(value) - if err != nil { - return bc, err - } - bc.values[tenantID] = asURL.Path[1:] - default: - bc.values[key] = value - } - } - } - - return bc, err -} - -// EventGridKeyAuthorizer implements authorization for event grid using key authentication. -type EventGridKeyAuthorizer struct { - topicKey string -} - -// NewEventGridKeyAuthorizer creates a new EventGridKeyAuthorizer -// with the specified topic key. -func NewEventGridKeyAuthorizer(topicKey string) EventGridKeyAuthorizer { - return EventGridKeyAuthorizer{topicKey: topicKey} -} - -// WithAuthorization returns a PrepareDecorator that adds the aeg-sas-key authentication header. -func (egta EventGridKeyAuthorizer) WithAuthorization() PrepareDecorator { - headers := map[string]interface{}{ - "aeg-sas-key": egta.topicKey, - } - return NewAPIKeyAuthorizerWithHeaders(headers).WithAuthorization() -} - -// BasicAuthorizer implements basic HTTP authorization by adding the Authorization HTTP header -// with the value "Basic " where is a base64-encoded username:password tuple. -type BasicAuthorizer struct { - userName string - password string -} - -// NewBasicAuthorizer creates a new BasicAuthorizer with the specified username and password. -func NewBasicAuthorizer(userName, password string) *BasicAuthorizer { - return &BasicAuthorizer{ - userName: userName, - password: password, - } -} - -// WithAuthorization returns a PrepareDecorator that adds an HTTP Authorization header whose -// value is "Basic " followed by the base64-encoded username:password tuple. -func (ba *BasicAuthorizer) WithAuthorization() PrepareDecorator { - headers := make(map[string]interface{}) - headers[authorization] = basic + " " + base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%s:%s", ba.userName, ba.password))) - - return NewAPIKeyAuthorizerWithHeaders(headers).WithAuthorization() -} - -// MultiTenantServicePrincipalTokenAuthorizer provides authentication across tenants. -type MultiTenantServicePrincipalTokenAuthorizer interface { - WithAuthorization() PrepareDecorator -} - -// NewMultiTenantServicePrincipalTokenAuthorizer crates a BearerAuthorizer using the given token provider -func NewMultiTenantServicePrincipalTokenAuthorizer(tp adal.MultitenantOAuthTokenProvider) MultiTenantServicePrincipalTokenAuthorizer { - return NewMultiTenantBearerAuthorizer(tp) -} - -// MultiTenantBearerAuthorizer implements bearer authorization across multiple tenants. -type MultiTenantBearerAuthorizer struct { - tp adal.MultitenantOAuthTokenProvider -} - -// NewMultiTenantBearerAuthorizer creates a MultiTenantBearerAuthorizer using the given token provider. -func NewMultiTenantBearerAuthorizer(tp adal.MultitenantOAuthTokenProvider) *MultiTenantBearerAuthorizer { - return &MultiTenantBearerAuthorizer{tp: tp} -} - -// WithAuthorization returns a PrepareDecorator that adds an HTTP Authorization header using the -// primary token along with the auxiliary authorization header using the auxiliary tokens. -// -// By default, the token will be automatically refreshed through the Refresher interface. -func (mt *MultiTenantBearerAuthorizer) WithAuthorization() PrepareDecorator { - return func(p Preparer) Preparer { - return PreparerFunc(func(r *http.Request) (*http.Request, error) { - r, err := p.Prepare(r) - if err != nil { - return r, err - } - if refresher, ok := mt.tp.(adal.RefresherWithContext); ok { - err = refresher.EnsureFreshWithContext(r.Context()) - if err != nil { - var resp *http.Response - if tokError, ok := err.(adal.TokenRefreshError); ok { - resp = tokError.Response() - } - return r, NewErrorWithError(err, "azure.multiTenantSPTAuthorizer", "WithAuthorization", resp, - "Failed to refresh one or more Tokens for request to %s", r.URL) - } - } - r, err = Prepare(r, WithHeader(headerAuthorization, fmt.Sprintf("Bearer %s", mt.tp.PrimaryOAuthToken()))) - if err != nil { - return r, err - } - auxTokens := mt.tp.AuxiliaryOAuthTokens() - for i := range auxTokens { - auxTokens[i] = fmt.Sprintf("Bearer %s", auxTokens[i]) - } - return Prepare(r, WithHeader(headerAuxAuthorization, strings.Join(auxTokens, ", "))) - }) - } -} - -// TokenProvider returns the underlying MultitenantOAuthTokenProvider for this authorizer. -func (mt *MultiTenantBearerAuthorizer) TokenProvider() adal.MultitenantOAuthTokenProvider { - return mt.tp -} diff --git a/vendor/github.com/Azure/go-autorest/autorest/authorization_sas.go b/vendor/github.com/Azure/go-autorest/autorest/authorization_sas.go deleted file mode 100644 index 66501493b..000000000 --- a/vendor/github.com/Azure/go-autorest/autorest/authorization_sas.go +++ /dev/null @@ -1,66 +0,0 @@ -package autorest - -// Copyright 2017 Microsoft Corporation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -import ( - "fmt" - "net/http" - "strings" -) - -// SASTokenAuthorizer implements an authorization for SAS Token Authentication -// this can be used for interaction with Blob Storage Endpoints -type SASTokenAuthorizer struct { - sasToken string -} - -// NewSASTokenAuthorizer creates a SASTokenAuthorizer using the given credentials -func NewSASTokenAuthorizer(sasToken string) (*SASTokenAuthorizer, error) { - if strings.TrimSpace(sasToken) == "" { - return nil, fmt.Errorf("sasToken cannot be empty") - } - - token := sasToken - if strings.HasPrefix(sasToken, "?") { - token = strings.TrimPrefix(sasToken, "?") - } - - return &SASTokenAuthorizer{ - sasToken: token, - }, nil -} - -// WithAuthorization returns a PrepareDecorator that adds a shared access signature token to the -// URI's query parameters. This can be used for the Blob, Queue, and File Services. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/delegate-access-with-shared-access-signature -func (sas *SASTokenAuthorizer) WithAuthorization() PrepareDecorator { - return func(p Preparer) Preparer { - return PreparerFunc(func(r *http.Request) (*http.Request, error) { - r, err := p.Prepare(r) - if err != nil { - return r, err - } - - if r.URL.RawQuery == "" { - r.URL.RawQuery = sas.sasToken - } else if !strings.Contains(r.URL.RawQuery, sas.sasToken) { - r.URL.RawQuery = fmt.Sprintf("%s&%s", r.URL.RawQuery, sas.sasToken) - } - - return Prepare(r) - }) - } -} diff --git a/vendor/github.com/Azure/go-autorest/autorest/authorization_storage.go b/vendor/github.com/Azure/go-autorest/autorest/authorization_storage.go deleted file mode 100644 index 2af5030a1..000000000 --- a/vendor/github.com/Azure/go-autorest/autorest/authorization_storage.go +++ /dev/null @@ -1,307 +0,0 @@ -package autorest - -// Copyright 2017 Microsoft Corporation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -import ( - "bytes" - "crypto/hmac" - "crypto/sha256" - "encoding/base64" - "fmt" - "net/http" - "net/url" - "sort" - "strings" - "time" -) - -// SharedKeyType defines the enumeration for the various shared key types. -// See https://docs.microsoft.com/en-us/rest/api/storageservices/authorize-with-shared-key for details on the shared key types. -type SharedKeyType string - -const ( - // SharedKey is used to authorize against blobs, files and queues services. - SharedKey SharedKeyType = "sharedKey" - - // SharedKeyForTable is used to authorize against the table service. - SharedKeyForTable SharedKeyType = "sharedKeyTable" - - // SharedKeyLite is used to authorize against blobs, files and queues services. It's provided for - // backwards compatibility with API versions before 2009-09-19. Prefer SharedKey instead. - SharedKeyLite SharedKeyType = "sharedKeyLite" - - // SharedKeyLiteForTable is used to authorize against the table service. It's provided for - // backwards compatibility with older table API versions. Prefer SharedKeyForTable instead. - SharedKeyLiteForTable SharedKeyType = "sharedKeyLiteTable" -) - -const ( - headerAccept = "Accept" - headerAcceptCharset = "Accept-Charset" - headerContentEncoding = "Content-Encoding" - headerContentLength = "Content-Length" - headerContentMD5 = "Content-MD5" - headerContentLanguage = "Content-Language" - headerIfModifiedSince = "If-Modified-Since" - headerIfMatch = "If-Match" - headerIfNoneMatch = "If-None-Match" - headerIfUnmodifiedSince = "If-Unmodified-Since" - headerDate = "Date" - headerXMSDate = "X-Ms-Date" - headerXMSVersion = "x-ms-version" - headerRange = "Range" -) - -const storageEmulatorAccountName = "devstoreaccount1" - -// SharedKeyAuthorizer implements an authorization for Shared Key -// this can be used for interaction with Blob, File and Queue Storage Endpoints -type SharedKeyAuthorizer struct { - accountName string - accountKey []byte - keyType SharedKeyType -} - -// NewSharedKeyAuthorizer creates a SharedKeyAuthorizer using the provided credentials and shared key type. -func NewSharedKeyAuthorizer(accountName, accountKey string, keyType SharedKeyType) (*SharedKeyAuthorizer, error) { - key, err := base64.StdEncoding.DecodeString(accountKey) - if err != nil { - return nil, fmt.Errorf("malformed storage account key: %v", err) - } - return &SharedKeyAuthorizer{ - accountName: accountName, - accountKey: key, - keyType: keyType, - }, nil -} - -// WithAuthorization returns a PrepareDecorator that adds an HTTP Authorization header whose -// value is " " followed by the computed key. -// This can be used for the Blob, Queue, and File Services -// -// from: https://docs.microsoft.com/en-us/rest/api/storageservices/authorize-with-shared-key -// You may use Shared Key authorization to authorize a request made against the -// 2009-09-19 version and later of the Blob and Queue services, -// and version 2014-02-14 and later of the File services. -func (sk *SharedKeyAuthorizer) WithAuthorization() PrepareDecorator { - return func(p Preparer) Preparer { - return PreparerFunc(func(r *http.Request) (*http.Request, error) { - r, err := p.Prepare(r) - if err != nil { - return r, err - } - - sk, err := buildSharedKey(sk.accountName, sk.accountKey, r, sk.keyType) - if err != nil { - return r, err - } - return Prepare(r, WithHeader(headerAuthorization, sk)) - }) - } -} - -func buildSharedKey(accName string, accKey []byte, req *http.Request, keyType SharedKeyType) (string, error) { - canRes, err := buildCanonicalizedResource(accName, req.URL.String(), keyType) - if err != nil { - return "", err - } - - if req.Header == nil { - req.Header = http.Header{} - } - - // ensure date is set - if req.Header.Get(headerDate) == "" && req.Header.Get(headerXMSDate) == "" { - date := time.Now().UTC().Format(http.TimeFormat) - req.Header.Set(headerXMSDate, date) - } - canString, err := buildCanonicalizedString(req.Method, req.Header, canRes, keyType) - if err != nil { - return "", err - } - return createAuthorizationHeader(accName, accKey, canString, keyType), nil -} - -func buildCanonicalizedResource(accountName, uri string, keyType SharedKeyType) (string, error) { - errMsg := "buildCanonicalizedResource error: %s" - u, err := url.Parse(uri) - if err != nil { - return "", fmt.Errorf(errMsg, err.Error()) - } - - cr := bytes.NewBufferString("") - if accountName != storageEmulatorAccountName { - cr.WriteString("/") - cr.WriteString(getCanonicalizedAccountName(accountName)) - } - - if len(u.Path) > 0 { - // Any portion of the CanonicalizedResource string that is derived from - // the resource's URI should be encoded exactly as it is in the URI. - // -- https://msdn.microsoft.com/en-gb/library/azure/dd179428.aspx - cr.WriteString(u.EscapedPath()) - } else { - // a slash is required to indicate the root path - cr.WriteString("/") - } - - params, err := url.ParseQuery(u.RawQuery) - if err != nil { - return "", fmt.Errorf(errMsg, err.Error()) - } - - // See https://github.com/Azure/azure-storage-net/blob/master/Lib/Common/Core/Util/AuthenticationUtility.cs#L277 - if keyType == SharedKey { - if len(params) > 0 { - cr.WriteString("\n") - - keys := []string{} - for key := range params { - keys = append(keys, key) - } - sort.Strings(keys) - - completeParams := []string{} - for _, key := range keys { - if len(params[key]) > 1 { - sort.Strings(params[key]) - } - - completeParams = append(completeParams, fmt.Sprintf("%s:%s", key, strings.Join(params[key], ","))) - } - cr.WriteString(strings.Join(completeParams, "\n")) - } - } else { - // search for "comp" parameter, if exists then add it to canonicalizedresource - if v, ok := params["comp"]; ok { - cr.WriteString("?comp=" + v[0]) - } - } - - return string(cr.Bytes()), nil -} - -func getCanonicalizedAccountName(accountName string) string { - // since we may be trying to access a secondary storage account, we need to - // remove the -secondary part of the storage name - return strings.TrimSuffix(accountName, "-secondary") -} - -func buildCanonicalizedString(verb string, headers http.Header, canonicalizedResource string, keyType SharedKeyType) (string, error) { - contentLength := headers.Get(headerContentLength) - if contentLength == "0" { - contentLength = "" - } - date := headers.Get(headerDate) - if v := headers.Get(headerXMSDate); v != "" { - if keyType == SharedKey || keyType == SharedKeyLite { - date = "" - } else { - date = v - } - } - var canString string - switch keyType { - case SharedKey: - canString = strings.Join([]string{ - verb, - headers.Get(headerContentEncoding), - headers.Get(headerContentLanguage), - contentLength, - headers.Get(headerContentMD5), - headers.Get(headerContentType), - date, - headers.Get(headerIfModifiedSince), - headers.Get(headerIfMatch), - headers.Get(headerIfNoneMatch), - headers.Get(headerIfUnmodifiedSince), - headers.Get(headerRange), - buildCanonicalizedHeader(headers), - canonicalizedResource, - }, "\n") - case SharedKeyForTable: - canString = strings.Join([]string{ - verb, - headers.Get(headerContentMD5), - headers.Get(headerContentType), - date, - canonicalizedResource, - }, "\n") - case SharedKeyLite: - canString = strings.Join([]string{ - verb, - headers.Get(headerContentMD5), - headers.Get(headerContentType), - date, - buildCanonicalizedHeader(headers), - canonicalizedResource, - }, "\n") - case SharedKeyLiteForTable: - canString = strings.Join([]string{ - date, - canonicalizedResource, - }, "\n") - default: - return "", fmt.Errorf("key type '%s' is not supported", keyType) - } - return canString, nil -} - -func buildCanonicalizedHeader(headers http.Header) string { - cm := make(map[string]string) - - for k := range headers { - headerName := strings.TrimSpace(strings.ToLower(k)) - if strings.HasPrefix(headerName, "x-ms-") { - cm[headerName] = headers.Get(k) - } - } - - if len(cm) == 0 { - return "" - } - - keys := []string{} - for key := range cm { - keys = append(keys, key) - } - - sort.Strings(keys) - - ch := bytes.NewBufferString("") - - for _, key := range keys { - ch.WriteString(key) - ch.WriteRune(':') - ch.WriteString(cm[key]) - ch.WriteRune('\n') - } - - return strings.TrimSuffix(string(ch.Bytes()), "\n") -} - -func createAuthorizationHeader(accountName string, accountKey []byte, canonicalizedString string, keyType SharedKeyType) string { - h := hmac.New(sha256.New, accountKey) - h.Write([]byte(canonicalizedString)) - signature := base64.StdEncoding.EncodeToString(h.Sum(nil)) - var key string - switch keyType { - case SharedKey, SharedKeyForTable: - key = "SharedKey" - case SharedKeyLite, SharedKeyLiteForTable: - key = "SharedKeyLite" - } - return fmt.Sprintf("%s %s:%s", key, getCanonicalizedAccountName(accountName), signature) -} diff --git a/vendor/github.com/Azure/go-autorest/autorest/autorest.go b/vendor/github.com/Azure/go-autorest/autorest/autorest.go deleted file mode 100644 index aafdf021f..000000000 --- a/vendor/github.com/Azure/go-autorest/autorest/autorest.go +++ /dev/null @@ -1,150 +0,0 @@ -/* -Package autorest implements an HTTP request pipeline suitable for use across multiple go-routines -and provides the shared routines relied on by AutoRest (see https://github.com/Azure/autorest/) -generated Go code. - -The package breaks sending and responding to HTTP requests into three phases: Preparing, Sending, -and Responding. A typical pattern is: - - req, err := Prepare(&http.Request{}, - token.WithAuthorization()) - - resp, err := Send(req, - WithLogging(logger), - DoErrorIfStatusCode(http.StatusInternalServerError), - DoCloseIfError(), - DoRetryForAttempts(5, time.Second)) - - err = Respond(resp, - ByDiscardingBody(), - ByClosing()) - -Each phase relies on decorators to modify and / or manage processing. Decorators may first modify -and then pass the data along, pass the data first and then modify the result, or wrap themselves -around passing the data (such as a logger might do). Decorators run in the order provided. For -example, the following: - - req, err := Prepare(&http.Request{}, - WithBaseURL("https://microsoft.com/"), - WithPath("a"), - WithPath("b"), - WithPath("c")) - -will set the URL to: - - https://microsoft.com/a/b/c - -Preparers and Responders may be shared and re-used (assuming the underlying decorators support -sharing and re-use). Performant use is obtained by creating one or more Preparers and Responders -shared among multiple go-routines, and a single Sender shared among multiple sending go-routines, -all bound together by means of input / output channels. - -Decorators hold their passed state within a closure (such as the path components in the example -above). Be careful to share Preparers and Responders only in a context where such held state -applies. For example, it may not make sense to share a Preparer that applies a query string from a -fixed set of values. Similarly, sharing a Responder that reads the response body into a passed -struct (e.g., ByUnmarshallingJson) is likely incorrect. - -Lastly, the Swagger specification (https://swagger.io) that drives AutoRest -(https://github.com/Azure/autorest/) precisely defines two date forms: date and date-time. The -github.com/Azure/go-autorest/autorest/date package provides time.Time derivations to ensure -correct parsing and formatting. - -Errors raised by autorest objects and methods will conform to the autorest.Error interface. - -See the included examples for more detail. For details on the suggested use of this package by -generated clients, see the Client described below. -*/ -package autorest - -// Copyright 2017 Microsoft Corporation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -import ( - "context" - "net/http" - "time" -) - -const ( - // HeaderLocation specifies the HTTP Location header. - HeaderLocation = "Location" - - // HeaderRetryAfter specifies the HTTP Retry-After header. - HeaderRetryAfter = "Retry-After" -) - -// ResponseHasStatusCode returns true if the status code in the HTTP Response is in the passed set -// and false otherwise. -func ResponseHasStatusCode(resp *http.Response, codes ...int) bool { - if resp == nil { - return false - } - return containsInt(codes, resp.StatusCode) -} - -// GetLocation retrieves the URL from the Location header of the passed response. -func GetLocation(resp *http.Response) string { - return resp.Header.Get(HeaderLocation) -} - -// GetRetryAfter extracts the retry delay from the Retry-After header of the passed response. If -// the header is absent or is malformed, it will return the supplied default delay time.Duration. -func GetRetryAfter(resp *http.Response, defaultDelay time.Duration) time.Duration { - retry := resp.Header.Get(HeaderRetryAfter) - if retry == "" { - return defaultDelay - } - - d, err := time.ParseDuration(retry + "s") - if err != nil { - return defaultDelay - } - - return d -} - -// NewPollingRequest allocates and returns a new http.Request to poll for the passed response. -func NewPollingRequest(resp *http.Response, cancel <-chan struct{}) (*http.Request, error) { - location := GetLocation(resp) - if location == "" { - return nil, NewErrorWithResponse("autorest", "NewPollingRequest", resp, "Location header missing from response that requires polling") - } - - req, err := Prepare(&http.Request{Cancel: cancel}, - AsGet(), - WithBaseURL(location)) - if err != nil { - return nil, NewErrorWithError(err, "autorest", "NewPollingRequest", nil, "Failure creating poll request to %s", location) - } - - return req, nil -} - -// NewPollingRequestWithContext allocates and returns a new http.Request with the specified context to poll for the passed response. -func NewPollingRequestWithContext(ctx context.Context, resp *http.Response) (*http.Request, error) { - location := GetLocation(resp) - if location == "" { - return nil, NewErrorWithResponse("autorest", "NewPollingRequestWithContext", resp, "Location header missing from response that requires polling") - } - - req, err := Prepare((&http.Request{}).WithContext(ctx), - AsGet(), - WithBaseURL(location)) - if err != nil { - return nil, NewErrorWithError(err, "autorest", "NewPollingRequestWithContext", nil, "Failure creating poll request to %s", location) - } - - return req, nil -} diff --git a/vendor/github.com/Azure/go-autorest/autorest/azure/async.go b/vendor/github.com/Azure/go-autorest/autorest/azure/async.go deleted file mode 100644 index 45575eedb..000000000 --- a/vendor/github.com/Azure/go-autorest/autorest/azure/async.go +++ /dev/null @@ -1,995 +0,0 @@ -package azure - -// Copyright 2017 Microsoft Corporation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -import ( - "bytes" - "context" - "encoding/json" - "fmt" - "io/ioutil" - "net/http" - "net/url" - "strings" - "time" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/logger" - "github.com/Azure/go-autorest/tracing" -) - -const ( - headerAsyncOperation = "Azure-AsyncOperation" -) - -const ( - operationInProgress string = "InProgress" - operationCanceled string = "Canceled" - operationFailed string = "Failed" - operationSucceeded string = "Succeeded" -) - -var pollingCodes = [...]int{http.StatusNoContent, http.StatusAccepted, http.StatusCreated, http.StatusOK} - -// FutureAPI contains the set of methods on the Future type. -type FutureAPI interface { - // Response returns the last HTTP response. - Response() *http.Response - - // Status returns the last status message of the operation. - Status() string - - // PollingMethod returns the method used to monitor the status of the asynchronous operation. - PollingMethod() PollingMethodType - - // DoneWithContext queries the service to see if the operation has completed. - DoneWithContext(context.Context, autorest.Sender) (bool, error) - - // GetPollingDelay returns a duration the application should wait before checking - // the status of the asynchronous request and true; this value is returned from - // the service via the Retry-After response header. If the header wasn't returned - // then the function returns the zero-value time.Duration and false. - GetPollingDelay() (time.Duration, bool) - - // WaitForCompletionRef will return when one of the following conditions is met: the long - // running operation has completed, the provided context is cancelled, or the client's - // polling duration has been exceeded. It will retry failed polling attempts based on - // the retry value defined in the client up to the maximum retry attempts. - // If no deadline is specified in the context then the client.PollingDuration will be - // used to determine if a default deadline should be used. - // If PollingDuration is greater than zero the value will be used as the context's timeout. - // If PollingDuration is zero then no default deadline will be used. - WaitForCompletionRef(context.Context, autorest.Client) error - - // MarshalJSON implements the json.Marshaler interface. - MarshalJSON() ([]byte, error) - - // MarshalJSON implements the json.Unmarshaler interface. - UnmarshalJSON([]byte) error - - // PollingURL returns the URL used for retrieving the status of the long-running operation. - PollingURL() string - - // GetResult should be called once polling has completed successfully. - // It makes the final GET call to retrieve the resultant payload. - GetResult(autorest.Sender) (*http.Response, error) -} - -var _ FutureAPI = (*Future)(nil) - -// Future provides a mechanism to access the status and results of an asynchronous request. -// Since futures are stateful they should be passed by value to avoid race conditions. -type Future struct { - pt pollingTracker -} - -// NewFutureFromResponse returns a new Future object initialized -// with the initial response from an asynchronous operation. -func NewFutureFromResponse(resp *http.Response) (Future, error) { - pt, err := createPollingTracker(resp) - return Future{pt: pt}, err -} - -// Response returns the last HTTP response. -func (f Future) Response() *http.Response { - if f.pt == nil { - return nil - } - return f.pt.latestResponse() -} - -// Status returns the last status message of the operation. -func (f Future) Status() string { - if f.pt == nil { - return "" - } - return f.pt.pollingStatus() -} - -// PollingMethod returns the method used to monitor the status of the asynchronous operation. -func (f Future) PollingMethod() PollingMethodType { - if f.pt == nil { - return PollingUnknown - } - return f.pt.pollingMethod() -} - -// DoneWithContext queries the service to see if the operation has completed. -func (f *Future) DoneWithContext(ctx context.Context, sender autorest.Sender) (done bool, err error) { - ctx = tracing.StartSpan(ctx, "github.com/Azure/go-autorest/autorest/azure/async.DoneWithContext") - defer func() { - sc := -1 - resp := f.Response() - if resp != nil { - sc = resp.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - - if f.pt == nil { - return false, autorest.NewError("Future", "Done", "future is not initialized") - } - if f.pt.hasTerminated() { - return true, f.pt.pollingError() - } - if err := f.pt.pollForStatus(ctx, sender); err != nil { - return false, err - } - if err := f.pt.checkForErrors(); err != nil { - return f.pt.hasTerminated(), err - } - if err := f.pt.updatePollingState(f.pt.provisioningStateApplicable()); err != nil { - return false, err - } - if err := f.pt.initPollingMethod(); err != nil { - return false, err - } - if err := f.pt.updatePollingMethod(); err != nil { - return false, err - } - return f.pt.hasTerminated(), f.pt.pollingError() -} - -// GetPollingDelay returns a duration the application should wait before checking -// the status of the asynchronous request and true; this value is returned from -// the service via the Retry-After response header. If the header wasn't returned -// then the function returns the zero-value time.Duration and false. -func (f Future) GetPollingDelay() (time.Duration, bool) { - if f.pt == nil { - return 0, false - } - resp := f.pt.latestResponse() - if resp == nil { - return 0, false - } - - retry := resp.Header.Get(autorest.HeaderRetryAfter) - if retry == "" { - return 0, false - } - - d, err := time.ParseDuration(retry + "s") - if err != nil { - panic(err) - } - - return d, true -} - -// WaitForCompletionRef will return when one of the following conditions is met: the long -// running operation has completed, the provided context is cancelled, or the client's -// polling duration has been exceeded. It will retry failed polling attempts based on -// the retry value defined in the client up to the maximum retry attempts. -// If no deadline is specified in the context then the client.PollingDuration will be -// used to determine if a default deadline should be used. -// If PollingDuration is greater than zero the value will be used as the context's timeout. -// If PollingDuration is zero then no default deadline will be used. -func (f *Future) WaitForCompletionRef(ctx context.Context, client autorest.Client) (err error) { - ctx = tracing.StartSpan(ctx, "github.com/Azure/go-autorest/autorest/azure/async.WaitForCompletionRef") - defer func() { - sc := -1 - resp := f.Response() - if resp != nil { - sc = resp.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - cancelCtx := ctx - // if the provided context already has a deadline don't override it - _, hasDeadline := ctx.Deadline() - if d := client.PollingDuration; !hasDeadline && d != 0 { - var cancel context.CancelFunc - cancelCtx, cancel = context.WithTimeout(ctx, d) - defer cancel() - } - // if the initial response has a Retry-After, sleep for the specified amount of time before starting to poll - if delay, ok := f.GetPollingDelay(); ok { - logger.Instance.Writeln(logger.LogInfo, "WaitForCompletionRef: initial polling delay") - if delayElapsed := autorest.DelayForBackoff(delay, 0, cancelCtx.Done()); !delayElapsed { - err = cancelCtx.Err() - return - } - } - done, err := f.DoneWithContext(ctx, client) - for attempts := 0; !done; done, err = f.DoneWithContext(ctx, client) { - if attempts >= client.RetryAttempts { - return autorest.NewErrorWithError(err, "Future", "WaitForCompletion", f.pt.latestResponse(), "the number of retries has been exceeded") - } - // we want delayAttempt to be zero in the non-error case so - // that DelayForBackoff doesn't perform exponential back-off - var delayAttempt int - var delay time.Duration - if err == nil { - // check for Retry-After delay, if not present use the client's polling delay - var ok bool - delay, ok = f.GetPollingDelay() - if !ok { - logger.Instance.Writeln(logger.LogInfo, "WaitForCompletionRef: Using client polling delay") - delay = client.PollingDelay - } - } else { - // there was an error polling for status so perform exponential - // back-off based on the number of attempts using the client's retry - // duration. update attempts after delayAttempt to avoid off-by-one. - logger.Instance.Writef(logger.LogError, "WaitForCompletionRef: %s\n", err) - delayAttempt = attempts - delay = client.RetryDuration - attempts++ - } - // wait until the delay elapses or the context is cancelled - delayElapsed := autorest.DelayForBackoff(delay, delayAttempt, cancelCtx.Done()) - if !delayElapsed { - return autorest.NewErrorWithError(cancelCtx.Err(), "Future", "WaitForCompletion", f.pt.latestResponse(), "context has been cancelled") - } - } - return -} - -// MarshalJSON implements the json.Marshaler interface. -func (f Future) MarshalJSON() ([]byte, error) { - return json.Marshal(f.pt) -} - -// UnmarshalJSON implements the json.Unmarshaler interface. -func (f *Future) UnmarshalJSON(data []byte) error { - // unmarshal into JSON object to determine the tracker type - obj := map[string]interface{}{} - err := json.Unmarshal(data, &obj) - if err != nil { - return err - } - if obj["method"] == nil { - return autorest.NewError("Future", "UnmarshalJSON", "missing 'method' property") - } - method := obj["method"].(string) - switch strings.ToUpper(method) { - case http.MethodDelete: - f.pt = &pollingTrackerDelete{} - case http.MethodPatch: - f.pt = &pollingTrackerPatch{} - case http.MethodPost: - f.pt = &pollingTrackerPost{} - case http.MethodPut: - f.pt = &pollingTrackerPut{} - default: - return autorest.NewError("Future", "UnmarshalJSON", "unsupoorted method '%s'", method) - } - // now unmarshal into the tracker - return json.Unmarshal(data, &f.pt) -} - -// PollingURL returns the URL used for retrieving the status of the long-running operation. -func (f Future) PollingURL() string { - if f.pt == nil { - return "" - } - return f.pt.pollingURL() -} - -// GetResult should be called once polling has completed successfully. -// It makes the final GET call to retrieve the resultant payload. -func (f Future) GetResult(sender autorest.Sender) (*http.Response, error) { - if f.pt.finalGetURL() == "" { - // we can end up in this situation if the async operation returns a 200 - // with no polling URLs. in that case return the response which should - // contain the JSON payload (only do this for successful terminal cases). - if lr := f.pt.latestResponse(); lr != nil && f.pt.hasSucceeded() { - return lr, nil - } - return nil, autorest.NewError("Future", "GetResult", "missing URL for retrieving result") - } - req, err := http.NewRequest(http.MethodGet, f.pt.finalGetURL(), nil) - if err != nil { - return nil, err - } - resp, err := sender.Do(req) - if err == nil && resp.Body != nil { - // copy the body and close it so callers don't have to - defer resp.Body.Close() - b, err := ioutil.ReadAll(resp.Body) - if err != nil { - return resp, err - } - resp.Body = ioutil.NopCloser(bytes.NewReader(b)) - } - return resp, err -} - -type pollingTracker interface { - // these methods can differ per tracker - - // checks the response headers and status code to determine the polling mechanism - updatePollingMethod() error - - // checks the response for tracker-specific error conditions - checkForErrors() error - - // returns true if provisioning state should be checked - provisioningStateApplicable() bool - - // methods common to all trackers - - // initializes a tracker's polling URL and method, called for each iteration. - // these values can be overridden by each polling tracker as required. - initPollingMethod() error - - // initializes the tracker's internal state, call this when the tracker is created - initializeState() error - - // makes an HTTP request to check the status of the LRO - pollForStatus(ctx context.Context, sender autorest.Sender) error - - // updates internal tracker state, call this after each call to pollForStatus - updatePollingState(provStateApl bool) error - - // returns the error response from the service, can be nil - pollingError() error - - // returns the polling method being used - pollingMethod() PollingMethodType - - // returns the state of the LRO as returned from the service - pollingStatus() string - - // returns the URL used for polling status - pollingURL() string - - // returns the URL used for the final GET to retrieve the resource - finalGetURL() string - - // returns true if the LRO is in a terminal state - hasTerminated() bool - - // returns true if the LRO is in a failed terminal state - hasFailed() bool - - // returns true if the LRO is in a successful terminal state - hasSucceeded() bool - - // returns the cached HTTP response after a call to pollForStatus(), can be nil - latestResponse() *http.Response -} - -type pollingTrackerBase struct { - // resp is the last response, either from the submission of the LRO or from polling - resp *http.Response - - // method is the HTTP verb, this is needed for deserialization - Method string `json:"method"` - - // rawBody is the raw JSON response body - rawBody map[string]interface{} - - // denotes if polling is using async-operation or location header - Pm PollingMethodType `json:"pollingMethod"` - - // the URL to poll for status - URI string `json:"pollingURI"` - - // the state of the LRO as returned from the service - State string `json:"lroState"` - - // the URL to GET for the final result - FinalGetURI string `json:"resultURI"` - - // used to hold an error object returned from the service - Err *ServiceError `json:"error,omitempty"` -} - -func (pt *pollingTrackerBase) initializeState() error { - // determine the initial polling state based on response body and/or HTTP status - // code. this is applicable to the initial LRO response, not polling responses! - pt.Method = pt.resp.Request.Method - if err := pt.updateRawBody(); err != nil { - return err - } - switch pt.resp.StatusCode { - case http.StatusOK: - if ps := pt.getProvisioningState(); ps != nil { - pt.State = *ps - if pt.hasFailed() { - pt.updateErrorFromResponse() - return pt.pollingError() - } - } else { - pt.State = operationSucceeded - } - case http.StatusCreated: - if ps := pt.getProvisioningState(); ps != nil { - pt.State = *ps - } else { - pt.State = operationInProgress - } - case http.StatusAccepted: - pt.State = operationInProgress - case http.StatusNoContent: - pt.State = operationSucceeded - default: - pt.State = operationFailed - pt.updateErrorFromResponse() - return pt.pollingError() - } - return pt.initPollingMethod() -} - -func (pt pollingTrackerBase) getProvisioningState() *string { - if pt.rawBody != nil && pt.rawBody["properties"] != nil { - p := pt.rawBody["properties"].(map[string]interface{}) - if ps := p["provisioningState"]; ps != nil { - s := ps.(string) - return &s - } - } - return nil -} - -func (pt *pollingTrackerBase) updateRawBody() error { - pt.rawBody = map[string]interface{}{} - if pt.resp.ContentLength != 0 { - defer pt.resp.Body.Close() - b, err := ioutil.ReadAll(pt.resp.Body) - if err != nil { - return autorest.NewErrorWithError(err, "pollingTrackerBase", "updateRawBody", nil, "failed to read response body") - } - // put the body back so it's available to other callers - pt.resp.Body = ioutil.NopCloser(bytes.NewReader(b)) - // observed in 204 responses over HTTP/2.0; the content length is -1 but body is empty - if len(b) == 0 { - return nil - } - if err = json.Unmarshal(b, &pt.rawBody); err != nil { - return autorest.NewErrorWithError(err, "pollingTrackerBase", "updateRawBody", nil, "failed to unmarshal response body") - } - } - return nil -} - -func (pt *pollingTrackerBase) pollForStatus(ctx context.Context, sender autorest.Sender) error { - req, err := http.NewRequest(http.MethodGet, pt.URI, nil) - if err != nil { - return autorest.NewErrorWithError(err, "pollingTrackerBase", "pollForStatus", nil, "failed to create HTTP request") - } - - req = req.WithContext(ctx) - preparer := autorest.CreatePreparer(autorest.GetPrepareDecorators(ctx)...) - req, err = preparer.Prepare(req) - if err != nil { - return autorest.NewErrorWithError(err, "pollingTrackerBase", "pollForStatus", nil, "failed preparing HTTP request") - } - pt.resp, err = sender.Do(req) - if err != nil { - return autorest.NewErrorWithError(err, "pollingTrackerBase", "pollForStatus", nil, "failed to send HTTP request") - } - if autorest.ResponseHasStatusCode(pt.resp, pollingCodes[:]...) { - // reset the service error on success case - pt.Err = nil - err = pt.updateRawBody() - } else { - // check response body for error content - pt.updateErrorFromResponse() - err = pt.pollingError() - } - return err -} - -// attempts to unmarshal a ServiceError type from the response body. -// if that fails then make a best attempt at creating something meaningful. -// NOTE: this assumes that the async operation has failed. -func (pt *pollingTrackerBase) updateErrorFromResponse() { - var err error - if pt.resp.ContentLength != 0 { - type respErr struct { - ServiceError *ServiceError `json:"error"` - } - re := respErr{} - defer pt.resp.Body.Close() - var b []byte - if b, err = ioutil.ReadAll(pt.resp.Body); err != nil { - goto Default - } - // put the body back so it's available to other callers - pt.resp.Body = ioutil.NopCloser(bytes.NewReader(b)) - if len(b) == 0 { - goto Default - } - if err = json.Unmarshal(b, &re); err != nil { - goto Default - } - // unmarshalling the error didn't yield anything, try unwrapped error - if re.ServiceError == nil { - err = json.Unmarshal(b, &re.ServiceError) - if err != nil { - goto Default - } - } - // the unmarshaller will ensure re.ServiceError is non-nil - // even if there was no content unmarshalled so check the code. - if re.ServiceError.Code != "" { - pt.Err = re.ServiceError - return - } - } -Default: - se := &ServiceError{ - Code: pt.pollingStatus(), - Message: "The async operation failed.", - } - if err != nil { - se.InnerError = make(map[string]interface{}) - se.InnerError["unmarshalError"] = err.Error() - } - // stick the response body into the error object in hopes - // it contains something useful to help diagnose the failure. - if len(pt.rawBody) > 0 { - se.AdditionalInfo = []map[string]interface{}{ - pt.rawBody, - } - } - pt.Err = se -} - -func (pt *pollingTrackerBase) updatePollingState(provStateApl bool) error { - if pt.Pm == PollingAsyncOperation && pt.rawBody["status"] != nil { - pt.State = pt.rawBody["status"].(string) - } else { - if pt.resp.StatusCode == http.StatusAccepted { - pt.State = operationInProgress - } else if provStateApl { - if ps := pt.getProvisioningState(); ps != nil { - pt.State = *ps - } else { - pt.State = operationSucceeded - } - } else { - return autorest.NewError("pollingTrackerBase", "updatePollingState", "the response from the async operation has an invalid status code") - } - } - // if the operation has failed update the error state - if pt.hasFailed() { - pt.updateErrorFromResponse() - } - return nil -} - -func (pt pollingTrackerBase) pollingError() error { - if pt.Err == nil { - return nil - } - return pt.Err -} - -func (pt pollingTrackerBase) pollingMethod() PollingMethodType { - return pt.Pm -} - -func (pt pollingTrackerBase) pollingStatus() string { - return pt.State -} - -func (pt pollingTrackerBase) pollingURL() string { - return pt.URI -} - -func (pt pollingTrackerBase) finalGetURL() string { - return pt.FinalGetURI -} - -func (pt pollingTrackerBase) hasTerminated() bool { - return strings.EqualFold(pt.State, operationCanceled) || strings.EqualFold(pt.State, operationFailed) || strings.EqualFold(pt.State, operationSucceeded) -} - -func (pt pollingTrackerBase) hasFailed() bool { - return strings.EqualFold(pt.State, operationCanceled) || strings.EqualFold(pt.State, operationFailed) -} - -func (pt pollingTrackerBase) hasSucceeded() bool { - return strings.EqualFold(pt.State, operationSucceeded) -} - -func (pt pollingTrackerBase) latestResponse() *http.Response { - return pt.resp -} - -// error checking common to all trackers -func (pt pollingTrackerBase) baseCheckForErrors() error { - // for Azure-AsyncOperations the response body cannot be nil or empty - if pt.Pm == PollingAsyncOperation { - if pt.resp.Body == nil || pt.resp.ContentLength == 0 { - return autorest.NewError("pollingTrackerBase", "baseCheckForErrors", "for Azure-AsyncOperation response body cannot be nil") - } - if pt.rawBody["status"] == nil { - return autorest.NewError("pollingTrackerBase", "baseCheckForErrors", "missing status property in Azure-AsyncOperation response body") - } - } - return nil -} - -// default initialization of polling URL/method. each verb tracker will update this as required. -func (pt *pollingTrackerBase) initPollingMethod() error { - if ao, err := getURLFromAsyncOpHeader(pt.resp); err != nil { - return err - } else if ao != "" { - pt.URI = ao - pt.Pm = PollingAsyncOperation - return nil - } - if lh, err := getURLFromLocationHeader(pt.resp); err != nil { - return err - } else if lh != "" { - pt.URI = lh - pt.Pm = PollingLocation - return nil - } - // it's ok if we didn't find a polling header, this will be handled elsewhere - return nil -} - -// DELETE - -type pollingTrackerDelete struct { - pollingTrackerBase -} - -func (pt *pollingTrackerDelete) updatePollingMethod() error { - // for 201 the Location header is required - if pt.resp.StatusCode == http.StatusCreated { - if lh, err := getURLFromLocationHeader(pt.resp); err != nil { - return err - } else if lh == "" { - return autorest.NewError("pollingTrackerDelete", "updateHeaders", "missing Location header in 201 response") - } else { - pt.URI = lh - } - pt.Pm = PollingLocation - pt.FinalGetURI = pt.URI - } - // for 202 prefer the Azure-AsyncOperation header but fall back to Location if necessary - if pt.resp.StatusCode == http.StatusAccepted { - ao, err := getURLFromAsyncOpHeader(pt.resp) - if err != nil { - return err - } else if ao != "" { - pt.URI = ao - pt.Pm = PollingAsyncOperation - } - // if the Location header is invalid and we already have a polling URL - // then we don't care if the Location header URL is malformed. - if lh, err := getURLFromLocationHeader(pt.resp); err != nil && pt.URI == "" { - return err - } else if lh != "" { - if ao == "" { - pt.URI = lh - pt.Pm = PollingLocation - } - // when both headers are returned we use the value in the Location header for the final GET - pt.FinalGetURI = lh - } - // make sure a polling URL was found - if pt.URI == "" { - return autorest.NewError("pollingTrackerPost", "updateHeaders", "didn't get any suitable polling URLs in 202 response") - } - } - return nil -} - -func (pt pollingTrackerDelete) checkForErrors() error { - return pt.baseCheckForErrors() -} - -func (pt pollingTrackerDelete) provisioningStateApplicable() bool { - return pt.resp.StatusCode == http.StatusOK || pt.resp.StatusCode == http.StatusNoContent -} - -// PATCH - -type pollingTrackerPatch struct { - pollingTrackerBase -} - -func (pt *pollingTrackerPatch) updatePollingMethod() error { - // by default we can use the original URL for polling and final GET - if pt.URI == "" { - pt.URI = pt.resp.Request.URL.String() - } - if pt.FinalGetURI == "" { - pt.FinalGetURI = pt.resp.Request.URL.String() - } - if pt.Pm == PollingUnknown { - pt.Pm = PollingRequestURI - } - // for 201 it's permissible for no headers to be returned - if pt.resp.StatusCode == http.StatusCreated { - if ao, err := getURLFromAsyncOpHeader(pt.resp); err != nil { - return err - } else if ao != "" { - pt.URI = ao - pt.Pm = PollingAsyncOperation - } - } - // for 202 prefer the Azure-AsyncOperation header but fall back to Location if necessary - // note the absence of the "final GET" mechanism for PATCH - if pt.resp.StatusCode == http.StatusAccepted { - ao, err := getURLFromAsyncOpHeader(pt.resp) - if err != nil { - return err - } else if ao != "" { - pt.URI = ao - pt.Pm = PollingAsyncOperation - } - if ao == "" { - if lh, err := getURLFromLocationHeader(pt.resp); err != nil { - return err - } else if lh == "" { - return autorest.NewError("pollingTrackerPatch", "updateHeaders", "didn't get any suitable polling URLs in 202 response") - } else { - pt.URI = lh - pt.Pm = PollingLocation - } - } - } - return nil -} - -func (pt pollingTrackerPatch) checkForErrors() error { - return pt.baseCheckForErrors() -} - -func (pt pollingTrackerPatch) provisioningStateApplicable() bool { - return pt.resp.StatusCode == http.StatusOK || pt.resp.StatusCode == http.StatusCreated -} - -// POST - -type pollingTrackerPost struct { - pollingTrackerBase -} - -func (pt *pollingTrackerPost) updatePollingMethod() error { - // 201 requires Location header - if pt.resp.StatusCode == http.StatusCreated { - if lh, err := getURLFromLocationHeader(pt.resp); err != nil { - return err - } else if lh == "" { - return autorest.NewError("pollingTrackerPost", "updateHeaders", "missing Location header in 201 response") - } else { - pt.URI = lh - pt.FinalGetURI = lh - pt.Pm = PollingLocation - } - } - // for 202 prefer the Azure-AsyncOperation header but fall back to Location if necessary - if pt.resp.StatusCode == http.StatusAccepted { - ao, err := getURLFromAsyncOpHeader(pt.resp) - if err != nil { - return err - } else if ao != "" { - pt.URI = ao - pt.Pm = PollingAsyncOperation - } - // if the Location header is invalid and we already have a polling URL - // then we don't care if the Location header URL is malformed. - if lh, err := getURLFromLocationHeader(pt.resp); err != nil && pt.URI == "" { - return err - } else if lh != "" { - if ao == "" { - pt.URI = lh - pt.Pm = PollingLocation - } - // when both headers are returned we use the value in the Location header for the final GET - pt.FinalGetURI = lh - } - // make sure a polling URL was found - if pt.URI == "" { - return autorest.NewError("pollingTrackerPost", "updateHeaders", "didn't get any suitable polling URLs in 202 response") - } - } - return nil -} - -func (pt pollingTrackerPost) checkForErrors() error { - return pt.baseCheckForErrors() -} - -func (pt pollingTrackerPost) provisioningStateApplicable() bool { - return pt.resp.StatusCode == http.StatusOK || pt.resp.StatusCode == http.StatusNoContent -} - -// PUT - -type pollingTrackerPut struct { - pollingTrackerBase -} - -func (pt *pollingTrackerPut) updatePollingMethod() error { - // by default we can use the original URL for polling and final GET - if pt.URI == "" { - pt.URI = pt.resp.Request.URL.String() - } - if pt.FinalGetURI == "" { - pt.FinalGetURI = pt.resp.Request.URL.String() - } - if pt.Pm == PollingUnknown { - pt.Pm = PollingRequestURI - } - // for 201 it's permissible for no headers to be returned - if pt.resp.StatusCode == http.StatusCreated { - if ao, err := getURLFromAsyncOpHeader(pt.resp); err != nil { - return err - } else if ao != "" { - pt.URI = ao - pt.Pm = PollingAsyncOperation - } - } - // for 202 prefer the Azure-AsyncOperation header but fall back to Location if necessary - if pt.resp.StatusCode == http.StatusAccepted { - ao, err := getURLFromAsyncOpHeader(pt.resp) - if err != nil { - return err - } else if ao != "" { - pt.URI = ao - pt.Pm = PollingAsyncOperation - } - // if the Location header is invalid and we already have a polling URL - // then we don't care if the Location header URL is malformed. - if lh, err := getURLFromLocationHeader(pt.resp); err != nil && pt.URI == "" { - return err - } else if lh != "" { - if ao == "" { - pt.URI = lh - pt.Pm = PollingLocation - } - } - // make sure a polling URL was found - if pt.URI == "" { - return autorest.NewError("pollingTrackerPut", "updateHeaders", "didn't get any suitable polling URLs in 202 response") - } - } - return nil -} - -func (pt pollingTrackerPut) checkForErrors() error { - err := pt.baseCheckForErrors() - if err != nil { - return err - } - // if there are no LRO headers then the body cannot be empty - ao, err := getURLFromAsyncOpHeader(pt.resp) - if err != nil { - return err - } - lh, err := getURLFromLocationHeader(pt.resp) - if err != nil { - return err - } - if ao == "" && lh == "" && len(pt.rawBody) == 0 { - return autorest.NewError("pollingTrackerPut", "checkForErrors", "the response did not contain a body") - } - return nil -} - -func (pt pollingTrackerPut) provisioningStateApplicable() bool { - return pt.resp.StatusCode == http.StatusOK || pt.resp.StatusCode == http.StatusCreated -} - -// creates a polling tracker based on the verb of the original request -func createPollingTracker(resp *http.Response) (pollingTracker, error) { - var pt pollingTracker - switch strings.ToUpper(resp.Request.Method) { - case http.MethodDelete: - pt = &pollingTrackerDelete{pollingTrackerBase: pollingTrackerBase{resp: resp}} - case http.MethodPatch: - pt = &pollingTrackerPatch{pollingTrackerBase: pollingTrackerBase{resp: resp}} - case http.MethodPost: - pt = &pollingTrackerPost{pollingTrackerBase: pollingTrackerBase{resp: resp}} - case http.MethodPut: - pt = &pollingTrackerPut{pollingTrackerBase: pollingTrackerBase{resp: resp}} - default: - return nil, autorest.NewError("azure", "createPollingTracker", "unsupported HTTP method %s", resp.Request.Method) - } - if err := pt.initializeState(); err != nil { - return pt, err - } - // this initializes the polling header values, we do this during creation in case the - // initial response send us invalid values; this way the API call will return a non-nil - // error (not doing this means the error shows up in Future.Done) - return pt, pt.updatePollingMethod() -} - -// gets the polling URL from the Azure-AsyncOperation header. -// ensures the URL is well-formed and absolute. -func getURLFromAsyncOpHeader(resp *http.Response) (string, error) { - s := resp.Header.Get(http.CanonicalHeaderKey(headerAsyncOperation)) - if s == "" { - return "", nil - } - if !isValidURL(s) { - return "", autorest.NewError("azure", "getURLFromAsyncOpHeader", "invalid polling URL '%s'", s) - } - return s, nil -} - -// gets the polling URL from the Location header. -// ensures the URL is well-formed and absolute. -func getURLFromLocationHeader(resp *http.Response) (string, error) { - s := resp.Header.Get(http.CanonicalHeaderKey(autorest.HeaderLocation)) - if s == "" { - return "", nil - } - if !isValidURL(s) { - return "", autorest.NewError("azure", "getURLFromLocationHeader", "invalid polling URL '%s'", s) - } - return s, nil -} - -// verify that the URL is valid and absolute -func isValidURL(s string) bool { - u, err := url.Parse(s) - return err == nil && u.IsAbs() -} - -// PollingMethodType defines a type used for enumerating polling mechanisms. -type PollingMethodType string - -const ( - // PollingAsyncOperation indicates the polling method uses the Azure-AsyncOperation header. - PollingAsyncOperation PollingMethodType = "AsyncOperation" - - // PollingLocation indicates the polling method uses the Location header. - PollingLocation PollingMethodType = "Location" - - // PollingRequestURI indicates the polling method uses the original request URI. - PollingRequestURI PollingMethodType = "RequestURI" - - // PollingUnknown indicates an unknown polling method and is the default value. - PollingUnknown PollingMethodType = "" -) - -// AsyncOpIncompleteError is the type that's returned from a future that has not completed. -type AsyncOpIncompleteError struct { - // FutureType is the name of the type composed of a azure.Future. - FutureType string -} - -// Error returns an error message including the originating type name of the error. -func (e AsyncOpIncompleteError) Error() string { - return fmt.Sprintf("%s: asynchronous operation has not completed", e.FutureType) -} - -// NewAsyncOpIncompleteError creates a new AsyncOpIncompleteError with the specified parameters. -func NewAsyncOpIncompleteError(futureType string) AsyncOpIncompleteError { - return AsyncOpIncompleteError{ - FutureType: futureType, - } -} diff --git a/vendor/github.com/Azure/go-autorest/autorest/azure/azure.go b/vendor/github.com/Azure/go-autorest/autorest/azure/azure.go deleted file mode 100644 index 1328f1764..000000000 --- a/vendor/github.com/Azure/go-autorest/autorest/azure/azure.go +++ /dev/null @@ -1,388 +0,0 @@ -// Package azure provides Azure-specific implementations used with AutoRest. -// See the included examples for more detail. -package azure - -// Copyright 2017 Microsoft Corporation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -import ( - "bytes" - "encoding/json" - "fmt" - "io/ioutil" - "net/http" - "regexp" - "strconv" - "strings" - - "github.com/Azure/go-autorest/autorest" -) - -const ( - // HeaderClientID is the Azure extension header to set a user-specified request ID. - HeaderClientID = "x-ms-client-request-id" - - // HeaderReturnClientID is the Azure extension header to set if the user-specified request ID - // should be included in the response. - HeaderReturnClientID = "x-ms-return-client-request-id" - - // HeaderContentType is the type of the content in the HTTP response. - HeaderContentType = "Content-Type" - - // HeaderRequestID is the Azure extension header of the service generated request ID returned - // in the response. - HeaderRequestID = "x-ms-request-id" -) - -// ServiceError encapsulates the error response from an Azure service. -// It adhears to the OData v4 specification for error responses. -type ServiceError struct { - Code string `json:"code"` - Message string `json:"message"` - Target *string `json:"target"` - Details []map[string]interface{} `json:"details"` - InnerError map[string]interface{} `json:"innererror"` - AdditionalInfo []map[string]interface{} `json:"additionalInfo"` -} - -func (se ServiceError) Error() string { - result := fmt.Sprintf("Code=%q Message=%q", se.Code, se.Message) - - if se.Target != nil { - result += fmt.Sprintf(" Target=%q", *se.Target) - } - - if se.Details != nil { - d, err := json.Marshal(se.Details) - if err != nil { - result += fmt.Sprintf(" Details=%v", se.Details) - } - result += fmt.Sprintf(" Details=%s", d) - } - - if se.InnerError != nil { - d, err := json.Marshal(se.InnerError) - if err != nil { - result += fmt.Sprintf(" InnerError=%v", se.InnerError) - } - result += fmt.Sprintf(" InnerError=%s", d) - } - - if se.AdditionalInfo != nil { - d, err := json.Marshal(se.AdditionalInfo) - if err != nil { - result += fmt.Sprintf(" AdditionalInfo=%v", se.AdditionalInfo) - } - result += fmt.Sprintf(" AdditionalInfo=%s", d) - } - - return result -} - -// UnmarshalJSON implements the json.Unmarshaler interface for the ServiceError type. -func (se *ServiceError) UnmarshalJSON(b []byte) error { - // http://docs.oasis-open.org/odata/odata-json-format/v4.0/os/odata-json-format-v4.0-os.html#_Toc372793091 - - type serviceErrorInternal struct { - Code string `json:"code"` - Message string `json:"message"` - Target *string `json:"target,omitempty"` - AdditionalInfo []map[string]interface{} `json:"additionalInfo,omitempty"` - // not all services conform to the OData v4 spec. - // the following fields are where we've seen discrepancies - - // spec calls for []map[string]interface{} but have seen map[string]interface{} - Details interface{} `json:"details,omitempty"` - - // spec calls for map[string]interface{} but have seen []map[string]interface{} and string - InnerError interface{} `json:"innererror,omitempty"` - } - - sei := serviceErrorInternal{} - if err := json.Unmarshal(b, &sei); err != nil { - return err - } - - // copy the fields we know to be correct - se.AdditionalInfo = sei.AdditionalInfo - se.Code = sei.Code - se.Message = sei.Message - se.Target = sei.Target - - // converts an []interface{} to []map[string]interface{} - arrayOfObjs := func(v interface{}) ([]map[string]interface{}, bool) { - arrayOf, ok := v.([]interface{}) - if !ok { - return nil, false - } - final := []map[string]interface{}{} - for _, item := range arrayOf { - as, ok := item.(map[string]interface{}) - if !ok { - return nil, false - } - final = append(final, as) - } - return final, true - } - - // convert the remaining fields, falling back to raw JSON if necessary - - if c, ok := arrayOfObjs(sei.Details); ok { - se.Details = c - } else if c, ok := sei.Details.(map[string]interface{}); ok { - se.Details = []map[string]interface{}{c} - } else if sei.Details != nil { - // stuff into Details - se.Details = []map[string]interface{}{ - {"raw": sei.Details}, - } - } - - if c, ok := sei.InnerError.(map[string]interface{}); ok { - se.InnerError = c - } else if c, ok := arrayOfObjs(sei.InnerError); ok { - // if there's only one error extract it - if len(c) == 1 { - se.InnerError = c[0] - } else { - // multiple errors, stuff them into the value - se.InnerError = map[string]interface{}{ - "multi": c, - } - } - } else if c, ok := sei.InnerError.(string); ok { - se.InnerError = map[string]interface{}{"error": c} - } else if sei.InnerError != nil { - // stuff into InnerError - se.InnerError = map[string]interface{}{ - "raw": sei.InnerError, - } - } - return nil -} - -// RequestError describes an error response returned by Azure service. -type RequestError struct { - autorest.DetailedError - - // The error returned by the Azure service. - ServiceError *ServiceError `json:"error" xml:"Error"` - - // The request id (from the x-ms-request-id-header) of the request. - RequestID string -} - -// Error returns a human-friendly error message from service error. -func (e RequestError) Error() string { - return fmt.Sprintf("autorest/azure: Service returned an error. Status=%v %v", - e.StatusCode, e.ServiceError) -} - -// IsAzureError returns true if the passed error is an Azure Service error; false otherwise. -func IsAzureError(e error) bool { - _, ok := e.(*RequestError) - return ok -} - -// Resource contains details about an Azure resource. -type Resource struct { - SubscriptionID string - ResourceGroup string - Provider string - ResourceType string - ResourceName string -} - -// String function returns a string in form of azureResourceID -func (r Resource) String() string { - return fmt.Sprintf("/subscriptions/%s/resourceGroups/%s/providers/%s/%s/%s", r.SubscriptionID, r.ResourceGroup, r.Provider, r.ResourceType, r.ResourceName) -} - -// ParseResourceID parses a resource ID into a ResourceDetails struct. -// See https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/template-functions-resource?tabs=json#resourceid. -func ParseResourceID(resourceID string) (Resource, error) { - - const resourceIDPatternText = `(?i)subscriptions/(.+)/resourceGroups/(.+)/providers/(.+?)/(.+?)/(.+)` - resourceIDPattern := regexp.MustCompile(resourceIDPatternText) - match := resourceIDPattern.FindStringSubmatch(resourceID) - - if len(match) == 0 { - return Resource{}, fmt.Errorf("parsing failed for %s. Invalid resource Id format", resourceID) - } - - v := strings.Split(match[5], "/") - resourceName := v[len(v)-1] - - result := Resource{ - SubscriptionID: match[1], - ResourceGroup: match[2], - Provider: match[3], - ResourceType: match[4], - ResourceName: resourceName, - } - - return result, nil -} - -// NewErrorWithError creates a new Error conforming object from the -// passed packageType, method, statusCode of the given resp (UndefinedStatusCode -// if resp is nil), message, and original error. message is treated as a format -// string to which the optional args apply. -func NewErrorWithError(original error, packageType string, method string, resp *http.Response, message string, args ...interface{}) RequestError { - if v, ok := original.(*RequestError); ok { - return *v - } - - statusCode := autorest.UndefinedStatusCode - if resp != nil { - statusCode = resp.StatusCode - } - return RequestError{ - DetailedError: autorest.DetailedError{ - Original: original, - PackageType: packageType, - Method: method, - StatusCode: statusCode, - Message: fmt.Sprintf(message, args...), - }, - } -} - -// WithReturningClientID returns a PrepareDecorator that adds an HTTP extension header of -// x-ms-client-request-id whose value is the passed, undecorated UUID (e.g., -// "0F39878C-5F76-4DB8-A25D-61D2C193C3CA"). It also sets the x-ms-return-client-request-id -// header to true such that UUID accompanies the http.Response. -func WithReturningClientID(uuid string) autorest.PrepareDecorator { - preparer := autorest.CreatePreparer( - WithClientID(uuid), - WithReturnClientID(true)) - - return func(p autorest.Preparer) autorest.Preparer { - return autorest.PreparerFunc(func(r *http.Request) (*http.Request, error) { - r, err := p.Prepare(r) - if err != nil { - return r, err - } - return preparer.Prepare(r) - }) - } -} - -// WithClientID returns a PrepareDecorator that adds an HTTP extension header of -// x-ms-client-request-id whose value is passed, undecorated UUID (e.g., -// "0F39878C-5F76-4DB8-A25D-61D2C193C3CA"). -func WithClientID(uuid string) autorest.PrepareDecorator { - return autorest.WithHeader(HeaderClientID, uuid) -} - -// WithReturnClientID returns a PrepareDecorator that adds an HTTP extension header of -// x-ms-return-client-request-id whose boolean value indicates if the value of the -// x-ms-client-request-id header should be included in the http.Response. -func WithReturnClientID(b bool) autorest.PrepareDecorator { - return autorest.WithHeader(HeaderReturnClientID, strconv.FormatBool(b)) -} - -// ExtractClientID extracts the client identifier from the x-ms-client-request-id header set on the -// http.Request sent to the service (and returned in the http.Response) -func ExtractClientID(resp *http.Response) string { - return autorest.ExtractHeaderValue(HeaderClientID, resp) -} - -// ExtractRequestID extracts the Azure server generated request identifier from the -// x-ms-request-id header. -func ExtractRequestID(resp *http.Response) string { - return autorest.ExtractHeaderValue(HeaderRequestID, resp) -} - -// WithErrorUnlessStatusCode returns a RespondDecorator that emits an -// azure.RequestError by reading the response body unless the response HTTP status code -// is among the set passed. -// -// If there is a chance service may return responses other than the Azure error -// format and the response cannot be parsed into an error, a decoding error will -// be returned containing the response body. In any case, the Responder will -// return an error if the status code is not satisfied. -// -// If this Responder returns an error, the response body will be replaced with -// an in-memory reader, which needs no further closing. -func WithErrorUnlessStatusCode(codes ...int) autorest.RespondDecorator { - return func(r autorest.Responder) autorest.Responder { - return autorest.ResponderFunc(func(resp *http.Response) error { - err := r.Respond(resp) - if err == nil && !autorest.ResponseHasStatusCode(resp, codes...) { - var e RequestError - defer resp.Body.Close() - - encodedAs := autorest.EncodedAsJSON - if strings.Contains(resp.Header.Get("Content-Type"), "xml") { - encodedAs = autorest.EncodedAsXML - } - - // Copy and replace the Body in case it does not contain an error object. - // This will leave the Body available to the caller. - b, decodeErr := autorest.CopyAndDecode(encodedAs, resp.Body, &e) - resp.Body = ioutil.NopCloser(&b) - if decodeErr != nil { - return fmt.Errorf("autorest/azure: error response cannot be parsed: %q error: %v", b, decodeErr) - } - if e.ServiceError == nil { - // Check if error is unwrapped ServiceError - decoder := autorest.NewDecoder(encodedAs, bytes.NewReader(b.Bytes())) - if err := decoder.Decode(&e.ServiceError); err != nil { - return fmt.Errorf("autorest/azure: error response cannot be parsed: %q error: %v", b, err) - } - - // for example, should the API return the literal value `null` as the response - if e.ServiceError == nil { - e.ServiceError = &ServiceError{ - Code: "Unknown", - Message: "Unknown service error", - Details: []map[string]interface{}{ - { - "HttpResponse.Body": b.String(), - }, - }, - } - } - } - - if e.ServiceError != nil && e.ServiceError.Message == "" { - // if we're here it means the returned error wasn't OData v4 compliant. - // try to unmarshal the body in hopes of getting something. - rawBody := map[string]interface{}{} - decoder := autorest.NewDecoder(encodedAs, bytes.NewReader(b.Bytes())) - if err := decoder.Decode(&rawBody); err != nil { - return fmt.Errorf("autorest/azure: error response cannot be parsed: %q error: %v", b, err) - } - - e.ServiceError = &ServiceError{ - Code: "Unknown", - Message: "Unknown service error", - } - if len(rawBody) > 0 { - e.ServiceError.Details = []map[string]interface{}{rawBody} - } - } - e.Response = resp - e.RequestID = ExtractRequestID(resp) - if e.StatusCode == nil { - e.StatusCode = resp.StatusCode - } - err = &e - } - return err - }) - } -} diff --git a/vendor/github.com/Azure/go-autorest/autorest/azure/environments.go b/vendor/github.com/Azure/go-autorest/autorest/azure/environments.go deleted file mode 100644 index b0a53769f..000000000 --- a/vendor/github.com/Azure/go-autorest/autorest/azure/environments.go +++ /dev/null @@ -1,331 +0,0 @@ -package azure - -// Copyright 2017 Microsoft Corporation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -import ( - "encoding/json" - "fmt" - "io/ioutil" - "os" - "strings" -) - -const ( - // EnvironmentFilepathName captures the name of the environment variable containing the path to the file - // to be used while populating the Azure Environment. - EnvironmentFilepathName = "AZURE_ENVIRONMENT_FILEPATH" - - // NotAvailable is used for endpoints and resource IDs that are not available for a given cloud. - NotAvailable = "N/A" -) - -var environments = map[string]Environment{ - "AZURECHINACLOUD": ChinaCloud, - "AZUREGERMANCLOUD": GermanCloud, - "AZURECLOUD": PublicCloud, - "AZUREPUBLICCLOUD": PublicCloud, - "AZUREUSGOVERNMENT": USGovernmentCloud, - "AZUREUSGOVERNMENTCLOUD": USGovernmentCloud, //TODO: deprecate -} - -// ResourceIdentifier contains a set of Azure resource IDs. -type ResourceIdentifier struct { - Graph string `json:"graph"` - KeyVault string `json:"keyVault"` - Datalake string `json:"datalake"` - Batch string `json:"batch"` - OperationalInsights string `json:"operationalInsights"` - OSSRDBMS string `json:"ossRDBMS"` - Storage string `json:"storage"` - Synapse string `json:"synapse"` - ServiceBus string `json:"serviceBus"` - SQLDatabase string `json:"sqlDatabase"` - CosmosDB string `json:"cosmosDB"` - ManagedHSM string `json:"managedHSM"` - MicrosoftGraph string `json:"microsoftGraph"` -} - -// Environment represents a set of endpoints for each of Azure's Clouds. -type Environment struct { - Name string `json:"name"` - ManagementPortalURL string `json:"managementPortalURL"` - PublishSettingsURL string `json:"publishSettingsURL"` - ServiceManagementEndpoint string `json:"serviceManagementEndpoint"` - ResourceManagerEndpoint string `json:"resourceManagerEndpoint"` - ActiveDirectoryEndpoint string `json:"activeDirectoryEndpoint"` - GalleryEndpoint string `json:"galleryEndpoint"` - KeyVaultEndpoint string `json:"keyVaultEndpoint"` - ManagedHSMEndpoint string `json:"managedHSMEndpoint"` - GraphEndpoint string `json:"graphEndpoint"` - ServiceBusEndpoint string `json:"serviceBusEndpoint"` - BatchManagementEndpoint string `json:"batchManagementEndpoint"` - MicrosoftGraphEndpoint string `json:"microsoftGraphEndpoint"` - StorageEndpointSuffix string `json:"storageEndpointSuffix"` - CosmosDBDNSSuffix string `json:"cosmosDBDNSSuffix"` - MariaDBDNSSuffix string `json:"mariaDBDNSSuffix"` - MySQLDatabaseDNSSuffix string `json:"mySqlDatabaseDNSSuffix"` - PostgresqlDatabaseDNSSuffix string `json:"postgresqlDatabaseDNSSuffix"` - SQLDatabaseDNSSuffix string `json:"sqlDatabaseDNSSuffix"` - TrafficManagerDNSSuffix string `json:"trafficManagerDNSSuffix"` - KeyVaultDNSSuffix string `json:"keyVaultDNSSuffix"` - ManagedHSMDNSSuffix string `json:"managedHSMDNSSuffix"` - ServiceBusEndpointSuffix string `json:"serviceBusEndpointSuffix"` - ServiceManagementVMDNSSuffix string `json:"serviceManagementVMDNSSuffix"` - ResourceManagerVMDNSSuffix string `json:"resourceManagerVMDNSSuffix"` - ContainerRegistryDNSSuffix string `json:"containerRegistryDNSSuffix"` - TokenAudience string `json:"tokenAudience"` - APIManagementHostNameSuffix string `json:"apiManagementHostNameSuffix"` - SynapseEndpointSuffix string `json:"synapseEndpointSuffix"` - DatalakeSuffix string `json:"datalakeSuffix"` - ResourceIdentifiers ResourceIdentifier `json:"resourceIdentifiers"` -} - -var ( - // PublicCloud is the default public Azure cloud environment - PublicCloud = Environment{ - Name: "AzurePublicCloud", - ManagementPortalURL: "https://manage.windowsazure.com/", - PublishSettingsURL: "https://manage.windowsazure.com/publishsettings/index", - ServiceManagementEndpoint: "https://management.core.windows.net/", - ResourceManagerEndpoint: "https://management.azure.com/", - ActiveDirectoryEndpoint: "https://login.microsoftonline.com/", - GalleryEndpoint: "https://gallery.azure.com/", - KeyVaultEndpoint: "https://vault.azure.net/", - ManagedHSMEndpoint: "https://managedhsm.azure.net/", - GraphEndpoint: "https://graph.windows.net/", - ServiceBusEndpoint: "https://servicebus.windows.net/", - BatchManagementEndpoint: "https://batch.core.windows.net/", - MicrosoftGraphEndpoint: "https://graph.microsoft.com/", - StorageEndpointSuffix: "core.windows.net", - CosmosDBDNSSuffix: "documents.azure.com", - MariaDBDNSSuffix: "mariadb.database.azure.com", - MySQLDatabaseDNSSuffix: "mysql.database.azure.com", - PostgresqlDatabaseDNSSuffix: "postgres.database.azure.com", - SQLDatabaseDNSSuffix: "database.windows.net", - TrafficManagerDNSSuffix: "trafficmanager.net", - KeyVaultDNSSuffix: "vault.azure.net", - ManagedHSMDNSSuffix: "managedhsm.azure.net", - ServiceBusEndpointSuffix: "servicebus.windows.net", - ServiceManagementVMDNSSuffix: "cloudapp.net", - ResourceManagerVMDNSSuffix: "cloudapp.azure.com", - ContainerRegistryDNSSuffix: "azurecr.io", - TokenAudience: "https://management.azure.com/", - APIManagementHostNameSuffix: "azure-api.net", - SynapseEndpointSuffix: "dev.azuresynapse.net", - DatalakeSuffix: "azuredatalakestore.net", - ResourceIdentifiers: ResourceIdentifier{ - Graph: "https://graph.windows.net/", - KeyVault: "https://vault.azure.net", - Datalake: "https://datalake.azure.net/", - Batch: "https://batch.core.windows.net/", - OperationalInsights: "https://api.loganalytics.io", - OSSRDBMS: "https://ossrdbms-aad.database.windows.net", - Storage: "https://storage.azure.com/", - Synapse: "https://dev.azuresynapse.net", - ServiceBus: "https://servicebus.azure.net/", - SQLDatabase: "https://database.windows.net/", - CosmosDB: "https://cosmos.azure.com", - ManagedHSM: "https://managedhsm.azure.net", - MicrosoftGraph: "https://graph.microsoft.com/", - }, - } - - // USGovernmentCloud is the cloud environment for the US Government - USGovernmentCloud = Environment{ - Name: "AzureUSGovernmentCloud", - ManagementPortalURL: "https://manage.windowsazure.us/", - PublishSettingsURL: "https://manage.windowsazure.us/publishsettings/index", - ServiceManagementEndpoint: "https://management.core.usgovcloudapi.net/", - ResourceManagerEndpoint: "https://management.usgovcloudapi.net/", - ActiveDirectoryEndpoint: "https://login.microsoftonline.us/", - GalleryEndpoint: "https://gallery.usgovcloudapi.net/", - KeyVaultEndpoint: "https://vault.usgovcloudapi.net/", - ManagedHSMEndpoint: NotAvailable, - GraphEndpoint: "https://graph.windows.net/", - ServiceBusEndpoint: "https://servicebus.usgovcloudapi.net/", - BatchManagementEndpoint: "https://batch.core.usgovcloudapi.net/", - MicrosoftGraphEndpoint: "https://graph.microsoft.us/", - StorageEndpointSuffix: "core.usgovcloudapi.net", - CosmosDBDNSSuffix: "documents.azure.us", - MariaDBDNSSuffix: "mariadb.database.usgovcloudapi.net", - MySQLDatabaseDNSSuffix: "mysql.database.usgovcloudapi.net", - PostgresqlDatabaseDNSSuffix: "postgres.database.usgovcloudapi.net", - SQLDatabaseDNSSuffix: "database.usgovcloudapi.net", - TrafficManagerDNSSuffix: "usgovtrafficmanager.net", - KeyVaultDNSSuffix: "vault.usgovcloudapi.net", - ManagedHSMDNSSuffix: NotAvailable, - ServiceBusEndpointSuffix: "servicebus.usgovcloudapi.net", - ServiceManagementVMDNSSuffix: "usgovcloudapp.net", - ResourceManagerVMDNSSuffix: "cloudapp.usgovcloudapi.net", - ContainerRegistryDNSSuffix: "azurecr.us", - TokenAudience: "https://management.usgovcloudapi.net/", - APIManagementHostNameSuffix: "azure-api.us", - SynapseEndpointSuffix: "dev.azuresynapse.usgovcloudapi.net", - DatalakeSuffix: NotAvailable, - ResourceIdentifiers: ResourceIdentifier{ - Graph: "https://graph.windows.net/", - KeyVault: "https://vault.usgovcloudapi.net", - Datalake: NotAvailable, - Batch: "https://batch.core.usgovcloudapi.net/", - OperationalInsights: "https://api.loganalytics.us", - OSSRDBMS: "https://ossrdbms-aad.database.usgovcloudapi.net", - Storage: "https://storage.azure.com/", - Synapse: "https://dev.azuresynapse.usgovcloudapi.net", - ServiceBus: "https://servicebus.azure.net/", - SQLDatabase: "https://database.usgovcloudapi.net/", - CosmosDB: "https://cosmos.azure.com", - ManagedHSM: NotAvailable, - MicrosoftGraph: "https://graph.microsoft.us/", - }, - } - - // ChinaCloud is the cloud environment operated in China - ChinaCloud = Environment{ - Name: "AzureChinaCloud", - ManagementPortalURL: "https://manage.chinacloudapi.com/", - PublishSettingsURL: "https://manage.chinacloudapi.com/publishsettings/index", - ServiceManagementEndpoint: "https://management.core.chinacloudapi.cn/", - ResourceManagerEndpoint: "https://management.chinacloudapi.cn/", - ActiveDirectoryEndpoint: "https://login.chinacloudapi.cn/", - GalleryEndpoint: "https://gallery.chinacloudapi.cn/", - KeyVaultEndpoint: "https://vault.azure.cn/", - ManagedHSMEndpoint: NotAvailable, - GraphEndpoint: "https://graph.chinacloudapi.cn/", - ServiceBusEndpoint: "https://servicebus.chinacloudapi.cn/", - BatchManagementEndpoint: "https://batch.chinacloudapi.cn/", - MicrosoftGraphEndpoint: "https://microsoftgraph.chinacloudapi.cn/", - StorageEndpointSuffix: "core.chinacloudapi.cn", - CosmosDBDNSSuffix: "documents.azure.cn", - MariaDBDNSSuffix: "mariadb.database.chinacloudapi.cn", - MySQLDatabaseDNSSuffix: "mysql.database.chinacloudapi.cn", - PostgresqlDatabaseDNSSuffix: "postgres.database.chinacloudapi.cn", - SQLDatabaseDNSSuffix: "database.chinacloudapi.cn", - TrafficManagerDNSSuffix: "trafficmanager.cn", - KeyVaultDNSSuffix: "vault.azure.cn", - ManagedHSMDNSSuffix: NotAvailable, - ServiceBusEndpointSuffix: "servicebus.chinacloudapi.cn", - ServiceManagementVMDNSSuffix: "chinacloudapp.cn", - ResourceManagerVMDNSSuffix: "cloudapp.chinacloudapi.cn", - ContainerRegistryDNSSuffix: "azurecr.cn", - TokenAudience: "https://management.chinacloudapi.cn/", - APIManagementHostNameSuffix: "azure-api.cn", - SynapseEndpointSuffix: "dev.azuresynapse.azure.cn", - DatalakeSuffix: NotAvailable, - ResourceIdentifiers: ResourceIdentifier{ - Graph: "https://graph.chinacloudapi.cn/", - KeyVault: "https://vault.azure.cn", - Datalake: NotAvailable, - Batch: "https://batch.chinacloudapi.cn/", - OperationalInsights: NotAvailable, - OSSRDBMS: "https://ossrdbms-aad.database.chinacloudapi.cn", - Storage: "https://storage.azure.com/", - Synapse: "https://dev.azuresynapse.net", - ServiceBus: "https://servicebus.azure.net/", - SQLDatabase: "https://database.chinacloudapi.cn/", - CosmosDB: "https://cosmos.azure.com", - ManagedHSM: NotAvailable, - MicrosoftGraph: "https://microsoftgraph.chinacloudapi.cn", - }, - } - - // GermanCloud is the cloud environment operated in Germany - GermanCloud = Environment{ - Name: "AzureGermanCloud", - ManagementPortalURL: "http://portal.microsoftazure.de/", - PublishSettingsURL: "https://manage.microsoftazure.de/publishsettings/index", - ServiceManagementEndpoint: "https://management.core.cloudapi.de/", - ResourceManagerEndpoint: "https://management.microsoftazure.de/", - ActiveDirectoryEndpoint: "https://login.microsoftonline.de/", - GalleryEndpoint: "https://gallery.cloudapi.de/", - KeyVaultEndpoint: "https://vault.microsoftazure.de/", - ManagedHSMEndpoint: NotAvailable, - GraphEndpoint: "https://graph.cloudapi.de/", - ServiceBusEndpoint: "https://servicebus.cloudapi.de/", - BatchManagementEndpoint: "https://batch.cloudapi.de/", - MicrosoftGraphEndpoint: NotAvailable, - StorageEndpointSuffix: "core.cloudapi.de", - CosmosDBDNSSuffix: "documents.microsoftazure.de", - MariaDBDNSSuffix: "mariadb.database.cloudapi.de", - MySQLDatabaseDNSSuffix: "mysql.database.cloudapi.de", - PostgresqlDatabaseDNSSuffix: "postgres.database.cloudapi.de", - SQLDatabaseDNSSuffix: "database.cloudapi.de", - TrafficManagerDNSSuffix: "azuretrafficmanager.de", - KeyVaultDNSSuffix: "vault.microsoftazure.de", - ManagedHSMDNSSuffix: NotAvailable, - ServiceBusEndpointSuffix: "servicebus.cloudapi.de", - ServiceManagementVMDNSSuffix: "azurecloudapp.de", - ResourceManagerVMDNSSuffix: "cloudapp.microsoftazure.de", - ContainerRegistryDNSSuffix: NotAvailable, - TokenAudience: "https://management.microsoftazure.de/", - APIManagementHostNameSuffix: NotAvailable, - SynapseEndpointSuffix: NotAvailable, - DatalakeSuffix: NotAvailable, - ResourceIdentifiers: ResourceIdentifier{ - Graph: "https://graph.cloudapi.de/", - KeyVault: "https://vault.microsoftazure.de", - Datalake: NotAvailable, - Batch: "https://batch.cloudapi.de/", - OperationalInsights: NotAvailable, - OSSRDBMS: "https://ossrdbms-aad.database.cloudapi.de", - Storage: "https://storage.azure.com/", - Synapse: NotAvailable, - ServiceBus: "https://servicebus.azure.net/", - SQLDatabase: "https://database.cloudapi.de/", - CosmosDB: "https://cosmos.azure.com", - ManagedHSM: NotAvailable, - MicrosoftGraph: NotAvailable, - }, - } -) - -// EnvironmentFromName returns an Environment based on the common name specified. -func EnvironmentFromName(name string) (Environment, error) { - // IMPORTANT - // As per @radhikagupta5: - // This is technical debt, fundamentally here because Kubernetes is not currently accepting - // contributions to the providers. Once that is an option, the provider should be updated to - // directly call `EnvironmentFromFile`. Until then, we rely on dispatching Azure Stack environment creation - // from this method based on the name that is provided to us. - if strings.EqualFold(name, "AZURESTACKCLOUD") { - return EnvironmentFromFile(os.Getenv(EnvironmentFilepathName)) - } - - name = strings.ToUpper(name) - env, ok := environments[name] - if !ok { - return env, fmt.Errorf("autorest/azure: There is no cloud environment matching the name %q", name) - } - - return env, nil -} - -// EnvironmentFromFile loads an Environment from a configuration file available on disk. -// This function is particularly useful in the Hybrid Cloud model, where one must define their own -// endpoints. -func EnvironmentFromFile(location string) (unmarshaled Environment, err error) { - fileContents, err := ioutil.ReadFile(location) - if err != nil { - return - } - - err = json.Unmarshal(fileContents, &unmarshaled) - - return -} - -// SetEnvironment updates the environment map with the specified values. -func SetEnvironment(name string, env Environment) { - environments[strings.ToUpper(name)] = env -} diff --git a/vendor/github.com/Azure/go-autorest/autorest/azure/metadata_environment.go b/vendor/github.com/Azure/go-autorest/autorest/azure/metadata_environment.go deleted file mode 100644 index 507f9e95c..000000000 --- a/vendor/github.com/Azure/go-autorest/autorest/azure/metadata_environment.go +++ /dev/null @@ -1,245 +0,0 @@ -package azure - -import ( - "encoding/json" - "fmt" - "io/ioutil" - "net/http" - "strings" - - "github.com/Azure/go-autorest/autorest" -) - -// Copyright 2017 Microsoft Corporation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -type audience []string - -type authentication struct { - LoginEndpoint string `json:"loginEndpoint"` - Audiences audience `json:"audiences"` -} - -type environmentMetadataInfo struct { - GalleryEndpoint string `json:"galleryEndpoint"` - GraphEndpoint string `json:"graphEndpoint"` - PortalEndpoint string `json:"portalEndpoint"` - Authentication authentication `json:"authentication"` -} - -// EnvironmentProperty represent property names that clients can override -type EnvironmentProperty string - -const ( - // EnvironmentName ... - EnvironmentName EnvironmentProperty = "name" - // EnvironmentManagementPortalURL .. - EnvironmentManagementPortalURL EnvironmentProperty = "managementPortalURL" - // EnvironmentPublishSettingsURL ... - EnvironmentPublishSettingsURL EnvironmentProperty = "publishSettingsURL" - // EnvironmentServiceManagementEndpoint ... - EnvironmentServiceManagementEndpoint EnvironmentProperty = "serviceManagementEndpoint" - // EnvironmentResourceManagerEndpoint ... - EnvironmentResourceManagerEndpoint EnvironmentProperty = "resourceManagerEndpoint" - // EnvironmentActiveDirectoryEndpoint ... - EnvironmentActiveDirectoryEndpoint EnvironmentProperty = "activeDirectoryEndpoint" - // EnvironmentGalleryEndpoint ... - EnvironmentGalleryEndpoint EnvironmentProperty = "galleryEndpoint" - // EnvironmentKeyVaultEndpoint ... - EnvironmentKeyVaultEndpoint EnvironmentProperty = "keyVaultEndpoint" - // EnvironmentGraphEndpoint ... - EnvironmentGraphEndpoint EnvironmentProperty = "graphEndpoint" - // EnvironmentServiceBusEndpoint ... - EnvironmentServiceBusEndpoint EnvironmentProperty = "serviceBusEndpoint" - // EnvironmentBatchManagementEndpoint ... - EnvironmentBatchManagementEndpoint EnvironmentProperty = "batchManagementEndpoint" - // EnvironmentStorageEndpointSuffix ... - EnvironmentStorageEndpointSuffix EnvironmentProperty = "storageEndpointSuffix" - // EnvironmentSQLDatabaseDNSSuffix ... - EnvironmentSQLDatabaseDNSSuffix EnvironmentProperty = "sqlDatabaseDNSSuffix" - // EnvironmentTrafficManagerDNSSuffix ... - EnvironmentTrafficManagerDNSSuffix EnvironmentProperty = "trafficManagerDNSSuffix" - // EnvironmentKeyVaultDNSSuffix ... - EnvironmentKeyVaultDNSSuffix EnvironmentProperty = "keyVaultDNSSuffix" - // EnvironmentServiceBusEndpointSuffix ... - EnvironmentServiceBusEndpointSuffix EnvironmentProperty = "serviceBusEndpointSuffix" - // EnvironmentServiceManagementVMDNSSuffix ... - EnvironmentServiceManagementVMDNSSuffix EnvironmentProperty = "serviceManagementVMDNSSuffix" - // EnvironmentResourceManagerVMDNSSuffix ... - EnvironmentResourceManagerVMDNSSuffix EnvironmentProperty = "resourceManagerVMDNSSuffix" - // EnvironmentContainerRegistryDNSSuffix ... - EnvironmentContainerRegistryDNSSuffix EnvironmentProperty = "containerRegistryDNSSuffix" - // EnvironmentTokenAudience ... - EnvironmentTokenAudience EnvironmentProperty = "tokenAudience" -) - -// OverrideProperty represents property name and value that clients can override -type OverrideProperty struct { - Key EnvironmentProperty - Value string -} - -// EnvironmentFromURL loads an Environment from a URL -// This function is particularly useful in the Hybrid Cloud model, where one may define their own -// endpoints. -func EnvironmentFromURL(resourceManagerEndpoint string, properties ...OverrideProperty) (environment Environment, err error) { - var metadataEnvProperties environmentMetadataInfo - - if resourceManagerEndpoint == "" { - return environment, fmt.Errorf("Metadata resource manager endpoint is empty") - } - - if metadataEnvProperties, err = retrieveMetadataEnvironment(resourceManagerEndpoint); err != nil { - return environment, err - } - - // Give priority to user's override values - overrideProperties(&environment, properties) - - if environment.Name == "" { - environment.Name = "HybridEnvironment" - } - stampDNSSuffix := environment.StorageEndpointSuffix - if stampDNSSuffix == "" { - stampDNSSuffix = strings.TrimSuffix(strings.TrimPrefix(strings.Replace(resourceManagerEndpoint, strings.Split(resourceManagerEndpoint, ".")[0], "", 1), "."), "/") - environment.StorageEndpointSuffix = stampDNSSuffix - } - if environment.KeyVaultDNSSuffix == "" { - environment.KeyVaultDNSSuffix = fmt.Sprintf("%s.%s", "vault", stampDNSSuffix) - } - if environment.KeyVaultEndpoint == "" { - environment.KeyVaultEndpoint = fmt.Sprintf("%s%s", "https://", environment.KeyVaultDNSSuffix) - } - if environment.TokenAudience == "" { - environment.TokenAudience = metadataEnvProperties.Authentication.Audiences[0] - } - if environment.ActiveDirectoryEndpoint == "" { - environment.ActiveDirectoryEndpoint = metadataEnvProperties.Authentication.LoginEndpoint - } - if environment.ResourceManagerEndpoint == "" { - environment.ResourceManagerEndpoint = resourceManagerEndpoint - } - if environment.GalleryEndpoint == "" { - environment.GalleryEndpoint = metadataEnvProperties.GalleryEndpoint - } - if environment.GraphEndpoint == "" { - environment.GraphEndpoint = metadataEnvProperties.GraphEndpoint - } - - return environment, nil -} - -func overrideProperties(environment *Environment, properties []OverrideProperty) { - for _, property := range properties { - switch property.Key { - case EnvironmentName: - { - environment.Name = property.Value - } - case EnvironmentManagementPortalURL: - { - environment.ManagementPortalURL = property.Value - } - case EnvironmentPublishSettingsURL: - { - environment.PublishSettingsURL = property.Value - } - case EnvironmentServiceManagementEndpoint: - { - environment.ServiceManagementEndpoint = property.Value - } - case EnvironmentResourceManagerEndpoint: - { - environment.ResourceManagerEndpoint = property.Value - } - case EnvironmentActiveDirectoryEndpoint: - { - environment.ActiveDirectoryEndpoint = property.Value - } - case EnvironmentGalleryEndpoint: - { - environment.GalleryEndpoint = property.Value - } - case EnvironmentKeyVaultEndpoint: - { - environment.KeyVaultEndpoint = property.Value - } - case EnvironmentGraphEndpoint: - { - environment.GraphEndpoint = property.Value - } - case EnvironmentServiceBusEndpoint: - { - environment.ServiceBusEndpoint = property.Value - } - case EnvironmentBatchManagementEndpoint: - { - environment.BatchManagementEndpoint = property.Value - } - case EnvironmentStorageEndpointSuffix: - { - environment.StorageEndpointSuffix = property.Value - } - case EnvironmentSQLDatabaseDNSSuffix: - { - environment.SQLDatabaseDNSSuffix = property.Value - } - case EnvironmentTrafficManagerDNSSuffix: - { - environment.TrafficManagerDNSSuffix = property.Value - } - case EnvironmentKeyVaultDNSSuffix: - { - environment.KeyVaultDNSSuffix = property.Value - } - case EnvironmentServiceBusEndpointSuffix: - { - environment.ServiceBusEndpointSuffix = property.Value - } - case EnvironmentServiceManagementVMDNSSuffix: - { - environment.ServiceManagementVMDNSSuffix = property.Value - } - case EnvironmentResourceManagerVMDNSSuffix: - { - environment.ResourceManagerVMDNSSuffix = property.Value - } - case EnvironmentContainerRegistryDNSSuffix: - { - environment.ContainerRegistryDNSSuffix = property.Value - } - case EnvironmentTokenAudience: - { - environment.TokenAudience = property.Value - } - } - } -} - -func retrieveMetadataEnvironment(endpoint string) (environment environmentMetadataInfo, err error) { - client := autorest.NewClientWithUserAgent("") - managementEndpoint := fmt.Sprintf("%s%s", strings.TrimSuffix(endpoint, "/"), "/metadata/endpoints?api-version=1.0") - req, _ := http.NewRequest("GET", managementEndpoint, nil) - response, err := client.Do(req) - if err != nil { - return environment, err - } - defer response.Body.Close() - jsonResponse, err := ioutil.ReadAll(response.Body) - if err != nil { - return environment, err - } - err = json.Unmarshal(jsonResponse, &environment) - return environment, err -} diff --git a/vendor/github.com/Azure/go-autorest/autorest/azure/rp.go b/vendor/github.com/Azure/go-autorest/autorest/azure/rp.go deleted file mode 100644 index 5b52357f9..000000000 --- a/vendor/github.com/Azure/go-autorest/autorest/azure/rp.go +++ /dev/null @@ -1,204 +0,0 @@ -// Copyright 2017 Microsoft Corporation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package azure - -import ( - "errors" - "fmt" - "net/http" - "net/url" - "strings" - "time" - - "github.com/Azure/go-autorest/autorest" -) - -// DoRetryWithRegistration tries to register the resource provider in case it is unregistered. -// It also handles request retries -func DoRetryWithRegistration(client autorest.Client) autorest.SendDecorator { - return func(s autorest.Sender) autorest.Sender { - return autorest.SenderFunc(func(r *http.Request) (resp *http.Response, err error) { - rr := autorest.NewRetriableRequest(r) - for currentAttempt := 0; currentAttempt < client.RetryAttempts; currentAttempt++ { - err = rr.Prepare() - if err != nil { - return resp, err - } - - resp, err = autorest.SendWithSender(s, rr.Request(), - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...), - ) - if err != nil { - return resp, err - } - - if resp.StatusCode != http.StatusConflict || client.SkipResourceProviderRegistration { - return resp, err - } - - var re RequestError - if strings.Contains(r.Header.Get("Content-Type"), "xml") { - // XML errors (e.g. Storage Data Plane) only return the inner object - err = autorest.Respond(resp, autorest.ByUnmarshallingXML(&re.ServiceError)) - } else { - err = autorest.Respond(resp, autorest.ByUnmarshallingJSON(&re)) - } - - if err != nil { - return resp, err - } - err = re - - if re.ServiceError != nil && re.ServiceError.Code == "MissingSubscriptionRegistration" { - regErr := register(client, r, re) - if regErr != nil { - return resp, fmt.Errorf("failed auto registering Resource Provider: %s. Original error: %w", regErr, err) - } - } - } - return resp, err - }) - } -} - -func getProvider(re RequestError) (string, error) { - if re.ServiceError != nil && len(re.ServiceError.Details) > 0 { - return re.ServiceError.Details[0]["target"].(string), nil - } - return "", errors.New("provider was not found in the response") -} - -func register(client autorest.Client, originalReq *http.Request, re RequestError) error { - subID := getSubscription(originalReq.URL.Path) - if subID == "" { - return errors.New("missing parameter subscriptionID to register resource provider") - } - providerName, err := getProvider(re) - if err != nil { - return fmt.Errorf("missing parameter provider to register resource provider: %s", err) - } - newURL := url.URL{ - Scheme: originalReq.URL.Scheme, - Host: originalReq.URL.Host, - } - - // taken from the resources SDK - // with almost identical code, this sections are easier to mantain - // It is also not a good idea to import the SDK here - // https://github.com/Azure/azure-sdk-for-go/blob/9f366792afa3e0ddaecdc860e793ba9d75e76c27/arm/resources/resources/providers.go#L252 - pathParameters := map[string]interface{}{ - "resourceProviderNamespace": autorest.Encode("path", providerName), - "subscriptionId": autorest.Encode("path", subID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(newURL.String()), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/register", pathParameters), - autorest.WithQueryParameters(queryParameters), - ) - - req, err := preparer.Prepare(&http.Request{}) - if err != nil { - return err - } - req = req.WithContext(originalReq.Context()) - - resp, err := autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...), - ) - if err != nil { - return err - } - - type Provider struct { - RegistrationState *string `json:"registrationState,omitempty"` - } - var provider Provider - - err = autorest.Respond( - resp, - WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&provider), - autorest.ByClosing(), - ) - if err != nil { - return err - } - - // poll for registered provisioning state - registrationStartTime := time.Now() - for err == nil && (client.PollingDuration == 0 || (client.PollingDuration != 0 && time.Since(registrationStartTime) < client.PollingDuration)) { - // taken from the resources SDK - // https://github.com/Azure/azure-sdk-for-go/blob/9f366792afa3e0ddaecdc860e793ba9d75e76c27/arm/resources/resources/providers.go#L45 - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(newURL.String()), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}", pathParameters), - autorest.WithQueryParameters(queryParameters), - ) - req, err = preparer.Prepare(&http.Request{}) - if err != nil { - return err - } - req = req.WithContext(originalReq.Context()) - - resp, err := autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...), - ) - if err != nil { - return err - } - - err = autorest.Respond( - resp, - WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&provider), - autorest.ByClosing(), - ) - if err != nil { - return err - } - - if provider.RegistrationState != nil && - *provider.RegistrationState == "Registered" { - break - } - - delayed := autorest.DelayWithRetryAfter(resp, originalReq.Context().Done()) - if !delayed && !autorest.DelayForBackoff(client.PollingDelay, 0, originalReq.Context().Done()) { - return originalReq.Context().Err() - } - } - if client.PollingDuration != 0 && !(time.Since(registrationStartTime) < client.PollingDuration) { - return errors.New("polling for resource provider registration has exceeded the polling duration") - } - return err -} - -func getSubscription(path string) string { - parts := strings.Split(path, "/") - for i, v := range parts { - if v == "subscriptions" && (i+1) < len(parts) { - return parts[i+1] - } - } - return "" -} diff --git a/vendor/github.com/Azure/go-autorest/autorest/client.go b/vendor/github.com/Azure/go-autorest/autorest/client.go deleted file mode 100644 index bb5f9396e..000000000 --- a/vendor/github.com/Azure/go-autorest/autorest/client.go +++ /dev/null @@ -1,328 +0,0 @@ -package autorest - -// Copyright 2017 Microsoft Corporation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -import ( - "bytes" - "crypto/tls" - "errors" - "fmt" - "io" - "io/ioutil" - "log" - "net/http" - "strings" - "time" - - "github.com/Azure/go-autorest/logger" -) - -const ( - // DefaultPollingDelay is a reasonable delay between polling requests. - DefaultPollingDelay = 30 * time.Second - - // DefaultPollingDuration is a reasonable total polling duration. - DefaultPollingDuration = 15 * time.Minute - - // DefaultRetryAttempts is number of attempts for retry status codes (5xx). - DefaultRetryAttempts = 3 - - // DefaultRetryDuration is the duration to wait between retries. - DefaultRetryDuration = 30 * time.Second -) - -var ( - // StatusCodesForRetry are a defined group of status code for which the client will retry - StatusCodesForRetry = []int{ - http.StatusRequestTimeout, // 408 - http.StatusTooManyRequests, // 429 - http.StatusInternalServerError, // 500 - http.StatusBadGateway, // 502 - http.StatusServiceUnavailable, // 503 - http.StatusGatewayTimeout, // 504 - } -) - -const ( - requestFormat = `HTTP Request Begin =================================================== -%s -===================================================== HTTP Request End -` - responseFormat = `HTTP Response Begin =================================================== -%s -===================================================== HTTP Response End -` -) - -// Response serves as the base for all responses from generated clients. It provides access to the -// last http.Response. -type Response struct { - *http.Response `json:"-"` -} - -// IsHTTPStatus returns true if the returned HTTP status code matches the provided status code. -// If there was no response (i.e. the underlying http.Response is nil) the return value is false. -func (r Response) IsHTTPStatus(statusCode int) bool { - if r.Response == nil { - return false - } - return r.Response.StatusCode == statusCode -} - -// HasHTTPStatus returns true if the returned HTTP status code matches one of the provided status codes. -// If there was no response (i.e. the underlying http.Response is nil) or not status codes are provided -// the return value is false. -func (r Response) HasHTTPStatus(statusCodes ...int) bool { - return ResponseHasStatusCode(r.Response, statusCodes...) -} - -// LoggingInspector implements request and response inspectors that log the full request and -// response to a supplied log. -type LoggingInspector struct { - Logger *log.Logger -} - -// WithInspection returns a PrepareDecorator that emits the http.Request to the supplied logger. The -// body is restored after being emitted. -// -// Note: Since it reads the entire Body, this decorator should not be used where body streaming is -// important. It is best used to trace JSON or similar body values. -func (li LoggingInspector) WithInspection() PrepareDecorator { - return func(p Preparer) Preparer { - return PreparerFunc(func(r *http.Request) (*http.Request, error) { - var body, b bytes.Buffer - - defer r.Body.Close() - - r.Body = ioutil.NopCloser(io.TeeReader(r.Body, &body)) - if err := r.Write(&b); err != nil { - return nil, fmt.Errorf("Failed to write response: %v", err) - } - - li.Logger.Printf(requestFormat, b.String()) - - r.Body = ioutil.NopCloser(&body) - return p.Prepare(r) - }) - } -} - -// ByInspecting returns a RespondDecorator that emits the http.Response to the supplied logger. The -// body is restored after being emitted. -// -// Note: Since it reads the entire Body, this decorator should not be used where body streaming is -// important. It is best used to trace JSON or similar body values. -func (li LoggingInspector) ByInspecting() RespondDecorator { - return func(r Responder) Responder { - return ResponderFunc(func(resp *http.Response) error { - var body, b bytes.Buffer - defer resp.Body.Close() - resp.Body = ioutil.NopCloser(io.TeeReader(resp.Body, &body)) - if err := resp.Write(&b); err != nil { - return fmt.Errorf("Failed to write response: %v", err) - } - - li.Logger.Printf(responseFormat, b.String()) - - resp.Body = ioutil.NopCloser(&body) - return r.Respond(resp) - }) - } -} - -// Client is the base for autorest generated clients. It provides default, "do nothing" -// implementations of an Authorizer, RequestInspector, and ResponseInspector. It also returns the -// standard, undecorated http.Client as a default Sender. -// -// Generated clients should also use Error (see NewError and NewErrorWithError) for errors and -// return responses that compose with Response. -// -// Most customization of generated clients is best achieved by supplying a custom Authorizer, custom -// RequestInspector, and / or custom ResponseInspector. Users may log requests, implement circuit -// breakers (see https://msdn.microsoft.com/en-us/library/dn589784.aspx) or otherwise influence -// sending the request by providing a decorated Sender. -type Client struct { - Authorizer Authorizer - Sender Sender - RequestInspector PrepareDecorator - ResponseInspector RespondDecorator - - // PollingDelay sets the polling frequency used in absence of a Retry-After HTTP header - PollingDelay time.Duration - - // PollingDuration sets the maximum polling time after which an error is returned. - // Setting this to zero will use the provided context to control the duration. - PollingDuration time.Duration - - // RetryAttempts sets the total number of times the client will attempt to make an HTTP request. - // Set the value to 1 to disable retries. DO NOT set the value to less than 1. - RetryAttempts int - - // RetryDuration sets the delay duration for retries. - RetryDuration time.Duration - - // UserAgent, if not empty, will be set as the HTTP User-Agent header on all requests sent - // through the Do method. - UserAgent string - - Jar http.CookieJar - - // Set to true to skip attempted registration of resource providers (false by default). - SkipResourceProviderRegistration bool - - // SendDecorators can be used to override the default chain of SendDecorators. - // This can be used to specify things like a custom retry SendDecorator. - // Set this to an empty slice to use no SendDecorators. - SendDecorators []SendDecorator -} - -// NewClientWithUserAgent returns an instance of a Client with the UserAgent set to the passed -// string. -func NewClientWithUserAgent(ua string) Client { - return newClient(ua, tls.RenegotiateNever) -} - -// ClientOptions contains various Client configuration options. -type ClientOptions struct { - // UserAgent is an optional user-agent string to append to the default user agent. - UserAgent string - - // Renegotiation is an optional setting to control client-side TLS renegotiation. - Renegotiation tls.RenegotiationSupport -} - -// NewClientWithOptions returns an instance of a Client with the specified values. -func NewClientWithOptions(options ClientOptions) Client { - return newClient(options.UserAgent, options.Renegotiation) -} - -func newClient(ua string, renegotiation tls.RenegotiationSupport) Client { - c := Client{ - PollingDelay: DefaultPollingDelay, - PollingDuration: DefaultPollingDuration, - RetryAttempts: DefaultRetryAttempts, - RetryDuration: DefaultRetryDuration, - UserAgent: UserAgent(), - } - c.Sender = c.sender(renegotiation) - c.AddToUserAgent(ua) - return c -} - -// AddToUserAgent adds an extension to the current user agent -func (c *Client) AddToUserAgent(extension string) error { - if extension != "" { - c.UserAgent = fmt.Sprintf("%s %s", c.UserAgent, extension) - return nil - } - return fmt.Errorf("Extension was empty, User Agent stayed as %s", c.UserAgent) -} - -// Do implements the Sender interface by invoking the active Sender after applying authorization. -// If Sender is not set, it uses a new instance of http.Client. In both cases it will, if UserAgent -// is set, apply set the User-Agent header. -func (c Client) Do(r *http.Request) (*http.Response, error) { - if r.UserAgent() == "" { - r, _ = Prepare(r, - WithUserAgent(c.UserAgent)) - } - // NOTE: c.WithInspection() must be last in the list so that it can inspect all preceding operations - r, err := Prepare(r, - c.WithAuthorization(), - c.WithInspection()) - if err != nil { - var resp *http.Response - if detErr, ok := err.(DetailedError); ok { - // if the authorization failed (e.g. invalid credentials) there will - // be a response associated with the error, be sure to return it. - resp = detErr.Response - } - return resp, NewErrorWithError(err, "autorest/Client", "Do", nil, "Preparing request failed") - } - logger.Instance.WriteRequest(r, logger.Filter{ - Header: func(k string, v []string) (bool, []string) { - // remove the auth token from the log - if strings.EqualFold(k, "Authorization") || strings.EqualFold(k, "Ocp-Apim-Subscription-Key") { - v = []string{"**REDACTED**"} - } - return true, v - }, - }) - resp, err := SendWithSender(c.sender(tls.RenegotiateNever), r) - if resp == nil && err == nil { - err = errors.New("autorest: received nil response and error") - } - logger.Instance.WriteResponse(resp, logger.Filter{}) - Respond(resp, c.ByInspecting()) - return resp, err -} - -// sender returns the Sender to which to send requests. -func (c Client) sender(renengotiation tls.RenegotiationSupport) Sender { - if c.Sender == nil { - return sender(renengotiation) - } - return c.Sender -} - -// WithAuthorization is a convenience method that returns the WithAuthorization PrepareDecorator -// from the current Authorizer. If not Authorizer is set, it uses the NullAuthorizer. -func (c Client) WithAuthorization() PrepareDecorator { - return c.authorizer().WithAuthorization() -} - -// authorizer returns the Authorizer to use. -func (c Client) authorizer() Authorizer { - if c.Authorizer == nil { - return NullAuthorizer{} - } - return c.Authorizer -} - -// WithInspection is a convenience method that passes the request to the supplied RequestInspector, -// if present, or returns the WithNothing PrepareDecorator otherwise. -func (c Client) WithInspection() PrepareDecorator { - if c.RequestInspector == nil { - return WithNothing() - } - return c.RequestInspector -} - -// ByInspecting is a convenience method that passes the response to the supplied ResponseInspector, -// if present, or returns the ByIgnoring RespondDecorator otherwise. -func (c Client) ByInspecting() RespondDecorator { - if c.ResponseInspector == nil { - return ByIgnoring() - } - return c.ResponseInspector -} - -// Send sends the provided http.Request using the client's Sender or the default sender. -// It returns the http.Response and possible error. It also accepts a, possibly empty, -// default set of SendDecorators used when sending the request. -// SendDecorators have the following precedence: -// 1. In a request's context via WithSendDecorators() -// 2. Specified on the client in SendDecorators -// 3. The default values specified in this method -func (c Client) Send(req *http.Request, decorators ...SendDecorator) (*http.Response, error) { - if c.SendDecorators != nil { - decorators = c.SendDecorators - } - inCtx := req.Context().Value(ctxSendDecorators{}) - if sd, ok := inCtx.([]SendDecorator); ok { - decorators = sd - } - return SendWithSender(c, req, decorators...) -} diff --git a/vendor/github.com/Azure/go-autorest/autorest/date/LICENSE b/vendor/github.com/Azure/go-autorest/autorest/date/LICENSE deleted file mode 100644 index b9d6a27ea..000000000 --- a/vendor/github.com/Azure/go-autorest/autorest/date/LICENSE +++ /dev/null @@ -1,191 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - Copyright 2015 Microsoft Corporation - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/github.com/Azure/go-autorest/autorest/date/date.go b/vendor/github.com/Azure/go-autorest/autorest/date/date.go deleted file mode 100644 index c45710656..000000000 --- a/vendor/github.com/Azure/go-autorest/autorest/date/date.go +++ /dev/null @@ -1,96 +0,0 @@ -/* -Package date provides time.Time derivatives that conform to the Swagger.io (https://swagger.io/) -defined date formats: Date and DateTime. Both types may, in most cases, be used in lieu of -time.Time types. And both convert to time.Time through a ToTime method. -*/ -package date - -// Copyright 2017 Microsoft Corporation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -import ( - "fmt" - "time" -) - -const ( - fullDate = "2006-01-02" - fullDateJSON = `"2006-01-02"` - dateFormat = "%04d-%02d-%02d" - jsonFormat = `"%04d-%02d-%02d"` -) - -// Date defines a type similar to time.Time but assumes a layout of RFC3339 full-date (i.e., -// 2006-01-02). -type Date struct { - time.Time -} - -// ParseDate create a new Date from the passed string. -func ParseDate(date string) (d Date, err error) { - return parseDate(date, fullDate) -} - -func parseDate(date string, format string) (Date, error) { - d, err := time.Parse(format, date) - return Date{Time: d}, err -} - -// MarshalBinary preserves the Date as a byte array conforming to RFC3339 full-date (i.e., -// 2006-01-02). -func (d Date) MarshalBinary() ([]byte, error) { - return d.MarshalText() -} - -// UnmarshalBinary reconstitutes a Date saved as a byte array conforming to RFC3339 full-date (i.e., -// 2006-01-02). -func (d *Date) UnmarshalBinary(data []byte) error { - return d.UnmarshalText(data) -} - -// MarshalJSON preserves the Date as a JSON string conforming to RFC3339 full-date (i.e., -// 2006-01-02). -func (d Date) MarshalJSON() (json []byte, err error) { - return []byte(fmt.Sprintf(jsonFormat, d.Year(), d.Month(), d.Day())), nil -} - -// UnmarshalJSON reconstitutes the Date from a JSON string conforming to RFC3339 full-date (i.e., -// 2006-01-02). -func (d *Date) UnmarshalJSON(data []byte) (err error) { - d.Time, err = time.Parse(fullDateJSON, string(data)) - return err -} - -// MarshalText preserves the Date as a byte array conforming to RFC3339 full-date (i.e., -// 2006-01-02). -func (d Date) MarshalText() (text []byte, err error) { - return []byte(fmt.Sprintf(dateFormat, d.Year(), d.Month(), d.Day())), nil -} - -// UnmarshalText reconstitutes a Date saved as a byte array conforming to RFC3339 full-date (i.e., -// 2006-01-02). -func (d *Date) UnmarshalText(data []byte) (err error) { - d.Time, err = time.Parse(fullDate, string(data)) - return err -} - -// String returns the Date formatted as an RFC3339 full-date string (i.e., 2006-01-02). -func (d Date) String() string { - return fmt.Sprintf(dateFormat, d.Year(), d.Month(), d.Day()) -} - -// ToTime returns a Date as a time.Time -func (d Date) ToTime() time.Time { - return d.Time -} diff --git a/vendor/github.com/Azure/go-autorest/autorest/date/go_mod_tidy_hack.go b/vendor/github.com/Azure/go-autorest/autorest/date/go_mod_tidy_hack.go deleted file mode 100644 index 4e0543207..000000000 --- a/vendor/github.com/Azure/go-autorest/autorest/date/go_mod_tidy_hack.go +++ /dev/null @@ -1,24 +0,0 @@ -// +build modhack - -package date - -// Copyright 2017 Microsoft Corporation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// This file, and the github.com/Azure/go-autorest import, won't actually become part of -// the resultant binary. - -// Necessary for safely adding multi-module repo. -// See: https://github.com/golang/go/wiki/Modules#is-it-possible-to-add-a-module-to-a-multi-module-repository -import _ "github.com/Azure/go-autorest" diff --git a/vendor/github.com/Azure/go-autorest/autorest/date/time.go b/vendor/github.com/Azure/go-autorest/autorest/date/time.go deleted file mode 100644 index b453fad04..000000000 --- a/vendor/github.com/Azure/go-autorest/autorest/date/time.go +++ /dev/null @@ -1,103 +0,0 @@ -package date - -// Copyright 2017 Microsoft Corporation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -import ( - "regexp" - "time" -) - -// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -const ( - azureUtcFormatJSON = `"2006-01-02T15:04:05.999999999"` - azureUtcFormat = "2006-01-02T15:04:05.999999999" - rfc3339JSON = `"` + time.RFC3339Nano + `"` - rfc3339 = time.RFC3339Nano - tzOffsetRegex = `(Z|z|\+|-)(\d+:\d+)*"*$` -) - -// Time defines a type similar to time.Time but assumes a layout of RFC3339 date-time (i.e., -// 2006-01-02T15:04:05Z). -type Time struct { - time.Time -} - -// MarshalBinary preserves the Time as a byte array conforming to RFC3339 date-time (i.e., -// 2006-01-02T15:04:05Z). -func (t Time) MarshalBinary() ([]byte, error) { - return t.Time.MarshalText() -} - -// UnmarshalBinary reconstitutes a Time saved as a byte array conforming to RFC3339 date-time -// (i.e., 2006-01-02T15:04:05Z). -func (t *Time) UnmarshalBinary(data []byte) error { - return t.UnmarshalText(data) -} - -// MarshalJSON preserves the Time as a JSON string conforming to RFC3339 date-time (i.e., -// 2006-01-02T15:04:05Z). -func (t Time) MarshalJSON() (json []byte, err error) { - return t.Time.MarshalJSON() -} - -// UnmarshalJSON reconstitutes the Time from a JSON string conforming to RFC3339 date-time -// (i.e., 2006-01-02T15:04:05Z). -func (t *Time) UnmarshalJSON(data []byte) (err error) { - timeFormat := azureUtcFormatJSON - match, err := regexp.Match(tzOffsetRegex, data) - if err != nil { - return err - } else if match { - timeFormat = rfc3339JSON - } - t.Time, err = ParseTime(timeFormat, string(data)) - return err -} - -// MarshalText preserves the Time as a byte array conforming to RFC3339 date-time (i.e., -// 2006-01-02T15:04:05Z). -func (t Time) MarshalText() (text []byte, err error) { - return t.Time.MarshalText() -} - -// UnmarshalText reconstitutes a Time saved as a byte array conforming to RFC3339 date-time -// (i.e., 2006-01-02T15:04:05Z). -func (t *Time) UnmarshalText(data []byte) (err error) { - timeFormat := azureUtcFormat - match, err := regexp.Match(tzOffsetRegex, data) - if err != nil { - return err - } else if match { - timeFormat = rfc3339 - } - t.Time, err = ParseTime(timeFormat, string(data)) - return err -} - -// String returns the Time formatted as an RFC3339 date-time string (i.e., -// 2006-01-02T15:04:05Z). -func (t Time) String() string { - // Note: time.Time.String does not return an RFC3339 compliant string, time.Time.MarshalText does. - b, err := t.MarshalText() - if err != nil { - return "" - } - return string(b) -} - -// ToTime returns a Time as a time.Time -func (t Time) ToTime() time.Time { - return t.Time -} diff --git a/vendor/github.com/Azure/go-autorest/autorest/date/timerfc1123.go b/vendor/github.com/Azure/go-autorest/autorest/date/timerfc1123.go deleted file mode 100644 index 48fb39ba9..000000000 --- a/vendor/github.com/Azure/go-autorest/autorest/date/timerfc1123.go +++ /dev/null @@ -1,100 +0,0 @@ -package date - -// Copyright 2017 Microsoft Corporation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -import ( - "errors" - "time" -) - -const ( - rfc1123JSON = `"` + time.RFC1123 + `"` - rfc1123 = time.RFC1123 -) - -// TimeRFC1123 defines a type similar to time.Time but assumes a layout of RFC1123 date-time (i.e., -// Mon, 02 Jan 2006 15:04:05 MST). -type TimeRFC1123 struct { - time.Time -} - -// UnmarshalJSON reconstitutes the Time from a JSON string conforming to RFC1123 date-time -// (i.e., Mon, 02 Jan 2006 15:04:05 MST). -func (t *TimeRFC1123) UnmarshalJSON(data []byte) (err error) { - t.Time, err = ParseTime(rfc1123JSON, string(data)) - if err != nil { - return err - } - return nil -} - -// MarshalJSON preserves the Time as a JSON string conforming to RFC1123 date-time (i.e., -// Mon, 02 Jan 2006 15:04:05 MST). -func (t TimeRFC1123) MarshalJSON() ([]byte, error) { - if y := t.Year(); y < 0 || y >= 10000 { - return nil, errors.New("Time.MarshalJSON: year outside of range [0,9999]") - } - b := []byte(t.Format(rfc1123JSON)) - return b, nil -} - -// MarshalText preserves the Time as a byte array conforming to RFC1123 date-time (i.e., -// Mon, 02 Jan 2006 15:04:05 MST). -func (t TimeRFC1123) MarshalText() ([]byte, error) { - if y := t.Year(); y < 0 || y >= 10000 { - return nil, errors.New("Time.MarshalText: year outside of range [0,9999]") - } - - b := []byte(t.Format(rfc1123)) - return b, nil -} - -// UnmarshalText reconstitutes a Time saved as a byte array conforming to RFC1123 date-time -// (i.e., Mon, 02 Jan 2006 15:04:05 MST). -func (t *TimeRFC1123) UnmarshalText(data []byte) (err error) { - t.Time, err = ParseTime(rfc1123, string(data)) - if err != nil { - return err - } - return nil -} - -// MarshalBinary preserves the Time as a byte array conforming to RFC1123 date-time (i.e., -// Mon, 02 Jan 2006 15:04:05 MST). -func (t TimeRFC1123) MarshalBinary() ([]byte, error) { - return t.MarshalText() -} - -// UnmarshalBinary reconstitutes a Time saved as a byte array conforming to RFC1123 date-time -// (i.e., Mon, 02 Jan 2006 15:04:05 MST). -func (t *TimeRFC1123) UnmarshalBinary(data []byte) error { - return t.UnmarshalText(data) -} - -// ToTime returns a Time as a time.Time -func (t TimeRFC1123) ToTime() time.Time { - return t.Time -} - -// String returns the Time formatted as an RFC1123 date-time string (i.e., -// Mon, 02 Jan 2006 15:04:05 MST). -func (t TimeRFC1123) String() string { - // Note: time.Time.String does not return an RFC1123 compliant string, time.Time.MarshalText does. - b, err := t.MarshalText() - if err != nil { - return "" - } - return string(b) -} diff --git a/vendor/github.com/Azure/go-autorest/autorest/date/unixtime.go b/vendor/github.com/Azure/go-autorest/autorest/date/unixtime.go deleted file mode 100644 index 7073959b2..000000000 --- a/vendor/github.com/Azure/go-autorest/autorest/date/unixtime.go +++ /dev/null @@ -1,123 +0,0 @@ -package date - -// Copyright 2017 Microsoft Corporation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -import ( - "bytes" - "encoding/binary" - "encoding/json" - "time" -) - -// unixEpoch is the moment in time that should be treated as timestamp 0. -var unixEpoch = time.Date(1970, time.January, 1, 0, 0, 0, 0, time.UTC) - -// UnixTime marshals and unmarshals a time that is represented as the number -// of seconds (ignoring skip-seconds) since the Unix Epoch. -type UnixTime time.Time - -// Duration returns the time as a Duration since the UnixEpoch. -func (t UnixTime) Duration() time.Duration { - return time.Time(t).Sub(unixEpoch) -} - -// NewUnixTimeFromSeconds creates a UnixTime as a number of seconds from the UnixEpoch. -func NewUnixTimeFromSeconds(seconds float64) UnixTime { - return NewUnixTimeFromDuration(time.Duration(seconds * float64(time.Second))) -} - -// NewUnixTimeFromNanoseconds creates a UnixTime as a number of nanoseconds from the UnixEpoch. -func NewUnixTimeFromNanoseconds(nanoseconds int64) UnixTime { - return NewUnixTimeFromDuration(time.Duration(nanoseconds)) -} - -// NewUnixTimeFromDuration creates a UnixTime as a duration of time since the UnixEpoch. -func NewUnixTimeFromDuration(dur time.Duration) UnixTime { - return UnixTime(unixEpoch.Add(dur)) -} - -// UnixEpoch retreives the moment considered the Unix Epoch. I.e. The time represented by '0' -func UnixEpoch() time.Time { - return unixEpoch -} - -// MarshalJSON preserves the UnixTime as a JSON number conforming to Unix Timestamp requirements. -// (i.e. the number of seconds since midnight January 1st, 1970 not considering leap seconds.) -func (t UnixTime) MarshalJSON() ([]byte, error) { - buffer := &bytes.Buffer{} - enc := json.NewEncoder(buffer) - err := enc.Encode(float64(time.Time(t).UnixNano()) / 1e9) - if err != nil { - return nil, err - } - return buffer.Bytes(), nil -} - -// UnmarshalJSON reconstitures a UnixTime saved as a JSON number of the number of seconds since -// midnight January 1st, 1970. -func (t *UnixTime) UnmarshalJSON(text []byte) error { - dec := json.NewDecoder(bytes.NewReader(text)) - - var secondsSinceEpoch float64 - if err := dec.Decode(&secondsSinceEpoch); err != nil { - return err - } - - *t = NewUnixTimeFromSeconds(secondsSinceEpoch) - - return nil -} - -// MarshalText stores the number of seconds since the Unix Epoch as a textual floating point number. -func (t UnixTime) MarshalText() ([]byte, error) { - cast := time.Time(t) - return cast.MarshalText() -} - -// UnmarshalText populates a UnixTime with a value stored textually as a floating point number of seconds since the Unix Epoch. -func (t *UnixTime) UnmarshalText(raw []byte) error { - var unmarshaled time.Time - - if err := unmarshaled.UnmarshalText(raw); err != nil { - return err - } - - *t = UnixTime(unmarshaled) - return nil -} - -// MarshalBinary converts a UnixTime into a binary.LittleEndian float64 of nanoseconds since the epoch. -func (t UnixTime) MarshalBinary() ([]byte, error) { - buf := &bytes.Buffer{} - - payload := int64(t.Duration()) - - if err := binary.Write(buf, binary.LittleEndian, &payload); err != nil { - return nil, err - } - - return buf.Bytes(), nil -} - -// UnmarshalBinary converts a from a binary.LittleEndian float64 of nanoseconds since the epoch into a UnixTime. -func (t *UnixTime) UnmarshalBinary(raw []byte) error { - var nanosecondsSinceEpoch int64 - - if err := binary.Read(bytes.NewReader(raw), binary.LittleEndian, &nanosecondsSinceEpoch); err != nil { - return err - } - *t = NewUnixTimeFromNanoseconds(nanosecondsSinceEpoch) - return nil -} diff --git a/vendor/github.com/Azure/go-autorest/autorest/date/utility.go b/vendor/github.com/Azure/go-autorest/autorest/date/utility.go deleted file mode 100644 index 12addf0eb..000000000 --- a/vendor/github.com/Azure/go-autorest/autorest/date/utility.go +++ /dev/null @@ -1,25 +0,0 @@ -package date - -// Copyright 2017 Microsoft Corporation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -import ( - "strings" - "time" -) - -// ParseTime to parse Time string to specified format. -func ParseTime(format string, t string) (d time.Time, err error) { - return time.Parse(format, strings.ToUpper(t)) -} diff --git a/vendor/github.com/Azure/go-autorest/autorest/error.go b/vendor/github.com/Azure/go-autorest/autorest/error.go deleted file mode 100644 index 35098eda8..000000000 --- a/vendor/github.com/Azure/go-autorest/autorest/error.go +++ /dev/null @@ -1,103 +0,0 @@ -package autorest - -// Copyright 2017 Microsoft Corporation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -import ( - "fmt" - "net/http" -) - -const ( - // UndefinedStatusCode is used when HTTP status code is not available for an error. - UndefinedStatusCode = 0 -) - -// DetailedError encloses a error with details of the package, method, and associated HTTP -// status code (if any). -type DetailedError struct { - Original error - - // PackageType is the package type of the object emitting the error. For types, the value - // matches that produced the the '%T' format specifier of the fmt package. For other elements, - // such as functions, it is just the package name (e.g., "autorest"). - PackageType string - - // Method is the name of the method raising the error. - Method string - - // StatusCode is the HTTP Response StatusCode (if non-zero) that led to the error. - StatusCode interface{} - - // Message is the error message. - Message string - - // Service Error is the response body of failed API in bytes - ServiceError []byte - - // Response is the response object that was returned during failure if applicable. - Response *http.Response -} - -// NewError creates a new Error conforming object from the passed packageType, method, and -// message. message is treated as a format string to which the optional args apply. -func NewError(packageType string, method string, message string, args ...interface{}) DetailedError { - return NewErrorWithError(nil, packageType, method, nil, message, args...) -} - -// NewErrorWithResponse creates a new Error conforming object from the passed -// packageType, method, statusCode of the given resp (UndefinedStatusCode if -// resp is nil), and message. message is treated as a format string to which the -// optional args apply. -func NewErrorWithResponse(packageType string, method string, resp *http.Response, message string, args ...interface{}) DetailedError { - return NewErrorWithError(nil, packageType, method, resp, message, args...) -} - -// NewErrorWithError creates a new Error conforming object from the -// passed packageType, method, statusCode of the given resp (UndefinedStatusCode -// if resp is nil), message, and original error. message is treated as a format -// string to which the optional args apply. -func NewErrorWithError(original error, packageType string, method string, resp *http.Response, message string, args ...interface{}) DetailedError { - if v, ok := original.(DetailedError); ok { - return v - } - - statusCode := UndefinedStatusCode - if resp != nil { - statusCode = resp.StatusCode - } - - return DetailedError{ - Original: original, - PackageType: packageType, - Method: method, - StatusCode: statusCode, - Message: fmt.Sprintf(message, args...), - Response: resp, - } -} - -// Error returns a formatted containing all available details (i.e., PackageType, Method, -// StatusCode, Message, and original error (if any)). -func (e DetailedError) Error() string { - if e.Original == nil { - return fmt.Sprintf("%s#%s: %s: StatusCode=%d", e.PackageType, e.Method, e.Message, e.StatusCode) - } - return fmt.Sprintf("%s#%s: %s: StatusCode=%d -- Original Error: %v", e.PackageType, e.Method, e.Message, e.StatusCode, e.Original) -} - -// Unwrap returns the original error. -func (e DetailedError) Unwrap() error { - return e.Original -} diff --git a/vendor/github.com/Azure/go-autorest/autorest/go_mod_tidy_hack.go b/vendor/github.com/Azure/go-autorest/autorest/go_mod_tidy_hack.go deleted file mode 100644 index 792f82d4b..000000000 --- a/vendor/github.com/Azure/go-autorest/autorest/go_mod_tidy_hack.go +++ /dev/null @@ -1,25 +0,0 @@ -//go:build modhack -// +build modhack - -package autorest - -// Copyright 2017 Microsoft Corporation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// This file, and the github.com/Azure/go-autorest import, won't actually become part of -// the resultant binary. - -// Necessary for safely adding multi-module repo. -// See: https://github.com/golang/go/wiki/Modules#is-it-possible-to-add-a-module-to-a-multi-module-repository -import _ "github.com/Azure/go-autorest" diff --git a/vendor/github.com/Azure/go-autorest/autorest/preparer.go b/vendor/github.com/Azure/go-autorest/autorest/preparer.go deleted file mode 100644 index 121a66fa8..000000000 --- a/vendor/github.com/Azure/go-autorest/autorest/preparer.go +++ /dev/null @@ -1,549 +0,0 @@ -package autorest - -// Copyright 2017 Microsoft Corporation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -import ( - "bytes" - "context" - "encoding/json" - "encoding/xml" - "fmt" - "io" - "io/ioutil" - "mime/multipart" - "net/http" - "net/url" - "strings" -) - -const ( - mimeTypeJSON = "application/json" - mimeTypeOctetStream = "application/octet-stream" - mimeTypeFormPost = "application/x-www-form-urlencoded" - - headerAuthorization = "Authorization" - headerAuxAuthorization = "x-ms-authorization-auxiliary" - headerContentType = "Content-Type" - headerUserAgent = "User-Agent" -) - -// used as a key type in context.WithValue() -type ctxPrepareDecorators struct{} - -// WithPrepareDecorators adds the specified PrepareDecorators to the provided context. -// If no PrepareDecorators are provided the context is unchanged. -func WithPrepareDecorators(ctx context.Context, prepareDecorator []PrepareDecorator) context.Context { - if len(prepareDecorator) == 0 { - return ctx - } - return context.WithValue(ctx, ctxPrepareDecorators{}, prepareDecorator) -} - -// GetPrepareDecorators returns the PrepareDecorators in the provided context or the provided default PrepareDecorators. -func GetPrepareDecorators(ctx context.Context, defaultPrepareDecorators ...PrepareDecorator) []PrepareDecorator { - inCtx := ctx.Value(ctxPrepareDecorators{}) - if pd, ok := inCtx.([]PrepareDecorator); ok { - return pd - } - return defaultPrepareDecorators -} - -// Preparer is the interface that wraps the Prepare method. -// -// Prepare accepts and possibly modifies an http.Request (e.g., adding Headers). Implementations -// must ensure to not share or hold per-invocation state since Preparers may be shared and re-used. -type Preparer interface { - Prepare(*http.Request) (*http.Request, error) -} - -// PreparerFunc is a method that implements the Preparer interface. -type PreparerFunc func(*http.Request) (*http.Request, error) - -// Prepare implements the Preparer interface on PreparerFunc. -func (pf PreparerFunc) Prepare(r *http.Request) (*http.Request, error) { - return pf(r) -} - -// PrepareDecorator takes and possibly decorates, by wrapping, a Preparer. Decorators may affect the -// http.Request and pass it along or, first, pass the http.Request along then affect the result. -type PrepareDecorator func(Preparer) Preparer - -// CreatePreparer creates, decorates, and returns a Preparer. -// Without decorators, the returned Preparer returns the passed http.Request unmodified. -// Preparers are safe to share and re-use. -func CreatePreparer(decorators ...PrepareDecorator) Preparer { - return DecoratePreparer( - Preparer(PreparerFunc(func(r *http.Request) (*http.Request, error) { return r, nil })), - decorators...) -} - -// DecoratePreparer accepts a Preparer and a, possibly empty, set of PrepareDecorators, which it -// applies to the Preparer. Decorators are applied in the order received, but their affect upon the -// request depends on whether they are a pre-decorator (change the http.Request and then pass it -// along) or a post-decorator (pass the http.Request along and alter it on return). -func DecoratePreparer(p Preparer, decorators ...PrepareDecorator) Preparer { - for _, decorate := range decorators { - p = decorate(p) - } - return p -} - -// Prepare accepts an http.Request and a, possibly empty, set of PrepareDecorators. -// It creates a Preparer from the decorators which it then applies to the passed http.Request. -func Prepare(r *http.Request, decorators ...PrepareDecorator) (*http.Request, error) { - if r == nil { - return nil, NewError("autorest", "Prepare", "Invoked without an http.Request") - } - return CreatePreparer(decorators...).Prepare(r) -} - -// WithNothing returns a "do nothing" PrepareDecorator that makes no changes to the passed -// http.Request. -func WithNothing() PrepareDecorator { - return func(p Preparer) Preparer { - return PreparerFunc(func(r *http.Request) (*http.Request, error) { - return p.Prepare(r) - }) - } -} - -// WithHeader returns a PrepareDecorator that sets the specified HTTP header of the http.Request to -// the passed value. It canonicalizes the passed header name (via http.CanonicalHeaderKey) before -// adding the header. -func WithHeader(header string, value string) PrepareDecorator { - return func(p Preparer) Preparer { - return PreparerFunc(func(r *http.Request) (*http.Request, error) { - r, err := p.Prepare(r) - if err == nil { - setHeader(r, http.CanonicalHeaderKey(header), value) - } - return r, err - }) - } -} - -// WithHeaders returns a PrepareDecorator that sets the specified HTTP headers of the http.Request to -// the passed value. It canonicalizes the passed headers name (via http.CanonicalHeaderKey) before -// adding them. -func WithHeaders(headers map[string]interface{}) PrepareDecorator { - h := ensureValueStrings(headers) - return func(p Preparer) Preparer { - return PreparerFunc(func(r *http.Request) (*http.Request, error) { - r, err := p.Prepare(r) - if err == nil { - if r.Header == nil { - r.Header = make(http.Header) - } - - for name, value := range h { - r.Header.Set(http.CanonicalHeaderKey(name), value) - } - } - return r, err - }) - } -} - -// WithBearerAuthorization returns a PrepareDecorator that adds an HTTP Authorization header whose -// value is "Bearer " followed by the supplied token. -func WithBearerAuthorization(token string) PrepareDecorator { - return WithHeader(headerAuthorization, fmt.Sprintf("Bearer %s", token)) -} - -// AsContentType returns a PrepareDecorator that adds an HTTP Content-Type header whose value -// is the passed contentType. -func AsContentType(contentType string) PrepareDecorator { - return WithHeader(headerContentType, contentType) -} - -// WithUserAgent returns a PrepareDecorator that adds an HTTP User-Agent header whose value is the -// passed string. -func WithUserAgent(ua string) PrepareDecorator { - return WithHeader(headerUserAgent, ua) -} - -// AsFormURLEncoded returns a PrepareDecorator that adds an HTTP Content-Type header whose value is -// "application/x-www-form-urlencoded". -func AsFormURLEncoded() PrepareDecorator { - return AsContentType(mimeTypeFormPost) -} - -// AsJSON returns a PrepareDecorator that adds an HTTP Content-Type header whose value is -// "application/json". -func AsJSON() PrepareDecorator { - return AsContentType(mimeTypeJSON) -} - -// AsOctetStream returns a PrepareDecorator that adds the "application/octet-stream" Content-Type header. -func AsOctetStream() PrepareDecorator { - return AsContentType(mimeTypeOctetStream) -} - -// WithMethod returns a PrepareDecorator that sets the HTTP method of the passed request. The -// decorator does not validate that the passed method string is a known HTTP method. -func WithMethod(method string) PrepareDecorator { - return func(p Preparer) Preparer { - return PreparerFunc(func(r *http.Request) (*http.Request, error) { - r.Method = method - return p.Prepare(r) - }) - } -} - -// AsDelete returns a PrepareDecorator that sets the HTTP method to DELETE. -func AsDelete() PrepareDecorator { return WithMethod("DELETE") } - -// AsGet returns a PrepareDecorator that sets the HTTP method to GET. -func AsGet() PrepareDecorator { return WithMethod("GET") } - -// AsHead returns a PrepareDecorator that sets the HTTP method to HEAD. -func AsHead() PrepareDecorator { return WithMethod("HEAD") } - -// AsMerge returns a PrepareDecorator that sets the HTTP method to MERGE. -func AsMerge() PrepareDecorator { return WithMethod("MERGE") } - -// AsOptions returns a PrepareDecorator that sets the HTTP method to OPTIONS. -func AsOptions() PrepareDecorator { return WithMethod("OPTIONS") } - -// AsPatch returns a PrepareDecorator that sets the HTTP method to PATCH. -func AsPatch() PrepareDecorator { return WithMethod("PATCH") } - -// AsPost returns a PrepareDecorator that sets the HTTP method to POST. -func AsPost() PrepareDecorator { return WithMethod("POST") } - -// AsPut returns a PrepareDecorator that sets the HTTP method to PUT. -func AsPut() PrepareDecorator { return WithMethod("PUT") } - -// WithBaseURL returns a PrepareDecorator that populates the http.Request with a url.URL constructed -// from the supplied baseUrl. Query parameters will be encoded as required. -func WithBaseURL(baseURL string) PrepareDecorator { - return func(p Preparer) Preparer { - return PreparerFunc(func(r *http.Request) (*http.Request, error) { - r, err := p.Prepare(r) - if err == nil { - var u *url.URL - if u, err = url.Parse(baseURL); err != nil { - return r, err - } - if u.Scheme == "" { - return r, fmt.Errorf("autorest: No scheme detected in URL %s", baseURL) - } - if u.RawQuery != "" { - // handle unencoded semicolons (ideally the server would send them already encoded) - u.RawQuery = strings.Replace(u.RawQuery, ";", "%3B", -1) - q, err := url.ParseQuery(u.RawQuery) - if err != nil { - return r, err - } - u.RawQuery = q.Encode() - } - r.URL = u - } - return r, err - }) - } -} - -// WithBytes returns a PrepareDecorator that takes a list of bytes -// which passes the bytes directly to the body -func WithBytes(input *[]byte) PrepareDecorator { - return func(p Preparer) Preparer { - return PreparerFunc(func(r *http.Request) (*http.Request, error) { - r, err := p.Prepare(r) - if err == nil { - if input == nil { - return r, fmt.Errorf("Input Bytes was nil") - } - - r.ContentLength = int64(len(*input)) - r.Body = ioutil.NopCloser(bytes.NewReader(*input)) - } - return r, err - }) - } -} - -// WithCustomBaseURL returns a PrepareDecorator that replaces brace-enclosed keys within the -// request base URL (i.e., http.Request.URL) with the corresponding values from the passed map. -func WithCustomBaseURL(baseURL string, urlParameters map[string]interface{}) PrepareDecorator { - parameters := ensureValueStrings(urlParameters) - for key, value := range parameters { - baseURL = strings.Replace(baseURL, "{"+key+"}", value, -1) - } - return WithBaseURL(baseURL) -} - -// WithFormData returns a PrepareDecoratore that "URL encodes" (e.g., bar=baz&foo=quux) into the -// http.Request body. -func WithFormData(v url.Values) PrepareDecorator { - return func(p Preparer) Preparer { - return PreparerFunc(func(r *http.Request) (*http.Request, error) { - r, err := p.Prepare(r) - if err == nil { - s := v.Encode() - - setHeader(r, http.CanonicalHeaderKey(headerContentType), mimeTypeFormPost) - r.ContentLength = int64(len(s)) - r.Body = ioutil.NopCloser(strings.NewReader(s)) - } - return r, err - }) - } -} - -// WithMultiPartFormData returns a PrepareDecoratore that "URL encodes" (e.g., bar=baz&foo=quux) form parameters -// into the http.Request body. -func WithMultiPartFormData(formDataParameters map[string]interface{}) PrepareDecorator { - return func(p Preparer) Preparer { - return PreparerFunc(func(r *http.Request) (*http.Request, error) { - r, err := p.Prepare(r) - if err == nil { - var body bytes.Buffer - writer := multipart.NewWriter(&body) - for key, value := range formDataParameters { - if rc, ok := value.(io.ReadCloser); ok { - var fd io.Writer - if fd, err = writer.CreateFormFile(key, key); err != nil { - return r, err - } - if _, err = io.Copy(fd, rc); err != nil { - return r, err - } - } else { - if err = writer.WriteField(key, ensureValueString(value)); err != nil { - return r, err - } - } - } - if err = writer.Close(); err != nil { - return r, err - } - setHeader(r, http.CanonicalHeaderKey(headerContentType), writer.FormDataContentType()) - r.Body = ioutil.NopCloser(bytes.NewReader(body.Bytes())) - r.ContentLength = int64(body.Len()) - return r, err - } - return r, err - }) - } -} - -// WithFile returns a PrepareDecorator that sends file in request body. -func WithFile(f io.ReadCloser) PrepareDecorator { - return func(p Preparer) Preparer { - return PreparerFunc(func(r *http.Request) (*http.Request, error) { - r, err := p.Prepare(r) - if err == nil { - b, err := ioutil.ReadAll(f) - if err != nil { - return r, err - } - r.Body = ioutil.NopCloser(bytes.NewReader(b)) - r.ContentLength = int64(len(b)) - } - return r, err - }) - } -} - -// WithBool returns a PrepareDecorator that encodes the passed bool into the body of the request -// and sets the Content-Length header. -func WithBool(v bool) PrepareDecorator { - return WithString(fmt.Sprintf("%v", v)) -} - -// WithFloat32 returns a PrepareDecorator that encodes the passed float32 into the body of the -// request and sets the Content-Length header. -func WithFloat32(v float32) PrepareDecorator { - return WithString(fmt.Sprintf("%v", v)) -} - -// WithFloat64 returns a PrepareDecorator that encodes the passed float64 into the body of the -// request and sets the Content-Length header. -func WithFloat64(v float64) PrepareDecorator { - return WithString(fmt.Sprintf("%v", v)) -} - -// WithInt32 returns a PrepareDecorator that encodes the passed int32 into the body of the request -// and sets the Content-Length header. -func WithInt32(v int32) PrepareDecorator { - return WithString(fmt.Sprintf("%v", v)) -} - -// WithInt64 returns a PrepareDecorator that encodes the passed int64 into the body of the request -// and sets the Content-Length header. -func WithInt64(v int64) PrepareDecorator { - return WithString(fmt.Sprintf("%v", v)) -} - -// WithString returns a PrepareDecorator that encodes the passed string into the body of the request -// and sets the Content-Length header. -func WithString(v string) PrepareDecorator { - return func(p Preparer) Preparer { - return PreparerFunc(func(r *http.Request) (*http.Request, error) { - r, err := p.Prepare(r) - if err == nil { - r.ContentLength = int64(len(v)) - r.Body = ioutil.NopCloser(strings.NewReader(v)) - } - return r, err - }) - } -} - -// WithJSON returns a PrepareDecorator that encodes the data passed as JSON into the body of the -// request and sets the Content-Length header. -func WithJSON(v interface{}) PrepareDecorator { - return func(p Preparer) Preparer { - return PreparerFunc(func(r *http.Request) (*http.Request, error) { - r, err := p.Prepare(r) - if err == nil { - b, err := json.Marshal(v) - if err == nil { - r.ContentLength = int64(len(b)) - r.Body = ioutil.NopCloser(bytes.NewReader(b)) - } - } - return r, err - }) - } -} - -// WithXML returns a PrepareDecorator that encodes the data passed as XML into the body of the -// request and sets the Content-Length header. -func WithXML(v interface{}) PrepareDecorator { - return func(p Preparer) Preparer { - return PreparerFunc(func(r *http.Request) (*http.Request, error) { - r, err := p.Prepare(r) - if err == nil { - b, err := xml.Marshal(v) - if err == nil { - // we have to tack on an XML header - withHeader := xml.Header + string(b) - bytesWithHeader := []byte(withHeader) - - r.ContentLength = int64(len(bytesWithHeader)) - setHeader(r, headerContentLength, fmt.Sprintf("%d", len(bytesWithHeader))) - r.Body = ioutil.NopCloser(bytes.NewReader(bytesWithHeader)) - } - } - return r, err - }) - } -} - -// WithPath returns a PrepareDecorator that adds the supplied path to the request URL. If the path -// is absolute (that is, it begins with a "/"), it replaces the existing path. -func WithPath(path string) PrepareDecorator { - return func(p Preparer) Preparer { - return PreparerFunc(func(r *http.Request) (*http.Request, error) { - r, err := p.Prepare(r) - if err == nil { - if r.URL == nil { - return r, NewError("autorest", "WithPath", "Invoked with a nil URL") - } - if r.URL, err = parseURL(r.URL, path); err != nil { - return r, err - } - } - return r, err - }) - } -} - -// WithEscapedPathParameters returns a PrepareDecorator that replaces brace-enclosed keys within the -// request path (i.e., http.Request.URL.Path) with the corresponding values from the passed map. The -// values will be escaped (aka URL encoded) before insertion into the path. -func WithEscapedPathParameters(path string, pathParameters map[string]interface{}) PrepareDecorator { - parameters := escapeValueStrings(ensureValueStrings(pathParameters)) - return func(p Preparer) Preparer { - return PreparerFunc(func(r *http.Request) (*http.Request, error) { - r, err := p.Prepare(r) - if err == nil { - if r.URL == nil { - return r, NewError("autorest", "WithEscapedPathParameters", "Invoked with a nil URL") - } - for key, value := range parameters { - path = strings.Replace(path, "{"+key+"}", value, -1) - } - if r.URL, err = parseURL(r.URL, path); err != nil { - return r, err - } - } - return r, err - }) - } -} - -// WithPathParameters returns a PrepareDecorator that replaces brace-enclosed keys within the -// request path (i.e., http.Request.URL.Path) with the corresponding values from the passed map. -func WithPathParameters(path string, pathParameters map[string]interface{}) PrepareDecorator { - parameters := ensureValueStrings(pathParameters) - return func(p Preparer) Preparer { - return PreparerFunc(func(r *http.Request) (*http.Request, error) { - r, err := p.Prepare(r) - if err == nil { - if r.URL == nil { - return r, NewError("autorest", "WithPathParameters", "Invoked with a nil URL") - } - for key, value := range parameters { - path = strings.Replace(path, "{"+key+"}", value, -1) - } - - if r.URL, err = parseURL(r.URL, path); err != nil { - return r, err - } - } - return r, err - }) - } -} - -func parseURL(u *url.URL, path string) (*url.URL, error) { - p := strings.TrimRight(u.String(), "/") - if !strings.HasPrefix(path, "/") { - path = "/" + path - } - return url.Parse(p + path) -} - -// WithQueryParameters returns a PrepareDecorators that encodes and applies the query parameters -// given in the supplied map (i.e., key=value). -func WithQueryParameters(queryParameters map[string]interface{}) PrepareDecorator { - parameters := MapToValues(queryParameters) - return func(p Preparer) Preparer { - return PreparerFunc(func(r *http.Request) (*http.Request, error) { - r, err := p.Prepare(r) - if err == nil { - if r.URL == nil { - return r, NewError("autorest", "WithQueryParameters", "Invoked with a nil URL") - } - v := r.URL.Query() - for key, value := range parameters { - for i := range value { - d, err := url.QueryUnescape(value[i]) - if err != nil { - return r, err - } - value[i] = d - } - v[key] = value - } - r.URL.RawQuery = v.Encode() - } - return r, err - }) - } -} diff --git a/vendor/github.com/Azure/go-autorest/autorest/responder.go b/vendor/github.com/Azure/go-autorest/autorest/responder.go deleted file mode 100644 index 349e1963a..000000000 --- a/vendor/github.com/Azure/go-autorest/autorest/responder.go +++ /dev/null @@ -1,269 +0,0 @@ -package autorest - -// Copyright 2017 Microsoft Corporation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -import ( - "bytes" - "encoding/json" - "encoding/xml" - "fmt" - "io" - "io/ioutil" - "net/http" - "strings" -) - -// Responder is the interface that wraps the Respond method. -// -// Respond accepts and reacts to an http.Response. Implementations must ensure to not share or hold -// state since Responders may be shared and re-used. -type Responder interface { - Respond(*http.Response) error -} - -// ResponderFunc is a method that implements the Responder interface. -type ResponderFunc func(*http.Response) error - -// Respond implements the Responder interface on ResponderFunc. -func (rf ResponderFunc) Respond(r *http.Response) error { - return rf(r) -} - -// RespondDecorator takes and possibly decorates, by wrapping, a Responder. Decorators may react to -// the http.Response and pass it along or, first, pass the http.Response along then react. -type RespondDecorator func(Responder) Responder - -// CreateResponder creates, decorates, and returns a Responder. Without decorators, the returned -// Responder returns the passed http.Response unmodified. Responders may or may not be safe to share -// and re-used: It depends on the applied decorators. For example, a standard decorator that closes -// the response body is fine to share whereas a decorator that reads the body into a passed struct -// is not. -// -// To prevent memory leaks, ensure that at least one Responder closes the response body. -func CreateResponder(decorators ...RespondDecorator) Responder { - return DecorateResponder( - Responder(ResponderFunc(func(r *http.Response) error { return nil })), - decorators...) -} - -// DecorateResponder accepts a Responder and a, possibly empty, set of RespondDecorators, which it -// applies to the Responder. Decorators are applied in the order received, but their affect upon the -// request depends on whether they are a pre-decorator (react to the http.Response and then pass it -// along) or a post-decorator (pass the http.Response along and then react). -func DecorateResponder(r Responder, decorators ...RespondDecorator) Responder { - for _, decorate := range decorators { - r = decorate(r) - } - return r -} - -// Respond accepts an http.Response and a, possibly empty, set of RespondDecorators. -// It creates a Responder from the decorators it then applies to the passed http.Response. -func Respond(r *http.Response, decorators ...RespondDecorator) error { - if r == nil { - return nil - } - return CreateResponder(decorators...).Respond(r) -} - -// ByIgnoring returns a RespondDecorator that ignores the passed http.Response passing it unexamined -// to the next RespondDecorator. -func ByIgnoring() RespondDecorator { - return func(r Responder) Responder { - return ResponderFunc(func(resp *http.Response) error { - return r.Respond(resp) - }) - } -} - -// ByCopying copies the contents of the http.Response Body into the passed bytes.Buffer as -// the Body is read. -func ByCopying(b *bytes.Buffer) RespondDecorator { - return func(r Responder) Responder { - return ResponderFunc(func(resp *http.Response) error { - err := r.Respond(resp) - if err == nil && resp != nil && resp.Body != nil { - resp.Body = TeeReadCloser(resp.Body, b) - } - return err - }) - } -} - -// ByDiscardingBody returns a RespondDecorator that first invokes the passed Responder after which -// it copies the remaining bytes (if any) in the response body to ioutil.Discard. Since the passed -// Responder is invoked prior to discarding the response body, the decorator may occur anywhere -// within the set. -func ByDiscardingBody() RespondDecorator { - return func(r Responder) Responder { - return ResponderFunc(func(resp *http.Response) error { - err := r.Respond(resp) - if err == nil && resp != nil && resp.Body != nil { - if _, err := io.Copy(ioutil.Discard, resp.Body); err != nil { - return fmt.Errorf("Error discarding the response body: %v", err) - } - } - return err - }) - } -} - -// ByClosing returns a RespondDecorator that first invokes the passed Responder after which it -// closes the response body. Since the passed Responder is invoked prior to closing the response -// body, the decorator may occur anywhere within the set. -func ByClosing() RespondDecorator { - return func(r Responder) Responder { - return ResponderFunc(func(resp *http.Response) error { - err := r.Respond(resp) - if resp != nil && resp.Body != nil { - if err := resp.Body.Close(); err != nil { - return fmt.Errorf("Error closing the response body: %v", err) - } - } - return err - }) - } -} - -// ByClosingIfError returns a RespondDecorator that first invokes the passed Responder after which -// it closes the response if the passed Responder returns an error and the response body exists. -func ByClosingIfError() RespondDecorator { - return func(r Responder) Responder { - return ResponderFunc(func(resp *http.Response) error { - err := r.Respond(resp) - if err != nil && resp != nil && resp.Body != nil { - if err := resp.Body.Close(); err != nil { - return fmt.Errorf("Error closing the response body: %v", err) - } - } - return err - }) - } -} - -// ByUnmarshallingBytes returns a RespondDecorator that copies the Bytes returned in the -// response Body into the value pointed to by v. -func ByUnmarshallingBytes(v *[]byte) RespondDecorator { - return func(r Responder) Responder { - return ResponderFunc(func(resp *http.Response) error { - err := r.Respond(resp) - if err == nil { - bytes, errInner := ioutil.ReadAll(resp.Body) - if errInner != nil { - err = fmt.Errorf("Error occurred reading http.Response#Body - Error = '%v'", errInner) - } else { - *v = bytes - } - } - return err - }) - } -} - -// ByUnmarshallingJSON returns a RespondDecorator that decodes a JSON document returned in the -// response Body into the value pointed to by v. -func ByUnmarshallingJSON(v interface{}) RespondDecorator { - return func(r Responder) Responder { - return ResponderFunc(func(resp *http.Response) error { - err := r.Respond(resp) - if err == nil { - b, errInner := ioutil.ReadAll(resp.Body) - // Some responses might include a BOM, remove for successful unmarshalling - b = bytes.TrimPrefix(b, []byte("\xef\xbb\xbf")) - if errInner != nil { - err = fmt.Errorf("Error occurred reading http.Response#Body - Error = '%v'", errInner) - } else if len(strings.Trim(string(b), " ")) > 0 { - errInner = json.Unmarshal(b, v) - if errInner != nil { - err = fmt.Errorf("Error occurred unmarshalling JSON - Error = '%v' JSON = '%s'", errInner, string(b)) - } - } - } - return err - }) - } -} - -// ByUnmarshallingXML returns a RespondDecorator that decodes a XML document returned in the -// response Body into the value pointed to by v. -func ByUnmarshallingXML(v interface{}) RespondDecorator { - return func(r Responder) Responder { - return ResponderFunc(func(resp *http.Response) error { - err := r.Respond(resp) - if err == nil { - b, errInner := ioutil.ReadAll(resp.Body) - if errInner != nil { - err = fmt.Errorf("Error occurred reading http.Response#Body - Error = '%v'", errInner) - } else { - errInner = xml.Unmarshal(b, v) - if errInner != nil { - err = fmt.Errorf("Error occurred unmarshalling Xml - Error = '%v' Xml = '%s'", errInner, string(b)) - } - } - } - return err - }) - } -} - -// WithErrorUnlessStatusCode returns a RespondDecorator that emits an error unless the response -// StatusCode is among the set passed. On error, response body is fully read into a buffer and -// presented in the returned error, as well as in the response body. -func WithErrorUnlessStatusCode(codes ...int) RespondDecorator { - return func(r Responder) Responder { - return ResponderFunc(func(resp *http.Response) error { - err := r.Respond(resp) - if err == nil && !ResponseHasStatusCode(resp, codes...) { - derr := NewErrorWithResponse("autorest", "WithErrorUnlessStatusCode", resp, "%v %v failed with %s", - resp.Request.Method, - resp.Request.URL, - resp.Status) - if resp.Body != nil { - defer resp.Body.Close() - b, _ := ioutil.ReadAll(resp.Body) - derr.ServiceError = b - resp.Body = ioutil.NopCloser(bytes.NewReader(b)) - } - err = derr - } - return err - }) - } -} - -// WithErrorUnlessOK returns a RespondDecorator that emits an error if the response StatusCode is -// anything other than HTTP 200. -func WithErrorUnlessOK() RespondDecorator { - return WithErrorUnlessStatusCode(http.StatusOK) -} - -// ExtractHeader extracts all values of the specified header from the http.Response. It returns an -// empty string slice if the passed http.Response is nil or the header does not exist. -func ExtractHeader(header string, resp *http.Response) []string { - if resp != nil && resp.Header != nil { - return resp.Header[http.CanonicalHeaderKey(header)] - } - return nil -} - -// ExtractHeaderValue extracts the first value of the specified header from the http.Response. It -// returns an empty string if the passed http.Response is nil or the header does not exist. -func ExtractHeaderValue(header string, resp *http.Response) string { - h := ExtractHeader(header, resp) - if len(h) > 0 { - return h[0] - } - return "" -} diff --git a/vendor/github.com/Azure/go-autorest/autorest/retriablerequest.go b/vendor/github.com/Azure/go-autorest/autorest/retriablerequest.go deleted file mode 100644 index fa11dbed7..000000000 --- a/vendor/github.com/Azure/go-autorest/autorest/retriablerequest.go +++ /dev/null @@ -1,52 +0,0 @@ -package autorest - -// Copyright 2017 Microsoft Corporation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -import ( - "bytes" - "io" - "io/ioutil" - "net/http" -) - -// NewRetriableRequest returns a wrapper around an HTTP request that support retry logic. -func NewRetriableRequest(req *http.Request) *RetriableRequest { - return &RetriableRequest{req: req} -} - -// Request returns the wrapped HTTP request. -func (rr *RetriableRequest) Request() *http.Request { - return rr.req -} - -func (rr *RetriableRequest) prepareFromByteReader() (err error) { - // fall back to making a copy (only do this once) - b := []byte{} - if rr.req.ContentLength > 0 { - b = make([]byte, rr.req.ContentLength) - _, err = io.ReadFull(rr.req.Body, b) - if err != nil { - return err - } - } else { - b, err = ioutil.ReadAll(rr.req.Body) - if err != nil { - return err - } - } - rr.br = bytes.NewReader(b) - rr.req.Body = ioutil.NopCloser(rr.br) - return err -} diff --git a/vendor/github.com/Azure/go-autorest/autorest/retriablerequest_1.7.go b/vendor/github.com/Azure/go-autorest/autorest/retriablerequest_1.7.go deleted file mode 100644 index 4c87030e8..000000000 --- a/vendor/github.com/Azure/go-autorest/autorest/retriablerequest_1.7.go +++ /dev/null @@ -1,55 +0,0 @@ -//go:build !go1.8 -// +build !go1.8 - -// Copyright 2017 Microsoft Corporation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package autorest - -import ( - "bytes" - "io/ioutil" - "net/http" -) - -// RetriableRequest provides facilities for retrying an HTTP request. -type RetriableRequest struct { - req *http.Request - br *bytes.Reader -} - -// Prepare signals that the request is about to be sent. -func (rr *RetriableRequest) Prepare() (err error) { - // preserve the request body; this is to support retry logic as - // the underlying transport will always close the reqeust body - if rr.req.Body != nil { - if rr.br != nil { - _, err = rr.br.Seek(0, 0 /*io.SeekStart*/) - rr.req.Body = ioutil.NopCloser(rr.br) - } - if err != nil { - return err - } - if rr.br == nil { - // fall back to making a copy (only do this once) - err = rr.prepareFromByteReader() - } - } - return err -} - -func removeRequestBody(req *http.Request) { - req.Body = nil - req.ContentLength = 0 -} diff --git a/vendor/github.com/Azure/go-autorest/autorest/retriablerequest_1.8.go b/vendor/github.com/Azure/go-autorest/autorest/retriablerequest_1.8.go deleted file mode 100644 index 05847c08b..000000000 --- a/vendor/github.com/Azure/go-autorest/autorest/retriablerequest_1.8.go +++ /dev/null @@ -1,67 +0,0 @@ -//go:build go1.8 -// +build go1.8 - -// Copyright 2017 Microsoft Corporation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package autorest - -import ( - "bytes" - "io" - "io/ioutil" - "net/http" -) - -// RetriableRequest provides facilities for retrying an HTTP request. -type RetriableRequest struct { - req *http.Request - rc io.ReadCloser - br *bytes.Reader -} - -// Prepare signals that the request is about to be sent. -func (rr *RetriableRequest) Prepare() (err error) { - // preserve the request body; this is to support retry logic as - // the underlying transport will always close the reqeust body - if rr.req.Body != nil { - if rr.rc != nil { - rr.req.Body = rr.rc - } else if rr.br != nil { - _, err = rr.br.Seek(0, io.SeekStart) - rr.req.Body = ioutil.NopCloser(rr.br) - } - if err != nil { - return err - } - if rr.req.GetBody != nil { - // this will allow us to preserve the body without having to - // make a copy. note we need to do this on each iteration - rr.rc, err = rr.req.GetBody() - if err != nil { - return err - } - } else if rr.br == nil { - // fall back to making a copy (only do this once) - err = rr.prepareFromByteReader() - } - } - return err -} - -func removeRequestBody(req *http.Request) { - req.Body = nil - req.GetBody = nil - req.ContentLength = 0 -} diff --git a/vendor/github.com/Azure/go-autorest/autorest/sender.go b/vendor/github.com/Azure/go-autorest/autorest/sender.go deleted file mode 100644 index 118de8141..000000000 --- a/vendor/github.com/Azure/go-autorest/autorest/sender.go +++ /dev/null @@ -1,458 +0,0 @@ -package autorest - -// Copyright 2017 Microsoft Corporation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -import ( - "context" - "crypto/tls" - "fmt" - "log" - "math" - "net" - "net/http" - "net/http/cookiejar" - "strconv" - "sync" - "time" - - "github.com/Azure/go-autorest/logger" - "github.com/Azure/go-autorest/tracing" -) - -// there is one sender per TLS renegotiation type, i.e. count of tls.RenegotiationSupport enums -const defaultSendersCount = 3 - -type defaultSender struct { - sender Sender - init *sync.Once -} - -// each type of sender will be created on demand in sender() -var defaultSenders [defaultSendersCount]defaultSender - -func init() { - for i := 0; i < defaultSendersCount; i++ { - defaultSenders[i].init = &sync.Once{} - } -} - -// used as a key type in context.WithValue() -type ctxSendDecorators struct{} - -// WithSendDecorators adds the specified SendDecorators to the provided context. -// If no SendDecorators are provided the context is unchanged. -func WithSendDecorators(ctx context.Context, sendDecorator []SendDecorator) context.Context { - if len(sendDecorator) == 0 { - return ctx - } - return context.WithValue(ctx, ctxSendDecorators{}, sendDecorator) -} - -// GetSendDecorators returns the SendDecorators in the provided context or the provided default SendDecorators. -func GetSendDecorators(ctx context.Context, defaultSendDecorators ...SendDecorator) []SendDecorator { - inCtx := ctx.Value(ctxSendDecorators{}) - if sd, ok := inCtx.([]SendDecorator); ok { - return sd - } - return defaultSendDecorators -} - -// Sender is the interface that wraps the Do method to send HTTP requests. -// -// The standard http.Client conforms to this interface. -type Sender interface { - Do(*http.Request) (*http.Response, error) -} - -// SenderFunc is a method that implements the Sender interface. -type SenderFunc func(*http.Request) (*http.Response, error) - -// Do implements the Sender interface on SenderFunc. -func (sf SenderFunc) Do(r *http.Request) (*http.Response, error) { - return sf(r) -} - -// SendDecorator takes and possibly decorates, by wrapping, a Sender. Decorators may affect the -// http.Request and pass it along or, first, pass the http.Request along then react to the -// http.Response result. -type SendDecorator func(Sender) Sender - -// CreateSender creates, decorates, and returns, as a Sender, the default http.Client. -func CreateSender(decorators ...SendDecorator) Sender { - return DecorateSender(sender(tls.RenegotiateNever), decorators...) -} - -// DecorateSender accepts a Sender and a, possibly empty, set of SendDecorators, which is applies to -// the Sender. Decorators are applied in the order received, but their affect upon the request -// depends on whether they are a pre-decorator (change the http.Request and then pass it along) or a -// post-decorator (pass the http.Request along and react to the results in http.Response). -func DecorateSender(s Sender, decorators ...SendDecorator) Sender { - for _, decorate := range decorators { - s = decorate(s) - } - return s -} - -// Send sends, by means of the default http.Client, the passed http.Request, returning the -// http.Response and possible error. It also accepts a, possibly empty, set of SendDecorators which -// it will apply the http.Client before invoking the Do method. -// -// Send is a convenience method and not recommended for production. Advanced users should use -// SendWithSender, passing and sharing their own Sender (e.g., instance of http.Client). -// -// Send will not poll or retry requests. -func Send(r *http.Request, decorators ...SendDecorator) (*http.Response, error) { - return SendWithSender(sender(tls.RenegotiateNever), r, decorators...) -} - -// SendWithSender sends the passed http.Request, through the provided Sender, returning the -// http.Response and possible error. It also accepts a, possibly empty, set of SendDecorators which -// it will apply the http.Client before invoking the Do method. -// -// SendWithSender will not poll or retry requests. -func SendWithSender(s Sender, r *http.Request, decorators ...SendDecorator) (*http.Response, error) { - return DecorateSender(s, decorators...).Do(r) -} - -func sender(renengotiation tls.RenegotiationSupport) Sender { - // note that we can't init defaultSenders in init() since it will - // execute before calling code has had a chance to enable tracing - defaultSenders[renengotiation].init.Do(func() { - // copied from http.DefaultTransport with a TLS minimum version. - transport := &http.Transport{ - Proxy: http.ProxyFromEnvironment, - DialContext: (&net.Dialer{ - Timeout: 30 * time.Second, - KeepAlive: 30 * time.Second, - }).DialContext, - ForceAttemptHTTP2: true, - MaxIdleConns: 100, - IdleConnTimeout: 90 * time.Second, - TLSHandshakeTimeout: 10 * time.Second, - ExpectContinueTimeout: 1 * time.Second, - TLSClientConfig: &tls.Config{ - MinVersion: tls.VersionTLS12, - Renegotiation: renengotiation, - }, - } - var roundTripper http.RoundTripper = transport - if tracing.IsEnabled() { - roundTripper = tracing.NewTransport(transport) - } - j, _ := cookiejar.New(nil) - defaultSenders[renengotiation].sender = &http.Client{Jar: j, Transport: roundTripper} - }) - return defaultSenders[renengotiation].sender -} - -// AfterDelay returns a SendDecorator that delays for the passed time.Duration before -// invoking the Sender. The delay may be terminated by closing the optional channel on the -// http.Request. If canceled, no further Senders are invoked. -func AfterDelay(d time.Duration) SendDecorator { - return func(s Sender) Sender { - return SenderFunc(func(r *http.Request) (*http.Response, error) { - if !DelayForBackoff(d, 0, r.Context().Done()) { - return nil, fmt.Errorf("autorest: AfterDelay canceled before full delay") - } - return s.Do(r) - }) - } -} - -// AsIs returns a SendDecorator that invokes the passed Sender without modifying the http.Request. -func AsIs() SendDecorator { - return func(s Sender) Sender { - return SenderFunc(func(r *http.Request) (*http.Response, error) { - return s.Do(r) - }) - } -} - -// DoCloseIfError returns a SendDecorator that first invokes the passed Sender after which -// it closes the response if the passed Sender returns an error and the response body exists. -func DoCloseIfError() SendDecorator { - return func(s Sender) Sender { - return SenderFunc(func(r *http.Request) (*http.Response, error) { - resp, err := s.Do(r) - if err != nil { - Respond(resp, ByDiscardingBody(), ByClosing()) - } - return resp, err - }) - } -} - -// DoErrorIfStatusCode returns a SendDecorator that emits an error if the response StatusCode is -// among the set passed. Since these are artificial errors, the response body may still require -// closing. -func DoErrorIfStatusCode(codes ...int) SendDecorator { - return func(s Sender) Sender { - return SenderFunc(func(r *http.Request) (*http.Response, error) { - resp, err := s.Do(r) - if err == nil && ResponseHasStatusCode(resp, codes...) { - err = NewErrorWithResponse("autorest", "DoErrorIfStatusCode", resp, "%v %v failed with %s", - resp.Request.Method, - resp.Request.URL, - resp.Status) - } - return resp, err - }) - } -} - -// DoErrorUnlessStatusCode returns a SendDecorator that emits an error unless the response -// StatusCode is among the set passed. Since these are artificial errors, the response body -// may still require closing. -func DoErrorUnlessStatusCode(codes ...int) SendDecorator { - return func(s Sender) Sender { - return SenderFunc(func(r *http.Request) (*http.Response, error) { - resp, err := s.Do(r) - if err == nil && !ResponseHasStatusCode(resp, codes...) { - err = NewErrorWithResponse("autorest", "DoErrorUnlessStatusCode", resp, "%v %v failed with %s", - resp.Request.Method, - resp.Request.URL, - resp.Status) - } - return resp, err - }) - } -} - -// DoPollForStatusCodes returns a SendDecorator that polls if the http.Response contains one of the -// passed status codes. It expects the http.Response to contain a Location header providing the -// URL at which to poll (using GET) and will poll until the time passed is equal to or greater than -// the supplied duration. It will delay between requests for the duration specified in the -// RetryAfter header or, if the header is absent, the passed delay. Polling may be canceled by -// closing the optional channel on the http.Request. -func DoPollForStatusCodes(duration time.Duration, delay time.Duration, codes ...int) SendDecorator { - return func(s Sender) Sender { - return SenderFunc(func(r *http.Request) (resp *http.Response, err error) { - resp, err = s.Do(r) - - if err == nil && ResponseHasStatusCode(resp, codes...) { - r, err = NewPollingRequestWithContext(r.Context(), resp) - - for err == nil && ResponseHasStatusCode(resp, codes...) { - Respond(resp, - ByDiscardingBody(), - ByClosing()) - resp, err = SendWithSender(s, r, - AfterDelay(GetRetryAfter(resp, delay))) - } - } - - return resp, err - }) - } -} - -// DoRetryForAttempts returns a SendDecorator that retries a failed request for up to the specified -// number of attempts, exponentially backing off between requests using the supplied backoff -// time.Duration (which may be zero). Retrying may be canceled by closing the optional channel on -// the http.Request. -func DoRetryForAttempts(attempts int, backoff time.Duration) SendDecorator { - return func(s Sender) Sender { - return SenderFunc(func(r *http.Request) (resp *http.Response, err error) { - rr := NewRetriableRequest(r) - for attempt := 0; attempt < attempts; attempt++ { - err = rr.Prepare() - if err != nil { - return resp, err - } - DrainResponseBody(resp) - resp, err = s.Do(rr.Request()) - if err == nil { - return resp, err - } - logger.Instance.Writef(logger.LogError, "DoRetryForAttempts: received error for attempt %d: %v\n", attempt+1, err) - if !DelayForBackoff(backoff, attempt, r.Context().Done()) { - return nil, r.Context().Err() - } - } - return resp, err - }) - } -} - -// Count429AsRetry indicates that a 429 response should be included as a retry attempt. -var Count429AsRetry = true - -// Max429Delay is the maximum duration to wait between retries on a 429 if no Retry-After header was received. -var Max429Delay time.Duration - -// DoRetryForStatusCodes returns a SendDecorator that retries for specified statusCodes for up to the specified -// number of attempts, exponentially backing off between requests using the supplied backoff -// time.Duration (which may be zero). Retrying may be canceled by cancelling the context on the http.Request. -// NOTE: Code http.StatusTooManyRequests (429) will *not* be counted against the number of attempts. -func DoRetryForStatusCodes(attempts int, backoff time.Duration, codes ...int) SendDecorator { - return func(s Sender) Sender { - return SenderFunc(func(r *http.Request) (*http.Response, error) { - return doRetryForStatusCodesImpl(s, r, Count429AsRetry, attempts, backoff, 0, codes...) - }) - } -} - -// DoRetryForStatusCodesWithCap returns a SendDecorator that retries for specified statusCodes for up to the -// specified number of attempts, exponentially backing off between requests using the supplied backoff -// time.Duration (which may be zero). To cap the maximum possible delay between iterations specify a value greater -// than zero for cap. Retrying may be canceled by cancelling the context on the http.Request. -func DoRetryForStatusCodesWithCap(attempts int, backoff, cap time.Duration, codes ...int) SendDecorator { - return func(s Sender) Sender { - return SenderFunc(func(r *http.Request) (*http.Response, error) { - return doRetryForStatusCodesImpl(s, r, Count429AsRetry, attempts, backoff, cap, codes...) - }) - } -} - -func doRetryForStatusCodesImpl(s Sender, r *http.Request, count429 bool, attempts int, backoff, cap time.Duration, codes ...int) (resp *http.Response, err error) { - rr := NewRetriableRequest(r) - // Increment to add the first call (attempts denotes number of retries) - for attempt, delayCount := 0, 0; attempt < attempts+1; { - err = rr.Prepare() - if err != nil { - return - } - DrainResponseBody(resp) - resp, err = s.Do(rr.Request()) - // we want to retry if err is not nil (e.g. transient network failure). note that for failed authentication - // resp and err will both have a value, so in this case we don't want to retry as it will never succeed. - if err == nil && !ResponseHasStatusCode(resp, codes...) || IsTokenRefreshError(err) { - return resp, err - } - if err != nil { - logger.Instance.Writef(logger.LogError, "DoRetryForStatusCodes: received error for attempt %d: %v\n", attempt+1, err) - } - delayed := DelayWithRetryAfter(resp, r.Context().Done()) - // if this was a 429 set the delay cap as specified. - // applicable only in the absence of a retry-after header. - if resp != nil && resp.StatusCode == http.StatusTooManyRequests { - cap = Max429Delay - } - if !delayed && !DelayForBackoffWithCap(backoff, cap, delayCount, r.Context().Done()) { - return resp, r.Context().Err() - } - // when count429 == false don't count a 429 against the number - // of attempts so that we continue to retry until it succeeds - if count429 || (resp == nil || resp.StatusCode != http.StatusTooManyRequests) { - attempt++ - } - // delay count is tracked separately from attempts to - // ensure that 429 participates in exponential back-off - delayCount++ - } - return resp, err -} - -// DelayWithRetryAfter invokes time.After for the duration specified in the "Retry-After" header. -// The value of Retry-After can be either the number of seconds or a date in RFC1123 format. -// The function returns true after successfully waiting for the specified duration. If there is -// no Retry-After header or the wait is cancelled the return value is false. -func DelayWithRetryAfter(resp *http.Response, cancel <-chan struct{}) bool { - if resp == nil { - return false - } - var dur time.Duration - ra := resp.Header.Get("Retry-After") - if retryAfter, _ := strconv.Atoi(ra); retryAfter > 0 { - dur = time.Duration(retryAfter) * time.Second - } else if t, err := time.Parse(time.RFC1123, ra); err == nil { - dur = t.Sub(time.Now()) - } - if dur > 0 { - select { - case <-time.After(dur): - return true - case <-cancel: - return false - } - } - return false -} - -// DoRetryForDuration returns a SendDecorator that retries the request until the total time is equal -// to or greater than the specified duration, exponentially backing off between requests using the -// supplied backoff time.Duration (which may be zero). Retrying may be canceled by closing the -// optional channel on the http.Request. -func DoRetryForDuration(d time.Duration, backoff time.Duration) SendDecorator { - return func(s Sender) Sender { - return SenderFunc(func(r *http.Request) (resp *http.Response, err error) { - rr := NewRetriableRequest(r) - end := time.Now().Add(d) - for attempt := 0; time.Now().Before(end); attempt++ { - err = rr.Prepare() - if err != nil { - return resp, err - } - DrainResponseBody(resp) - resp, err = s.Do(rr.Request()) - if err == nil { - return resp, err - } - logger.Instance.Writef(logger.LogError, "DoRetryForDuration: received error for attempt %d: %v\n", attempt+1, err) - if !DelayForBackoff(backoff, attempt, r.Context().Done()) { - return nil, r.Context().Err() - } - } - return resp, err - }) - } -} - -// WithLogging returns a SendDecorator that implements simple before and after logging of the -// request. -func WithLogging(logger *log.Logger) SendDecorator { - return func(s Sender) Sender { - return SenderFunc(func(r *http.Request) (*http.Response, error) { - logger.Printf("Sending %s %s", r.Method, r.URL) - resp, err := s.Do(r) - if err != nil { - logger.Printf("%s %s received error '%v'", r.Method, r.URL, err) - } else { - logger.Printf("%s %s received %s", r.Method, r.URL, resp.Status) - } - return resp, err - }) - } -} - -// DelayForBackoff invokes time.After for the supplied backoff duration raised to the power of -// passed attempt (i.e., an exponential backoff delay). Backoff duration is in seconds and can set -// to zero for no delay. The delay may be canceled by closing the passed channel. If terminated early, -// returns false. -// Note: Passing attempt 1 will result in doubling "backoff" duration. Treat this as a zero-based attempt -// count. -func DelayForBackoff(backoff time.Duration, attempt int, cancel <-chan struct{}) bool { - return DelayForBackoffWithCap(backoff, 0, attempt, cancel) -} - -// DelayForBackoffWithCap invokes time.After for the supplied backoff duration raised to the power of -// passed attempt (i.e., an exponential backoff delay). Backoff duration is in seconds and can set -// to zero for no delay. To cap the maximum possible delay specify a value greater than zero for cap. -// The delay may be canceled by closing the passed channel. If terminated early, returns false. -// Note: Passing attempt 1 will result in doubling "backoff" duration. Treat this as a zero-based attempt -// count. -func DelayForBackoffWithCap(backoff, cap time.Duration, attempt int, cancel <-chan struct{}) bool { - d := time.Duration(backoff.Seconds()*math.Pow(2, float64(attempt))) * time.Second - if cap > 0 && d > cap { - d = cap - } - logger.Instance.Writef(logger.LogInfo, "DelayForBackoffWithCap: sleeping for %s\n", d) - select { - case <-time.After(d): - return true - case <-cancel: - return false - } -} diff --git a/vendor/github.com/Azure/go-autorest/autorest/utility.go b/vendor/github.com/Azure/go-autorest/autorest/utility.go deleted file mode 100644 index 3467b8fa6..000000000 --- a/vendor/github.com/Azure/go-autorest/autorest/utility.go +++ /dev/null @@ -1,232 +0,0 @@ -package autorest - -// Copyright 2017 Microsoft Corporation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -import ( - "bytes" - "encoding/json" - "encoding/xml" - "fmt" - "io" - "io/ioutil" - "net" - "net/http" - "net/url" - "reflect" - "strings" -) - -// EncodedAs is a series of constants specifying various data encodings -type EncodedAs string - -const ( - // EncodedAsJSON states that data is encoded as JSON - EncodedAsJSON EncodedAs = "JSON" - - // EncodedAsXML states that data is encoded as Xml - EncodedAsXML EncodedAs = "XML" -) - -// Decoder defines the decoding method json.Decoder and xml.Decoder share -type Decoder interface { - Decode(v interface{}) error -} - -// NewDecoder creates a new decoder appropriate to the passed encoding. -// encodedAs specifies the type of encoding and r supplies the io.Reader containing the -// encoded data. -func NewDecoder(encodedAs EncodedAs, r io.Reader) Decoder { - if encodedAs == EncodedAsJSON { - return json.NewDecoder(r) - } else if encodedAs == EncodedAsXML { - return xml.NewDecoder(r) - } - return nil -} - -// CopyAndDecode decodes the data from the passed io.Reader while making a copy. Having a copy -// is especially useful if there is a chance the data will fail to decode. -// encodedAs specifies the expected encoding, r provides the io.Reader to the data, and v -// is the decoding destination. -func CopyAndDecode(encodedAs EncodedAs, r io.Reader, v interface{}) (bytes.Buffer, error) { - b := bytes.Buffer{} - return b, NewDecoder(encodedAs, io.TeeReader(r, &b)).Decode(v) -} - -// TeeReadCloser returns a ReadCloser that writes to w what it reads from rc. -// It utilizes io.TeeReader to copy the data read and has the same behavior when reading. -// Further, when it is closed, it ensures that rc is closed as well. -func TeeReadCloser(rc io.ReadCloser, w io.Writer) io.ReadCloser { - return &teeReadCloser{rc, io.TeeReader(rc, w)} -} - -type teeReadCloser struct { - rc io.ReadCloser - r io.Reader -} - -func (t *teeReadCloser) Read(p []byte) (int, error) { - return t.r.Read(p) -} - -func (t *teeReadCloser) Close() error { - return t.rc.Close() -} - -func containsInt(ints []int, n int) bool { - for _, i := range ints { - if i == n { - return true - } - } - return false -} - -func escapeValueStrings(m map[string]string) map[string]string { - for key, value := range m { - m[key] = url.QueryEscape(value) - } - return m -} - -func ensureValueStrings(mapOfInterface map[string]interface{}) map[string]string { - mapOfStrings := make(map[string]string) - for key, value := range mapOfInterface { - mapOfStrings[key] = ensureValueString(value) - } - return mapOfStrings -} - -func ensureValueString(value interface{}) string { - if value == nil { - return "" - } - switch v := value.(type) { - case string: - return v - case []byte: - return string(v) - default: - return fmt.Sprintf("%v", v) - } -} - -// MapToValues method converts map[string]interface{} to url.Values. -func MapToValues(m map[string]interface{}) url.Values { - v := url.Values{} - for key, value := range m { - x := reflect.ValueOf(value) - if x.Kind() == reflect.Array || x.Kind() == reflect.Slice { - for i := 0; i < x.Len(); i++ { - v.Add(key, ensureValueString(x.Index(i))) - } - } else { - v.Add(key, ensureValueString(value)) - } - } - return v -} - -// AsStringSlice method converts interface{} to []string. -// s must be of type slice or array or an error is returned. -// Each element of s will be converted to its string representation. -func AsStringSlice(s interface{}) ([]string, error) { - v := reflect.ValueOf(s) - if v.Kind() != reflect.Slice && v.Kind() != reflect.Array { - return nil, NewError("autorest", "AsStringSlice", "the value's type is not a slice or array.") - } - stringSlice := make([]string, 0, v.Len()) - - for i := 0; i < v.Len(); i++ { - stringSlice = append(stringSlice, fmt.Sprintf("%v", v.Index(i))) - } - return stringSlice, nil -} - -// String method converts interface v to string. If interface is a list, it -// joins list elements using the separator. Note that only sep[0] will be used for -// joining if any separator is specified. -func String(v interface{}, sep ...string) string { - if len(sep) == 0 { - return ensureValueString(v) - } - stringSlice, ok := v.([]string) - if ok == false { - var err error - stringSlice, err = AsStringSlice(v) - if err != nil { - panic(fmt.Sprintf("autorest: Couldn't convert value to a string %s.", err)) - } - } - return ensureValueString(strings.Join(stringSlice, sep[0])) -} - -// Encode method encodes url path and query parameters. -func Encode(location string, v interface{}, sep ...string) string { - s := String(v, sep...) - switch strings.ToLower(location) { - case "path": - return pathEscape(s) - case "query": - return queryEscape(s) - default: - return s - } -} - -func pathEscape(s string) string { - return strings.Replace(url.QueryEscape(s), "+", "%20", -1) -} - -func queryEscape(s string) string { - return url.QueryEscape(s) -} - -// ChangeToGet turns the specified http.Request into a GET (it assumes it wasn't). -// This is mainly useful for long-running operations that use the Azure-AsyncOperation -// header, so we change the initial PUT into a GET to retrieve the final result. -func ChangeToGet(req *http.Request) *http.Request { - req.Method = "GET" - req.Body = nil - req.ContentLength = 0 - req.Header.Del("Content-Length") - return req -} - -// IsTemporaryNetworkError returns true if the specified error is a temporary network error or false -// if it's not. If the error doesn't implement the net.Error interface the return value is true. -func IsTemporaryNetworkError(err error) bool { - if netErr, ok := err.(net.Error); !ok || (ok && netErr.Temporary()) { - return true - } - return false -} - -// DrainResponseBody reads the response body then closes it. -func DrainResponseBody(resp *http.Response) error { - if resp != nil && resp.Body != nil { - _, err := io.Copy(ioutil.Discard, resp.Body) - resp.Body.Close() - return err - } - return nil -} - -func setHeader(r *http.Request, key, value string) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set(key, value) -} diff --git a/vendor/github.com/Azure/go-autorest/autorest/utility_1.13.go b/vendor/github.com/Azure/go-autorest/autorest/utility_1.13.go deleted file mode 100644 index 3133fcc08..000000000 --- a/vendor/github.com/Azure/go-autorest/autorest/utility_1.13.go +++ /dev/null @@ -1,30 +0,0 @@ -//go:build go1.13 -// +build go1.13 - -// Copyright 2017 Microsoft Corporation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package autorest - -import ( - "errors" - - "github.com/Azure/go-autorest/autorest/adal" -) - -// IsTokenRefreshError returns true if the specified error implements the TokenRefreshError interface. -func IsTokenRefreshError(err error) bool { - var tre adal.TokenRefreshError - return errors.As(err, &tre) -} diff --git a/vendor/github.com/Azure/go-autorest/autorest/utility_legacy.go b/vendor/github.com/Azure/go-autorest/autorest/utility_legacy.go deleted file mode 100644 index 851e152db..000000000 --- a/vendor/github.com/Azure/go-autorest/autorest/utility_legacy.go +++ /dev/null @@ -1,32 +0,0 @@ -//go:build !go1.13 -// +build !go1.13 - -// Copyright 2017 Microsoft Corporation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package autorest - -import "github.com/Azure/go-autorest/autorest/adal" - -// IsTokenRefreshError returns true if the specified error implements the TokenRefreshError -// interface. If err is a DetailedError it will walk the chain of Original errors. -func IsTokenRefreshError(err error) bool { - if _, ok := err.(adal.TokenRefreshError); ok { - return true - } - if de, ok := err.(DetailedError); ok { - return IsTokenRefreshError(de.Original) - } - return false -} diff --git a/vendor/github.com/Azure/go-autorest/autorest/version.go b/vendor/github.com/Azure/go-autorest/autorest/version.go deleted file mode 100644 index 713e23581..000000000 --- a/vendor/github.com/Azure/go-autorest/autorest/version.go +++ /dev/null @@ -1,41 +0,0 @@ -package autorest - -// Copyright 2017 Microsoft Corporation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -import ( - "fmt" - "runtime" -) - -const number = "v14.2.1" - -var ( - userAgent = fmt.Sprintf("Go/%s (%s-%s) go-autorest/%s", - runtime.Version(), - runtime.GOARCH, - runtime.GOOS, - number, - ) -) - -// UserAgent returns a string containing the Go version, system architecture and OS, and the go-autorest version. -func UserAgent() string { - return userAgent -} - -// Version returns the semantic version (see http://semver.org). -func Version() string { - return number -} diff --git a/vendor/github.com/Azure/go-autorest/azure-pipelines.yml b/vendor/github.com/Azure/go-autorest/azure-pipelines.yml deleted file mode 100644 index 6fb8404fd..000000000 --- a/vendor/github.com/Azure/go-autorest/azure-pipelines.yml +++ /dev/null @@ -1,105 +0,0 @@ -variables: - GOPATH: '$(system.defaultWorkingDirectory)/work' - sdkPath: '$(GOPATH)/src/github.com/$(build.repository.name)' - -jobs: - - job: 'goautorest' - displayName: 'Run go-autorest CI Checks' - - strategy: - matrix: - Linux_Go113: - vm.image: 'ubuntu-18.04' - go.version: '1.13' - Linux_Go114: - vm.image: 'ubuntu-18.04' - go.version: '1.14' - - pool: - vmImage: '$(vm.image)' - - steps: - - task: GoTool@0 - inputs: - version: '$(go.version)' - displayName: "Select Go Version" - - - script: | - set -e - mkdir -p '$(GOPATH)/bin' - mkdir -p '$(sdkPath)' - shopt -s extglob - mv !(work) '$(sdkPath)' - echo '##vso[task.prependpath]$(GOPATH)/bin' - displayName: 'Create Go Workspace' - - - script: | - set -e - curl -sSL https://raw.githubusercontent.com/golang/dep/master/install.sh | sh - dep ensure -v - go install ./vendor/golang.org/x/lint/golint - go get github.com/jstemmer/go-junit-report - go get github.com/axw/gocov/gocov - go get github.com/AlekSi/gocov-xml - go get -u github.com/matm/gocov-html - workingDirectory: '$(sdkPath)' - displayName: 'Install Dependencies' - - - script: | - go vet ./autorest/... - go vet ./logger/... - go vet ./tracing/... - workingDirectory: '$(sdkPath)' - displayName: 'Vet' - - - script: | - go build -v ./autorest/... - go build -v ./logger/... - go build -v ./tracing/... - workingDirectory: '$(sdkPath)' - displayName: 'Build' - - - script: | - set -e - go test -race -v -coverprofile=coverage.txt -covermode atomic ./autorest/... ./logger/... ./tracing/... 2>&1 | go-junit-report > report.xml - gocov convert coverage.txt > coverage.json - gocov-xml < coverage.json > coverage.xml - gocov-html < coverage.json > coverage.html - workingDirectory: '$(sdkPath)' - displayName: 'Run Tests' - - - script: grep -L -r --include *.go --exclude-dir vendor -P "Copyright (\d{4}|\(c\)) Microsoft" ./ | tee >&2 - workingDirectory: '$(sdkPath)' - displayName: 'Copyright Header Check' - failOnStderr: true - condition: succeededOrFailed() - - - script: | - gofmt -s -l -w ./autorest/. >&2 - gofmt -s -l -w ./logger/. >&2 - gofmt -s -l -w ./tracing/. >&2 - workingDirectory: '$(sdkPath)' - displayName: 'Format Check' - failOnStderr: true - condition: succeededOrFailed() - - - script: | - golint ./autorest/... >&2 - golint ./logger/... >&2 - golint ./tracing/... >&2 - workingDirectory: '$(sdkPath)' - displayName: 'Linter Check' - failOnStderr: true - condition: succeededOrFailed() - - - task: PublishTestResults@2 - inputs: - testRunner: JUnit - testResultsFiles: $(sdkPath)/report.xml - failTaskOnFailedTests: true - - - task: PublishCodeCoverageResults@1 - inputs: - codeCoverageTool: Cobertura - summaryFileLocation: $(sdkPath)/coverage.xml - additionalCodeCoverageFiles: $(sdkPath)/coverage.html diff --git a/vendor/github.com/Azure/go-autorest/doc.go b/vendor/github.com/Azure/go-autorest/doc.go deleted file mode 100644 index 99ae6ca98..000000000 --- a/vendor/github.com/Azure/go-autorest/doc.go +++ /dev/null @@ -1,18 +0,0 @@ -/* -Package go-autorest provides an HTTP request client for use with Autorest-generated API client packages. -*/ -package go_autorest - -// Copyright 2017 Microsoft Corporation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. diff --git a/vendor/github.com/Azure/go-autorest/logger/LICENSE b/vendor/github.com/Azure/go-autorest/logger/LICENSE deleted file mode 100644 index b9d6a27ea..000000000 --- a/vendor/github.com/Azure/go-autorest/logger/LICENSE +++ /dev/null @@ -1,191 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - Copyright 2015 Microsoft Corporation - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/github.com/Azure/go-autorest/logger/go_mod_tidy_hack.go b/vendor/github.com/Azure/go-autorest/logger/go_mod_tidy_hack.go deleted file mode 100644 index 0aa27680d..000000000 --- a/vendor/github.com/Azure/go-autorest/logger/go_mod_tidy_hack.go +++ /dev/null @@ -1,24 +0,0 @@ -// +build modhack - -package logger - -// Copyright 2017 Microsoft Corporation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// This file, and the github.com/Azure/go-autorest import, won't actually become part of -// the resultant binary. - -// Necessary for safely adding multi-module repo. -// See: https://github.com/golang/go/wiki/Modules#is-it-possible-to-add-a-module-to-a-multi-module-repository -import _ "github.com/Azure/go-autorest" diff --git a/vendor/github.com/Azure/go-autorest/logger/logger.go b/vendor/github.com/Azure/go-autorest/logger/logger.go deleted file mode 100644 index 2f5d8cc1a..000000000 --- a/vendor/github.com/Azure/go-autorest/logger/logger.go +++ /dev/null @@ -1,337 +0,0 @@ -package logger - -// Copyright 2017 Microsoft Corporation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -import ( - "bytes" - "fmt" - "io" - "io/ioutil" - "net/http" - "net/url" - "os" - "strings" - "sync" - "time" -) - -// LevelType tells a logger the minimum level to log. When code reports a log entry, -// the LogLevel indicates the level of the log entry. The logger only records entries -// whose level is at least the level it was told to log. See the Log* constants. -// For example, if a logger is configured with LogError, then LogError, LogPanic, -// and LogFatal entries will be logged; lower level entries are ignored. -type LevelType uint32 - -const ( - // LogNone tells a logger not to log any entries passed to it. - LogNone LevelType = iota - - // LogFatal tells a logger to log all LogFatal entries passed to it. - LogFatal - - // LogPanic tells a logger to log all LogPanic and LogFatal entries passed to it. - LogPanic - - // LogError tells a logger to log all LogError, LogPanic and LogFatal entries passed to it. - LogError - - // LogWarning tells a logger to log all LogWarning, LogError, LogPanic and LogFatal entries passed to it. - LogWarning - - // LogInfo tells a logger to log all LogInfo, LogWarning, LogError, LogPanic and LogFatal entries passed to it. - LogInfo - - // LogDebug tells a logger to log all LogDebug, LogInfo, LogWarning, LogError, LogPanic and LogFatal entries passed to it. - LogDebug - - // LogAuth is a special case of LogDebug, it tells a logger to also log the body of an authentication request and response. - // NOTE: this can disclose sensitive information, use with care. - LogAuth -) - -const ( - logNone = "NONE" - logFatal = "FATAL" - logPanic = "PANIC" - logError = "ERROR" - logWarning = "WARNING" - logInfo = "INFO" - logDebug = "DEBUG" - logAuth = "AUTH" - logUnknown = "UNKNOWN" -) - -// ParseLevel converts the specified string into the corresponding LevelType. -func ParseLevel(s string) (lt LevelType, err error) { - switch strings.ToUpper(s) { - case logFatal: - lt = LogFatal - case logPanic: - lt = LogPanic - case logError: - lt = LogError - case logWarning: - lt = LogWarning - case logInfo: - lt = LogInfo - case logDebug: - lt = LogDebug - case logAuth: - lt = LogAuth - default: - err = fmt.Errorf("bad log level '%s'", s) - } - return -} - -// String implements the stringer interface for LevelType. -func (lt LevelType) String() string { - switch lt { - case LogNone: - return logNone - case LogFatal: - return logFatal - case LogPanic: - return logPanic - case LogError: - return logError - case LogWarning: - return logWarning - case LogInfo: - return logInfo - case LogDebug: - return logDebug - case LogAuth: - return logAuth - default: - return logUnknown - } -} - -// Filter defines functions for filtering HTTP request/response content. -type Filter struct { - // URL returns a potentially modified string representation of a request URL. - URL func(u *url.URL) string - - // Header returns a potentially modified set of values for the specified key. - // To completely exclude the header key/values return false. - Header func(key string, val []string) (bool, []string) - - // Body returns a potentially modified request/response body. - Body func(b []byte) []byte -} - -func (f Filter) processURL(u *url.URL) string { - if f.URL == nil { - return u.String() - } - return f.URL(u) -} - -func (f Filter) processHeader(k string, val []string) (bool, []string) { - if f.Header == nil { - return true, val - } - return f.Header(k, val) -} - -func (f Filter) processBody(b []byte) []byte { - if f.Body == nil { - return b - } - return f.Body(b) -} - -// Writer defines methods for writing to a logging facility. -type Writer interface { - // Writeln writes the specified message with the standard log entry header and new-line character. - Writeln(level LevelType, message string) - - // Writef writes the specified format specifier with the standard log entry header and no new-line character. - Writef(level LevelType, format string, a ...interface{}) - - // WriteRequest writes the specified HTTP request to the logger if the log level is greater than - // or equal to LogInfo. The request body, if set, is logged at level LogDebug or higher. - // Custom filters can be specified to exclude URL, header, and/or body content from the log. - // By default no request content is excluded. - WriteRequest(req *http.Request, filter Filter) - - // WriteResponse writes the specified HTTP response to the logger if the log level is greater than - // or equal to LogInfo. The response body, if set, is logged at level LogDebug or higher. - // Custom filters can be specified to exclude URL, header, and/or body content from the log. - // By default no response content is excluded. - WriteResponse(resp *http.Response, filter Filter) -} - -// Instance is the default log writer initialized during package init. -// This can be replaced with a custom implementation as required. -var Instance Writer - -// default log level -var logLevel = LogNone - -// Level returns the value specified in AZURE_GO_AUTOREST_LOG_LEVEL. -// If no value was specified the default value is LogNone. -// Custom loggers can call this to retrieve the configured log level. -func Level() LevelType { - return logLevel -} - -func init() { - // separated for testing purposes - initDefaultLogger() -} - -func initDefaultLogger() { - // init with nilLogger so callers don't have to do a nil check on Default - Instance = nilLogger{} - llStr := strings.ToLower(os.Getenv("AZURE_GO_SDK_LOG_LEVEL")) - if llStr == "" { - return - } - var err error - logLevel, err = ParseLevel(llStr) - if err != nil { - fmt.Fprintf(os.Stderr, "go-autorest: failed to parse log level: %s\n", err.Error()) - return - } - if logLevel == LogNone { - return - } - // default to stderr - dest := os.Stderr - lfStr := os.Getenv("AZURE_GO_SDK_LOG_FILE") - if strings.EqualFold(lfStr, "stdout") { - dest = os.Stdout - } else if lfStr != "" { - lf, err := os.Create(lfStr) - if err == nil { - dest = lf - } else { - fmt.Fprintf(os.Stderr, "go-autorest: failed to create log file, using stderr: %s\n", err.Error()) - } - } - Instance = fileLogger{ - logLevel: logLevel, - mu: &sync.Mutex{}, - logFile: dest, - } -} - -// the nil logger does nothing -type nilLogger struct{} - -func (nilLogger) Writeln(LevelType, string) {} - -func (nilLogger) Writef(LevelType, string, ...interface{}) {} - -func (nilLogger) WriteRequest(*http.Request, Filter) {} - -func (nilLogger) WriteResponse(*http.Response, Filter) {} - -// A File is used instead of a Logger so the stream can be flushed after every write. -type fileLogger struct { - logLevel LevelType - mu *sync.Mutex // for synchronizing writes to logFile - logFile *os.File -} - -func (fl fileLogger) Writeln(level LevelType, message string) { - fl.Writef(level, "%s\n", message) -} - -func (fl fileLogger) Writef(level LevelType, format string, a ...interface{}) { - if fl.logLevel >= level { - fl.mu.Lock() - defer fl.mu.Unlock() - fmt.Fprintf(fl.logFile, "%s %s", entryHeader(level), fmt.Sprintf(format, a...)) - fl.logFile.Sync() - } -} - -func (fl fileLogger) WriteRequest(req *http.Request, filter Filter) { - if req == nil || fl.logLevel < LogInfo { - return - } - b := &bytes.Buffer{} - fmt.Fprintf(b, "%s REQUEST: %s %s\n", entryHeader(LogInfo), req.Method, filter.processURL(req.URL)) - // dump headers - for k, v := range req.Header { - if ok, mv := filter.processHeader(k, v); ok { - fmt.Fprintf(b, "%s: %s\n", k, strings.Join(mv, ",")) - } - } - if fl.shouldLogBody(req.Header, req.Body) { - // dump body - body, err := ioutil.ReadAll(req.Body) - if err == nil { - fmt.Fprintln(b, string(filter.processBody(body))) - if nc, ok := req.Body.(io.Seeker); ok { - // rewind to the beginning - nc.Seek(0, io.SeekStart) - } else { - // recreate the body - req.Body = ioutil.NopCloser(bytes.NewReader(body)) - } - } else { - fmt.Fprintf(b, "failed to read body: %v\n", err) - } - } - fl.mu.Lock() - defer fl.mu.Unlock() - fmt.Fprint(fl.logFile, b.String()) - fl.logFile.Sync() -} - -func (fl fileLogger) WriteResponse(resp *http.Response, filter Filter) { - if resp == nil || fl.logLevel < LogInfo { - return - } - b := &bytes.Buffer{} - fmt.Fprintf(b, "%s RESPONSE: %d %s\n", entryHeader(LogInfo), resp.StatusCode, filter.processURL(resp.Request.URL)) - // dump headers - for k, v := range resp.Header { - if ok, mv := filter.processHeader(k, v); ok { - fmt.Fprintf(b, "%s: %s\n", k, strings.Join(mv, ",")) - } - } - if fl.shouldLogBody(resp.Header, resp.Body) { - // dump body - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err == nil { - fmt.Fprintln(b, string(filter.processBody(body))) - resp.Body = ioutil.NopCloser(bytes.NewReader(body)) - } else { - fmt.Fprintf(b, "failed to read body: %v\n", err) - } - } - fl.mu.Lock() - defer fl.mu.Unlock() - fmt.Fprint(fl.logFile, b.String()) - fl.logFile.Sync() -} - -// returns true if the provided body should be included in the log -func (fl fileLogger) shouldLogBody(header http.Header, body io.ReadCloser) bool { - ct := header.Get("Content-Type") - return fl.logLevel >= LogDebug && body != nil && !strings.Contains(ct, "application/octet-stream") -} - -// creates standard header for log entries, it contains a timestamp and the log level -func entryHeader(level LevelType) string { - // this format provides a fixed number of digits so the size of the timestamp is constant - return fmt.Sprintf("(%s) %s:", time.Now().Format("2006-01-02T15:04:05.0000000Z07:00"), level.String()) -} diff --git a/vendor/github.com/Azure/go-autorest/tracing/LICENSE b/vendor/github.com/Azure/go-autorest/tracing/LICENSE deleted file mode 100644 index b9d6a27ea..000000000 --- a/vendor/github.com/Azure/go-autorest/tracing/LICENSE +++ /dev/null @@ -1,191 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - Copyright 2015 Microsoft Corporation - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/github.com/Azure/go-autorest/tracing/go_mod_tidy_hack.go b/vendor/github.com/Azure/go-autorest/tracing/go_mod_tidy_hack.go deleted file mode 100644 index e163975cd..000000000 --- a/vendor/github.com/Azure/go-autorest/tracing/go_mod_tidy_hack.go +++ /dev/null @@ -1,24 +0,0 @@ -// +build modhack - -package tracing - -// Copyright 2017 Microsoft Corporation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// This file, and the github.com/Azure/go-autorest import, won't actually become part of -// the resultant binary. - -// Necessary for safely adding multi-module repo. -// See: https://github.com/golang/go/wiki/Modules#is-it-possible-to-add-a-module-to-a-multi-module-repository -import _ "github.com/Azure/go-autorest" diff --git a/vendor/github.com/Azure/go-autorest/tracing/tracing.go b/vendor/github.com/Azure/go-autorest/tracing/tracing.go deleted file mode 100644 index 0e7a6e962..000000000 --- a/vendor/github.com/Azure/go-autorest/tracing/tracing.go +++ /dev/null @@ -1,67 +0,0 @@ -package tracing - -// Copyright 2018 Microsoft Corporation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -import ( - "context" - "net/http" -) - -// Tracer represents an HTTP tracing facility. -type Tracer interface { - NewTransport(base *http.Transport) http.RoundTripper - StartSpan(ctx context.Context, name string) context.Context - EndSpan(ctx context.Context, httpStatusCode int, err error) -} - -var ( - tracer Tracer -) - -// Register will register the provided Tracer. Pass nil to unregister a Tracer. -func Register(t Tracer) { - tracer = t -} - -// IsEnabled returns true if a Tracer has been registered. -func IsEnabled() bool { - return tracer != nil -} - -// NewTransport creates a new instrumenting http.RoundTripper for the -// registered Tracer. If no Tracer has been registered it returns nil. -func NewTransport(base *http.Transport) http.RoundTripper { - if tracer != nil { - return tracer.NewTransport(base) - } - return nil -} - -// StartSpan starts a trace span with the specified name, associating it with the -// provided context. Has no effect if a Tracer has not been registered. -func StartSpan(ctx context.Context, name string) context.Context { - if tracer != nil { - return tracer.StartSpan(ctx, name) - } - return ctx -} - -// EndSpan ends a previously started span stored in the context. -// Has no effect if a Tracer has not been registered. -func EndSpan(ctx context.Context, httpStatusCode int, err error) { - if tracer != nil { - tracer.EndSpan(ctx, httpStatusCode, err) - } -} diff --git a/vendor/github.com/Masterminds/goutils/.travis.yml b/vendor/github.com/Masterminds/goutils/.travis.yml deleted file mode 100644 index 4025e01ec..000000000 --- a/vendor/github.com/Masterminds/goutils/.travis.yml +++ /dev/null @@ -1,18 +0,0 @@ -language: go - -go: - - 1.6 - - 1.7 - - 1.8 - - tip - -script: - - go test -v - -notifications: - webhooks: - urls: - - https://webhooks.gitter.im/e/06e3328629952dabe3e0 - on_success: change # options: [always|never|change] default: always - on_failure: always # options: [always|never|change] default: always - on_start: never # options: [always|never|change] default: always diff --git a/vendor/github.com/Masterminds/goutils/CHANGELOG.md b/vendor/github.com/Masterminds/goutils/CHANGELOG.md deleted file mode 100644 index d700ec47f..000000000 --- a/vendor/github.com/Masterminds/goutils/CHANGELOG.md +++ /dev/null @@ -1,8 +0,0 @@ -# 1.0.1 (2017-05-31) - -## Fixed -- #21: Fix generation of alphanumeric strings (thanks @dbarranco) - -# 1.0.0 (2014-04-30) - -- Initial release. diff --git a/vendor/github.com/Masterminds/goutils/LICENSE.txt b/vendor/github.com/Masterminds/goutils/LICENSE.txt deleted file mode 100644 index d64569567..000000000 --- a/vendor/github.com/Masterminds/goutils/LICENSE.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/github.com/Masterminds/goutils/README.md b/vendor/github.com/Masterminds/goutils/README.md deleted file mode 100644 index 163ffe72a..000000000 --- a/vendor/github.com/Masterminds/goutils/README.md +++ /dev/null @@ -1,70 +0,0 @@ -GoUtils -=========== -[![Stability: Maintenance](https://masterminds.github.io/stability/maintenance.svg)](https://masterminds.github.io/stability/maintenance.html) -[![GoDoc](https://godoc.org/github.com/Masterminds/goutils?status.png)](https://godoc.org/github.com/Masterminds/goutils) [![Build Status](https://travis-ci.org/Masterminds/goutils.svg?branch=master)](https://travis-ci.org/Masterminds/goutils) [![Build status](https://ci.appveyor.com/api/projects/status/sc2b1ew0m7f0aiju?svg=true)](https://ci.appveyor.com/project/mattfarina/goutils) - - -GoUtils provides users with utility functions to manipulate strings in various ways. It is a Go implementation of some -string manipulation libraries of Java Apache Commons. GoUtils includes the following Java Apache Commons classes: -* WordUtils -* RandomStringUtils -* StringUtils (partial implementation) - -## Installation -If you have Go set up on your system, from the GOPATH directory within the command line/terminal, enter this: - - go get github.com/Masterminds/goutils - -If you do not have Go set up on your system, please follow the [Go installation directions from the documenation](http://golang.org/doc/install), and then follow the instructions above to install GoUtils. - - -## Documentation -GoUtils doc is available here: [![GoDoc](https://godoc.org/github.com/Masterminds/goutils?status.png)](https://godoc.org/github.com/Masterminds/goutils) - - -## Usage -The code snippets below show examples of how to use GoUtils. Some functions return errors while others do not. The first instance below, which does not return an error, is the `Initials` function (located within the `wordutils.go` file). - - package main - - import ( - "fmt" - "github.com/Masterminds/goutils" - ) - - func main() { - - // EXAMPLE 1: A goutils function which returns no errors - fmt.Println (goutils.Initials("John Doe Foo")) // Prints out "JDF" - - } -Some functions return errors mainly due to illegal arguements used as parameters. The code example below illustrates how to deal with function that returns an error. In this instance, the function is the `Random` function (located within the `randomstringutils.go` file). - - package main - - import ( - "fmt" - "github.com/Masterminds/goutils" - ) - - func main() { - - // EXAMPLE 2: A goutils function which returns an error - rand1, err1 := goutils.Random (-1, 0, 0, true, true) - - if err1 != nil { - fmt.Println(err1) // Prints out error message because -1 was entered as the first parameter in goutils.Random(...) - } else { - fmt.Println(rand1) - } - - } - -## License -GoUtils is licensed under the Apache License, Version 2.0. Please check the LICENSE.txt file or visit http://www.apache.org/licenses/LICENSE-2.0 for a copy of the license. - -## Issue Reporting -Make suggestions or report issues using the Git issue tracker: https://github.com/Masterminds/goutils/issues - -## Website -* [GoUtils webpage](http://Masterminds.github.io/goutils/) diff --git a/vendor/github.com/Masterminds/goutils/appveyor.yml b/vendor/github.com/Masterminds/goutils/appveyor.yml deleted file mode 100644 index 657564a84..000000000 --- a/vendor/github.com/Masterminds/goutils/appveyor.yml +++ /dev/null @@ -1,21 +0,0 @@ -version: build-{build}.{branch} - -clone_folder: C:\gopath\src\github.com\Masterminds\goutils -shallow_clone: true - -environment: - GOPATH: C:\gopath - -platform: - - x64 - -build: off - -install: - - go version - - go env - -test_script: - - go test -v - -deploy: off diff --git a/vendor/github.com/Masterminds/goutils/cryptorandomstringutils.go b/vendor/github.com/Masterminds/goutils/cryptorandomstringutils.go deleted file mode 100644 index 8dbd92485..000000000 --- a/vendor/github.com/Masterminds/goutils/cryptorandomstringutils.go +++ /dev/null @@ -1,230 +0,0 @@ -/* -Copyright 2014 Alexander Okoli - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package goutils - -import ( - "crypto/rand" - "fmt" - "math" - "math/big" - "unicode" -) - -/* -CryptoRandomNonAlphaNumeric creates a random string whose length is the number of characters specified. -Characters will be chosen from the set of all characters (ASCII/Unicode values between 0 to 2,147,483,647 (math.MaxInt32)). - -Parameter: - count - the length of random string to create - -Returns: - string - the random string - error - an error stemming from an invalid parameter within underlying function, CryptoRandom(...) -*/ -func CryptoRandomNonAlphaNumeric(count int) (string, error) { - return CryptoRandomAlphaNumericCustom(count, false, false) -} - -/* -CryptoRandomAscii creates a random string whose length is the number of characters specified. -Characters will be chosen from the set of characters whose ASCII value is between 32 and 126 (inclusive). - -Parameter: - count - the length of random string to create - -Returns: - string - the random string - error - an error stemming from an invalid parameter within underlying function, CryptoRandom(...) -*/ -func CryptoRandomAscii(count int) (string, error) { - return CryptoRandom(count, 32, 127, false, false) -} - -/* -CryptoRandomNumeric creates a random string whose length is the number of characters specified. -Characters will be chosen from the set of numeric characters. - -Parameter: - count - the length of random string to create - -Returns: - string - the random string - error - an error stemming from an invalid parameter within underlying function, CryptoRandom(...) -*/ -func CryptoRandomNumeric(count int) (string, error) { - return CryptoRandom(count, 0, 0, false, true) -} - -/* -CryptoRandomAlphabetic creates a random string whose length is the number of characters specified. -Characters will be chosen from the set of alpha-numeric characters as indicated by the arguments. - -Parameters: - count - the length of random string to create - letters - if true, generated string may include alphabetic characters - numbers - if true, generated string may include numeric characters - -Returns: - string - the random string - error - an error stemming from an invalid parameter within underlying function, CryptoRandom(...) -*/ -func CryptoRandomAlphabetic(count int) (string, error) { - return CryptoRandom(count, 0, 0, true, false) -} - -/* -CryptoRandomAlphaNumeric creates a random string whose length is the number of characters specified. -Characters will be chosen from the set of alpha-numeric characters. - -Parameter: - count - the length of random string to create - -Returns: - string - the random string - error - an error stemming from an invalid parameter within underlying function, CryptoRandom(...) -*/ -func CryptoRandomAlphaNumeric(count int) (string, error) { - return CryptoRandom(count, 0, 0, true, true) -} - -/* -CryptoRandomAlphaNumericCustom creates a random string whose length is the number of characters specified. -Characters will be chosen from the set of alpha-numeric characters as indicated by the arguments. - -Parameters: - count - the length of random string to create - letters - if true, generated string may include alphabetic characters - numbers - if true, generated string may include numeric characters - -Returns: - string - the random string - error - an error stemming from an invalid parameter within underlying function, CryptoRandom(...) -*/ -func CryptoRandomAlphaNumericCustom(count int, letters bool, numbers bool) (string, error) { - return CryptoRandom(count, 0, 0, letters, numbers) -} - -/* -CryptoRandom creates a random string based on a variety of options, using using golang's crypto/rand source of randomness. -If the parameters start and end are both 0, start and end are set to ' ' and 'z', the ASCII printable characters, will be used, -unless letters and numbers are both false, in which case, start and end are set to 0 and math.MaxInt32, respectively. -If chars is not nil, characters stored in chars that are between start and end are chosen. - -Parameters: - count - the length of random string to create - start - the position in set of chars (ASCII/Unicode int) to start at - end - the position in set of chars (ASCII/Unicode int) to end before - letters - if true, generated string may include alphabetic characters - numbers - if true, generated string may include numeric characters - chars - the set of chars to choose randoms from. If nil, then it will use the set of all chars. - -Returns: - string - the random string - error - an error stemming from invalid parameters: if count < 0; or the provided chars array is empty; or end <= start; or end > len(chars) -*/ -func CryptoRandom(count int, start int, end int, letters bool, numbers bool, chars ...rune) (string, error) { - if count == 0 { - return "", nil - } else if count < 0 { - err := fmt.Errorf("randomstringutils illegal argument: Requested random string length %v is less than 0.", count) // equiv to err := errors.New("...") - return "", err - } - if chars != nil && len(chars) == 0 { - err := fmt.Errorf("randomstringutils illegal argument: The chars array must not be empty") - return "", err - } - - if start == 0 && end == 0 { - if chars != nil { - end = len(chars) - } else { - if !letters && !numbers { - end = math.MaxInt32 - } else { - end = 'z' + 1 - start = ' ' - } - } - } else { - if end <= start { - err := fmt.Errorf("randomstringutils illegal argument: Parameter end (%v) must be greater than start (%v)", end, start) - return "", err - } - - if chars != nil && end > len(chars) { - err := fmt.Errorf("randomstringutils illegal argument: Parameter end (%v) cannot be greater than len(chars) (%v)", end, len(chars)) - return "", err - } - } - - buffer := make([]rune, count) - gap := end - start - - // high-surrogates range, (\uD800-\uDBFF) = 55296 - 56319 - // low-surrogates range, (\uDC00-\uDFFF) = 56320 - 57343 - - for count != 0 { - count-- - var ch rune - if chars == nil { - ch = rune(getCryptoRandomInt(gap) + int64(start)) - } else { - ch = chars[getCryptoRandomInt(gap)+int64(start)] - } - - if letters && unicode.IsLetter(ch) || numbers && unicode.IsDigit(ch) || !letters && !numbers { - if ch >= 56320 && ch <= 57343 { // low surrogate range - if count == 0 { - count++ - } else { - // Insert low surrogate - buffer[count] = ch - count-- - // Insert high surrogate - buffer[count] = rune(55296 + getCryptoRandomInt(128)) - } - } else if ch >= 55296 && ch <= 56191 { // High surrogates range (Partial) - if count == 0 { - count++ - } else { - // Insert low surrogate - buffer[count] = rune(56320 + getCryptoRandomInt(128)) - count-- - // Insert high surrogate - buffer[count] = ch - } - } else if ch >= 56192 && ch <= 56319 { - // private high surrogate, skip it - count++ - } else { - // not one of the surrogates* - buffer[count] = ch - } - } else { - count++ - } - } - return string(buffer), nil -} - -func getCryptoRandomInt(count int) int64 { - nBig, err := rand.Int(rand.Reader, big.NewInt(int64(count))) - if err != nil { - panic(err) - } - return nBig.Int64() -} diff --git a/vendor/github.com/Masterminds/goutils/randomstringutils.go b/vendor/github.com/Masterminds/goutils/randomstringutils.go deleted file mode 100644 index 272670231..000000000 --- a/vendor/github.com/Masterminds/goutils/randomstringutils.go +++ /dev/null @@ -1,248 +0,0 @@ -/* -Copyright 2014 Alexander Okoli - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package goutils - -import ( - "fmt" - "math" - "math/rand" - "time" - "unicode" -) - -// RANDOM provides the time-based seed used to generate random numbers -var RANDOM = rand.New(rand.NewSource(time.Now().UnixNano())) - -/* -RandomNonAlphaNumeric creates a random string whose length is the number of characters specified. -Characters will be chosen from the set of all characters (ASCII/Unicode values between 0 to 2,147,483,647 (math.MaxInt32)). - -Parameter: - count - the length of random string to create - -Returns: - string - the random string - error - an error stemming from an invalid parameter within underlying function, RandomSeed(...) -*/ -func RandomNonAlphaNumeric(count int) (string, error) { - return RandomAlphaNumericCustom(count, false, false) -} - -/* -RandomAscii creates a random string whose length is the number of characters specified. -Characters will be chosen from the set of characters whose ASCII value is between 32 and 126 (inclusive). - -Parameter: - count - the length of random string to create - -Returns: - string - the random string - error - an error stemming from an invalid parameter within underlying function, RandomSeed(...) -*/ -func RandomAscii(count int) (string, error) { - return Random(count, 32, 127, false, false) -} - -/* -RandomNumeric creates a random string whose length is the number of characters specified. -Characters will be chosen from the set of numeric characters. - -Parameter: - count - the length of random string to create - -Returns: - string - the random string - error - an error stemming from an invalid parameter within underlying function, RandomSeed(...) -*/ -func RandomNumeric(count int) (string, error) { - return Random(count, 0, 0, false, true) -} - -/* -RandomAlphabetic creates a random string whose length is the number of characters specified. -Characters will be chosen from the set of alphabetic characters. - -Parameters: - count - the length of random string to create - -Returns: - string - the random string - error - an error stemming from an invalid parameter within underlying function, RandomSeed(...) -*/ -func RandomAlphabetic(count int) (string, error) { - return Random(count, 0, 0, true, false) -} - -/* -RandomAlphaNumeric creates a random string whose length is the number of characters specified. -Characters will be chosen from the set of alpha-numeric characters. - -Parameter: - count - the length of random string to create - -Returns: - string - the random string - error - an error stemming from an invalid parameter within underlying function, RandomSeed(...) -*/ -func RandomAlphaNumeric(count int) (string, error) { - return Random(count, 0, 0, true, true) -} - -/* -RandomAlphaNumericCustom creates a random string whose length is the number of characters specified. -Characters will be chosen from the set of alpha-numeric characters as indicated by the arguments. - -Parameters: - count - the length of random string to create - letters - if true, generated string may include alphabetic characters - numbers - if true, generated string may include numeric characters - -Returns: - string - the random string - error - an error stemming from an invalid parameter within underlying function, RandomSeed(...) -*/ -func RandomAlphaNumericCustom(count int, letters bool, numbers bool) (string, error) { - return Random(count, 0, 0, letters, numbers) -} - -/* -Random creates a random string based on a variety of options, using default source of randomness. -This method has exactly the same semantics as RandomSeed(int, int, int, bool, bool, []char, *rand.Rand), but -instead of using an externally supplied source of randomness, it uses the internal *rand.Rand instance. - -Parameters: - count - the length of random string to create - start - the position in set of chars (ASCII/Unicode int) to start at - end - the position in set of chars (ASCII/Unicode int) to end before - letters - if true, generated string may include alphabetic characters - numbers - if true, generated string may include numeric characters - chars - the set of chars to choose randoms from. If nil, then it will use the set of all chars. - -Returns: - string - the random string - error - an error stemming from an invalid parameter within underlying function, RandomSeed(...) -*/ -func Random(count int, start int, end int, letters bool, numbers bool, chars ...rune) (string, error) { - return RandomSeed(count, start, end, letters, numbers, chars, RANDOM) -} - -/* -RandomSeed creates a random string based on a variety of options, using supplied source of randomness. -If the parameters start and end are both 0, start and end are set to ' ' and 'z', the ASCII printable characters, will be used, -unless letters and numbers are both false, in which case, start and end are set to 0 and math.MaxInt32, respectively. -If chars is not nil, characters stored in chars that are between start and end are chosen. -This method accepts a user-supplied *rand.Rand instance to use as a source of randomness. By seeding a single *rand.Rand instance -with a fixed seed and using it for each call, the same random sequence of strings can be generated repeatedly and predictably. - -Parameters: - count - the length of random string to create - start - the position in set of chars (ASCII/Unicode decimals) to start at - end - the position in set of chars (ASCII/Unicode decimals) to end before - letters - if true, generated string may include alphabetic characters - numbers - if true, generated string may include numeric characters - chars - the set of chars to choose randoms from. If nil, then it will use the set of all chars. - random - a source of randomness. - -Returns: - string - the random string - error - an error stemming from invalid parameters: if count < 0; or the provided chars array is empty; or end <= start; or end > len(chars) -*/ -func RandomSeed(count int, start int, end int, letters bool, numbers bool, chars []rune, random *rand.Rand) (string, error) { - - if count == 0 { - return "", nil - } else if count < 0 { - err := fmt.Errorf("randomstringutils illegal argument: Requested random string length %v is less than 0.", count) // equiv to err := errors.New("...") - return "", err - } - if chars != nil && len(chars) == 0 { - err := fmt.Errorf("randomstringutils illegal argument: The chars array must not be empty") - return "", err - } - - if start == 0 && end == 0 { - if chars != nil { - end = len(chars) - } else { - if !letters && !numbers { - end = math.MaxInt32 - } else { - end = 'z' + 1 - start = ' ' - } - } - } else { - if end <= start { - err := fmt.Errorf("randomstringutils illegal argument: Parameter end (%v) must be greater than start (%v)", end, start) - return "", err - } - - if chars != nil && end > len(chars) { - err := fmt.Errorf("randomstringutils illegal argument: Parameter end (%v) cannot be greater than len(chars) (%v)", end, len(chars)) - return "", err - } - } - - buffer := make([]rune, count) - gap := end - start - - // high-surrogates range, (\uD800-\uDBFF) = 55296 - 56319 - // low-surrogates range, (\uDC00-\uDFFF) = 56320 - 57343 - - for count != 0 { - count-- - var ch rune - if chars == nil { - ch = rune(random.Intn(gap) + start) - } else { - ch = chars[random.Intn(gap)+start] - } - - if letters && unicode.IsLetter(ch) || numbers && unicode.IsDigit(ch) || !letters && !numbers { - if ch >= 56320 && ch <= 57343 { // low surrogate range - if count == 0 { - count++ - } else { - // Insert low surrogate - buffer[count] = ch - count-- - // Insert high surrogate - buffer[count] = rune(55296 + random.Intn(128)) - } - } else if ch >= 55296 && ch <= 56191 { // High surrogates range (Partial) - if count == 0 { - count++ - } else { - // Insert low surrogate - buffer[count] = rune(56320 + random.Intn(128)) - count-- - // Insert high surrogate - buffer[count] = ch - } - } else if ch >= 56192 && ch <= 56319 { - // private high surrogate, skip it - count++ - } else { - // not one of the surrogates* - buffer[count] = ch - } - } else { - count++ - } - } - return string(buffer), nil -} diff --git a/vendor/github.com/Masterminds/goutils/stringutils.go b/vendor/github.com/Masterminds/goutils/stringutils.go deleted file mode 100644 index 741bb530e..000000000 --- a/vendor/github.com/Masterminds/goutils/stringutils.go +++ /dev/null @@ -1,240 +0,0 @@ -/* -Copyright 2014 Alexander Okoli - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package goutils - -import ( - "bytes" - "fmt" - "strings" - "unicode" -) - -// Typically returned by functions where a searched item cannot be found -const INDEX_NOT_FOUND = -1 - -/* -Abbreviate abbreviates a string using ellipses. This will turn the string "Now is the time for all good men" into "Now is the time for..." - -Specifically, the algorithm is as follows: - - - If str is less than maxWidth characters long, return it. - - Else abbreviate it to (str[0:maxWidth - 3] + "..."). - - If maxWidth is less than 4, return an illegal argument error. - - In no case will it return a string of length greater than maxWidth. - -Parameters: - str - the string to check - maxWidth - maximum length of result string, must be at least 4 - -Returns: - string - abbreviated string - error - if the width is too small -*/ -func Abbreviate(str string, maxWidth int) (string, error) { - return AbbreviateFull(str, 0, maxWidth) -} - -/* -AbbreviateFull abbreviates a string using ellipses. This will turn the string "Now is the time for all good men" into "...is the time for..." -This function works like Abbreviate(string, int), but allows you to specify a "left edge" offset. Note that this left edge is not -necessarily going to be the leftmost character in the result, or the first character following the ellipses, but it will appear -somewhere in the result. -In no case will it return a string of length greater than maxWidth. - -Parameters: - str - the string to check - offset - left edge of source string - maxWidth - maximum length of result string, must be at least 4 - -Returns: - string - abbreviated string - error - if the width is too small -*/ -func AbbreviateFull(str string, offset int, maxWidth int) (string, error) { - if str == "" { - return "", nil - } - if maxWidth < 4 { - err := fmt.Errorf("stringutils illegal argument: Minimum abbreviation width is 4") - return "", err - } - if len(str) <= maxWidth { - return str, nil - } - if offset > len(str) { - offset = len(str) - } - if len(str)-offset < (maxWidth - 3) { // 15 - 5 < 10 - 3 = 10 < 7 - offset = len(str) - (maxWidth - 3) - } - abrevMarker := "..." - if offset <= 4 { - return str[0:maxWidth-3] + abrevMarker, nil // str.substring(0, maxWidth - 3) + abrevMarker; - } - if maxWidth < 7 { - err := fmt.Errorf("stringutils illegal argument: Minimum abbreviation width with offset is 7") - return "", err - } - if (offset + maxWidth - 3) < len(str) { // 5 + (10-3) < 15 = 12 < 15 - abrevStr, _ := Abbreviate(str[offset:len(str)], (maxWidth - 3)) - return abrevMarker + abrevStr, nil // abrevMarker + abbreviate(str.substring(offset), maxWidth - 3); - } - return abrevMarker + str[(len(str)-(maxWidth-3)):len(str)], nil // abrevMarker + str.substring(str.length() - (maxWidth - 3)); -} - -/* -DeleteWhiteSpace deletes all whitespaces from a string as defined by unicode.IsSpace(rune). -It returns the string without whitespaces. - -Parameter: - str - the string to delete whitespace from, may be nil - -Returns: - the string without whitespaces -*/ -func DeleteWhiteSpace(str string) string { - if str == "" { - return str - } - sz := len(str) - var chs bytes.Buffer - count := 0 - for i := 0; i < sz; i++ { - ch := rune(str[i]) - if !unicode.IsSpace(ch) { - chs.WriteRune(ch) - count++ - } - } - if count == sz { - return str - } - return chs.String() -} - -/* -IndexOfDifference compares two strings, and returns the index at which the strings begin to differ. - -Parameters: - str1 - the first string - str2 - the second string - -Returns: - the index where str1 and str2 begin to differ; -1 if they are equal -*/ -func IndexOfDifference(str1 string, str2 string) int { - if str1 == str2 { - return INDEX_NOT_FOUND - } - if IsEmpty(str1) || IsEmpty(str2) { - return 0 - } - var i int - for i = 0; i < len(str1) && i < len(str2); i++ { - if rune(str1[i]) != rune(str2[i]) { - break - } - } - if i < len(str2) || i < len(str1) { - return i - } - return INDEX_NOT_FOUND -} - -/* -IsBlank checks if a string is whitespace or empty (""). Observe the following behavior: - - goutils.IsBlank("") = true - goutils.IsBlank(" ") = true - goutils.IsBlank("bob") = false - goutils.IsBlank(" bob ") = false - -Parameter: - str - the string to check - -Returns: - true - if the string is whitespace or empty ("") -*/ -func IsBlank(str string) bool { - strLen := len(str) - if str == "" || strLen == 0 { - return true - } - for i := 0; i < strLen; i++ { - if unicode.IsSpace(rune(str[i])) == false { - return false - } - } - return true -} - -/* -IndexOf returns the index of the first instance of sub in str, with the search beginning from the -index start point specified. -1 is returned if sub is not present in str. - -An empty string ("") will return -1 (INDEX_NOT_FOUND). A negative start position is treated as zero. -A start position greater than the string length returns -1. - -Parameters: - str - the string to check - sub - the substring to find - start - the start position; negative treated as zero - -Returns: - the first index where the sub string was found (always >= start) -*/ -func IndexOf(str string, sub string, start int) int { - - if start < 0 { - start = 0 - } - - if len(str) < start { - return INDEX_NOT_FOUND - } - - if IsEmpty(str) || IsEmpty(sub) { - return INDEX_NOT_FOUND - } - - partialIndex := strings.Index(str[start:len(str)], sub) - if partialIndex == -1 { - return INDEX_NOT_FOUND - } - return partialIndex + start -} - -// IsEmpty checks if a string is empty (""). Returns true if empty, and false otherwise. -func IsEmpty(str string) bool { - return len(str) == 0 -} - -// Returns either the passed in string, or if the string is empty, the value of defaultStr. -func DefaultString(str string, defaultStr string) string { - if IsEmpty(str) { - return defaultStr - } - return str -} - -// Returns either the passed in string, or if the string is whitespace, empty (""), the value of defaultStr. -func DefaultIfBlank(str string, defaultStr string) string { - if IsBlank(str) { - return defaultStr - } - return str -} diff --git a/vendor/github.com/Masterminds/goutils/wordutils.go b/vendor/github.com/Masterminds/goutils/wordutils.go deleted file mode 100644 index 034cad8e2..000000000 --- a/vendor/github.com/Masterminds/goutils/wordutils.go +++ /dev/null @@ -1,357 +0,0 @@ -/* -Copyright 2014 Alexander Okoli - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -/* -Package goutils provides utility functions to manipulate strings in various ways. -The code snippets below show examples of how to use goutils. Some functions return -errors while others do not, so usage would vary as a result. - -Example: - - package main - - import ( - "fmt" - "github.com/aokoli/goutils" - ) - - func main() { - - // EXAMPLE 1: A goutils function which returns no errors - fmt.Println (goutils.Initials("John Doe Foo")) // Prints out "JDF" - - - - // EXAMPLE 2: A goutils function which returns an error - rand1, err1 := goutils.Random (-1, 0, 0, true, true) - - if err1 != nil { - fmt.Println(err1) // Prints out error message because -1 was entered as the first parameter in goutils.Random(...) - } else { - fmt.Println(rand1) - } - } -*/ -package goutils - -import ( - "bytes" - "strings" - "unicode" -) - -// VERSION indicates the current version of goutils -const VERSION = "1.0.0" - -/* -Wrap wraps a single line of text, identifying words by ' '. -New lines will be separated by '\n'. Very long words, such as URLs will not be wrapped. -Leading spaces on a new line are stripped. Trailing spaces are not stripped. - -Parameters: - str - the string to be word wrapped - wrapLength - the column (a column can fit only one character) to wrap the words at, less than 1 is treated as 1 - -Returns: - a line with newlines inserted -*/ -func Wrap(str string, wrapLength int) string { - return WrapCustom(str, wrapLength, "", false) -} - -/* -WrapCustom wraps a single line of text, identifying words by ' '. -Leading spaces on a new line are stripped. Trailing spaces are not stripped. - -Parameters: - str - the string to be word wrapped - wrapLength - the column number (a column can fit only one character) to wrap the words at, less than 1 is treated as 1 - newLineStr - the string to insert for a new line, "" uses '\n' - wrapLongWords - true if long words (such as URLs) should be wrapped - -Returns: - a line with newlines inserted -*/ -func WrapCustom(str string, wrapLength int, newLineStr string, wrapLongWords bool) string { - - if str == "" { - return "" - } - if newLineStr == "" { - newLineStr = "\n" // TODO Assumes "\n" is seperator. Explore SystemUtils.LINE_SEPARATOR from Apache Commons - } - if wrapLength < 1 { - wrapLength = 1 - } - - inputLineLength := len(str) - offset := 0 - - var wrappedLine bytes.Buffer - - for inputLineLength-offset > wrapLength { - - if rune(str[offset]) == ' ' { - offset++ - continue - } - - end := wrapLength + offset + 1 - spaceToWrapAt := strings.LastIndex(str[offset:end], " ") + offset - - if spaceToWrapAt >= offset { - // normal word (not longer than wrapLength) - wrappedLine.WriteString(str[offset:spaceToWrapAt]) - wrappedLine.WriteString(newLineStr) - offset = spaceToWrapAt + 1 - - } else { - // long word or URL - if wrapLongWords { - end := wrapLength + offset - // long words are wrapped one line at a time - wrappedLine.WriteString(str[offset:end]) - wrappedLine.WriteString(newLineStr) - offset += wrapLength - } else { - // long words aren't wrapped, just extended beyond limit - end := wrapLength + offset - index := strings.IndexRune(str[end:len(str)], ' ') - if index == -1 { - wrappedLine.WriteString(str[offset:len(str)]) - offset = inputLineLength - } else { - spaceToWrapAt = index + end - wrappedLine.WriteString(str[offset:spaceToWrapAt]) - wrappedLine.WriteString(newLineStr) - offset = spaceToWrapAt + 1 - } - } - } - } - - wrappedLine.WriteString(str[offset:len(str)]) - - return wrappedLine.String() - -} - -/* -Capitalize capitalizes all the delimiter separated words in a string. Only the first letter of each word is changed. -To convert the rest of each word to lowercase at the same time, use CapitalizeFully(str string, delimiters ...rune). -The delimiters represent a set of characters understood to separate words. The first string character -and the first non-delimiter character after a delimiter will be capitalized. A "" input string returns "". -Capitalization uses the Unicode title case, normally equivalent to upper case. - -Parameters: - str - the string to capitalize - delimiters - set of characters to determine capitalization, exclusion of this parameter means whitespace would be delimeter - -Returns: - capitalized string -*/ -func Capitalize(str string, delimiters ...rune) string { - - var delimLen int - - if delimiters == nil { - delimLen = -1 - } else { - delimLen = len(delimiters) - } - - if str == "" || delimLen == 0 { - return str - } - - buffer := []rune(str) - capitalizeNext := true - for i := 0; i < len(buffer); i++ { - ch := buffer[i] - if isDelimiter(ch, delimiters...) { - capitalizeNext = true - } else if capitalizeNext { - buffer[i] = unicode.ToTitle(ch) - capitalizeNext = false - } - } - return string(buffer) - -} - -/* -CapitalizeFully converts all the delimiter separated words in a string into capitalized words, that is each word is made up of a -titlecase character and then a series of lowercase characters. The delimiters represent a set of characters understood -to separate words. The first string character and the first non-delimiter character after a delimiter will be capitalized. -Capitalization uses the Unicode title case, normally equivalent to upper case. - -Parameters: - str - the string to capitalize fully - delimiters - set of characters to determine capitalization, exclusion of this parameter means whitespace would be delimeter - -Returns: - capitalized string -*/ -func CapitalizeFully(str string, delimiters ...rune) string { - - var delimLen int - - if delimiters == nil { - delimLen = -1 - } else { - delimLen = len(delimiters) - } - - if str == "" || delimLen == 0 { - return str - } - str = strings.ToLower(str) - return Capitalize(str, delimiters...) -} - -/* -Uncapitalize uncapitalizes all the whitespace separated words in a string. Only the first letter of each word is changed. -The delimiters represent a set of characters understood to separate words. The first string character and the first non-delimiter -character after a delimiter will be uncapitalized. Whitespace is defined by unicode.IsSpace(char). - -Parameters: - str - the string to uncapitalize fully - delimiters - set of characters to determine capitalization, exclusion of this parameter means whitespace would be delimeter - -Returns: - uncapitalized string -*/ -func Uncapitalize(str string, delimiters ...rune) string { - - var delimLen int - - if delimiters == nil { - delimLen = -1 - } else { - delimLen = len(delimiters) - } - - if str == "" || delimLen == 0 { - return str - } - - buffer := []rune(str) - uncapitalizeNext := true // TODO Always makes capitalize/un apply to first char. - for i := 0; i < len(buffer); i++ { - ch := buffer[i] - if isDelimiter(ch, delimiters...) { - uncapitalizeNext = true - } else if uncapitalizeNext { - buffer[i] = unicode.ToLower(ch) - uncapitalizeNext = false - } - } - return string(buffer) -} - -/* -SwapCase swaps the case of a string using a word based algorithm. - -Conversion algorithm: - - Upper case character converts to Lower case - Title case character converts to Lower case - Lower case character after Whitespace or at start converts to Title case - Other Lower case character converts to Upper case - Whitespace is defined by unicode.IsSpace(char). - -Parameters: - str - the string to swap case - -Returns: - the changed string -*/ -func SwapCase(str string) string { - if str == "" { - return str - } - buffer := []rune(str) - - whitespace := true - - for i := 0; i < len(buffer); i++ { - ch := buffer[i] - if unicode.IsUpper(ch) { - buffer[i] = unicode.ToLower(ch) - whitespace = false - } else if unicode.IsTitle(ch) { - buffer[i] = unicode.ToLower(ch) - whitespace = false - } else if unicode.IsLower(ch) { - if whitespace { - buffer[i] = unicode.ToTitle(ch) - whitespace = false - } else { - buffer[i] = unicode.ToUpper(ch) - } - } else { - whitespace = unicode.IsSpace(ch) - } - } - return string(buffer) -} - -/* -Initials extracts the initial letters from each word in the string. The first letter of the string and all first -letters after the defined delimiters are returned as a new string. Their case is not changed. If the delimiters -parameter is excluded, then Whitespace is used. Whitespace is defined by unicode.IsSpacea(char). An empty delimiter array returns an empty string. - -Parameters: - str - the string to get initials from - delimiters - set of characters to determine words, exclusion of this parameter means whitespace would be delimeter -Returns: - string of initial letters -*/ -func Initials(str string, delimiters ...rune) string { - if str == "" { - return str - } - if delimiters != nil && len(delimiters) == 0 { - return "" - } - strLen := len(str) - var buf bytes.Buffer - lastWasGap := true - for i := 0; i < strLen; i++ { - ch := rune(str[i]) - - if isDelimiter(ch, delimiters...) { - lastWasGap = true - } else if lastWasGap { - buf.WriteRune(ch) - lastWasGap = false - } - } - return buf.String() -} - -// private function (lower case func name) -func isDelimiter(ch rune, delimiters ...rune) bool { - if delimiters == nil { - return unicode.IsSpace(ch) - } - for _, delimiter := range delimiters { - if ch == delimiter { - return true - } - } - return false -} diff --git a/vendor/github.com/Masterminds/semver/v3/.gitignore b/vendor/github.com/Masterminds/semver/v3/.gitignore deleted file mode 100644 index 6b061e617..000000000 --- a/vendor/github.com/Masterminds/semver/v3/.gitignore +++ /dev/null @@ -1 +0,0 @@ -_fuzz/ \ No newline at end of file diff --git a/vendor/github.com/Masterminds/semver/v3/.golangci.yml b/vendor/github.com/Masterminds/semver/v3/.golangci.yml deleted file mode 100644 index fdbdf1448..000000000 --- a/vendor/github.com/Masterminds/semver/v3/.golangci.yml +++ /dev/null @@ -1,26 +0,0 @@ -run: - deadline: 2m - -linters: - disable-all: true - enable: - - deadcode - - dupl - - errcheck - - gofmt - - goimports - - golint - - gosimple - - govet - - ineffassign - - misspell - - nakedret - - structcheck - - unused - - varcheck - -linters-settings: - gofmt: - simplify: true - dupl: - threshold: 400 diff --git a/vendor/github.com/Masterminds/semver/v3/CHANGELOG.md b/vendor/github.com/Masterminds/semver/v3/CHANGELOG.md deleted file mode 100644 index 1f90c38d2..000000000 --- a/vendor/github.com/Masterminds/semver/v3/CHANGELOG.md +++ /dev/null @@ -1,194 +0,0 @@ -# Changelog - -## 3.1.1 (2020-11-23) - -### Fixed - -- #158: Fixed issue with generated regex operation order that could cause problem - -## 3.1.0 (2020-04-15) - -### Added - -- #131: Add support for serializing/deserializing SQL (thanks @ryancurrah) - -### Changed - -- #148: More accurate validation messages on constraints - -## 3.0.3 (2019-12-13) - -### Fixed - -- #141: Fixed issue with <= comparison - -## 3.0.2 (2019-11-14) - -### Fixed - -- #134: Fixed broken constraint checking with ^0.0 (thanks @krmichelos) - -## 3.0.1 (2019-09-13) - -### Fixed - -- #125: Fixes issue with module path for v3 - -## 3.0.0 (2019-09-12) - -This is a major release of the semver package which includes API changes. The Go -API is compatible with ^1. The Go API was not changed because many people are using -`go get` without Go modules for their applications and API breaking changes cause -errors which we have or would need to support. - -The changes in this release are the handling based on the data passed into the -functions. These are described in the added and changed sections below. - -### Added - -- StrictNewVersion function. This is similar to NewVersion but will return an - error if the version passed in is not a strict semantic version. For example, - 1.2.3 would pass but v1.2.3 or 1.2 would fail because they are not strictly - speaking semantic versions. This function is faster, performs fewer operations, - and uses fewer allocations than NewVersion. -- Fuzzing has been performed on NewVersion, StrictNewVersion, and NewConstraint. - The Makefile contains the operations used. For more information on you can start - on Wikipedia at https://en.wikipedia.org/wiki/Fuzzing -- Now using Go modules - -### Changed - -- NewVersion has proper prerelease and metadata validation with error messages - to signal an issue with either of them -- ^ now operates using a similar set of rules to npm/js and Rust/Cargo. If the - version is >=1 the ^ ranges works the same as v1. For major versions of 0 the - rules have changed. The minor version is treated as the stable version unless - a patch is specified and then it is equivalent to =. One difference from npm/js - is that prereleases there are only to a specific version (e.g. 1.2.3). - Prereleases here look over multiple versions and follow semantic version - ordering rules. This pattern now follows along with the expected and requested - handling of this packaged by numerous users. - -## 1.5.0 (2019-09-11) - -### Added - -- #103: Add basic fuzzing for `NewVersion()` (thanks @jesse-c) - -### Changed - -- #82: Clarify wildcard meaning in range constraints and update tests for it (thanks @greysteil) -- #83: Clarify caret operator range for pre-1.0.0 dependencies (thanks @greysteil) -- #72: Adding docs comment pointing to vert for a cli -- #71: Update the docs on pre-release comparator handling -- #89: Test with new go versions (thanks @thedevsaddam) -- #87: Added $ to ValidPrerelease for better validation (thanks @jeremycarroll) - -### Fixed - -- #78: Fix unchecked error in example code (thanks @ravron) -- #70: Fix the handling of pre-releases and the 0.0.0 release edge case -- #97: Fixed copyright file for proper display on GitHub -- #107: Fix handling prerelease when sorting alphanum and num -- #109: Fixed where Validate sometimes returns wrong message on error - -## 1.4.2 (2018-04-10) - -### Changed - -- #72: Updated the docs to point to vert for a console appliaction -- #71: Update the docs on pre-release comparator handling - -### Fixed - -- #70: Fix the handling of pre-releases and the 0.0.0 release edge case - -## 1.4.1 (2018-04-02) - -### Fixed - -- Fixed #64: Fix pre-release precedence issue (thanks @uudashr) - -## 1.4.0 (2017-10-04) - -### Changed - -- #61: Update NewVersion to parse ints with a 64bit int size (thanks @zknill) - -## 1.3.1 (2017-07-10) - -### Fixed - -- Fixed #57: number comparisons in prerelease sometimes inaccurate - -## 1.3.0 (2017-05-02) - -### Added - -- #45: Added json (un)marshaling support (thanks @mh-cbon) -- Stability marker. See https://masterminds.github.io/stability/ - -### Fixed - -- #51: Fix handling of single digit tilde constraint (thanks @dgodd) - -### Changed - -- #55: The godoc icon moved from png to svg - -## 1.2.3 (2017-04-03) - -### Fixed - -- #46: Fixed 0.x.x and 0.0.x in constraints being treated as * - -## Release 1.2.2 (2016-12-13) - -### Fixed - -- #34: Fixed issue where hyphen range was not working with pre-release parsing. - -## Release 1.2.1 (2016-11-28) - -### Fixed - -- #24: Fixed edge case issue where constraint "> 0" does not handle "0.0.1-alpha" - properly. - -## Release 1.2.0 (2016-11-04) - -### Added - -- #20: Added MustParse function for versions (thanks @adamreese) -- #15: Added increment methods on versions (thanks @mh-cbon) - -### Fixed - -- Issue #21: Per the SemVer spec (section 9) a pre-release is unstable and - might not satisfy the intended compatibility. The change here ignores pre-releases - on constraint checks (e.g., ~ or ^) when a pre-release is not part of the - constraint. For example, `^1.2.3` will ignore pre-releases while - `^1.2.3-alpha` will include them. - -## Release 1.1.1 (2016-06-30) - -### Changed - -- Issue #9: Speed up version comparison performance (thanks @sdboyer) -- Issue #8: Added benchmarks (thanks @sdboyer) -- Updated Go Report Card URL to new location -- Updated Readme to add code snippet formatting (thanks @mh-cbon) -- Updating tagging to v[SemVer] structure for compatibility with other tools. - -## Release 1.1.0 (2016-03-11) - -- Issue #2: Implemented validation to provide reasons a versions failed a - constraint. - -## Release 1.0.1 (2015-12-31) - -- Fixed #1: * constraint failing on valid versions. - -## Release 1.0.0 (2015-10-20) - -- Initial release diff --git a/vendor/github.com/Masterminds/semver/v3/LICENSE.txt b/vendor/github.com/Masterminds/semver/v3/LICENSE.txt deleted file mode 100644 index 9ff7da9c4..000000000 --- a/vendor/github.com/Masterminds/semver/v3/LICENSE.txt +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (C) 2014-2019, Matt Butcher and Matt Farina - -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/vendor/github.com/Masterminds/semver/v3/Makefile b/vendor/github.com/Masterminds/semver/v3/Makefile deleted file mode 100644 index eac19178f..000000000 --- a/vendor/github.com/Masterminds/semver/v3/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -GOPATH=$(shell go env GOPATH) -GOLANGCI_LINT=$(GOPATH)/bin/golangci-lint -GOFUZZBUILD = $(GOPATH)/bin/go-fuzz-build -GOFUZZ = $(GOPATH)/bin/go-fuzz - -.PHONY: lint -lint: $(GOLANGCI_LINT) - @echo "==> Linting codebase" - @$(GOLANGCI_LINT) run - -.PHONY: test -test: - @echo "==> Running tests" - GO111MODULE=on go test -v - -.PHONY: test-cover -test-cover: - @echo "==> Running Tests with coverage" - GO111MODULE=on go test -cover . - -.PHONY: fuzz -fuzz: $(GOFUZZBUILD) $(GOFUZZ) - @echo "==> Fuzz testing" - $(GOFUZZBUILD) - $(GOFUZZ) -workdir=_fuzz - -$(GOLANGCI_LINT): - # Install golangci-lint. The configuration for it is in the .golangci.yml - # file in the root of the repository - echo ${GOPATH} - curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(GOPATH)/bin v1.17.1 - -$(GOFUZZBUILD): - cd / && go get -u github.com/dvyukov/go-fuzz/go-fuzz-build - -$(GOFUZZ): - cd / && go get -u github.com/dvyukov/go-fuzz/go-fuzz github.com/dvyukov/go-fuzz/go-fuzz-dep \ No newline at end of file diff --git a/vendor/github.com/Masterminds/semver/v3/README.md b/vendor/github.com/Masterminds/semver/v3/README.md deleted file mode 100644 index d8f54dcbd..000000000 --- a/vendor/github.com/Masterminds/semver/v3/README.md +++ /dev/null @@ -1,244 +0,0 @@ -# SemVer - -The `semver` package provides the ability to work with [Semantic Versions](http://semver.org) in Go. Specifically it provides the ability to: - -* Parse semantic versions -* Sort semantic versions -* Check if a semantic version fits within a set of constraints -* Optionally work with a `v` prefix - -[![Stability: -Active](https://masterminds.github.io/stability/active.svg)](https://masterminds.github.io/stability/active.html) -[![](https://github.com/Masterminds/semver/workflows/Tests/badge.svg)](https://github.com/Masterminds/semver/actions) -[![GoDoc](https://img.shields.io/static/v1?label=godoc&message=reference&color=blue)](https://pkg.go.dev/github.com/Masterminds/semver/v3) -[![Go Report Card](https://goreportcard.com/badge/github.com/Masterminds/semver)](https://goreportcard.com/report/github.com/Masterminds/semver) - -If you are looking for a command line tool for version comparisons please see -[vert](https://github.com/Masterminds/vert) which uses this library. - -## Package Versions - -There are three major versions fo the `semver` package. - -* 3.x.x is the new stable and active version. This version is focused on constraint - compatibility for range handling in other tools from other languages. It has - a similar API to the v1 releases. The development of this version is on the master - branch. The documentation for this version is below. -* 2.x was developed primarily for [dep](https://github.com/golang/dep). There are - no tagged releases and the development was performed by [@sdboyer](https://github.com/sdboyer). - There are API breaking changes from v1. This version lives on the [2.x branch](https://github.com/Masterminds/semver/tree/2.x). -* 1.x.x is the most widely used version with numerous tagged releases. This is the - previous stable and is still maintained for bug fixes. The development, to fix - bugs, occurs on the release-1 branch. You can read the documentation [here](https://github.com/Masterminds/semver/blob/release-1/README.md). - -## Parsing Semantic Versions - -There are two functions that can parse semantic versions. The `StrictNewVersion` -function only parses valid version 2 semantic versions as outlined in the -specification. The `NewVersion` function attempts to coerce a version into a -semantic version and parse it. For example, if there is a leading v or a version -listed without all 3 parts (e.g. `v1.2`) it will attempt to coerce it into a valid -semantic version (e.g., 1.2.0). In both cases a `Version` object is returned -that can be sorted, compared, and used in constraints. - -When parsing a version an error is returned if there is an issue parsing the -version. For example, - - v, err := semver.NewVersion("1.2.3-beta.1+build345") - -The version object has methods to get the parts of the version, compare it to -other versions, convert the version back into a string, and get the original -string. Getting the original string is useful if the semantic version was coerced -into a valid form. - -## Sorting Semantic Versions - -A set of versions can be sorted using the `sort` package from the standard library. -For example, - -```go -raw := []string{"1.2.3", "1.0", "1.3", "2", "0.4.2",} -vs := make([]*semver.Version, len(raw)) -for i, r := range raw { - v, err := semver.NewVersion(r) - if err != nil { - t.Errorf("Error parsing version: %s", err) - } - - vs[i] = v -} - -sort.Sort(semver.Collection(vs)) -``` - -## Checking Version Constraints - -There are two methods for comparing versions. One uses comparison methods on -`Version` instances and the other uses `Constraints`. There are some important -differences to notes between these two methods of comparison. - -1. When two versions are compared using functions such as `Compare`, `LessThan`, - and others it will follow the specification and always include prereleases - within the comparison. It will provide an answer that is valid with the - comparison section of the spec at https://semver.org/#spec-item-11 -2. When constraint checking is used for checks or validation it will follow a - different set of rules that are common for ranges with tools like npm/js - and Rust/Cargo. This includes considering prereleases to be invalid if the - ranges does not include one. If you want to have it include pre-releases a - simple solution is to include `-0` in your range. -3. Constraint ranges can have some complex rules including the shorthand use of - ~ and ^. For more details on those see the options below. - -There are differences between the two methods or checking versions because the -comparison methods on `Version` follow the specification while comparison ranges -are not part of the specification. Different packages and tools have taken it -upon themselves to come up with range rules. This has resulted in differences. -For example, npm/js and Cargo/Rust follow similar patterns while PHP has a -different pattern for ^. The comparison features in this package follow the -npm/js and Cargo/Rust lead because applications using it have followed similar -patters with their versions. - -Checking a version against version constraints is one of the most featureful -parts of the package. - -```go -c, err := semver.NewConstraint(">= 1.2.3") -if err != nil { - // Handle constraint not being parsable. -} - -v, err := semver.NewVersion("1.3") -if err != nil { - // Handle version not being parsable. -} -// Check if the version meets the constraints. The a variable will be true. -a := c.Check(v) -``` - -### Basic Comparisons - -There are two elements to the comparisons. First, a comparison string is a list -of space or comma separated AND comparisons. These are then separated by || (OR) -comparisons. For example, `">= 1.2 < 3.0.0 || >= 4.2.3"` is looking for a -comparison that's greater than or equal to 1.2 and less than 3.0.0 or is -greater than or equal to 4.2.3. - -The basic comparisons are: - -* `=`: equal (aliased to no operator) -* `!=`: not equal -* `>`: greater than -* `<`: less than -* `>=`: greater than or equal to -* `<=`: less than or equal to - -### Working With Prerelease Versions - -Pre-releases, for those not familiar with them, are used for software releases -prior to stable or generally available releases. Examples of prereleases include -development, alpha, beta, and release candidate releases. A prerelease may be -a version such as `1.2.3-beta.1` while the stable release would be `1.2.3`. In the -order of precedence, prereleases come before their associated releases. In this -example `1.2.3-beta.1 < 1.2.3`. - -According to the Semantic Version specification prereleases may not be -API compliant with their release counterpart. It says, - -> A pre-release version indicates that the version is unstable and might not satisfy the intended compatibility requirements as denoted by its associated normal version. - -SemVer comparisons using constraints without a prerelease comparator will skip -prerelease versions. For example, `>=1.2.3` will skip prereleases when looking -at a list of releases while `>=1.2.3-0` will evaluate and find prereleases. - -The reason for the `0` as a pre-release version in the example comparison is -because pre-releases can only contain ASCII alphanumerics and hyphens (along with -`.` separators), per the spec. Sorting happens in ASCII sort order, again per the -spec. The lowest character is a `0` in ASCII sort order -(see an [ASCII Table](http://www.asciitable.com/)) - -Understanding ASCII sort ordering is important because A-Z comes before a-z. That -means `>=1.2.3-BETA` will return `1.2.3-alpha`. What you might expect from case -sensitivity doesn't apply here. This is due to ASCII sort ordering which is what -the spec specifies. - -### Hyphen Range Comparisons - -There are multiple methods to handle ranges and the first is hyphens ranges. -These look like: - -* `1.2 - 1.4.5` which is equivalent to `>= 1.2 <= 1.4.5` -* `2.3.4 - 4.5` which is equivalent to `>= 2.3.4 <= 4.5` - -### Wildcards In Comparisons - -The `x`, `X`, and `*` characters can be used as a wildcard character. This works -for all comparison operators. When used on the `=` operator it falls -back to the patch level comparison (see tilde below). For example, - -* `1.2.x` is equivalent to `>= 1.2.0, < 1.3.0` -* `>= 1.2.x` is equivalent to `>= 1.2.0` -* `<= 2.x` is equivalent to `< 3` -* `*` is equivalent to `>= 0.0.0` - -### Tilde Range Comparisons (Patch) - -The tilde (`~`) comparison operator is for patch level ranges when a minor -version is specified and major level changes when the minor number is missing. -For example, - -* `~1.2.3` is equivalent to `>= 1.2.3, < 1.3.0` -* `~1` is equivalent to `>= 1, < 2` -* `~2.3` is equivalent to `>= 2.3, < 2.4` -* `~1.2.x` is equivalent to `>= 1.2.0, < 1.3.0` -* `~1.x` is equivalent to `>= 1, < 2` - -### Caret Range Comparisons (Major) - -The caret (`^`) comparison operator is for major level changes once a stable -(1.0.0) release has occurred. Prior to a 1.0.0 release the minor versions acts -as the API stability level. This is useful when comparisons of API versions as a -major change is API breaking. For example, - -* `^1.2.3` is equivalent to `>= 1.2.3, < 2.0.0` -* `^1.2.x` is equivalent to `>= 1.2.0, < 2.0.0` -* `^2.3` is equivalent to `>= 2.3, < 3` -* `^2.x` is equivalent to `>= 2.0.0, < 3` -* `^0.2.3` is equivalent to `>=0.2.3 <0.3.0` -* `^0.2` is equivalent to `>=0.2.0 <0.3.0` -* `^0.0.3` is equivalent to `>=0.0.3 <0.0.4` -* `^0.0` is equivalent to `>=0.0.0 <0.1.0` -* `^0` is equivalent to `>=0.0.0 <1.0.0` - -## Validation - -In addition to testing a version against a constraint, a version can be validated -against a constraint. When validation fails a slice of errors containing why a -version didn't meet the constraint is returned. For example, - -```go -c, err := semver.NewConstraint("<= 1.2.3, >= 1.4") -if err != nil { - // Handle constraint not being parseable. -} - -v, err := semver.NewVersion("1.3") -if err != nil { - // Handle version not being parseable. -} - -// Validate a version against a constraint. -a, msgs := c.Validate(v) -// a is false -for _, m := range msgs { - fmt.Println(m) - - // Loops over the errors which would read - // "1.3 is greater than 1.2.3" - // "1.3 is less than 1.4" -} -``` - -## Contribute - -If you find an issue or want to contribute please file an [issue](https://github.com/Masterminds/semver/issues) -or [create a pull request](https://github.com/Masterminds/semver/pulls). diff --git a/vendor/github.com/Masterminds/semver/v3/collection.go b/vendor/github.com/Masterminds/semver/v3/collection.go deleted file mode 100644 index a78235895..000000000 --- a/vendor/github.com/Masterminds/semver/v3/collection.go +++ /dev/null @@ -1,24 +0,0 @@ -package semver - -// Collection is a collection of Version instances and implements the sort -// interface. See the sort package for more details. -// https://golang.org/pkg/sort/ -type Collection []*Version - -// Len returns the length of a collection. The number of Version instances -// on the slice. -func (c Collection) Len() int { - return len(c) -} - -// Less is needed for the sort interface to compare two Version objects on the -// slice. If checks if one is less than the other. -func (c Collection) Less(i, j int) bool { - return c[i].LessThan(c[j]) -} - -// Swap is needed for the sort interface to replace the Version objects -// at two different positions in the slice. -func (c Collection) Swap(i, j int) { - c[i], c[j] = c[j], c[i] -} diff --git a/vendor/github.com/Masterminds/semver/v3/constraints.go b/vendor/github.com/Masterminds/semver/v3/constraints.go deleted file mode 100644 index 547613f04..000000000 --- a/vendor/github.com/Masterminds/semver/v3/constraints.go +++ /dev/null @@ -1,568 +0,0 @@ -package semver - -import ( - "bytes" - "errors" - "fmt" - "regexp" - "strings" -) - -// Constraints is one or more constraint that a semantic version can be -// checked against. -type Constraints struct { - constraints [][]*constraint -} - -// NewConstraint returns a Constraints instance that a Version instance can -// be checked against. If there is a parse error it will be returned. -func NewConstraint(c string) (*Constraints, error) { - - // Rewrite - ranges into a comparison operation. - c = rewriteRange(c) - - ors := strings.Split(c, "||") - or := make([][]*constraint, len(ors)) - for k, v := range ors { - - // TODO: Find a way to validate and fetch all the constraints in a simpler form - - // Validate the segment - if !validConstraintRegex.MatchString(v) { - return nil, fmt.Errorf("improper constraint: %s", v) - } - - cs := findConstraintRegex.FindAllString(v, -1) - if cs == nil { - cs = append(cs, v) - } - result := make([]*constraint, len(cs)) - for i, s := range cs { - pc, err := parseConstraint(s) - if err != nil { - return nil, err - } - - result[i] = pc - } - or[k] = result - } - - o := &Constraints{constraints: or} - return o, nil -} - -// Check tests if a version satisfies the constraints. -func (cs Constraints) Check(v *Version) bool { - // TODO(mattfarina): For v4 of this library consolidate the Check and Validate - // functions as the underlying functions make that possible now. - // loop over the ORs and check the inner ANDs - for _, o := range cs.constraints { - joy := true - for _, c := range o { - if check, _ := c.check(v); !check { - joy = false - break - } - } - - if joy { - return true - } - } - - return false -} - -// Validate checks if a version satisfies a constraint. If not a slice of -// reasons for the failure are returned in addition to a bool. -func (cs Constraints) Validate(v *Version) (bool, []error) { - // loop over the ORs and check the inner ANDs - var e []error - - // Capture the prerelease message only once. When it happens the first time - // this var is marked - var prerelesase bool - for _, o := range cs.constraints { - joy := true - for _, c := range o { - // Before running the check handle the case there the version is - // a prerelease and the check is not searching for prereleases. - if c.con.pre == "" && v.pre != "" { - if !prerelesase { - em := fmt.Errorf("%s is a prerelease version and the constraint is only looking for release versions", v) - e = append(e, em) - prerelesase = true - } - joy = false - - } else { - - if _, err := c.check(v); err != nil { - e = append(e, err) - joy = false - } - } - } - - if joy { - return true, []error{} - } - } - - return false, e -} - -func (cs Constraints) String() string { - buf := make([]string, len(cs.constraints)) - var tmp bytes.Buffer - - for k, v := range cs.constraints { - tmp.Reset() - vlen := len(v) - for kk, c := range v { - tmp.WriteString(c.string()) - - // Space separate the AND conditions - if vlen > 1 && kk < vlen-1 { - tmp.WriteString(" ") - } - } - buf[k] = tmp.String() - } - - return strings.Join(buf, " || ") -} - -var constraintOps map[string]cfunc -var constraintRegex *regexp.Regexp -var constraintRangeRegex *regexp.Regexp - -// Used to find individual constraints within a multi-constraint string -var findConstraintRegex *regexp.Regexp - -// Used to validate an segment of ANDs is valid -var validConstraintRegex *regexp.Regexp - -const cvRegex string = `v?([0-9|x|X|\*]+)(\.[0-9|x|X|\*]+)?(\.[0-9|x|X|\*]+)?` + - `(-([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?` + - `(\+([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?` - -func init() { - constraintOps = map[string]cfunc{ - "": constraintTildeOrEqual, - "=": constraintTildeOrEqual, - "!=": constraintNotEqual, - ">": constraintGreaterThan, - "<": constraintLessThan, - ">=": constraintGreaterThanEqual, - "=>": constraintGreaterThanEqual, - "<=": constraintLessThanEqual, - "=<": constraintLessThanEqual, - "~": constraintTilde, - "~>": constraintTilde, - "^": constraintCaret, - } - - ops := `=||!=|>|<|>=|=>|<=|=<|~|~>|\^` - - constraintRegex = regexp.MustCompile(fmt.Sprintf( - `^\s*(%s)\s*(%s)\s*$`, - ops, - cvRegex)) - - constraintRangeRegex = regexp.MustCompile(fmt.Sprintf( - `\s*(%s)\s+-\s+(%s)\s*`, - cvRegex, cvRegex)) - - findConstraintRegex = regexp.MustCompile(fmt.Sprintf( - `(%s)\s*(%s)`, - ops, - cvRegex)) - - validConstraintRegex = regexp.MustCompile(fmt.Sprintf( - `^(\s*(%s)\s*(%s)\s*\,?)+$`, - ops, - cvRegex)) -} - -// An individual constraint -type constraint struct { - // The version used in the constraint check. For example, if a constraint - // is '<= 2.0.0' the con a version instance representing 2.0.0. - con *Version - - // The original parsed version (e.g., 4.x from != 4.x) - orig string - - // The original operator for the constraint - origfunc string - - // When an x is used as part of the version (e.g., 1.x) - minorDirty bool - dirty bool - patchDirty bool -} - -// Check if a version meets the constraint -func (c *constraint) check(v *Version) (bool, error) { - return constraintOps[c.origfunc](v, c) -} - -// String prints an individual constraint into a string -func (c *constraint) string() string { - return c.origfunc + c.orig -} - -type cfunc func(v *Version, c *constraint) (bool, error) - -func parseConstraint(c string) (*constraint, error) { - if len(c) > 0 { - m := constraintRegex.FindStringSubmatch(c) - if m == nil { - return nil, fmt.Errorf("improper constraint: %s", c) - } - - cs := &constraint{ - orig: m[2], - origfunc: m[1], - } - - ver := m[2] - minorDirty := false - patchDirty := false - dirty := false - if isX(m[3]) || m[3] == "" { - ver = "0.0.0" - dirty = true - } else if isX(strings.TrimPrefix(m[4], ".")) || m[4] == "" { - minorDirty = true - dirty = true - ver = fmt.Sprintf("%s.0.0%s", m[3], m[6]) - } else if isX(strings.TrimPrefix(m[5], ".")) || m[5] == "" { - dirty = true - patchDirty = true - ver = fmt.Sprintf("%s%s.0%s", m[3], m[4], m[6]) - } - - con, err := NewVersion(ver) - if err != nil { - - // The constraintRegex should catch any regex parsing errors. So, - // we should never get here. - return nil, errors.New("constraint Parser Error") - } - - cs.con = con - cs.minorDirty = minorDirty - cs.patchDirty = patchDirty - cs.dirty = dirty - - return cs, nil - } - - // The rest is the special case where an empty string was passed in which - // is equivalent to * or >=0.0.0 - con, err := StrictNewVersion("0.0.0") - if err != nil { - - // The constraintRegex should catch any regex parsing errors. So, - // we should never get here. - return nil, errors.New("constraint Parser Error") - } - - cs := &constraint{ - con: con, - orig: c, - origfunc: "", - minorDirty: false, - patchDirty: false, - dirty: true, - } - return cs, nil -} - -// Constraint functions -func constraintNotEqual(v *Version, c *constraint) (bool, error) { - if c.dirty { - - // If there is a pre-release on the version but the constraint isn't looking - // for them assume that pre-releases are not compatible. See issue 21 for - // more details. - if v.Prerelease() != "" && c.con.Prerelease() == "" { - return false, fmt.Errorf("%s is a prerelease version and the constraint is only looking for release versions", v) - } - - if c.con.Major() != v.Major() { - return true, nil - } - if c.con.Minor() != v.Minor() && !c.minorDirty { - return true, nil - } else if c.minorDirty { - return false, fmt.Errorf("%s is equal to %s", v, c.orig) - } else if c.con.Patch() != v.Patch() && !c.patchDirty { - return true, nil - } else if c.patchDirty { - // Need to handle prereleases if present - if v.Prerelease() != "" || c.con.Prerelease() != "" { - eq := comparePrerelease(v.Prerelease(), c.con.Prerelease()) != 0 - if eq { - return true, nil - } - return false, fmt.Errorf("%s is equal to %s", v, c.orig) - } - return false, fmt.Errorf("%s is equal to %s", v, c.orig) - } - } - - eq := v.Equal(c.con) - if eq { - return false, fmt.Errorf("%s is equal to %s", v, c.orig) - } - - return true, nil -} - -func constraintGreaterThan(v *Version, c *constraint) (bool, error) { - - // If there is a pre-release on the version but the constraint isn't looking - // for them assume that pre-releases are not compatible. See issue 21 for - // more details. - if v.Prerelease() != "" && c.con.Prerelease() == "" { - return false, fmt.Errorf("%s is a prerelease version and the constraint is only looking for release versions", v) - } - - var eq bool - - if !c.dirty { - eq = v.Compare(c.con) == 1 - if eq { - return true, nil - } - return false, fmt.Errorf("%s is less than or equal to %s", v, c.orig) - } - - if v.Major() > c.con.Major() { - return true, nil - } else if v.Major() < c.con.Major() { - return false, fmt.Errorf("%s is less than or equal to %s", v, c.orig) - } else if c.minorDirty { - // This is a range case such as >11. When the version is something like - // 11.1.0 is it not > 11. For that we would need 12 or higher - return false, fmt.Errorf("%s is less than or equal to %s", v, c.orig) - } else if c.patchDirty { - // This is for ranges such as >11.1. A version of 11.1.1 is not greater - // which one of 11.2.1 is greater - eq = v.Minor() > c.con.Minor() - if eq { - return true, nil - } - return false, fmt.Errorf("%s is less than or equal to %s", v, c.orig) - } - - // If we have gotten here we are not comparing pre-preleases and can use the - // Compare function to accomplish that. - eq = v.Compare(c.con) == 1 - if eq { - return true, nil - } - return false, fmt.Errorf("%s is less than or equal to %s", v, c.orig) -} - -func constraintLessThan(v *Version, c *constraint) (bool, error) { - // If there is a pre-release on the version but the constraint isn't looking - // for them assume that pre-releases are not compatible. See issue 21 for - // more details. - if v.Prerelease() != "" && c.con.Prerelease() == "" { - return false, fmt.Errorf("%s is a prerelease version and the constraint is only looking for release versions", v) - } - - eq := v.Compare(c.con) < 0 - if eq { - return true, nil - } - return false, fmt.Errorf("%s is greater than or equal to %s", v, c.orig) -} - -func constraintGreaterThanEqual(v *Version, c *constraint) (bool, error) { - - // If there is a pre-release on the version but the constraint isn't looking - // for them assume that pre-releases are not compatible. See issue 21 for - // more details. - if v.Prerelease() != "" && c.con.Prerelease() == "" { - return false, fmt.Errorf("%s is a prerelease version and the constraint is only looking for release versions", v) - } - - eq := v.Compare(c.con) >= 0 - if eq { - return true, nil - } - return false, fmt.Errorf("%s is less than %s", v, c.orig) -} - -func constraintLessThanEqual(v *Version, c *constraint) (bool, error) { - // If there is a pre-release on the version but the constraint isn't looking - // for them assume that pre-releases are not compatible. See issue 21 for - // more details. - if v.Prerelease() != "" && c.con.Prerelease() == "" { - return false, fmt.Errorf("%s is a prerelease version and the constraint is only looking for release versions", v) - } - - var eq bool - - if !c.dirty { - eq = v.Compare(c.con) <= 0 - if eq { - return true, nil - } - return false, fmt.Errorf("%s is greater than %s", v, c.orig) - } - - if v.Major() > c.con.Major() { - return false, fmt.Errorf("%s is greater than %s", v, c.orig) - } else if v.Major() == c.con.Major() && v.Minor() > c.con.Minor() && !c.minorDirty { - return false, fmt.Errorf("%s is greater than %s", v, c.orig) - } - - return true, nil -} - -// ~*, ~>* --> >= 0.0.0 (any) -// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0, <3.0.0 -// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0, <2.1.0 -// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0, <1.3.0 -// ~1.2.3, ~>1.2.3 --> >=1.2.3, <1.3.0 -// ~1.2.0, ~>1.2.0 --> >=1.2.0, <1.3.0 -func constraintTilde(v *Version, c *constraint) (bool, error) { - // If there is a pre-release on the version but the constraint isn't looking - // for them assume that pre-releases are not compatible. See issue 21 for - // more details. - if v.Prerelease() != "" && c.con.Prerelease() == "" { - return false, fmt.Errorf("%s is a prerelease version and the constraint is only looking for release versions", v) - } - - if v.LessThan(c.con) { - return false, fmt.Errorf("%s is less than %s", v, c.orig) - } - - // ~0.0.0 is a special case where all constraints are accepted. It's - // equivalent to >= 0.0.0. - if c.con.Major() == 0 && c.con.Minor() == 0 && c.con.Patch() == 0 && - !c.minorDirty && !c.patchDirty { - return true, nil - } - - if v.Major() != c.con.Major() { - return false, fmt.Errorf("%s does not have same major version as %s", v, c.orig) - } - - if v.Minor() != c.con.Minor() && !c.minorDirty { - return false, fmt.Errorf("%s does not have same major and minor version as %s", v, c.orig) - } - - return true, nil -} - -// When there is a .x (dirty) status it automatically opts in to ~. Otherwise -// it's a straight = -func constraintTildeOrEqual(v *Version, c *constraint) (bool, error) { - // If there is a pre-release on the version but the constraint isn't looking - // for them assume that pre-releases are not compatible. See issue 21 for - // more details. - if v.Prerelease() != "" && c.con.Prerelease() == "" { - return false, fmt.Errorf("%s is a prerelease version and the constraint is only looking for release versions", v) - } - - if c.dirty { - return constraintTilde(v, c) - } - - eq := v.Equal(c.con) - if eq { - return true, nil - } - - return false, fmt.Errorf("%s is not equal to %s", v, c.orig) -} - -// ^* --> (any) -// ^1.2.3 --> >=1.2.3 <2.0.0 -// ^1.2 --> >=1.2.0 <2.0.0 -// ^1 --> >=1.0.0 <2.0.0 -// ^0.2.3 --> >=0.2.3 <0.3.0 -// ^0.2 --> >=0.2.0 <0.3.0 -// ^0.0.3 --> >=0.0.3 <0.0.4 -// ^0.0 --> >=0.0.0 <0.1.0 -// ^0 --> >=0.0.0 <1.0.0 -func constraintCaret(v *Version, c *constraint) (bool, error) { - // If there is a pre-release on the version but the constraint isn't looking - // for them assume that pre-releases are not compatible. See issue 21 for - // more details. - if v.Prerelease() != "" && c.con.Prerelease() == "" { - return false, fmt.Errorf("%s is a prerelease version and the constraint is only looking for release versions", v) - } - - // This less than handles prereleases - if v.LessThan(c.con) { - return false, fmt.Errorf("%s is less than %s", v, c.orig) - } - - var eq bool - - // ^ when the major > 0 is >=x.y.z < x+1 - if c.con.Major() > 0 || c.minorDirty { - - // ^ has to be within a major range for > 0. Everything less than was - // filtered out with the LessThan call above. This filters out those - // that greater but not within the same major range. - eq = v.Major() == c.con.Major() - if eq { - return true, nil - } - return false, fmt.Errorf("%s does not have same major version as %s", v, c.orig) - } - - // ^ when the major is 0 and minor > 0 is >=0.y.z < 0.y+1 - if c.con.Major() == 0 && v.Major() > 0 { - return false, fmt.Errorf("%s does not have same major version as %s", v, c.orig) - } - // If the con Minor is > 0 it is not dirty - if c.con.Minor() > 0 || c.patchDirty { - eq = v.Minor() == c.con.Minor() - if eq { - return true, nil - } - return false, fmt.Errorf("%s does not have same minor version as %s. Expected minor versions to match when constraint major version is 0", v, c.orig) - } - - // At this point the major is 0 and the minor is 0 and not dirty. The patch - // is not dirty so we need to check if they are equal. If they are not equal - eq = c.con.Patch() == v.Patch() - if eq { - return true, nil - } - return false, fmt.Errorf("%s does not equal %s. Expect version and constraint to equal when major and minor versions are 0", v, c.orig) -} - -func isX(x string) bool { - switch x { - case "x", "*", "X": - return true - default: - return false - } -} - -func rewriteRange(i string) string { - m := constraintRangeRegex.FindAllStringSubmatch(i, -1) - if m == nil { - return i - } - o := i - for _, v := range m { - t := fmt.Sprintf(">= %s, <= %s", v[1], v[11]) - o = strings.Replace(o, v[0], t, 1) - } - - return o -} diff --git a/vendor/github.com/Masterminds/semver/v3/doc.go b/vendor/github.com/Masterminds/semver/v3/doc.go deleted file mode 100644 index 391aa46b7..000000000 --- a/vendor/github.com/Masterminds/semver/v3/doc.go +++ /dev/null @@ -1,184 +0,0 @@ -/* -Package semver provides the ability to work with Semantic Versions (http://semver.org) in Go. - -Specifically it provides the ability to: - - * Parse semantic versions - * Sort semantic versions - * Check if a semantic version fits within a set of constraints - * Optionally work with a `v` prefix - -Parsing Semantic Versions - -There are two functions that can parse semantic versions. The `StrictNewVersion` -function only parses valid version 2 semantic versions as outlined in the -specification. The `NewVersion` function attempts to coerce a version into a -semantic version and parse it. For example, if there is a leading v or a version -listed without all 3 parts (e.g. 1.2) it will attempt to coerce it into a valid -semantic version (e.g., 1.2.0). In both cases a `Version` object is returned -that can be sorted, compared, and used in constraints. - -When parsing a version an optional error can be returned if there is an issue -parsing the version. For example, - - v, err := semver.NewVersion("1.2.3-beta.1+b345") - -The version object has methods to get the parts of the version, compare it to -other versions, convert the version back into a string, and get the original -string. For more details please see the documentation -at https://godoc.org/github.com/Masterminds/semver. - -Sorting Semantic Versions - -A set of versions can be sorted using the `sort` package from the standard library. -For example, - - raw := []string{"1.2.3", "1.0", "1.3", "2", "0.4.2",} - vs := make([]*semver.Version, len(raw)) - for i, r := range raw { - v, err := semver.NewVersion(r) - if err != nil { - t.Errorf("Error parsing version: %s", err) - } - - vs[i] = v - } - - sort.Sort(semver.Collection(vs)) - -Checking Version Constraints and Comparing Versions - -There are two methods for comparing versions. One uses comparison methods on -`Version` instances and the other is using Constraints. There are some important -differences to notes between these two methods of comparison. - -1. When two versions are compared using functions such as `Compare`, `LessThan`, - and others it will follow the specification and always include prereleases - within the comparison. It will provide an answer valid with the comparison - spec section at https://semver.org/#spec-item-11 -2. When constraint checking is used for checks or validation it will follow a - different set of rules that are common for ranges with tools like npm/js - and Rust/Cargo. This includes considering prereleases to be invalid if the - ranges does not include on. If you want to have it include pre-releases a - simple solution is to include `-0` in your range. -3. Constraint ranges can have some complex rules including the shorthard use of - ~ and ^. For more details on those see the options below. - -There are differences between the two methods or checking versions because the -comparison methods on `Version` follow the specification while comparison ranges -are not part of the specification. Different packages and tools have taken it -upon themselves to come up with range rules. This has resulted in differences. -For example, npm/js and Cargo/Rust follow similar patterns which PHP has a -different pattern for ^. The comparison features in this package follow the -npm/js and Cargo/Rust lead because applications using it have followed similar -patters with their versions. - -Checking a version against version constraints is one of the most featureful -parts of the package. - - c, err := semver.NewConstraint(">= 1.2.3") - if err != nil { - // Handle constraint not being parsable. - } - - v, err := semver.NewVersion("1.3") - if err != nil { - // Handle version not being parsable. - } - // Check if the version meets the constraints. The a variable will be true. - a := c.Check(v) - -Basic Comparisons - -There are two elements to the comparisons. First, a comparison string is a list -of comma or space separated AND comparisons. These are then separated by || (OR) -comparisons. For example, `">= 1.2 < 3.0.0 || >= 4.2.3"` is looking for a -comparison that's greater than or equal to 1.2 and less than 3.0.0 or is -greater than or equal to 4.2.3. This can also be written as -`">= 1.2, < 3.0.0 || >= 4.2.3"` - -The basic comparisons are: - - * `=`: equal (aliased to no operator) - * `!=`: not equal - * `>`: greater than - * `<`: less than - * `>=`: greater than or equal to - * `<=`: less than or equal to - -Hyphen Range Comparisons - -There are multiple methods to handle ranges and the first is hyphens ranges. -These look like: - - * `1.2 - 1.4.5` which is equivalent to `>= 1.2, <= 1.4.5` - * `2.3.4 - 4.5` which is equivalent to `>= 2.3.4 <= 4.5` - -Wildcards In Comparisons - -The `x`, `X`, and `*` characters can be used as a wildcard character. This works -for all comparison operators. When used on the `=` operator it falls -back to the tilde operation. For example, - - * `1.2.x` is equivalent to `>= 1.2.0 < 1.3.0` - * `>= 1.2.x` is equivalent to `>= 1.2.0` - * `<= 2.x` is equivalent to `<= 3` - * `*` is equivalent to `>= 0.0.0` - -Tilde Range Comparisons (Patch) - -The tilde (`~`) comparison operator is for patch level ranges when a minor -version is specified and major level changes when the minor number is missing. -For example, - - * `~1.2.3` is equivalent to `>= 1.2.3 < 1.3.0` - * `~1` is equivalent to `>= 1, < 2` - * `~2.3` is equivalent to `>= 2.3 < 2.4` - * `~1.2.x` is equivalent to `>= 1.2.0 < 1.3.0` - * `~1.x` is equivalent to `>= 1 < 2` - -Caret Range Comparisons (Major) - -The caret (`^`) comparison operator is for major level changes once a stable -(1.0.0) release has occurred. Prior to a 1.0.0 release the minor versions acts -as the API stability level. This is useful when comparisons of API versions as a -major change is API breaking. For example, - - * `^1.2.3` is equivalent to `>= 1.2.3, < 2.0.0` - * `^1.2.x` is equivalent to `>= 1.2.0, < 2.0.0` - * `^2.3` is equivalent to `>= 2.3, < 3` - * `^2.x` is equivalent to `>= 2.0.0, < 3` - * `^0.2.3` is equivalent to `>=0.2.3 <0.3.0` - * `^0.2` is equivalent to `>=0.2.0 <0.3.0` - * `^0.0.3` is equivalent to `>=0.0.3 <0.0.4` - * `^0.0` is equivalent to `>=0.0.0 <0.1.0` - * `^0` is equivalent to `>=0.0.0 <1.0.0` - -Validation - -In addition to testing a version against a constraint, a version can be validated -against a constraint. When validation fails a slice of errors containing why a -version didn't meet the constraint is returned. For example, - - c, err := semver.NewConstraint("<= 1.2.3, >= 1.4") - if err != nil { - // Handle constraint not being parseable. - } - - v, _ := semver.NewVersion("1.3") - if err != nil { - // Handle version not being parseable. - } - - // Validate a version against a constraint. - a, msgs := c.Validate(v) - // a is false - for _, m := range msgs { - fmt.Println(m) - - // Loops over the errors which would read - // "1.3 is greater than 1.2.3" - // "1.3 is less than 1.4" - } -*/ -package semver diff --git a/vendor/github.com/Masterminds/semver/v3/fuzz.go b/vendor/github.com/Masterminds/semver/v3/fuzz.go deleted file mode 100644 index a242ad705..000000000 --- a/vendor/github.com/Masterminds/semver/v3/fuzz.go +++ /dev/null @@ -1,22 +0,0 @@ -// +build gofuzz - -package semver - -func Fuzz(data []byte) int { - d := string(data) - - // Test NewVersion - _, _ = NewVersion(d) - - // Test StrictNewVersion - _, _ = StrictNewVersion(d) - - // Test NewConstraint - _, _ = NewConstraint(d) - - // The return value should be 0 normally, 1 if the priority in future tests - // should be increased, and -1 if future tests should skip passing in that - // data. We do not have a reason to change priority so 0 is always returned. - // There are example tests that do this. - return 0 -} diff --git a/vendor/github.com/Masterminds/semver/v3/version.go b/vendor/github.com/Masterminds/semver/v3/version.go deleted file mode 100644 index d6b9cda3e..000000000 --- a/vendor/github.com/Masterminds/semver/v3/version.go +++ /dev/null @@ -1,606 +0,0 @@ -package semver - -import ( - "bytes" - "database/sql/driver" - "encoding/json" - "errors" - "fmt" - "regexp" - "strconv" - "strings" -) - -// The compiled version of the regex created at init() is cached here so it -// only needs to be created once. -var versionRegex *regexp.Regexp - -var ( - // ErrInvalidSemVer is returned a version is found to be invalid when - // being parsed. - ErrInvalidSemVer = errors.New("Invalid Semantic Version") - - // ErrEmptyString is returned when an empty string is passed in for parsing. - ErrEmptyString = errors.New("Version string empty") - - // ErrInvalidCharacters is returned when invalid characters are found as - // part of a version - ErrInvalidCharacters = errors.New("Invalid characters in version") - - // ErrSegmentStartsZero is returned when a version segment starts with 0. - // This is invalid in SemVer. - ErrSegmentStartsZero = errors.New("Version segment starts with 0") - - // ErrInvalidMetadata is returned when the metadata is an invalid format - ErrInvalidMetadata = errors.New("Invalid Metadata string") - - // ErrInvalidPrerelease is returned when the pre-release is an invalid format - ErrInvalidPrerelease = errors.New("Invalid Prerelease string") -) - -// semVerRegex is the regular expression used to parse a semantic version. -const semVerRegex string = `v?([0-9]+)(\.[0-9]+)?(\.[0-9]+)?` + - `(-([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?` + - `(\+([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?` - -// Version represents a single semantic version. -type Version struct { - major, minor, patch uint64 - pre string - metadata string - original string -} - -func init() { - versionRegex = regexp.MustCompile("^" + semVerRegex + "$") -} - -const num string = "0123456789" -const allowed string = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-" + num - -// StrictNewVersion parses a given version and returns an instance of Version or -// an error if unable to parse the version. Only parses valid semantic versions. -// Performs checking that can find errors within the version. -// If you want to coerce a version, such as 1 or 1.2, and perse that as the 1.x -// releases of semver provided use the NewSemver() function. -func StrictNewVersion(v string) (*Version, error) { - // Parsing here does not use RegEx in order to increase performance and reduce - // allocations. - - if len(v) == 0 { - return nil, ErrEmptyString - } - - // Split the parts into [0]major, [1]minor, and [2]patch,prerelease,build - parts := strings.SplitN(v, ".", 3) - if len(parts) != 3 { - return nil, ErrInvalidSemVer - } - - sv := &Version{ - original: v, - } - - // check for prerelease or build metadata - var extra []string - if strings.ContainsAny(parts[2], "-+") { - // Start with the build metadata first as it needs to be on the right - extra = strings.SplitN(parts[2], "+", 2) - if len(extra) > 1 { - // build metadata found - sv.metadata = extra[1] - parts[2] = extra[0] - } - - extra = strings.SplitN(parts[2], "-", 2) - if len(extra) > 1 { - // prerelease found - sv.pre = extra[1] - parts[2] = extra[0] - } - } - - // Validate the number segments are valid. This includes only having positive - // numbers and no leading 0's. - for _, p := range parts { - if !containsOnly(p, num) { - return nil, ErrInvalidCharacters - } - - if len(p) > 1 && p[0] == '0' { - return nil, ErrSegmentStartsZero - } - } - - // Extract the major, minor, and patch elements onto the returned Version - var err error - sv.major, err = strconv.ParseUint(parts[0], 10, 64) - if err != nil { - return nil, err - } - - sv.minor, err = strconv.ParseUint(parts[1], 10, 64) - if err != nil { - return nil, err - } - - sv.patch, err = strconv.ParseUint(parts[2], 10, 64) - if err != nil { - return nil, err - } - - // No prerelease or build metadata found so returning now as a fastpath. - if sv.pre == "" && sv.metadata == "" { - return sv, nil - } - - if sv.pre != "" { - if err = validatePrerelease(sv.pre); err != nil { - return nil, err - } - } - - if sv.metadata != "" { - if err = validateMetadata(sv.metadata); err != nil { - return nil, err - } - } - - return sv, nil -} - -// NewVersion parses a given version and returns an instance of Version or -// an error if unable to parse the version. If the version is SemVer-ish it -// attempts to convert it to SemVer. If you want to validate it was a strict -// semantic version at parse time see StrictNewVersion(). -func NewVersion(v string) (*Version, error) { - m := versionRegex.FindStringSubmatch(v) - if m == nil { - return nil, ErrInvalidSemVer - } - - sv := &Version{ - metadata: m[8], - pre: m[5], - original: v, - } - - var err error - sv.major, err = strconv.ParseUint(m[1], 10, 64) - if err != nil { - return nil, fmt.Errorf("Error parsing version segment: %s", err) - } - - if m[2] != "" { - sv.minor, err = strconv.ParseUint(strings.TrimPrefix(m[2], "."), 10, 64) - if err != nil { - return nil, fmt.Errorf("Error parsing version segment: %s", err) - } - } else { - sv.minor = 0 - } - - if m[3] != "" { - sv.patch, err = strconv.ParseUint(strings.TrimPrefix(m[3], "."), 10, 64) - if err != nil { - return nil, fmt.Errorf("Error parsing version segment: %s", err) - } - } else { - sv.patch = 0 - } - - // Perform some basic due diligence on the extra parts to ensure they are - // valid. - - if sv.pre != "" { - if err = validatePrerelease(sv.pre); err != nil { - return nil, err - } - } - - if sv.metadata != "" { - if err = validateMetadata(sv.metadata); err != nil { - return nil, err - } - } - - return sv, nil -} - -// MustParse parses a given version and panics on error. -func MustParse(v string) *Version { - sv, err := NewVersion(v) - if err != nil { - panic(err) - } - return sv -} - -// String converts a Version object to a string. -// Note, if the original version contained a leading v this version will not. -// See the Original() method to retrieve the original value. Semantic Versions -// don't contain a leading v per the spec. Instead it's optional on -// implementation. -func (v Version) String() string { - var buf bytes.Buffer - - fmt.Fprintf(&buf, "%d.%d.%d", v.major, v.minor, v.patch) - if v.pre != "" { - fmt.Fprintf(&buf, "-%s", v.pre) - } - if v.metadata != "" { - fmt.Fprintf(&buf, "+%s", v.metadata) - } - - return buf.String() -} - -// Original returns the original value passed in to be parsed. -func (v *Version) Original() string { - return v.original -} - -// Major returns the major version. -func (v Version) Major() uint64 { - return v.major -} - -// Minor returns the minor version. -func (v Version) Minor() uint64 { - return v.minor -} - -// Patch returns the patch version. -func (v Version) Patch() uint64 { - return v.patch -} - -// Prerelease returns the pre-release version. -func (v Version) Prerelease() string { - return v.pre -} - -// Metadata returns the metadata on the version. -func (v Version) Metadata() string { - return v.metadata -} - -// originalVPrefix returns the original 'v' prefix if any. -func (v Version) originalVPrefix() string { - - // Note, only lowercase v is supported as a prefix by the parser. - if v.original != "" && v.original[:1] == "v" { - return v.original[:1] - } - return "" -} - -// IncPatch produces the next patch version. -// If the current version does not have prerelease/metadata information, -// it unsets metadata and prerelease values, increments patch number. -// If the current version has any of prerelease or metadata information, -// it unsets both values and keeps current patch value -func (v Version) IncPatch() Version { - vNext := v - // according to http://semver.org/#spec-item-9 - // Pre-release versions have a lower precedence than the associated normal version. - // according to http://semver.org/#spec-item-10 - // Build metadata SHOULD be ignored when determining version precedence. - if v.pre != "" { - vNext.metadata = "" - vNext.pre = "" - } else { - vNext.metadata = "" - vNext.pre = "" - vNext.patch = v.patch + 1 - } - vNext.original = v.originalVPrefix() + "" + vNext.String() - return vNext -} - -// IncMinor produces the next minor version. -// Sets patch to 0. -// Increments minor number. -// Unsets metadata. -// Unsets prerelease status. -func (v Version) IncMinor() Version { - vNext := v - vNext.metadata = "" - vNext.pre = "" - vNext.patch = 0 - vNext.minor = v.minor + 1 - vNext.original = v.originalVPrefix() + "" + vNext.String() - return vNext -} - -// IncMajor produces the next major version. -// Sets patch to 0. -// Sets minor to 0. -// Increments major number. -// Unsets metadata. -// Unsets prerelease status. -func (v Version) IncMajor() Version { - vNext := v - vNext.metadata = "" - vNext.pre = "" - vNext.patch = 0 - vNext.minor = 0 - vNext.major = v.major + 1 - vNext.original = v.originalVPrefix() + "" + vNext.String() - return vNext -} - -// SetPrerelease defines the prerelease value. -// Value must not include the required 'hyphen' prefix. -func (v Version) SetPrerelease(prerelease string) (Version, error) { - vNext := v - if len(prerelease) > 0 { - if err := validatePrerelease(prerelease); err != nil { - return vNext, err - } - } - vNext.pre = prerelease - vNext.original = v.originalVPrefix() + "" + vNext.String() - return vNext, nil -} - -// SetMetadata defines metadata value. -// Value must not include the required 'plus' prefix. -func (v Version) SetMetadata(metadata string) (Version, error) { - vNext := v - if len(metadata) > 0 { - if err := validateMetadata(metadata); err != nil { - return vNext, err - } - } - vNext.metadata = metadata - vNext.original = v.originalVPrefix() + "" + vNext.String() - return vNext, nil -} - -// LessThan tests if one version is less than another one. -func (v *Version) LessThan(o *Version) bool { - return v.Compare(o) < 0 -} - -// GreaterThan tests if one version is greater than another one. -func (v *Version) GreaterThan(o *Version) bool { - return v.Compare(o) > 0 -} - -// Equal tests if two versions are equal to each other. -// Note, versions can be equal with different metadata since metadata -// is not considered part of the comparable version. -func (v *Version) Equal(o *Version) bool { - return v.Compare(o) == 0 -} - -// Compare compares this version to another one. It returns -1, 0, or 1 if -// the version smaller, equal, or larger than the other version. -// -// Versions are compared by X.Y.Z. Build metadata is ignored. Prerelease is -// lower than the version without a prerelease. Compare always takes into account -// prereleases. If you want to work with ranges using typical range syntaxes that -// skip prereleases if the range is not looking for them use constraints. -func (v *Version) Compare(o *Version) int { - // Compare the major, minor, and patch version for differences. If a - // difference is found return the comparison. - if d := compareSegment(v.Major(), o.Major()); d != 0 { - return d - } - if d := compareSegment(v.Minor(), o.Minor()); d != 0 { - return d - } - if d := compareSegment(v.Patch(), o.Patch()); d != 0 { - return d - } - - // At this point the major, minor, and patch versions are the same. - ps := v.pre - po := o.Prerelease() - - if ps == "" && po == "" { - return 0 - } - if ps == "" { - return 1 - } - if po == "" { - return -1 - } - - return comparePrerelease(ps, po) -} - -// UnmarshalJSON implements JSON.Unmarshaler interface. -func (v *Version) UnmarshalJSON(b []byte) error { - var s string - if err := json.Unmarshal(b, &s); err != nil { - return err - } - temp, err := NewVersion(s) - if err != nil { - return err - } - v.major = temp.major - v.minor = temp.minor - v.patch = temp.patch - v.pre = temp.pre - v.metadata = temp.metadata - v.original = temp.original - return nil -} - -// MarshalJSON implements JSON.Marshaler interface. -func (v Version) MarshalJSON() ([]byte, error) { - return json.Marshal(v.String()) -} - -// Scan implements the SQL.Scanner interface. -func (v *Version) Scan(value interface{}) error { - var s string - s, _ = value.(string) - temp, err := NewVersion(s) - if err != nil { - return err - } - v.major = temp.major - v.minor = temp.minor - v.patch = temp.patch - v.pre = temp.pre - v.metadata = temp.metadata - v.original = temp.original - return nil -} - -// Value implements the Driver.Valuer interface. -func (v Version) Value() (driver.Value, error) { - return v.String(), nil -} - -func compareSegment(v, o uint64) int { - if v < o { - return -1 - } - if v > o { - return 1 - } - - return 0 -} - -func comparePrerelease(v, o string) int { - - // split the prelease versions by their part. The separator, per the spec, - // is a . - sparts := strings.Split(v, ".") - oparts := strings.Split(o, ".") - - // Find the longer length of the parts to know how many loop iterations to - // go through. - slen := len(sparts) - olen := len(oparts) - - l := slen - if olen > slen { - l = olen - } - - // Iterate over each part of the prereleases to compare the differences. - for i := 0; i < l; i++ { - // Since the lentgh of the parts can be different we need to create - // a placeholder. This is to avoid out of bounds issues. - stemp := "" - if i < slen { - stemp = sparts[i] - } - - otemp := "" - if i < olen { - otemp = oparts[i] - } - - d := comparePrePart(stemp, otemp) - if d != 0 { - return d - } - } - - // Reaching here means two versions are of equal value but have different - // metadata (the part following a +). They are not identical in string form - // but the version comparison finds them to be equal. - return 0 -} - -func comparePrePart(s, o string) int { - // Fastpath if they are equal - if s == o { - return 0 - } - - // When s or o are empty we can use the other in an attempt to determine - // the response. - if s == "" { - if o != "" { - return -1 - } - return 1 - } - - if o == "" { - if s != "" { - return 1 - } - return -1 - } - - // When comparing strings "99" is greater than "103". To handle - // cases like this we need to detect numbers and compare them. According - // to the semver spec, numbers are always positive. If there is a - at the - // start like -99 this is to be evaluated as an alphanum. numbers always - // have precedence over alphanum. Parsing as Uints because negative numbers - // are ignored. - - oi, n1 := strconv.ParseUint(o, 10, 64) - si, n2 := strconv.ParseUint(s, 10, 64) - - // The case where both are strings compare the strings - if n1 != nil && n2 != nil { - if s > o { - return 1 - } - return -1 - } else if n1 != nil { - // o is a string and s is a number - return -1 - } else if n2 != nil { - // s is a string and o is a number - return 1 - } - // Both are numbers - if si > oi { - return 1 - } - return -1 - -} - -// Like strings.ContainsAny but does an only instead of any. -func containsOnly(s string, comp string) bool { - return strings.IndexFunc(s, func(r rune) bool { - return !strings.ContainsRune(comp, r) - }) == -1 -} - -// From the spec, "Identifiers MUST comprise only -// ASCII alphanumerics and hyphen [0-9A-Za-z-]. Identifiers MUST NOT be empty. -// Numeric identifiers MUST NOT include leading zeroes.". These segments can -// be dot separated. -func validatePrerelease(p string) error { - eparts := strings.Split(p, ".") - for _, p := range eparts { - if containsOnly(p, num) { - if len(p) > 1 && p[0] == '0' { - return ErrSegmentStartsZero - } - } else if !containsOnly(p, allowed) { - return ErrInvalidPrerelease - } - } - - return nil -} - -// From the spec, "Build metadata MAY be denoted by -// appending a plus sign and a series of dot separated identifiers immediately -// following the patch or pre-release version. Identifiers MUST comprise only -// ASCII alphanumerics and hyphen [0-9A-Za-z-]. Identifiers MUST NOT be empty." -func validateMetadata(m string) error { - eparts := strings.Split(m, ".") - for _, p := range eparts { - if !containsOnly(p, allowed) { - return ErrInvalidMetadata - } - } - return nil -} diff --git a/vendor/github.com/Masterminds/sprig/v3/.gitignore b/vendor/github.com/Masterminds/sprig/v3/.gitignore deleted file mode 100644 index 5e3002f88..000000000 --- a/vendor/github.com/Masterminds/sprig/v3/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -vendor/ -/.glide diff --git a/vendor/github.com/Masterminds/sprig/v3/CHANGELOG.md b/vendor/github.com/Masterminds/sprig/v3/CHANGELOG.md deleted file mode 100644 index fcdd4e88a..000000000 --- a/vendor/github.com/Masterminds/sprig/v3/CHANGELOG.md +++ /dev/null @@ -1,370 +0,0 @@ -# Changelog - -## Release 3.2.1 (2021-02-04) - -### Changed - -- Upgraded `Masterminds/goutils` to `v1.1.1`. see the [Security Advisory](https://github.com/Masterminds/goutils/security/advisories/GHSA-xg2h-wx96-xgxr) - -## Release 3.2.0 (2020-12-14) - -### Added - -- #211: Added randInt function (thanks @kochurovro) -- #223: Added fromJson and mustFromJson functions (thanks @mholt) -- #242: Added a bcrypt function (thanks @robbiet480) -- #253: Added randBytes function (thanks @MikaelSmith) -- #254: Added dig function for dicts (thanks @nyarly) -- #257: Added regexQuoteMeta for quoting regex metadata (thanks @rheaton) -- #261: Added filepath functions osBase, osDir, osExt, osClean, osIsAbs (thanks @zugl) -- #268: Added and and all functions for testing conditions (thanks @phuslu) -- #181: Added float64 arithmetic addf, add1f, subf, divf, mulf, maxf, and minf - (thanks @andrewmostello) -- #265: Added chunk function to split array into smaller arrays (thanks @karelbilek) -- #270: Extend certificate functions to handle non-RSA keys + add support for - ed25519 keys (thanks @misberner) - -### Changed - -- Removed testing and support for Go 1.12. ed25519 support requires Go 1.13 or newer -- Using semver 3.1.1 and mergo 0.3.11 - -### Fixed - -- #249: Fix htmlDateInZone example (thanks @spawnia) - -NOTE: The dependency github.com/imdario/mergo reverted the breaking change in -0.3.9 via 0.3.10 release. - -## Release 3.1.0 (2020-04-16) - -NOTE: The dependency github.com/imdario/mergo made a behavior change in 0.3.9 -that impacts sprig functionality. Do not use sprig with a version newer than 0.3.8. - -### Added - -- #225: Added support for generating htpasswd hash (thanks @rustycl0ck) -- #224: Added duration filter (thanks @frebib) -- #205: Added `seq` function (thanks @thadc23) - -### Changed - -- #203: Unlambda functions with correct signature (thanks @muesli) -- #236: Updated the license formatting for GitHub display purposes -- #238: Updated package dependency versions. Note, mergo not updated to 0.3.9 - as it causes a breaking change for sprig. That issue is tracked at - https://github.com/imdario/mergo/issues/139 - -### Fixed - -- #229: Fix `seq` example in docs (thanks @kalmant) - -## Release 3.0.2 (2019-12-13) - -### Fixed - -- #220: Updating to semver v3.0.3 to fix issue with <= ranges -- #218: fix typo elyptical->elliptic in ecdsa key description (thanks @laverya) - -## Release 3.0.1 (2019-12-08) - -### Fixed - -- #212: Updated semver fixing broken constraint checking with ^0.0 - -## Release 3.0.0 (2019-10-02) - -### Added - -- #187: Added durationRound function (thanks @yjp20) -- #189: Added numerous template functions that return errors rather than panic (thanks @nrvnrvn) -- #193: Added toRawJson support (thanks @Dean-Coakley) -- #197: Added get support to dicts (thanks @Dean-Coakley) - -### Changed - -- #186: Moving dependency management to Go modules -- #186: Updated semver to v3. This has changes in the way ^ is handled -- #194: Updated documentation on merging and how it copies. Added example using deepCopy -- #196: trunc now supports negative values (thanks @Dean-Coakley) - -## Release 2.22.0 (2019-10-02) - -### Added - -- #173: Added getHostByName function to resolve dns names to ips (thanks @fcgravalos) -- #195: Added deepCopy function for use with dicts - -### Changed - -- Updated merge and mergeOverwrite documentation to explain copying and how to - use deepCopy with it - -## Release 2.21.0 (2019-09-18) - -### Added - -- #122: Added encryptAES/decryptAES functions (thanks @n0madic) -- #128: Added toDecimal support (thanks @Dean-Coakley) -- #169: Added list contcat (thanks @astorath) -- #174: Added deepEqual function (thanks @bonifaido) -- #170: Added url parse and join functions (thanks @astorath) - -### Changed - -- #171: Updated glide config for Google UUID to v1 and to add ranges to semver and testify - -### Fixed - -- #172: Fix semver wildcard example (thanks @piepmatz) -- #175: Fix dateInZone doc example (thanks @s3than) - -## Release 2.20.0 (2019-06-18) - -### Added - -- #164: Adding function to get unix epoch for a time (@mattfarina) -- #166: Adding tests for date_in_zone (@mattfarina) - -### Changed - -- #144: Fix function comments based on best practices from Effective Go (@CodeLingoTeam) -- #150: Handles pointer type for time.Time in "htmlDate" (@mapreal19) -- #161, #157, #160, #153, #158, #156, #155, #159, #152 documentation updates (@badeadan) - -### Fixed - -## Release 2.19.0 (2019-03-02) - -IMPORTANT: This release reverts a change from 2.18.0 - -In the previous release (2.18), we prematurely merged a partial change to the crypto functions that led to creating two sets of crypto functions (I blame @technosophos -- since that's me). This release rolls back that change, and does what was originally intended: It alters the existing crypto functions to use secure random. - -We debated whether this classifies as a change worthy of major revision, but given the proximity to the last release, we have decided that treating 2.18 as a faulty release is the correct course of action. We apologize for any inconvenience. - -### Changed - -- Fix substr panic 35fb796 (Alexey igrychev) -- Remove extra period 1eb7729 (Matthew Lorimor) -- Make random string functions use crypto by default 6ceff26 (Matthew Lorimor) -- README edits/fixes/suggestions 08fe136 (Lauri Apple) - - -## Release 2.18.0 (2019-02-12) - -### Added - -- Added mergeOverwrite function -- cryptographic functions that use secure random (see fe1de12) - -### Changed - -- Improve documentation of regexMatch function, resolves #139 90b89ce (Jan Tagscherer) -- Handle has for nil list 9c10885 (Daniel Cohen) -- Document behaviour of mergeOverwrite fe0dbe9 (Lukas Rieder) -- doc: adds missing documentation. 4b871e6 (Fernandez Ludovic) -- Replace outdated goutils imports 01893d2 (Matthew Lorimor) -- Surface crypto secure random strings from goutils fe1de12 (Matthew Lorimor) -- Handle untyped nil values as paramters to string functions 2b2ec8f (Morten Torkildsen) - -### Fixed - -- Fix dict merge issue and provide mergeOverwrite .dst .src1 to overwrite from src -> dst 4c59c12 (Lukas Rieder) -- Fix substr var names and comments d581f80 (Dean Coakley) -- Fix substr documentation 2737203 (Dean Coakley) - -## Release 2.17.1 (2019-01-03) - -### Fixed - -The 2.17.0 release did not have a version pinned for xstrings, which caused compilation failures when xstrings < 1.2 was used. This adds the correct version string to glide.yaml. - -## Release 2.17.0 (2019-01-03) - -### Added - -- adds alder32sum function and test 6908fc2 (marshallford) -- Added kebabcase function ca331a1 (Ilyes512) - -### Changed - -- Update goutils to 1.1.0 4e1125d (Matt Butcher) - -### Fixed - -- Fix 'has' documentation e3f2a85 (dean-coakley) -- docs(dict): fix typo in pick example dc424f9 (Dustin Specker) -- fixes spelling errors... not sure how that happened 4cf188a (marshallford) - -## Release 2.16.0 (2018-08-13) - -### Added - -- add splitn function fccb0b0 (Helgi Þorbjörnsson) -- Add slice func df28ca7 (gongdo) -- Generate serial number a3bdffd (Cody Coons) -- Extract values of dict with values function df39312 (Lawrence Jones) - -### Changed - -- Modify panic message for list.slice ae38335 (gongdo) -- Minor improvement in code quality - Removed an unreachable piece of code at defaults.go#L26:6 - Resolve formatting issues. 5834241 (Abhishek Kashyap) -- Remove duplicated documentation 1d97af1 (Matthew Fisher) -- Test on go 1.11 49df809 (Helgi Þormar Þorbjörnsson) - -### Fixed - -- Fix file permissions c5f40b5 (gongdo) -- Fix example for buildCustomCert 7779e0d (Tin Lam) - -## Release 2.15.0 (2018-04-02) - -### Added - -- #68 and #69: Add json helpers to docs (thanks @arunvelsriram) -- #66: Add ternary function (thanks @binoculars) -- #67: Allow keys function to take multiple dicts (thanks @binoculars) -- #89: Added sha1sum to crypto function (thanks @benkeil) -- #81: Allow customizing Root CA that used by genSignedCert (thanks @chenzhiwei) -- #92: Add travis testing for go 1.10 -- #93: Adding appveyor config for windows testing - -### Changed - -- #90: Updating to more recent dependencies -- #73: replace satori/go.uuid with google/uuid (thanks @petterw) - -### Fixed - -- #76: Fixed documentation typos (thanks @Thiht) -- Fixed rounding issue on the `ago` function. Note, the removes support for Go 1.8 and older - -## Release 2.14.1 (2017-12-01) - -### Fixed - -- #60: Fix typo in function name documentation (thanks @neil-ca-moore) -- #61: Removing line with {{ due to blocking github pages genertion -- #64: Update the list functions to handle int, string, and other slices for compatibility - -## Release 2.14.0 (2017-10-06) - -This new version of Sprig adds a set of functions for generating and working with SSL certificates. - -- `genCA` generates an SSL Certificate Authority -- `genSelfSignedCert` generates an SSL self-signed certificate -- `genSignedCert` generates an SSL certificate and key based on a given CA - -## Release 2.13.0 (2017-09-18) - -This release adds new functions, including: - -- `regexMatch`, `regexFindAll`, `regexFind`, `regexReplaceAll`, `regexReplaceAllLiteral`, and `regexSplit` to work with regular expressions -- `floor`, `ceil`, and `round` math functions -- `toDate` converts a string to a date -- `nindent` is just like `indent` but also prepends a new line -- `ago` returns the time from `time.Now` - -### Added - -- #40: Added basic regex functionality (thanks @alanquillin) -- #41: Added ceil floor and round functions (thanks @alanquillin) -- #48: Added toDate function (thanks @andreynering) -- #50: Added nindent function (thanks @binoculars) -- #46: Added ago function (thanks @slayer) - -### Changed - -- #51: Updated godocs to include new string functions (thanks @curtisallen) -- #49: Added ability to merge multiple dicts (thanks @binoculars) - -## Release 2.12.0 (2017-05-17) - -- `snakecase`, `camelcase`, and `shuffle` are three new string functions -- `fail` allows you to bail out of a template render when conditions are not met - -## Release 2.11.0 (2017-05-02) - -- Added `toJson` and `toPrettyJson` -- Added `merge` -- Refactored documentation - -## Release 2.10.0 (2017-03-15) - -- Added `semver` and `semverCompare` for Semantic Versions -- `list` replaces `tuple` -- Fixed issue with `join` -- Added `first`, `last`, `intial`, `rest`, `prepend`, `append`, `toString`, `toStrings`, `sortAlpha`, `reverse`, `coalesce`, `pluck`, `pick`, `compact`, `keys`, `omit`, `uniq`, `has`, `without` - -## Release 2.9.0 (2017-02-23) - -- Added `splitList` to split a list -- Added crypto functions of `genPrivateKey` and `derivePassword` - -## Release 2.8.0 (2016-12-21) - -- Added access to several path functions (`base`, `dir`, `clean`, `ext`, and `abs`) -- Added functions for _mutating_ dictionaries (`set`, `unset`, `hasKey`) - -## Release 2.7.0 (2016-12-01) - -- Added `sha256sum` to generate a hash of an input -- Added functions to convert a numeric or string to `int`, `int64`, `float64` - -## Release 2.6.0 (2016-10-03) - -- Added a `uuidv4` template function for generating UUIDs inside of a template. - -## Release 2.5.0 (2016-08-19) - -- New `trimSuffix`, `trimPrefix`, `hasSuffix`, and `hasPrefix` functions -- New aliases have been added for a few functions that didn't follow the naming conventions (`trimAll` and `abbrevBoth`) -- `trimall` and `abbrevboth` (notice the case) are deprecated and will be removed in 3.0.0 - -## Release 2.4.0 (2016-08-16) - -- Adds two functions: `until` and `untilStep` - -## Release 2.3.0 (2016-06-21) - -- cat: Concatenate strings with whitespace separators. -- replace: Replace parts of a string: `replace " " "-" "Me First"` renders "Me-First" -- plural: Format plurals: `len "foo" | plural "one foo" "many foos"` renders "many foos" -- indent: Indent blocks of text in a way that is sensitive to "\n" characters. - -## Release 2.2.0 (2016-04-21) - -- Added a `genPrivateKey` function (Thanks @bacongobbler) - -## Release 2.1.0 (2016-03-30) - -- `default` now prints the default value when it does not receive a value down the pipeline. It is much safer now to do `{{.Foo | default "bar"}}`. -- Added accessors for "hermetic" functions. These return only functions that, when given the same input, produce the same output. - -## Release 2.0.0 (2016-03-29) - -Because we switched from `int` to `int64` as the return value for all integer math functions, the library's major version number has been incremented. - -- `min` complements `max` (formerly `biggest`) -- `empty` indicates that a value is the empty value for its type -- `tuple` creates a tuple inside of a template: `{{$t := tuple "a", "b" "c"}}` -- `dict` creates a dictionary inside of a template `{{$d := dict "key1" "val1" "key2" "val2"}}` -- Date formatters have been added for HTML dates (as used in `date` input fields) -- Integer math functions can convert from a number of types, including `string` (via `strconv.ParseInt`). - -## Release 1.2.0 (2016-02-01) - -- Added quote and squote -- Added b32enc and b32dec -- add now takes varargs -- biggest now takes varargs - -## Release 1.1.0 (2015-12-29) - -- Added #4: Added contains function. strings.Contains, but with the arguments - switched to simplify common pipelines. (thanks krancour) -- Added Travis-CI testing support - -## Release 1.0.0 (2015-12-23) - -- Initial release diff --git a/vendor/github.com/Masterminds/sprig/v3/LICENSE.txt b/vendor/github.com/Masterminds/sprig/v3/LICENSE.txt deleted file mode 100644 index f311b1eaa..000000000 --- a/vendor/github.com/Masterminds/sprig/v3/LICENSE.txt +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (C) 2013-2020 Masterminds - -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/vendor/github.com/Masterminds/sprig/v3/Makefile b/vendor/github.com/Masterminds/sprig/v3/Makefile deleted file mode 100644 index 78d409cde..000000000 --- a/vendor/github.com/Masterminds/sprig/v3/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -.PHONY: test -test: - @echo "==> Running tests" - GO111MODULE=on go test -v - -.PHONY: test-cover -test-cover: - @echo "==> Running Tests with coverage" - GO111MODULE=on go test -cover . diff --git a/vendor/github.com/Masterminds/sprig/v3/README.md b/vendor/github.com/Masterminds/sprig/v3/README.md deleted file mode 100644 index c37ba01c2..000000000 --- a/vendor/github.com/Masterminds/sprig/v3/README.md +++ /dev/null @@ -1,101 +0,0 @@ -# Sprig: Template functions for Go templates - -[![GoDoc](https://img.shields.io/static/v1?label=godoc&message=reference&color=blue)](https://pkg.go.dev/github.com/Masterminds/sprig/v3) -[![Go Report Card](https://goreportcard.com/badge/github.com/Masterminds/sprig)](https://goreportcard.com/report/github.com/Masterminds/sprig) -[![Stability: Sustained](https://masterminds.github.io/stability/sustained.svg)](https://masterminds.github.io/stability/sustained.html) -[![](https://github.com/Masterminds/sprig/workflows/Tests/badge.svg)](https://github.com/Masterminds/sprig/actions) - -The Go language comes with a [built-in template -language](http://golang.org/pkg/text/template/), but not -very many template functions. Sprig is a library that provides more than 100 commonly -used template functions. - -It is inspired by the template functions found in -[Twig](http://twig.sensiolabs.org/documentation) and in various -JavaScript libraries, such as [underscore.js](http://underscorejs.org/). - -## IMPORTANT NOTES - -Sprig leverages [mergo](https://github.com/imdario/mergo) to handle merges. In -its v0.3.9 release there was a behavior change that impacts merging template -functions in sprig. It is currently recommended to use v0.3.8 of that package. -Using v0.3.9 will cause sprig tests to fail. The issue in mergo is tracked at -https://github.com/imdario/mergo/issues/139. - -## Package Versions - -There are two active major versions of the `sprig` package. - -* v3 is currently stable release series on the `master` branch. The Go API should - remain compatible with v2, the current stable version. Behavior change behind - some functions is the reason for the new major version. -* v2 is the previous stable release series. It has been more than three years since - the initial release of v2. You can read the documentation and see the code - on the [release-2](https://github.com/Masterminds/sprig/tree/release-2) branch. - Bug fixes to this major version will continue for some time. - -## Usage - -**Template developers**: Please use Sprig's [function documentation](http://masterminds.github.io/sprig/) for -detailed instructions and code snippets for the >100 template functions available. - -**Go developers**: If you'd like to include Sprig as a library in your program, -our API documentation is available [at GoDoc.org](http://godoc.org/github.com/Masterminds/sprig). - -For standard usage, read on. - -### Load the Sprig library - -To load the Sprig `FuncMap`: - -```go - -import ( - "github.com/Masterminds/sprig" - "html/template" -) - -// This example illustrates that the FuncMap *must* be set before the -// templates themselves are loaded. -tpl := template.Must( - template.New("base").Funcs(sprig.FuncMap()).ParseGlob("*.html") -) - - -``` - -### Calling the functions inside of templates - -By convention, all functions are lowercase. This seems to follow the Go -idiom for template functions (as opposed to template methods, which are -TitleCase). For example, this: - -``` -{{ "hello!" | upper | repeat 5 }} -``` - -produces this: - -``` -HELLO!HELLO!HELLO!HELLO!HELLO! -``` - -## Principles Driving Our Function Selection - -We followed these principles to decide which functions to add and how to implement them: - -- Use template functions to build layout. The following - types of operations are within the domain of template functions: - - Formatting - - Layout - - Simple type conversions - - Utilities that assist in handling common formatting and layout needs (e.g. arithmetic) -- Template functions should not return errors unless there is no way to print - a sensible value. For example, converting a string to an integer should not - produce an error if conversion fails. Instead, it should display a default - value. -- Simple math is necessary for grid layouts, pagers, and so on. Complex math - (anything other than arithmetic) should be done outside of templates. -- Template functions only deal with the data passed into them. They never retrieve - data from a source. -- Finally, do not override core Go template functions. diff --git a/vendor/github.com/Masterminds/sprig/v3/crypto.go b/vendor/github.com/Masterminds/sprig/v3/crypto.go deleted file mode 100644 index 13a5cd559..000000000 --- a/vendor/github.com/Masterminds/sprig/v3/crypto.go +++ /dev/null @@ -1,653 +0,0 @@ -package sprig - -import ( - "bytes" - "crypto" - "crypto/aes" - "crypto/cipher" - "crypto/dsa" - "crypto/ecdsa" - "crypto/ed25519" - "crypto/elliptic" - "crypto/hmac" - "crypto/rand" - "crypto/rsa" - "crypto/sha1" - "crypto/sha256" - "crypto/x509" - "crypto/x509/pkix" - "encoding/asn1" - "encoding/base64" - "encoding/binary" - "encoding/hex" - "encoding/pem" - "errors" - "fmt" - "hash/adler32" - "io" - "math/big" - "net" - "time" - - "strings" - - "github.com/google/uuid" - bcrypt_lib "golang.org/x/crypto/bcrypt" - "golang.org/x/crypto/scrypt" -) - -func sha256sum(input string) string { - hash := sha256.Sum256([]byte(input)) - return hex.EncodeToString(hash[:]) -} - -func sha1sum(input string) string { - hash := sha1.Sum([]byte(input)) - return hex.EncodeToString(hash[:]) -} - -func adler32sum(input string) string { - hash := adler32.Checksum([]byte(input)) - return fmt.Sprintf("%d", hash) -} - -func bcrypt(input string) string { - hash, err := bcrypt_lib.GenerateFromPassword([]byte(input), bcrypt_lib.DefaultCost) - if err != nil { - return fmt.Sprintf("failed to encrypt string with bcrypt: %s", err) - } - - return string(hash) -} - -func htpasswd(username string, password string) string { - if strings.Contains(username, ":") { - return fmt.Sprintf("invalid username: %s", username) - } - return fmt.Sprintf("%s:%s", username, bcrypt(password)) -} - -func randBytes(count int) (string, error) { - buf := make([]byte, count) - if _, err := rand.Read(buf); err != nil { - return "", err - } - return base64.StdEncoding.EncodeToString(buf), nil -} - -// uuidv4 provides a safe and secure UUID v4 implementation -func uuidv4() string { - return uuid.New().String() -} - -var masterPasswordSeed = "com.lyndir.masterpassword" - -var passwordTypeTemplates = map[string][][]byte{ - "maximum": {[]byte("anoxxxxxxxxxxxxxxxxx"), []byte("axxxxxxxxxxxxxxxxxno")}, - "long": {[]byte("CvcvnoCvcvCvcv"), []byte("CvcvCvcvnoCvcv"), []byte("CvcvCvcvCvcvno"), []byte("CvccnoCvcvCvcv"), []byte("CvccCvcvnoCvcv"), - []byte("CvccCvcvCvcvno"), []byte("CvcvnoCvccCvcv"), []byte("CvcvCvccnoCvcv"), []byte("CvcvCvccCvcvno"), []byte("CvcvnoCvcvCvcc"), - []byte("CvcvCvcvnoCvcc"), []byte("CvcvCvcvCvccno"), []byte("CvccnoCvccCvcv"), []byte("CvccCvccnoCvcv"), []byte("CvccCvccCvcvno"), - []byte("CvcvnoCvccCvcc"), []byte("CvcvCvccnoCvcc"), []byte("CvcvCvccCvccno"), []byte("CvccnoCvcvCvcc"), []byte("CvccCvcvnoCvcc"), - []byte("CvccCvcvCvccno")}, - "medium": {[]byte("CvcnoCvc"), []byte("CvcCvcno")}, - "short": {[]byte("Cvcn")}, - "basic": {[]byte("aaanaaan"), []byte("aannaaan"), []byte("aaannaaa")}, - "pin": {[]byte("nnnn")}, -} - -var templateCharacters = map[byte]string{ - 'V': "AEIOU", - 'C': "BCDFGHJKLMNPQRSTVWXYZ", - 'v': "aeiou", - 'c': "bcdfghjklmnpqrstvwxyz", - 'A': "AEIOUBCDFGHJKLMNPQRSTVWXYZ", - 'a': "AEIOUaeiouBCDFGHJKLMNPQRSTVWXYZbcdfghjklmnpqrstvwxyz", - 'n': "0123456789", - 'o': "@&%?,=[]_:-+*$#!'^~;()/.", - 'x': "AEIOUaeiouBCDFGHJKLMNPQRSTVWXYZbcdfghjklmnpqrstvwxyz0123456789!@#$%^&*()", -} - -func derivePassword(counter uint32, passwordType, password, user, site string) string { - var templates = passwordTypeTemplates[passwordType] - if templates == nil { - return fmt.Sprintf("cannot find password template %s", passwordType) - } - - var buffer bytes.Buffer - buffer.WriteString(masterPasswordSeed) - binary.Write(&buffer, binary.BigEndian, uint32(len(user))) - buffer.WriteString(user) - - salt := buffer.Bytes() - key, err := scrypt.Key([]byte(password), salt, 32768, 8, 2, 64) - if err != nil { - return fmt.Sprintf("failed to derive password: %s", err) - } - - buffer.Truncate(len(masterPasswordSeed)) - binary.Write(&buffer, binary.BigEndian, uint32(len(site))) - buffer.WriteString(site) - binary.Write(&buffer, binary.BigEndian, counter) - - var hmacv = hmac.New(sha256.New, key) - hmacv.Write(buffer.Bytes()) - var seed = hmacv.Sum(nil) - var temp = templates[int(seed[0])%len(templates)] - - buffer.Truncate(0) - for i, element := range temp { - passChars := templateCharacters[element] - passChar := passChars[int(seed[i+1])%len(passChars)] - buffer.WriteByte(passChar) - } - - return buffer.String() -} - -func generatePrivateKey(typ string) string { - var priv interface{} - var err error - switch typ { - case "", "rsa": - // good enough for government work - priv, err = rsa.GenerateKey(rand.Reader, 4096) - case "dsa": - key := new(dsa.PrivateKey) - // again, good enough for government work - if err = dsa.GenerateParameters(&key.Parameters, rand.Reader, dsa.L2048N256); err != nil { - return fmt.Sprintf("failed to generate dsa params: %s", err) - } - err = dsa.GenerateKey(key, rand.Reader) - priv = key - case "ecdsa": - // again, good enough for government work - priv, err = ecdsa.GenerateKey(elliptic.P256(), rand.Reader) - case "ed25519": - _, priv, err = ed25519.GenerateKey(rand.Reader) - default: - return "Unknown type " + typ - } - if err != nil { - return fmt.Sprintf("failed to generate private key: %s", err) - } - - return string(pem.EncodeToMemory(pemBlockForKey(priv))) -} - -// DSAKeyFormat stores the format for DSA keys. -// Used by pemBlockForKey -type DSAKeyFormat struct { - Version int - P, Q, G, Y, X *big.Int -} - -func pemBlockForKey(priv interface{}) *pem.Block { - switch k := priv.(type) { - case *rsa.PrivateKey: - return &pem.Block{Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(k)} - case *dsa.PrivateKey: - val := DSAKeyFormat{ - P: k.P, Q: k.Q, G: k.G, - Y: k.Y, X: k.X, - } - bytes, _ := asn1.Marshal(val) - return &pem.Block{Type: "DSA PRIVATE KEY", Bytes: bytes} - case *ecdsa.PrivateKey: - b, _ := x509.MarshalECPrivateKey(k) - return &pem.Block{Type: "EC PRIVATE KEY", Bytes: b} - default: - // attempt PKCS#8 format for all other keys - b, err := x509.MarshalPKCS8PrivateKey(k) - if err != nil { - return nil - } - return &pem.Block{Type: "PRIVATE KEY", Bytes: b} - } -} - -func parsePrivateKeyPEM(pemBlock string) (crypto.PrivateKey, error) { - block, _ := pem.Decode([]byte(pemBlock)) - if block == nil { - return nil, errors.New("no PEM data in input") - } - - if block.Type == "PRIVATE KEY" { - priv, err := x509.ParsePKCS8PrivateKey(block.Bytes) - if err != nil { - return nil, fmt.Errorf("decoding PEM as PKCS#8: %s", err) - } - return priv, nil - } else if !strings.HasSuffix(block.Type, " PRIVATE KEY") { - return nil, fmt.Errorf("no private key data in PEM block of type %s", block.Type) - } - - switch block.Type[:len(block.Type)-12] { // strip " PRIVATE KEY" - case "RSA": - priv, err := x509.ParsePKCS1PrivateKey(block.Bytes) - if err != nil { - return nil, fmt.Errorf("parsing RSA private key from PEM: %s", err) - } - return priv, nil - case "EC": - priv, err := x509.ParseECPrivateKey(block.Bytes) - if err != nil { - return nil, fmt.Errorf("parsing EC private key from PEM: %s", err) - } - return priv, nil - case "DSA": - var k DSAKeyFormat - _, err := asn1.Unmarshal(block.Bytes, &k) - if err != nil { - return nil, fmt.Errorf("parsing DSA private key from PEM: %s", err) - } - priv := &dsa.PrivateKey{ - PublicKey: dsa.PublicKey{ - Parameters: dsa.Parameters{ - P: k.P, Q: k.Q, G: k.G, - }, - Y: k.Y, - }, - X: k.X, - } - return priv, nil - default: - return nil, fmt.Errorf("invalid private key type %s", block.Type) - } -} - -func getPublicKey(priv crypto.PrivateKey) (crypto.PublicKey, error) { - switch k := priv.(type) { - case interface{ Public() crypto.PublicKey }: - return k.Public(), nil - case *dsa.PrivateKey: - return &k.PublicKey, nil - default: - return nil, fmt.Errorf("unable to get public key for type %T", priv) - } -} - -type certificate struct { - Cert string - Key string -} - -func buildCustomCertificate(b64cert string, b64key string) (certificate, error) { - crt := certificate{} - - cert, err := base64.StdEncoding.DecodeString(b64cert) - if err != nil { - return crt, errors.New("unable to decode base64 certificate") - } - - key, err := base64.StdEncoding.DecodeString(b64key) - if err != nil { - return crt, errors.New("unable to decode base64 private key") - } - - decodedCert, _ := pem.Decode(cert) - if decodedCert == nil { - return crt, errors.New("unable to decode certificate") - } - _, err = x509.ParseCertificate(decodedCert.Bytes) - if err != nil { - return crt, fmt.Errorf( - "error parsing certificate: decodedCert.Bytes: %s", - err, - ) - } - - _, err = parsePrivateKeyPEM(string(key)) - if err != nil { - return crt, fmt.Errorf( - "error parsing private key: %s", - err, - ) - } - - crt.Cert = string(cert) - crt.Key = string(key) - - return crt, nil -} - -func generateCertificateAuthority( - cn string, - daysValid int, -) (certificate, error) { - priv, err := rsa.GenerateKey(rand.Reader, 2048) - if err != nil { - return certificate{}, fmt.Errorf("error generating rsa key: %s", err) - } - - return generateCertificateAuthorityWithKeyInternal(cn, daysValid, priv) -} - -func generateCertificateAuthorityWithPEMKey( - cn string, - daysValid int, - privPEM string, -) (certificate, error) { - priv, err := parsePrivateKeyPEM(privPEM) - if err != nil { - return certificate{}, fmt.Errorf("parsing private key: %s", err) - } - return generateCertificateAuthorityWithKeyInternal(cn, daysValid, priv) -} - -func generateCertificateAuthorityWithKeyInternal( - cn string, - daysValid int, - priv crypto.PrivateKey, -) (certificate, error) { - ca := certificate{} - - template, err := getBaseCertTemplate(cn, nil, nil, daysValid) - if err != nil { - return ca, err - } - // Override KeyUsage and IsCA - template.KeyUsage = x509.KeyUsageKeyEncipherment | - x509.KeyUsageDigitalSignature | - x509.KeyUsageCertSign - template.IsCA = true - - ca.Cert, ca.Key, err = getCertAndKey(template, priv, template, priv) - - return ca, err -} - -func generateSelfSignedCertificate( - cn string, - ips []interface{}, - alternateDNS []interface{}, - daysValid int, -) (certificate, error) { - priv, err := rsa.GenerateKey(rand.Reader, 2048) - if err != nil { - return certificate{}, fmt.Errorf("error generating rsa key: %s", err) - } - return generateSelfSignedCertificateWithKeyInternal(cn, ips, alternateDNS, daysValid, priv) -} - -func generateSelfSignedCertificateWithPEMKey( - cn string, - ips []interface{}, - alternateDNS []interface{}, - daysValid int, - privPEM string, -) (certificate, error) { - priv, err := parsePrivateKeyPEM(privPEM) - if err != nil { - return certificate{}, fmt.Errorf("parsing private key: %s", err) - } - return generateSelfSignedCertificateWithKeyInternal(cn, ips, alternateDNS, daysValid, priv) -} - -func generateSelfSignedCertificateWithKeyInternal( - cn string, - ips []interface{}, - alternateDNS []interface{}, - daysValid int, - priv crypto.PrivateKey, -) (certificate, error) { - cert := certificate{} - - template, err := getBaseCertTemplate(cn, ips, alternateDNS, daysValid) - if err != nil { - return cert, err - } - - cert.Cert, cert.Key, err = getCertAndKey(template, priv, template, priv) - - return cert, err -} - -func generateSignedCertificate( - cn string, - ips []interface{}, - alternateDNS []interface{}, - daysValid int, - ca certificate, -) (certificate, error) { - priv, err := rsa.GenerateKey(rand.Reader, 2048) - if err != nil { - return certificate{}, fmt.Errorf("error generating rsa key: %s", err) - } - return generateSignedCertificateWithKeyInternal(cn, ips, alternateDNS, daysValid, ca, priv) -} - -func generateSignedCertificateWithPEMKey( - cn string, - ips []interface{}, - alternateDNS []interface{}, - daysValid int, - ca certificate, - privPEM string, -) (certificate, error) { - priv, err := parsePrivateKeyPEM(privPEM) - if err != nil { - return certificate{}, fmt.Errorf("parsing private key: %s", err) - } - return generateSignedCertificateWithKeyInternal(cn, ips, alternateDNS, daysValid, ca, priv) -} - -func generateSignedCertificateWithKeyInternal( - cn string, - ips []interface{}, - alternateDNS []interface{}, - daysValid int, - ca certificate, - priv crypto.PrivateKey, -) (certificate, error) { - cert := certificate{} - - decodedSignerCert, _ := pem.Decode([]byte(ca.Cert)) - if decodedSignerCert == nil { - return cert, errors.New("unable to decode certificate") - } - signerCert, err := x509.ParseCertificate(decodedSignerCert.Bytes) - if err != nil { - return cert, fmt.Errorf( - "error parsing certificate: decodedSignerCert.Bytes: %s", - err, - ) - } - signerKey, err := parsePrivateKeyPEM(ca.Key) - if err != nil { - return cert, fmt.Errorf( - "error parsing private key: %s", - err, - ) - } - - template, err := getBaseCertTemplate(cn, ips, alternateDNS, daysValid) - if err != nil { - return cert, err - } - - cert.Cert, cert.Key, err = getCertAndKey( - template, - priv, - signerCert, - signerKey, - ) - - return cert, err -} - -func getCertAndKey( - template *x509.Certificate, - signeeKey crypto.PrivateKey, - parent *x509.Certificate, - signingKey crypto.PrivateKey, -) (string, string, error) { - signeePubKey, err := getPublicKey(signeeKey) - if err != nil { - return "", "", fmt.Errorf("error retrieving public key from signee key: %s", err) - } - derBytes, err := x509.CreateCertificate( - rand.Reader, - template, - parent, - signeePubKey, - signingKey, - ) - if err != nil { - return "", "", fmt.Errorf("error creating certificate: %s", err) - } - - certBuffer := bytes.Buffer{} - if err := pem.Encode( - &certBuffer, - &pem.Block{Type: "CERTIFICATE", Bytes: derBytes}, - ); err != nil { - return "", "", fmt.Errorf("error pem-encoding certificate: %s", err) - } - - keyBuffer := bytes.Buffer{} - if err := pem.Encode( - &keyBuffer, - pemBlockForKey(signeeKey), - ); err != nil { - return "", "", fmt.Errorf("error pem-encoding key: %s", err) - } - - return certBuffer.String(), keyBuffer.String(), nil -} - -func getBaseCertTemplate( - cn string, - ips []interface{}, - alternateDNS []interface{}, - daysValid int, -) (*x509.Certificate, error) { - ipAddresses, err := getNetIPs(ips) - if err != nil { - return nil, err - } - dnsNames, err := getAlternateDNSStrs(alternateDNS) - if err != nil { - return nil, err - } - serialNumberUpperBound := new(big.Int).Lsh(big.NewInt(1), 128) - serialNumber, err := rand.Int(rand.Reader, serialNumberUpperBound) - if err != nil { - return nil, err - } - return &x509.Certificate{ - SerialNumber: serialNumber, - Subject: pkix.Name{ - CommonName: cn, - }, - IPAddresses: ipAddresses, - DNSNames: dnsNames, - NotBefore: time.Now(), - NotAfter: time.Now().Add(time.Hour * 24 * time.Duration(daysValid)), - KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature, - ExtKeyUsage: []x509.ExtKeyUsage{ - x509.ExtKeyUsageServerAuth, - x509.ExtKeyUsageClientAuth, - }, - BasicConstraintsValid: true, - }, nil -} - -func getNetIPs(ips []interface{}) ([]net.IP, error) { - if ips == nil { - return []net.IP{}, nil - } - var ipStr string - var ok bool - var netIP net.IP - netIPs := make([]net.IP, len(ips)) - for i, ip := range ips { - ipStr, ok = ip.(string) - if !ok { - return nil, fmt.Errorf("error parsing ip: %v is not a string", ip) - } - netIP = net.ParseIP(ipStr) - if netIP == nil { - return nil, fmt.Errorf("error parsing ip: %s", ipStr) - } - netIPs[i] = netIP - } - return netIPs, nil -} - -func getAlternateDNSStrs(alternateDNS []interface{}) ([]string, error) { - if alternateDNS == nil { - return []string{}, nil - } - var dnsStr string - var ok bool - alternateDNSStrs := make([]string, len(alternateDNS)) - for i, dns := range alternateDNS { - dnsStr, ok = dns.(string) - if !ok { - return nil, fmt.Errorf( - "error processing alternate dns name: %v is not a string", - dns, - ) - } - alternateDNSStrs[i] = dnsStr - } - return alternateDNSStrs, nil -} - -func encryptAES(password string, plaintext string) (string, error) { - if plaintext == "" { - return "", nil - } - - key := make([]byte, 32) - copy(key, []byte(password)) - block, err := aes.NewCipher(key) - if err != nil { - return "", err - } - - content := []byte(plaintext) - blockSize := block.BlockSize() - padding := blockSize - len(content)%blockSize - padtext := bytes.Repeat([]byte{byte(padding)}, padding) - content = append(content, padtext...) - - ciphertext := make([]byte, aes.BlockSize+len(content)) - - iv := ciphertext[:aes.BlockSize] - if _, err := io.ReadFull(rand.Reader, iv); err != nil { - return "", err - } - - mode := cipher.NewCBCEncrypter(block, iv) - mode.CryptBlocks(ciphertext[aes.BlockSize:], content) - - return base64.StdEncoding.EncodeToString(ciphertext), nil -} - -func decryptAES(password string, crypt64 string) (string, error) { - if crypt64 == "" { - return "", nil - } - - key := make([]byte, 32) - copy(key, []byte(password)) - - crypt, err := base64.StdEncoding.DecodeString(crypt64) - if err != nil { - return "", err - } - - block, err := aes.NewCipher(key) - if err != nil { - return "", err - } - - iv := crypt[:aes.BlockSize] - crypt = crypt[aes.BlockSize:] - decrypted := make([]byte, len(crypt)) - mode := cipher.NewCBCDecrypter(block, iv) - mode.CryptBlocks(decrypted, crypt) - - return string(decrypted[:len(decrypted)-int(decrypted[len(decrypted)-1])]), nil -} diff --git a/vendor/github.com/Masterminds/sprig/v3/date.go b/vendor/github.com/Masterminds/sprig/v3/date.go deleted file mode 100644 index ed022ddac..000000000 --- a/vendor/github.com/Masterminds/sprig/v3/date.go +++ /dev/null @@ -1,152 +0,0 @@ -package sprig - -import ( - "strconv" - "time" -) - -// Given a format and a date, format the date string. -// -// Date can be a `time.Time` or an `int, int32, int64`. -// In the later case, it is treated as seconds since UNIX -// epoch. -func date(fmt string, date interface{}) string { - return dateInZone(fmt, date, "Local") -} - -func htmlDate(date interface{}) string { - return dateInZone("2006-01-02", date, "Local") -} - -func htmlDateInZone(date interface{}, zone string) string { - return dateInZone("2006-01-02", date, zone) -} - -func dateInZone(fmt string, date interface{}, zone string) string { - var t time.Time - switch date := date.(type) { - default: - t = time.Now() - case time.Time: - t = date - case *time.Time: - t = *date - case int64: - t = time.Unix(date, 0) - case int: - t = time.Unix(int64(date), 0) - case int32: - t = time.Unix(int64(date), 0) - } - - loc, err := time.LoadLocation(zone) - if err != nil { - loc, _ = time.LoadLocation("UTC") - } - - return t.In(loc).Format(fmt) -} - -func dateModify(fmt string, date time.Time) time.Time { - d, err := time.ParseDuration(fmt) - if err != nil { - return date - } - return date.Add(d) -} - -func mustDateModify(fmt string, date time.Time) (time.Time, error) { - d, err := time.ParseDuration(fmt) - if err != nil { - return time.Time{}, err - } - return date.Add(d), nil -} - -func dateAgo(date interface{}) string { - var t time.Time - - switch date := date.(type) { - default: - t = time.Now() - case time.Time: - t = date - case int64: - t = time.Unix(date, 0) - case int: - t = time.Unix(int64(date), 0) - } - // Drop resolution to seconds - duration := time.Since(t).Round(time.Second) - return duration.String() -} - -func duration(sec interface{}) string { - var n int64 - switch value := sec.(type) { - default: - n = 0 - case string: - n, _ = strconv.ParseInt(value, 10, 64) - case int64: - n = value - } - return (time.Duration(n) * time.Second).String() -} - -func durationRound(duration interface{}) string { - var d time.Duration - switch duration := duration.(type) { - default: - d = 0 - case string: - d, _ = time.ParseDuration(duration) - case int64: - d = time.Duration(duration) - case time.Time: - d = time.Since(duration) - } - - u := uint64(d) - neg := d < 0 - if neg { - u = -u - } - - var ( - year = uint64(time.Hour) * 24 * 365 - month = uint64(time.Hour) * 24 * 30 - day = uint64(time.Hour) * 24 - hour = uint64(time.Hour) - minute = uint64(time.Minute) - second = uint64(time.Second) - ) - switch { - case u > year: - return strconv.FormatUint(u/year, 10) + "y" - case u > month: - return strconv.FormatUint(u/month, 10) + "mo" - case u > day: - return strconv.FormatUint(u/day, 10) + "d" - case u > hour: - return strconv.FormatUint(u/hour, 10) + "h" - case u > minute: - return strconv.FormatUint(u/minute, 10) + "m" - case u > second: - return strconv.FormatUint(u/second, 10) + "s" - } - return "0s" -} - -func toDate(fmt, str string) time.Time { - t, _ := time.ParseInLocation(fmt, str, time.Local) - return t -} - -func mustToDate(fmt, str string) (time.Time, error) { - return time.ParseInLocation(fmt, str, time.Local) -} - -func unixEpoch(date time.Time) string { - return strconv.FormatInt(date.Unix(), 10) -} diff --git a/vendor/github.com/Masterminds/sprig/v3/defaults.go b/vendor/github.com/Masterminds/sprig/v3/defaults.go deleted file mode 100644 index b9f979666..000000000 --- a/vendor/github.com/Masterminds/sprig/v3/defaults.go +++ /dev/null @@ -1,163 +0,0 @@ -package sprig - -import ( - "bytes" - "encoding/json" - "math/rand" - "reflect" - "strings" - "time" -) - -func init() { - rand.Seed(time.Now().UnixNano()) -} - -// dfault checks whether `given` is set, and returns default if not set. -// -// This returns `d` if `given` appears not to be set, and `given` otherwise. -// -// For numeric types 0 is unset. -// For strings, maps, arrays, and slices, len() = 0 is considered unset. -// For bool, false is unset. -// Structs are never considered unset. -// -// For everything else, including pointers, a nil value is unset. -func dfault(d interface{}, given ...interface{}) interface{} { - - if empty(given) || empty(given[0]) { - return d - } - return given[0] -} - -// empty returns true if the given value has the zero value for its type. -func empty(given interface{}) bool { - g := reflect.ValueOf(given) - if !g.IsValid() { - return true - } - - // Basically adapted from text/template.isTrue - switch g.Kind() { - default: - return g.IsNil() - case reflect.Array, reflect.Slice, reflect.Map, reflect.String: - return g.Len() == 0 - case reflect.Bool: - return !g.Bool() - case reflect.Complex64, reflect.Complex128: - return g.Complex() == 0 - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return g.Int() == 0 - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - return g.Uint() == 0 - case reflect.Float32, reflect.Float64: - return g.Float() == 0 - case reflect.Struct: - return false - } -} - -// coalesce returns the first non-empty value. -func coalesce(v ...interface{}) interface{} { - for _, val := range v { - if !empty(val) { - return val - } - } - return nil -} - -// all returns true if empty(x) is false for all values x in the list. -// If the list is empty, return true. -func all(v ...interface{}) bool { - for _, val := range v { - if empty(val) { - return false - } - } - return true -} - -// any returns true if empty(x) is false for any x in the list. -// If the list is empty, return false. -func any(v ...interface{}) bool { - for _, val := range v { - if !empty(val) { - return true - } - } - return false -} - -// fromJson decodes JSON into a structured value, ignoring errors. -func fromJson(v string) interface{} { - output, _ := mustFromJson(v) - return output -} - -// mustFromJson decodes JSON into a structured value, returning errors. -func mustFromJson(v string) (interface{}, error) { - var output interface{} - err := json.Unmarshal([]byte(v), &output) - return output, err -} - -// toJson encodes an item into a JSON string -func toJson(v interface{}) string { - output, _ := json.Marshal(v) - return string(output) -} - -func mustToJson(v interface{}) (string, error) { - output, err := json.Marshal(v) - if err != nil { - return "", err - } - return string(output), nil -} - -// toPrettyJson encodes an item into a pretty (indented) JSON string -func toPrettyJson(v interface{}) string { - output, _ := json.MarshalIndent(v, "", " ") - return string(output) -} - -func mustToPrettyJson(v interface{}) (string, error) { - output, err := json.MarshalIndent(v, "", " ") - if err != nil { - return "", err - } - return string(output), nil -} - -// toRawJson encodes an item into a JSON string with no escaping of HTML characters. -func toRawJson(v interface{}) string { - output, err := mustToRawJson(v) - if err != nil { - panic(err) - } - return string(output) -} - -// mustToRawJson encodes an item into a JSON string with no escaping of HTML characters. -func mustToRawJson(v interface{}) (string, error) { - buf := new(bytes.Buffer) - enc := json.NewEncoder(buf) - enc.SetEscapeHTML(false) - err := enc.Encode(&v) - if err != nil { - return "", err - } - return strings.TrimSuffix(buf.String(), "\n"), nil -} - -// ternary returns the first value if the last value is true, otherwise returns the second value. -func ternary(vt interface{}, vf interface{}, v bool) interface{} { - if v { - return vt - } - - return vf -} diff --git a/vendor/github.com/Masterminds/sprig/v3/dict.go b/vendor/github.com/Masterminds/sprig/v3/dict.go deleted file mode 100644 index ade889698..000000000 --- a/vendor/github.com/Masterminds/sprig/v3/dict.go +++ /dev/null @@ -1,174 +0,0 @@ -package sprig - -import ( - "github.com/imdario/mergo" - "github.com/mitchellh/copystructure" -) - -func get(d map[string]interface{}, key string) interface{} { - if val, ok := d[key]; ok { - return val - } - return "" -} - -func set(d map[string]interface{}, key string, value interface{}) map[string]interface{} { - d[key] = value - return d -} - -func unset(d map[string]interface{}, key string) map[string]interface{} { - delete(d, key) - return d -} - -func hasKey(d map[string]interface{}, key string) bool { - _, ok := d[key] - return ok -} - -func pluck(key string, d ...map[string]interface{}) []interface{} { - res := []interface{}{} - for _, dict := range d { - if val, ok := dict[key]; ok { - res = append(res, val) - } - } - return res -} - -func keys(dicts ...map[string]interface{}) []string { - k := []string{} - for _, dict := range dicts { - for key := range dict { - k = append(k, key) - } - } - return k -} - -func pick(dict map[string]interface{}, keys ...string) map[string]interface{} { - res := map[string]interface{}{} - for _, k := range keys { - if v, ok := dict[k]; ok { - res[k] = v - } - } - return res -} - -func omit(dict map[string]interface{}, keys ...string) map[string]interface{} { - res := map[string]interface{}{} - - omit := make(map[string]bool, len(keys)) - for _, k := range keys { - omit[k] = true - } - - for k, v := range dict { - if _, ok := omit[k]; !ok { - res[k] = v - } - } - return res -} - -func dict(v ...interface{}) map[string]interface{} { - dict := map[string]interface{}{} - lenv := len(v) - for i := 0; i < lenv; i += 2 { - key := strval(v[i]) - if i+1 >= lenv { - dict[key] = "" - continue - } - dict[key] = v[i+1] - } - return dict -} - -func merge(dst map[string]interface{}, srcs ...map[string]interface{}) interface{} { - for _, src := range srcs { - if err := mergo.Merge(&dst, src); err != nil { - // Swallow errors inside of a template. - return "" - } - } - return dst -} - -func mustMerge(dst map[string]interface{}, srcs ...map[string]interface{}) (interface{}, error) { - for _, src := range srcs { - if err := mergo.Merge(&dst, src); err != nil { - return nil, err - } - } - return dst, nil -} - -func mergeOverwrite(dst map[string]interface{}, srcs ...map[string]interface{}) interface{} { - for _, src := range srcs { - if err := mergo.MergeWithOverwrite(&dst, src); err != nil { - // Swallow errors inside of a template. - return "" - } - } - return dst -} - -func mustMergeOverwrite(dst map[string]interface{}, srcs ...map[string]interface{}) (interface{}, error) { - for _, src := range srcs { - if err := mergo.MergeWithOverwrite(&dst, src); err != nil { - return nil, err - } - } - return dst, nil -} - -func values(dict map[string]interface{}) []interface{} { - values := []interface{}{} - for _, value := range dict { - values = append(values, value) - } - - return values -} - -func deepCopy(i interface{}) interface{} { - c, err := mustDeepCopy(i) - if err != nil { - panic("deepCopy error: " + err.Error()) - } - - return c -} - -func mustDeepCopy(i interface{}) (interface{}, error) { - return copystructure.Copy(i) -} - -func dig(ps ...interface{}) (interface{}, error) { - if len(ps) < 3 { - panic("dig needs at least three arguments") - } - dict := ps[len(ps)-1].(map[string]interface{}) - def := ps[len(ps)-2] - ks := make([]string, len(ps)-2) - for i := 0; i < len(ks); i++ { - ks[i] = ps[i].(string) - } - - return digFromDict(dict, def, ks) -} - -func digFromDict(dict map[string]interface{}, d interface{}, ks []string) (interface{}, error) { - k, ns := ks[0], ks[1:len(ks)] - step, has := dict[k] - if !has { - return d, nil - } - if len(ns) == 0 { - return step, nil - } - return digFromDict(step.(map[string]interface{}), d, ns) -} diff --git a/vendor/github.com/Masterminds/sprig/v3/doc.go b/vendor/github.com/Masterminds/sprig/v3/doc.go deleted file mode 100644 index aabb9d448..000000000 --- a/vendor/github.com/Masterminds/sprig/v3/doc.go +++ /dev/null @@ -1,19 +0,0 @@ -/* -Package sprig provides template functions for Go. - -This package contains a number of utility functions for working with data -inside of Go `html/template` and `text/template` files. - -To add these functions, use the `template.Funcs()` method: - - t := templates.New("foo").Funcs(sprig.FuncMap()) - -Note that you should add the function map before you parse any template files. - - In several cases, Sprig reverses the order of arguments from the way they - appear in the standard library. This is to make it easier to pipe - arguments into functions. - -See http://masterminds.github.io/sprig/ for more detailed documentation on each of the available functions. -*/ -package sprig diff --git a/vendor/github.com/Masterminds/sprig/v3/functions.go b/vendor/github.com/Masterminds/sprig/v3/functions.go deleted file mode 100644 index 57fcec1d9..000000000 --- a/vendor/github.com/Masterminds/sprig/v3/functions.go +++ /dev/null @@ -1,382 +0,0 @@ -package sprig - -import ( - "errors" - "html/template" - "math/rand" - "os" - "path" - "path/filepath" - "reflect" - "strconv" - "strings" - ttemplate "text/template" - "time" - - util "github.com/Masterminds/goutils" - "github.com/huandu/xstrings" - "github.com/shopspring/decimal" -) - -// FuncMap produces the function map. -// -// Use this to pass the functions into the template engine: -// -// tpl := template.New("foo").Funcs(sprig.FuncMap())) -// -func FuncMap() template.FuncMap { - return HtmlFuncMap() -} - -// HermeticTxtFuncMap returns a 'text/template'.FuncMap with only repeatable functions. -func HermeticTxtFuncMap() ttemplate.FuncMap { - r := TxtFuncMap() - for _, name := range nonhermeticFunctions { - delete(r, name) - } - return r -} - -// HermeticHtmlFuncMap returns an 'html/template'.Funcmap with only repeatable functions. -func HermeticHtmlFuncMap() template.FuncMap { - r := HtmlFuncMap() - for _, name := range nonhermeticFunctions { - delete(r, name) - } - return r -} - -// TxtFuncMap returns a 'text/template'.FuncMap -func TxtFuncMap() ttemplate.FuncMap { - return ttemplate.FuncMap(GenericFuncMap()) -} - -// HtmlFuncMap returns an 'html/template'.Funcmap -func HtmlFuncMap() template.FuncMap { - return template.FuncMap(GenericFuncMap()) -} - -// GenericFuncMap returns a copy of the basic function map as a map[string]interface{}. -func GenericFuncMap() map[string]interface{} { - gfm := make(map[string]interface{}, len(genericMap)) - for k, v := range genericMap { - gfm[k] = v - } - return gfm -} - -// These functions are not guaranteed to evaluate to the same result for given input, because they -// refer to the environment or global state. -var nonhermeticFunctions = []string{ - // Date functions - "date", - "date_in_zone", - "date_modify", - "now", - "htmlDate", - "htmlDateInZone", - "dateInZone", - "dateModify", - - // Strings - "randAlphaNum", - "randAlpha", - "randAscii", - "randNumeric", - "randBytes", - "uuidv4", - - // OS - "env", - "expandenv", - - // Network - "getHostByName", -} - -var genericMap = map[string]interface{}{ - "hello": func() string { return "Hello!" }, - - // Date functions - "ago": dateAgo, - "date": date, - "date_in_zone": dateInZone, - "date_modify": dateModify, - "dateInZone": dateInZone, - "dateModify": dateModify, - "duration": duration, - "durationRound": durationRound, - "htmlDate": htmlDate, - "htmlDateInZone": htmlDateInZone, - "must_date_modify": mustDateModify, - "mustDateModify": mustDateModify, - "mustToDate": mustToDate, - "now": time.Now, - "toDate": toDate, - "unixEpoch": unixEpoch, - - // Strings - "abbrev": abbrev, - "abbrevboth": abbrevboth, - "trunc": trunc, - "trim": strings.TrimSpace, - "upper": strings.ToUpper, - "lower": strings.ToLower, - "title": strings.Title, - "untitle": untitle, - "substr": substring, - // Switch order so that "foo" | repeat 5 - "repeat": func(count int, str string) string { return strings.Repeat(str, count) }, - // Deprecated: Use trimAll. - "trimall": func(a, b string) string { return strings.Trim(b, a) }, - // Switch order so that "$foo" | trimall "$" - "trimAll": func(a, b string) string { return strings.Trim(b, a) }, - "trimSuffix": func(a, b string) string { return strings.TrimSuffix(b, a) }, - "trimPrefix": func(a, b string) string { return strings.TrimPrefix(b, a) }, - "nospace": util.DeleteWhiteSpace, - "initials": initials, - "randAlphaNum": randAlphaNumeric, - "randAlpha": randAlpha, - "randAscii": randAscii, - "randNumeric": randNumeric, - "swapcase": util.SwapCase, - "shuffle": xstrings.Shuffle, - "snakecase": xstrings.ToSnakeCase, - "camelcase": xstrings.ToCamelCase, - "kebabcase": xstrings.ToKebabCase, - "wrap": func(l int, s string) string { return util.Wrap(s, l) }, - "wrapWith": func(l int, sep, str string) string { return util.WrapCustom(str, l, sep, true) }, - // Switch order so that "foobar" | contains "foo" - "contains": func(substr string, str string) bool { return strings.Contains(str, substr) }, - "hasPrefix": func(substr string, str string) bool { return strings.HasPrefix(str, substr) }, - "hasSuffix": func(substr string, str string) bool { return strings.HasSuffix(str, substr) }, - "quote": quote, - "squote": squote, - "cat": cat, - "indent": indent, - "nindent": nindent, - "replace": replace, - "plural": plural, - "sha1sum": sha1sum, - "sha256sum": sha256sum, - "adler32sum": adler32sum, - "toString": strval, - - // Wrap Atoi to stop errors. - "atoi": func(a string) int { i, _ := strconv.Atoi(a); return i }, - "int64": toInt64, - "int": toInt, - "float64": toFloat64, - "seq": seq, - "toDecimal": toDecimal, - - //"gt": func(a, b int) bool {return a > b}, - //"gte": func(a, b int) bool {return a >= b}, - //"lt": func(a, b int) bool {return a < b}, - //"lte": func(a, b int) bool {return a <= b}, - - // split "/" foo/bar returns map[int]string{0: foo, 1: bar} - "split": split, - "splitList": func(sep, orig string) []string { return strings.Split(orig, sep) }, - // splitn "/" foo/bar/fuu returns map[int]string{0: foo, 1: bar/fuu} - "splitn": splitn, - "toStrings": strslice, - - "until": until, - "untilStep": untilStep, - - // VERY basic arithmetic. - "add1": func(i interface{}) int64 { return toInt64(i) + 1 }, - "add": func(i ...interface{}) int64 { - var a int64 = 0 - for _, b := range i { - a += toInt64(b) - } - return a - }, - "sub": func(a, b interface{}) int64 { return toInt64(a) - toInt64(b) }, - "div": func(a, b interface{}) int64 { return toInt64(a) / toInt64(b) }, - "mod": func(a, b interface{}) int64 { return toInt64(a) % toInt64(b) }, - "mul": func(a interface{}, v ...interface{}) int64 { - val := toInt64(a) - for _, b := range v { - val = val * toInt64(b) - } - return val - }, - "randInt": func(min, max int) int { return rand.Intn(max-min) + min }, - "add1f": func(i interface{}) float64 { - return execDecimalOp(i, []interface{}{1}, func(d1, d2 decimal.Decimal) decimal.Decimal { return d1.Add(d2) }) - }, - "addf": func(i ...interface{}) float64 { - a := interface{}(float64(0)) - return execDecimalOp(a, i, func(d1, d2 decimal.Decimal) decimal.Decimal { return d1.Add(d2) }) - }, - "subf": func(a interface{}, v ...interface{}) float64 { - return execDecimalOp(a, v, func(d1, d2 decimal.Decimal) decimal.Decimal { return d1.Sub(d2) }) - }, - "divf": func(a interface{}, v ...interface{}) float64 { - return execDecimalOp(a, v, func(d1, d2 decimal.Decimal) decimal.Decimal { return d1.Div(d2) }) - }, - "mulf": func(a interface{}, v ...interface{}) float64 { - return execDecimalOp(a, v, func(d1, d2 decimal.Decimal) decimal.Decimal { return d1.Mul(d2) }) - }, - "biggest": max, - "max": max, - "min": min, - "maxf": maxf, - "minf": minf, - "ceil": ceil, - "floor": floor, - "round": round, - - // string slices. Note that we reverse the order b/c that's better - // for template processing. - "join": join, - "sortAlpha": sortAlpha, - - // Defaults - "default": dfault, - "empty": empty, - "coalesce": coalesce, - "all": all, - "any": any, - "compact": compact, - "mustCompact": mustCompact, - "fromJson": fromJson, - "toJson": toJson, - "toPrettyJson": toPrettyJson, - "toRawJson": toRawJson, - "mustFromJson": mustFromJson, - "mustToJson": mustToJson, - "mustToPrettyJson": mustToPrettyJson, - "mustToRawJson": mustToRawJson, - "ternary": ternary, - "deepCopy": deepCopy, - "mustDeepCopy": mustDeepCopy, - - // Reflection - "typeOf": typeOf, - "typeIs": typeIs, - "typeIsLike": typeIsLike, - "kindOf": kindOf, - "kindIs": kindIs, - "deepEqual": reflect.DeepEqual, - - // OS: - "env": os.Getenv, - "expandenv": os.ExpandEnv, - - // Network: - "getHostByName": getHostByName, - - // Paths: - "base": path.Base, - "dir": path.Dir, - "clean": path.Clean, - "ext": path.Ext, - "isAbs": path.IsAbs, - - // Filepaths: - "osBase": filepath.Base, - "osClean": filepath.Clean, - "osDir": filepath.Dir, - "osExt": filepath.Ext, - "osIsAbs": filepath.IsAbs, - - // Encoding: - "b64enc": base64encode, - "b64dec": base64decode, - "b32enc": base32encode, - "b32dec": base32decode, - - // Data Structures: - "tuple": list, // FIXME: with the addition of append/prepend these are no longer immutable. - "list": list, - "dict": dict, - "get": get, - "set": set, - "unset": unset, - "hasKey": hasKey, - "pluck": pluck, - "keys": keys, - "pick": pick, - "omit": omit, - "merge": merge, - "mergeOverwrite": mergeOverwrite, - "mustMerge": mustMerge, - "mustMergeOverwrite": mustMergeOverwrite, - "values": values, - - "append": push, "push": push, - "mustAppend": mustPush, "mustPush": mustPush, - "prepend": prepend, - "mustPrepend": mustPrepend, - "first": first, - "mustFirst": mustFirst, - "rest": rest, - "mustRest": mustRest, - "last": last, - "mustLast": mustLast, - "initial": initial, - "mustInitial": mustInitial, - "reverse": reverse, - "mustReverse": mustReverse, - "uniq": uniq, - "mustUniq": mustUniq, - "without": without, - "mustWithout": mustWithout, - "has": has, - "mustHas": mustHas, - "slice": slice, - "mustSlice": mustSlice, - "concat": concat, - "dig": dig, - "chunk": chunk, - "mustChunk": mustChunk, - - // Crypto: - "bcrypt": bcrypt, - "htpasswd": htpasswd, - "genPrivateKey": generatePrivateKey, - "derivePassword": derivePassword, - "buildCustomCert": buildCustomCertificate, - "genCA": generateCertificateAuthority, - "genCAWithKey": generateCertificateAuthorityWithPEMKey, - "genSelfSignedCert": generateSelfSignedCertificate, - "genSelfSignedCertWithKey": generateSelfSignedCertificateWithPEMKey, - "genSignedCert": generateSignedCertificate, - "genSignedCertWithKey": generateSignedCertificateWithPEMKey, - "encryptAES": encryptAES, - "decryptAES": decryptAES, - "randBytes": randBytes, - - // UUIDs: - "uuidv4": uuidv4, - - // SemVer: - "semver": semver, - "semverCompare": semverCompare, - - // Flow Control: - "fail": func(msg string) (string, error) { return "", errors.New(msg) }, - - // Regex - "regexMatch": regexMatch, - "mustRegexMatch": mustRegexMatch, - "regexFindAll": regexFindAll, - "mustRegexFindAll": mustRegexFindAll, - "regexFind": regexFind, - "mustRegexFind": mustRegexFind, - "regexReplaceAll": regexReplaceAll, - "mustRegexReplaceAll": mustRegexReplaceAll, - "regexReplaceAllLiteral": regexReplaceAllLiteral, - "mustRegexReplaceAllLiteral": mustRegexReplaceAllLiteral, - "regexSplit": regexSplit, - "mustRegexSplit": mustRegexSplit, - "regexQuoteMeta": regexQuoteMeta, - - // URLs: - "urlParse": urlParse, - "urlJoin": urlJoin, -} diff --git a/vendor/github.com/Masterminds/sprig/v3/list.go b/vendor/github.com/Masterminds/sprig/v3/list.go deleted file mode 100644 index ca0fbb789..000000000 --- a/vendor/github.com/Masterminds/sprig/v3/list.go +++ /dev/null @@ -1,464 +0,0 @@ -package sprig - -import ( - "fmt" - "math" - "reflect" - "sort" -) - -// Reflection is used in these functions so that slices and arrays of strings, -// ints, and other types not implementing []interface{} can be worked with. -// For example, this is useful if you need to work on the output of regexs. - -func list(v ...interface{}) []interface{} { - return v -} - -func push(list interface{}, v interface{}) []interface{} { - l, err := mustPush(list, v) - if err != nil { - panic(err) - } - - return l -} - -func mustPush(list interface{}, v interface{}) ([]interface{}, error) { - tp := reflect.TypeOf(list).Kind() - switch tp { - case reflect.Slice, reflect.Array: - l2 := reflect.ValueOf(list) - - l := l2.Len() - nl := make([]interface{}, l) - for i := 0; i < l; i++ { - nl[i] = l2.Index(i).Interface() - } - - return append(nl, v), nil - - default: - return nil, fmt.Errorf("Cannot push on type %s", tp) - } -} - -func prepend(list interface{}, v interface{}) []interface{} { - l, err := mustPrepend(list, v) - if err != nil { - panic(err) - } - - return l -} - -func mustPrepend(list interface{}, v interface{}) ([]interface{}, error) { - //return append([]interface{}{v}, list...) - - tp := reflect.TypeOf(list).Kind() - switch tp { - case reflect.Slice, reflect.Array: - l2 := reflect.ValueOf(list) - - l := l2.Len() - nl := make([]interface{}, l) - for i := 0; i < l; i++ { - nl[i] = l2.Index(i).Interface() - } - - return append([]interface{}{v}, nl...), nil - - default: - return nil, fmt.Errorf("Cannot prepend on type %s", tp) - } -} - -func chunk(size int, list interface{}) [][]interface{} { - l, err := mustChunk(size, list) - if err != nil { - panic(err) - } - - return l -} - -func mustChunk(size int, list interface{}) ([][]interface{}, error) { - tp := reflect.TypeOf(list).Kind() - switch tp { - case reflect.Slice, reflect.Array: - l2 := reflect.ValueOf(list) - - l := l2.Len() - - cs := int(math.Floor(float64(l-1)/float64(size)) + 1) - nl := make([][]interface{}, cs) - - for i := 0; i < cs; i++ { - clen := size - if i == cs-1 { - clen = int(math.Floor(math.Mod(float64(l), float64(size)))) - if clen == 0 { - clen = size - } - } - - nl[i] = make([]interface{}, clen) - - for j := 0; j < clen; j++ { - ix := i*size + j - nl[i][j] = l2.Index(ix).Interface() - } - } - - return nl, nil - - default: - return nil, fmt.Errorf("Cannot chunk type %s", tp) - } -} - -func last(list interface{}) interface{} { - l, err := mustLast(list) - if err != nil { - panic(err) - } - - return l -} - -func mustLast(list interface{}) (interface{}, error) { - tp := reflect.TypeOf(list).Kind() - switch tp { - case reflect.Slice, reflect.Array: - l2 := reflect.ValueOf(list) - - l := l2.Len() - if l == 0 { - return nil, nil - } - - return l2.Index(l - 1).Interface(), nil - default: - return nil, fmt.Errorf("Cannot find last on type %s", tp) - } -} - -func first(list interface{}) interface{} { - l, err := mustFirst(list) - if err != nil { - panic(err) - } - - return l -} - -func mustFirst(list interface{}) (interface{}, error) { - tp := reflect.TypeOf(list).Kind() - switch tp { - case reflect.Slice, reflect.Array: - l2 := reflect.ValueOf(list) - - l := l2.Len() - if l == 0 { - return nil, nil - } - - return l2.Index(0).Interface(), nil - default: - return nil, fmt.Errorf("Cannot find first on type %s", tp) - } -} - -func rest(list interface{}) []interface{} { - l, err := mustRest(list) - if err != nil { - panic(err) - } - - return l -} - -func mustRest(list interface{}) ([]interface{}, error) { - tp := reflect.TypeOf(list).Kind() - switch tp { - case reflect.Slice, reflect.Array: - l2 := reflect.ValueOf(list) - - l := l2.Len() - if l == 0 { - return nil, nil - } - - nl := make([]interface{}, l-1) - for i := 1; i < l; i++ { - nl[i-1] = l2.Index(i).Interface() - } - - return nl, nil - default: - return nil, fmt.Errorf("Cannot find rest on type %s", tp) - } -} - -func initial(list interface{}) []interface{} { - l, err := mustInitial(list) - if err != nil { - panic(err) - } - - return l -} - -func mustInitial(list interface{}) ([]interface{}, error) { - tp := reflect.TypeOf(list).Kind() - switch tp { - case reflect.Slice, reflect.Array: - l2 := reflect.ValueOf(list) - - l := l2.Len() - if l == 0 { - return nil, nil - } - - nl := make([]interface{}, l-1) - for i := 0; i < l-1; i++ { - nl[i] = l2.Index(i).Interface() - } - - return nl, nil - default: - return nil, fmt.Errorf("Cannot find initial on type %s", tp) - } -} - -func sortAlpha(list interface{}) []string { - k := reflect.Indirect(reflect.ValueOf(list)).Kind() - switch k { - case reflect.Slice, reflect.Array: - a := strslice(list) - s := sort.StringSlice(a) - s.Sort() - return s - } - return []string{strval(list)} -} - -func reverse(v interface{}) []interface{} { - l, err := mustReverse(v) - if err != nil { - panic(err) - } - - return l -} - -func mustReverse(v interface{}) ([]interface{}, error) { - tp := reflect.TypeOf(v).Kind() - switch tp { - case reflect.Slice, reflect.Array: - l2 := reflect.ValueOf(v) - - l := l2.Len() - // We do not sort in place because the incoming array should not be altered. - nl := make([]interface{}, l) - for i := 0; i < l; i++ { - nl[l-i-1] = l2.Index(i).Interface() - } - - return nl, nil - default: - return nil, fmt.Errorf("Cannot find reverse on type %s", tp) - } -} - -func compact(list interface{}) []interface{} { - l, err := mustCompact(list) - if err != nil { - panic(err) - } - - return l -} - -func mustCompact(list interface{}) ([]interface{}, error) { - tp := reflect.TypeOf(list).Kind() - switch tp { - case reflect.Slice, reflect.Array: - l2 := reflect.ValueOf(list) - - l := l2.Len() - nl := []interface{}{} - var item interface{} - for i := 0; i < l; i++ { - item = l2.Index(i).Interface() - if !empty(item) { - nl = append(nl, item) - } - } - - return nl, nil - default: - return nil, fmt.Errorf("Cannot compact on type %s", tp) - } -} - -func uniq(list interface{}) []interface{} { - l, err := mustUniq(list) - if err != nil { - panic(err) - } - - return l -} - -func mustUniq(list interface{}) ([]interface{}, error) { - tp := reflect.TypeOf(list).Kind() - switch tp { - case reflect.Slice, reflect.Array: - l2 := reflect.ValueOf(list) - - l := l2.Len() - dest := []interface{}{} - var item interface{} - for i := 0; i < l; i++ { - item = l2.Index(i).Interface() - if !inList(dest, item) { - dest = append(dest, item) - } - } - - return dest, nil - default: - return nil, fmt.Errorf("Cannot find uniq on type %s", tp) - } -} - -func inList(haystack []interface{}, needle interface{}) bool { - for _, h := range haystack { - if reflect.DeepEqual(needle, h) { - return true - } - } - return false -} - -func without(list interface{}, omit ...interface{}) []interface{} { - l, err := mustWithout(list, omit...) - if err != nil { - panic(err) - } - - return l -} - -func mustWithout(list interface{}, omit ...interface{}) ([]interface{}, error) { - tp := reflect.TypeOf(list).Kind() - switch tp { - case reflect.Slice, reflect.Array: - l2 := reflect.ValueOf(list) - - l := l2.Len() - res := []interface{}{} - var item interface{} - for i := 0; i < l; i++ { - item = l2.Index(i).Interface() - if !inList(omit, item) { - res = append(res, item) - } - } - - return res, nil - default: - return nil, fmt.Errorf("Cannot find without on type %s", tp) - } -} - -func has(needle interface{}, haystack interface{}) bool { - l, err := mustHas(needle, haystack) - if err != nil { - panic(err) - } - - return l -} - -func mustHas(needle interface{}, haystack interface{}) (bool, error) { - if haystack == nil { - return false, nil - } - tp := reflect.TypeOf(haystack).Kind() - switch tp { - case reflect.Slice, reflect.Array: - l2 := reflect.ValueOf(haystack) - var item interface{} - l := l2.Len() - for i := 0; i < l; i++ { - item = l2.Index(i).Interface() - if reflect.DeepEqual(needle, item) { - return true, nil - } - } - - return false, nil - default: - return false, fmt.Errorf("Cannot find has on type %s", tp) - } -} - -// $list := [1, 2, 3, 4, 5] -// slice $list -> list[0:5] = list[:] -// slice $list 0 3 -> list[0:3] = list[:3] -// slice $list 3 5 -> list[3:5] -// slice $list 3 -> list[3:5] = list[3:] -func slice(list interface{}, indices ...interface{}) interface{} { - l, err := mustSlice(list, indices...) - if err != nil { - panic(err) - } - - return l -} - -func mustSlice(list interface{}, indices ...interface{}) (interface{}, error) { - tp := reflect.TypeOf(list).Kind() - switch tp { - case reflect.Slice, reflect.Array: - l2 := reflect.ValueOf(list) - - l := l2.Len() - if l == 0 { - return nil, nil - } - - var start, end int - if len(indices) > 0 { - start = toInt(indices[0]) - } - if len(indices) < 2 { - end = l - } else { - end = toInt(indices[1]) - } - - return l2.Slice(start, end).Interface(), nil - default: - return nil, fmt.Errorf("list should be type of slice or array but %s", tp) - } -} - -func concat(lists ...interface{}) interface{} { - var res []interface{} - for _, list := range lists { - tp := reflect.TypeOf(list).Kind() - switch tp { - case reflect.Slice, reflect.Array: - l2 := reflect.ValueOf(list) - for i := 0; i < l2.Len(); i++ { - res = append(res, l2.Index(i).Interface()) - } - default: - panic(fmt.Sprintf("Cannot concat type %s as list", tp)) - } - } - return res -} diff --git a/vendor/github.com/Masterminds/sprig/v3/network.go b/vendor/github.com/Masterminds/sprig/v3/network.go deleted file mode 100644 index 108d78a94..000000000 --- a/vendor/github.com/Masterminds/sprig/v3/network.go +++ /dev/null @@ -1,12 +0,0 @@ -package sprig - -import ( - "math/rand" - "net" -) - -func getHostByName(name string) string { - addrs, _ := net.LookupHost(name) - //TODO: add error handing when release v3 comes out - return addrs[rand.Intn(len(addrs))] -} diff --git a/vendor/github.com/Masterminds/sprig/v3/numeric.go b/vendor/github.com/Masterminds/sprig/v3/numeric.go deleted file mode 100644 index f68e4182e..000000000 --- a/vendor/github.com/Masterminds/sprig/v3/numeric.go +++ /dev/null @@ -1,186 +0,0 @@ -package sprig - -import ( - "fmt" - "math" - "strconv" - "strings" - - "github.com/spf13/cast" - "github.com/shopspring/decimal" -) - -// toFloat64 converts 64-bit floats -func toFloat64(v interface{}) float64 { - return cast.ToFloat64(v) -} - -func toInt(v interface{}) int { - return cast.ToInt(v) -} - -// toInt64 converts integer types to 64-bit integers -func toInt64(v interface{}) int64 { - return cast.ToInt64(v) -} - -func max(a interface{}, i ...interface{}) int64 { - aa := toInt64(a) - for _, b := range i { - bb := toInt64(b) - if bb > aa { - aa = bb - } - } - return aa -} - -func maxf(a interface{}, i ...interface{}) float64 { - aa := toFloat64(a) - for _, b := range i { - bb := toFloat64(b) - aa = math.Max(aa, bb) - } - return aa -} - -func min(a interface{}, i ...interface{}) int64 { - aa := toInt64(a) - for _, b := range i { - bb := toInt64(b) - if bb < aa { - aa = bb - } - } - return aa -} - -func minf(a interface{}, i ...interface{}) float64 { - aa := toFloat64(a) - for _, b := range i { - bb := toFloat64(b) - aa = math.Min(aa, bb) - } - return aa -} - -func until(count int) []int { - step := 1 - if count < 0 { - step = -1 - } - return untilStep(0, count, step) -} - -func untilStep(start, stop, step int) []int { - v := []int{} - - if stop < start { - if step >= 0 { - return v - } - for i := start; i > stop; i += step { - v = append(v, i) - } - return v - } - - if step <= 0 { - return v - } - for i := start; i < stop; i += step { - v = append(v, i) - } - return v -} - -func floor(a interface{}) float64 { - aa := toFloat64(a) - return math.Floor(aa) -} - -func ceil(a interface{}) float64 { - aa := toFloat64(a) - return math.Ceil(aa) -} - -func round(a interface{}, p int, rOpt ...float64) float64 { - roundOn := .5 - if len(rOpt) > 0 { - roundOn = rOpt[0] - } - val := toFloat64(a) - places := toFloat64(p) - - var round float64 - pow := math.Pow(10, places) - digit := pow * val - _, div := math.Modf(digit) - if div >= roundOn { - round = math.Ceil(digit) - } else { - round = math.Floor(digit) - } - return round / pow -} - -// converts unix octal to decimal -func toDecimal(v interface{}) int64 { - result, err := strconv.ParseInt(fmt.Sprint(v), 8, 64) - if err != nil { - return 0 - } - return result -} - -func seq(params ...int) string { - increment := 1 - switch len(params) { - case 0: - return "" - case 1: - start := 1 - end := params[0] - if end < start { - increment = -1 - } - return intArrayToString(untilStep(start, end+increment, increment), " ") - case 3: - start := params[0] - end := params[2] - step := params[1] - if end < start { - increment = -1 - if step > 0 { - return "" - } - } - return intArrayToString(untilStep(start, end+increment, step), " ") - case 2: - start := params[0] - end := params[1] - step := 1 - if end < start { - step = -1 - } - return intArrayToString(untilStep(start, end+step, step), " ") - default: - return "" - } -} - -func intArrayToString(slice []int, delimeter string) string { - return strings.Trim(strings.Join(strings.Fields(fmt.Sprint(slice)), delimeter), "[]") -} - -// performs a float and subsequent decimal.Decimal conversion on inputs, -// and iterates through a and b executing the mathmetical operation f -func execDecimalOp(a interface{}, b []interface{}, f func(d1, d2 decimal.Decimal) decimal.Decimal) float64 { - prt := decimal.NewFromFloat(toFloat64(a)) - for _, x := range b { - dx := decimal.NewFromFloat(toFloat64(x)) - prt = f(prt, dx) - } - rslt, _ := prt.Float64() - return rslt -} diff --git a/vendor/github.com/Masterminds/sprig/v3/reflect.go b/vendor/github.com/Masterminds/sprig/v3/reflect.go deleted file mode 100644 index 8a65c132f..000000000 --- a/vendor/github.com/Masterminds/sprig/v3/reflect.go +++ /dev/null @@ -1,28 +0,0 @@ -package sprig - -import ( - "fmt" - "reflect" -) - -// typeIs returns true if the src is the type named in target. -func typeIs(target string, src interface{}) bool { - return target == typeOf(src) -} - -func typeIsLike(target string, src interface{}) bool { - t := typeOf(src) - return target == t || "*"+target == t -} - -func typeOf(src interface{}) string { - return fmt.Sprintf("%T", src) -} - -func kindIs(target string, src interface{}) bool { - return target == kindOf(src) -} - -func kindOf(src interface{}) string { - return reflect.ValueOf(src).Kind().String() -} diff --git a/vendor/github.com/Masterminds/sprig/v3/regex.go b/vendor/github.com/Masterminds/sprig/v3/regex.go deleted file mode 100644 index fab551018..000000000 --- a/vendor/github.com/Masterminds/sprig/v3/regex.go +++ /dev/null @@ -1,83 +0,0 @@ -package sprig - -import ( - "regexp" -) - -func regexMatch(regex string, s string) bool { - match, _ := regexp.MatchString(regex, s) - return match -} - -func mustRegexMatch(regex string, s string) (bool, error) { - return regexp.MatchString(regex, s) -} - -func regexFindAll(regex string, s string, n int) []string { - r := regexp.MustCompile(regex) - return r.FindAllString(s, n) -} - -func mustRegexFindAll(regex string, s string, n int) ([]string, error) { - r, err := regexp.Compile(regex) - if err != nil { - return []string{}, err - } - return r.FindAllString(s, n), nil -} - -func regexFind(regex string, s string) string { - r := regexp.MustCompile(regex) - return r.FindString(s) -} - -func mustRegexFind(regex string, s string) (string, error) { - r, err := regexp.Compile(regex) - if err != nil { - return "", err - } - return r.FindString(s), nil -} - -func regexReplaceAll(regex string, s string, repl string) string { - r := regexp.MustCompile(regex) - return r.ReplaceAllString(s, repl) -} - -func mustRegexReplaceAll(regex string, s string, repl string) (string, error) { - r, err := regexp.Compile(regex) - if err != nil { - return "", err - } - return r.ReplaceAllString(s, repl), nil -} - -func regexReplaceAllLiteral(regex string, s string, repl string) string { - r := regexp.MustCompile(regex) - return r.ReplaceAllLiteralString(s, repl) -} - -func mustRegexReplaceAllLiteral(regex string, s string, repl string) (string, error) { - r, err := regexp.Compile(regex) - if err != nil { - return "", err - } - return r.ReplaceAllLiteralString(s, repl), nil -} - -func regexSplit(regex string, s string, n int) []string { - r := regexp.MustCompile(regex) - return r.Split(s, n) -} - -func mustRegexSplit(regex string, s string, n int) ([]string, error) { - r, err := regexp.Compile(regex) - if err != nil { - return []string{}, err - } - return r.Split(s, n), nil -} - -func regexQuoteMeta(s string) string { - return regexp.QuoteMeta(s) -} diff --git a/vendor/github.com/Masterminds/sprig/v3/semver.go b/vendor/github.com/Masterminds/sprig/v3/semver.go deleted file mode 100644 index 3fbe08aa6..000000000 --- a/vendor/github.com/Masterminds/sprig/v3/semver.go +++ /dev/null @@ -1,23 +0,0 @@ -package sprig - -import ( - sv2 "github.com/Masterminds/semver/v3" -) - -func semverCompare(constraint, version string) (bool, error) { - c, err := sv2.NewConstraint(constraint) - if err != nil { - return false, err - } - - v, err := sv2.NewVersion(version) - if err != nil { - return false, err - } - - return c.Check(v), nil -} - -func semver(version string) (*sv2.Version, error) { - return sv2.NewVersion(version) -} diff --git a/vendor/github.com/Masterminds/sprig/v3/strings.go b/vendor/github.com/Masterminds/sprig/v3/strings.go deleted file mode 100644 index e0ae628c8..000000000 --- a/vendor/github.com/Masterminds/sprig/v3/strings.go +++ /dev/null @@ -1,236 +0,0 @@ -package sprig - -import ( - "encoding/base32" - "encoding/base64" - "fmt" - "reflect" - "strconv" - "strings" - - util "github.com/Masterminds/goutils" -) - -func base64encode(v string) string { - return base64.StdEncoding.EncodeToString([]byte(v)) -} - -func base64decode(v string) string { - data, err := base64.StdEncoding.DecodeString(v) - if err != nil { - return err.Error() - } - return string(data) -} - -func base32encode(v string) string { - return base32.StdEncoding.EncodeToString([]byte(v)) -} - -func base32decode(v string) string { - data, err := base32.StdEncoding.DecodeString(v) - if err != nil { - return err.Error() - } - return string(data) -} - -func abbrev(width int, s string) string { - if width < 4 { - return s - } - r, _ := util.Abbreviate(s, width) - return r -} - -func abbrevboth(left, right int, s string) string { - if right < 4 || left > 0 && right < 7 { - return s - } - r, _ := util.AbbreviateFull(s, left, right) - return r -} -func initials(s string) string { - // Wrap this just to eliminate the var args, which templates don't do well. - return util.Initials(s) -} - -func randAlphaNumeric(count int) string { - // It is not possible, it appears, to actually generate an error here. - r, _ := util.CryptoRandomAlphaNumeric(count) - return r -} - -func randAlpha(count int) string { - r, _ := util.CryptoRandomAlphabetic(count) - return r -} - -func randAscii(count int) string { - r, _ := util.CryptoRandomAscii(count) - return r -} - -func randNumeric(count int) string { - r, _ := util.CryptoRandomNumeric(count) - return r -} - -func untitle(str string) string { - return util.Uncapitalize(str) -} - -func quote(str ...interface{}) string { - out := make([]string, 0, len(str)) - for _, s := range str { - if s != nil { - out = append(out, fmt.Sprintf("%q", strval(s))) - } - } - return strings.Join(out, " ") -} - -func squote(str ...interface{}) string { - out := make([]string, 0, len(str)) - for _, s := range str { - if s != nil { - out = append(out, fmt.Sprintf("'%v'", s)) - } - } - return strings.Join(out, " ") -} - -func cat(v ...interface{}) string { - v = removeNilElements(v) - r := strings.TrimSpace(strings.Repeat("%v ", len(v))) - return fmt.Sprintf(r, v...) -} - -func indent(spaces int, v string) string { - pad := strings.Repeat(" ", spaces) - return pad + strings.Replace(v, "\n", "\n"+pad, -1) -} - -func nindent(spaces int, v string) string { - return "\n" + indent(spaces, v) -} - -func replace(old, new, src string) string { - return strings.Replace(src, old, new, -1) -} - -func plural(one, many string, count int) string { - if count == 1 { - return one - } - return many -} - -func strslice(v interface{}) []string { - switch v := v.(type) { - case []string: - return v - case []interface{}: - b := make([]string, 0, len(v)) - for _, s := range v { - if s != nil { - b = append(b, strval(s)) - } - } - return b - default: - val := reflect.ValueOf(v) - switch val.Kind() { - case reflect.Array, reflect.Slice: - l := val.Len() - b := make([]string, 0, l) - for i := 0; i < l; i++ { - value := val.Index(i).Interface() - if value != nil { - b = append(b, strval(value)) - } - } - return b - default: - if v == nil { - return []string{} - } - - return []string{strval(v)} - } - } -} - -func removeNilElements(v []interface{}) []interface{} { - newSlice := make([]interface{}, 0, len(v)) - for _, i := range v { - if i != nil { - newSlice = append(newSlice, i) - } - } - return newSlice -} - -func strval(v interface{}) string { - switch v := v.(type) { - case string: - return v - case []byte: - return string(v) - case error: - return v.Error() - case fmt.Stringer: - return v.String() - default: - return fmt.Sprintf("%v", v) - } -} - -func trunc(c int, s string) string { - if c < 0 && len(s)+c > 0 { - return s[len(s)+c:] - } - if c >= 0 && len(s) > c { - return s[:c] - } - return s -} - -func join(sep string, v interface{}) string { - return strings.Join(strslice(v), sep) -} - -func split(sep, orig string) map[string]string { - parts := strings.Split(orig, sep) - res := make(map[string]string, len(parts)) - for i, v := range parts { - res["_"+strconv.Itoa(i)] = v - } - return res -} - -func splitn(sep string, n int, orig string) map[string]string { - parts := strings.SplitN(orig, sep, n) - res := make(map[string]string, len(parts)) - for i, v := range parts { - res["_"+strconv.Itoa(i)] = v - } - return res -} - -// substring creates a substring of the given string. -// -// If start is < 0, this calls string[:end]. -// -// If start is >= 0 and end < 0 or end bigger than s length, this calls string[start:] -// -// Otherwise, this calls string[start, end]. -func substring(start, end int, s string) string { - if start < 0 { - return s[:end] - } - if end < 0 || end > len(s) { - return s[start:] - } - return s[start:end] -} diff --git a/vendor/github.com/Masterminds/sprig/v3/url.go b/vendor/github.com/Masterminds/sprig/v3/url.go deleted file mode 100644 index b8e120e19..000000000 --- a/vendor/github.com/Masterminds/sprig/v3/url.go +++ /dev/null @@ -1,66 +0,0 @@ -package sprig - -import ( - "fmt" - "net/url" - "reflect" -) - -func dictGetOrEmpty(dict map[string]interface{}, key string) string { - value, ok := dict[key] - if !ok { - return "" - } - tp := reflect.TypeOf(value).Kind() - if tp != reflect.String { - panic(fmt.Sprintf("unable to parse %s key, must be of type string, but %s found", key, tp.String())) - } - return reflect.ValueOf(value).String() -} - -// parses given URL to return dict object -func urlParse(v string) map[string]interface{} { - dict := map[string]interface{}{} - parsedURL, err := url.Parse(v) - if err != nil { - panic(fmt.Sprintf("unable to parse url: %s", err)) - } - dict["scheme"] = parsedURL.Scheme - dict["host"] = parsedURL.Host - dict["hostname"] = parsedURL.Hostname() - dict["path"] = parsedURL.Path - dict["query"] = parsedURL.RawQuery - dict["opaque"] = parsedURL.Opaque - dict["fragment"] = parsedURL.Fragment - if parsedURL.User != nil { - dict["userinfo"] = parsedURL.User.String() - } else { - dict["userinfo"] = "" - } - - return dict -} - -// join given dict to URL string -func urlJoin(d map[string]interface{}) string { - resURL := url.URL{ - Scheme: dictGetOrEmpty(d, "scheme"), - Host: dictGetOrEmpty(d, "host"), - Path: dictGetOrEmpty(d, "path"), - RawQuery: dictGetOrEmpty(d, "query"), - Opaque: dictGetOrEmpty(d, "opaque"), - Fragment: dictGetOrEmpty(d, "fragment"), - } - userinfo := dictGetOrEmpty(d, "userinfo") - var user *url.Userinfo - if userinfo != "" { - tempURL, err := url.Parse(fmt.Sprintf("proto://%s@host", userinfo)) - if err != nil { - panic(fmt.Sprintf("unable to parse userinfo in dict: %s", err)) - } - user = tempURL.User - } - - resURL.User = user - return resURL.String() -} diff --git a/vendor/github.com/PuerkitoBio/purell/.gitignore b/vendor/github.com/PuerkitoBio/purell/.gitignore deleted file mode 100644 index 748e4c807..000000000 --- a/vendor/github.com/PuerkitoBio/purell/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -*.sublime-* -.DS_Store -*.swp -*.swo -tags diff --git a/vendor/github.com/PuerkitoBio/purell/.travis.yml b/vendor/github.com/PuerkitoBio/purell/.travis.yml deleted file mode 100644 index cf31e6af6..000000000 --- a/vendor/github.com/PuerkitoBio/purell/.travis.yml +++ /dev/null @@ -1,12 +0,0 @@ -language: go - -go: - - 1.4.x - - 1.5.x - - 1.6.x - - 1.7.x - - 1.8.x - - 1.9.x - - "1.10.x" - - "1.11.x" - - tip diff --git a/vendor/github.com/PuerkitoBio/purell/LICENSE b/vendor/github.com/PuerkitoBio/purell/LICENSE deleted file mode 100644 index 4b9986dea..000000000 --- a/vendor/github.com/PuerkitoBio/purell/LICENSE +++ /dev/null @@ -1,12 +0,0 @@ -Copyright (c) 2012, Martin Angers -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -* Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/PuerkitoBio/purell/README.md b/vendor/github.com/PuerkitoBio/purell/README.md deleted file mode 100644 index 07de0c498..000000000 --- a/vendor/github.com/PuerkitoBio/purell/README.md +++ /dev/null @@ -1,188 +0,0 @@ -# Purell - -Purell is a tiny Go library to normalize URLs. It returns a pure URL. Pure-ell. Sanitizer and all. Yeah, I know... - -Based on the [wikipedia paper][wiki] and the [RFC 3986 document][rfc]. - -[![build status](https://travis-ci.org/PuerkitoBio/purell.svg?branch=master)](http://travis-ci.org/PuerkitoBio/purell) - -## Install - -`go get github.com/PuerkitoBio/purell` - -## Changelog - -* **v1.1.1** : Fix failing test due to Go1.12 changes (thanks to @ianlancetaylor). -* **2016-11-14 (v1.1.0)** : IDN: Conform to RFC 5895: Fold character width (thanks to @beeker1121). -* **2016-07-27 (v1.0.0)** : Normalize IDN to ASCII (thanks to @zenovich). -* **2015-02-08** : Add fix for relative paths issue ([PR #5][pr5]) and add fix for unnecessary encoding of reserved characters ([see issue #7][iss7]). -* **v0.2.0** : Add benchmarks, Attempt IDN support. -* **v0.1.0** : Initial release. - -## Examples - -From `example_test.go` (note that in your code, you would import "github.com/PuerkitoBio/purell", and would prefix references to its methods and constants with "purell."): - -```go -package purell - -import ( - "fmt" - "net/url" -) - -func ExampleNormalizeURLString() { - if normalized, err := NormalizeURLString("hTTp://someWEBsite.com:80/Amazing%3f/url/", - FlagLowercaseScheme|FlagLowercaseHost|FlagUppercaseEscapes); err != nil { - panic(err) - } else { - fmt.Print(normalized) - } - // Output: http://somewebsite.com:80/Amazing%3F/url/ -} - -func ExampleMustNormalizeURLString() { - normalized := MustNormalizeURLString("hTTpS://someWEBsite.com:443/Amazing%fa/url/", - FlagsUnsafeGreedy) - fmt.Print(normalized) - - // Output: http://somewebsite.com/Amazing%FA/url -} - -func ExampleNormalizeURL() { - if u, err := url.Parse("Http://SomeUrl.com:8080/a/b/.././c///g?c=3&a=1&b=9&c=0#target"); err != nil { - panic(err) - } else { - normalized := NormalizeURL(u, FlagsUsuallySafeGreedy|FlagRemoveDuplicateSlashes|FlagRemoveFragment) - fmt.Print(normalized) - } - - // Output: http://someurl.com:8080/a/c/g?c=3&a=1&b=9&c=0 -} -``` - -## API - -As seen in the examples above, purell offers three methods, `NormalizeURLString(string, NormalizationFlags) (string, error)`, `MustNormalizeURLString(string, NormalizationFlags) (string)` and `NormalizeURL(*url.URL, NormalizationFlags) (string)`. They all normalize the provided URL based on the specified flags. Here are the available flags: - -```go -const ( - // Safe normalizations - FlagLowercaseScheme NormalizationFlags = 1 << iota // HTTP://host -> http://host, applied by default in Go1.1 - FlagLowercaseHost // http://HOST -> http://host - FlagUppercaseEscapes // http://host/t%ef -> http://host/t%EF - FlagDecodeUnnecessaryEscapes // http://host/t%41 -> http://host/tA - FlagEncodeNecessaryEscapes // http://host/!"#$ -> http://host/%21%22#$ - FlagRemoveDefaultPort // http://host:80 -> http://host - FlagRemoveEmptyQuerySeparator // http://host/path? -> http://host/path - - // Usually safe normalizations - FlagRemoveTrailingSlash // http://host/path/ -> http://host/path - FlagAddTrailingSlash // http://host/path -> http://host/path/ (should choose only one of these add/remove trailing slash flags) - FlagRemoveDotSegments // http://host/path/./a/b/../c -> http://host/path/a/c - - // Unsafe normalizations - FlagRemoveDirectoryIndex // http://host/path/index.html -> http://host/path/ - FlagRemoveFragment // http://host/path#fragment -> http://host/path - FlagForceHTTP // https://host -> http://host - FlagRemoveDuplicateSlashes // http://host/path//a///b -> http://host/path/a/b - FlagRemoveWWW // http://www.host/ -> http://host/ - FlagAddWWW // http://host/ -> http://www.host/ (should choose only one of these add/remove WWW flags) - FlagSortQuery // http://host/path?c=3&b=2&a=1&b=1 -> http://host/path?a=1&b=1&b=2&c=3 - - // Normalizations not in the wikipedia article, required to cover tests cases - // submitted by jehiah - FlagDecodeDWORDHost // http://1113982867 -> http://66.102.7.147 - FlagDecodeOctalHost // http://0102.0146.07.0223 -> http://66.102.7.147 - FlagDecodeHexHost // http://0x42660793 -> http://66.102.7.147 - FlagRemoveUnnecessaryHostDots // http://.host../path -> http://host/path - FlagRemoveEmptyPortSeparator // http://host:/path -> http://host/path - - // Convenience set of safe normalizations - FlagsSafe NormalizationFlags = FlagLowercaseHost | FlagLowercaseScheme | FlagUppercaseEscapes | FlagDecodeUnnecessaryEscapes | FlagEncodeNecessaryEscapes | FlagRemoveDefaultPort | FlagRemoveEmptyQuerySeparator - - // For convenience sets, "greedy" uses the "remove trailing slash" and "remove www. prefix" flags, - // while "non-greedy" uses the "add (or keep) the trailing slash" and "add www. prefix". - - // Convenience set of usually safe normalizations (includes FlagsSafe) - FlagsUsuallySafeGreedy NormalizationFlags = FlagsSafe | FlagRemoveTrailingSlash | FlagRemoveDotSegments - FlagsUsuallySafeNonGreedy NormalizationFlags = FlagsSafe | FlagAddTrailingSlash | FlagRemoveDotSegments - - // Convenience set of unsafe normalizations (includes FlagsUsuallySafe) - FlagsUnsafeGreedy NormalizationFlags = FlagsUsuallySafeGreedy | FlagRemoveDirectoryIndex | FlagRemoveFragment | FlagForceHTTP | FlagRemoveDuplicateSlashes | FlagRemoveWWW | FlagSortQuery - FlagsUnsafeNonGreedy NormalizationFlags = FlagsUsuallySafeNonGreedy | FlagRemoveDirectoryIndex | FlagRemoveFragment | FlagForceHTTP | FlagRemoveDuplicateSlashes | FlagAddWWW | FlagSortQuery - - // Convenience set of all available flags - FlagsAllGreedy = FlagsUnsafeGreedy | FlagDecodeDWORDHost | FlagDecodeOctalHost | FlagDecodeHexHost | FlagRemoveUnnecessaryHostDots | FlagRemoveEmptyPortSeparator - FlagsAllNonGreedy = FlagsUnsafeNonGreedy | FlagDecodeDWORDHost | FlagDecodeOctalHost | FlagDecodeHexHost | FlagRemoveUnnecessaryHostDots | FlagRemoveEmptyPortSeparator -) -``` - -For convenience, the set of flags `FlagsSafe`, `FlagsUsuallySafe[Greedy|NonGreedy]`, `FlagsUnsafe[Greedy|NonGreedy]` and `FlagsAll[Greedy|NonGreedy]` are provided for the similarly grouped normalizations on [wikipedia's URL normalization page][wiki]. You can add (using the bitwise OR `|` operator) or remove (using the bitwise AND NOT `&^` operator) individual flags from the sets if required, to build your own custom set. - -The [full godoc reference is available on gopkgdoc][godoc]. - -Some things to note: - -* `FlagDecodeUnnecessaryEscapes`, `FlagEncodeNecessaryEscapes`, `FlagUppercaseEscapes` and `FlagRemoveEmptyQuerySeparator` are always implicitly set, because internally, the URL string is parsed as an URL object, which automatically decodes unnecessary escapes, uppercases and encodes necessary ones, and removes empty query separators (an unnecessary `?` at the end of the url). So this operation cannot **not** be done. For this reason, `FlagRemoveEmptyQuerySeparator` (as well as the other three) has been included in the `FlagsSafe` convenience set, instead of `FlagsUnsafe`, where Wikipedia puts it. - -* The `FlagDecodeUnnecessaryEscapes` decodes the following escapes (*from -> to*): - - %24 -> $ - - %26 -> & - - %2B-%3B -> +,-./0123456789:; - - %3D -> = - - %40-%5A -> @ABCDEFGHIJKLMNOPQRSTUVWXYZ - - %5F -> _ - - %61-%7A -> abcdefghijklmnopqrstuvwxyz - - %7E -> ~ - - -* When the `NormalizeURL` function is used (passing an URL object), this source URL object is modified (that is, after the call, the URL object will be modified to reflect the normalization). - -* The *replace IP with domain name* normalization (`http://208.77.188.166/ → http://www.example.com/`) is obviously not possible for a library without making some network requests. This is not implemented in purell. - -* The *remove unused query string parameters* and *remove default query parameters* are also not implemented, since this is a very case-specific normalization, and it is quite trivial to do with an URL object. - -### Safe vs Usually Safe vs Unsafe - -Purell allows you to control the level of risk you take while normalizing an URL. You can aggressively normalize, play it totally safe, or anything in between. - -Consider the following URL: - -`HTTPS://www.RooT.com/toto/t%45%1f///a/./b/../c/?z=3&w=2&a=4&w=1#invalid` - -Normalizing with the `FlagsSafe` gives: - -`https://www.root.com/toto/tE%1F///a/./b/../c/?z=3&w=2&a=4&w=1#invalid` - -With the `FlagsUsuallySafeGreedy`: - -`https://www.root.com/toto/tE%1F///a/c?z=3&w=2&a=4&w=1#invalid` - -And with `FlagsUnsafeGreedy`: - -`http://root.com/toto/tE%1F/a/c?a=4&w=1&w=2&z=3` - -## TODOs - -* Add a class/default instance to allow specifying custom directory index names? At the moment, removing directory index removes `(^|/)((?:default|index)\.\w{1,4})$`. - -## Thanks / Contributions - -@rogpeppe -@jehiah -@opennota -@pchristopher1275 -@zenovich -@beeker1121 - -## License - -The [BSD 3-Clause license][bsd]. - -[bsd]: http://opensource.org/licenses/BSD-3-Clause -[wiki]: http://en.wikipedia.org/wiki/URL_normalization -[rfc]: http://tools.ietf.org/html/rfc3986#section-6 -[godoc]: http://go.pkgdoc.org/github.com/PuerkitoBio/purell -[pr5]: https://github.com/PuerkitoBio/purell/pull/5 -[iss7]: https://github.com/PuerkitoBio/purell/issues/7 diff --git a/vendor/github.com/PuerkitoBio/purell/purell.go b/vendor/github.com/PuerkitoBio/purell/purell.go deleted file mode 100644 index 6d0fc190a..000000000 --- a/vendor/github.com/PuerkitoBio/purell/purell.go +++ /dev/null @@ -1,379 +0,0 @@ -/* -Package purell offers URL normalization as described on the wikipedia page: -http://en.wikipedia.org/wiki/URL_normalization -*/ -package purell - -import ( - "bytes" - "fmt" - "net/url" - "regexp" - "sort" - "strconv" - "strings" - - "github.com/PuerkitoBio/urlesc" - "golang.org/x/net/idna" - "golang.org/x/text/unicode/norm" - "golang.org/x/text/width" -) - -// A set of normalization flags determines how a URL will -// be normalized. -type NormalizationFlags uint - -const ( - // Safe normalizations - FlagLowercaseScheme NormalizationFlags = 1 << iota // HTTP://host -> http://host, applied by default in Go1.1 - FlagLowercaseHost // http://HOST -> http://host - FlagUppercaseEscapes // http://host/t%ef -> http://host/t%EF - FlagDecodeUnnecessaryEscapes // http://host/t%41 -> http://host/tA - FlagEncodeNecessaryEscapes // http://host/!"#$ -> http://host/%21%22#$ - FlagRemoveDefaultPort // http://host:80 -> http://host - FlagRemoveEmptyQuerySeparator // http://host/path? -> http://host/path - - // Usually safe normalizations - FlagRemoveTrailingSlash // http://host/path/ -> http://host/path - FlagAddTrailingSlash // http://host/path -> http://host/path/ (should choose only one of these add/remove trailing slash flags) - FlagRemoveDotSegments // http://host/path/./a/b/../c -> http://host/path/a/c - - // Unsafe normalizations - FlagRemoveDirectoryIndex // http://host/path/index.html -> http://host/path/ - FlagRemoveFragment // http://host/path#fragment -> http://host/path - FlagForceHTTP // https://host -> http://host - FlagRemoveDuplicateSlashes // http://host/path//a///b -> http://host/path/a/b - FlagRemoveWWW // http://www.host/ -> http://host/ - FlagAddWWW // http://host/ -> http://www.host/ (should choose only one of these add/remove WWW flags) - FlagSortQuery // http://host/path?c=3&b=2&a=1&b=1 -> http://host/path?a=1&b=1&b=2&c=3 - - // Normalizations not in the wikipedia article, required to cover tests cases - // submitted by jehiah - FlagDecodeDWORDHost // http://1113982867 -> http://66.102.7.147 - FlagDecodeOctalHost // http://0102.0146.07.0223 -> http://66.102.7.147 - FlagDecodeHexHost // http://0x42660793 -> http://66.102.7.147 - FlagRemoveUnnecessaryHostDots // http://.host../path -> http://host/path - FlagRemoveEmptyPortSeparator // http://host:/path -> http://host/path - - // Convenience set of safe normalizations - FlagsSafe NormalizationFlags = FlagLowercaseHost | FlagLowercaseScheme | FlagUppercaseEscapes | FlagDecodeUnnecessaryEscapes | FlagEncodeNecessaryEscapes | FlagRemoveDefaultPort | FlagRemoveEmptyQuerySeparator - - // For convenience sets, "greedy" uses the "remove trailing slash" and "remove www. prefix" flags, - // while "non-greedy" uses the "add (or keep) the trailing slash" and "add www. prefix". - - // Convenience set of usually safe normalizations (includes FlagsSafe) - FlagsUsuallySafeGreedy NormalizationFlags = FlagsSafe | FlagRemoveTrailingSlash | FlagRemoveDotSegments - FlagsUsuallySafeNonGreedy NormalizationFlags = FlagsSafe | FlagAddTrailingSlash | FlagRemoveDotSegments - - // Convenience set of unsafe normalizations (includes FlagsUsuallySafe) - FlagsUnsafeGreedy NormalizationFlags = FlagsUsuallySafeGreedy | FlagRemoveDirectoryIndex | FlagRemoveFragment | FlagForceHTTP | FlagRemoveDuplicateSlashes | FlagRemoveWWW | FlagSortQuery - FlagsUnsafeNonGreedy NormalizationFlags = FlagsUsuallySafeNonGreedy | FlagRemoveDirectoryIndex | FlagRemoveFragment | FlagForceHTTP | FlagRemoveDuplicateSlashes | FlagAddWWW | FlagSortQuery - - // Convenience set of all available flags - FlagsAllGreedy = FlagsUnsafeGreedy | FlagDecodeDWORDHost | FlagDecodeOctalHost | FlagDecodeHexHost | FlagRemoveUnnecessaryHostDots | FlagRemoveEmptyPortSeparator - FlagsAllNonGreedy = FlagsUnsafeNonGreedy | FlagDecodeDWORDHost | FlagDecodeOctalHost | FlagDecodeHexHost | FlagRemoveUnnecessaryHostDots | FlagRemoveEmptyPortSeparator -) - -const ( - defaultHttpPort = ":80" - defaultHttpsPort = ":443" -) - -// Regular expressions used by the normalizations -var rxPort = regexp.MustCompile(`(:\d+)/?$`) -var rxDirIndex = regexp.MustCompile(`(^|/)((?:default|index)\.\w{1,4})$`) -var rxDupSlashes = regexp.MustCompile(`/{2,}`) -var rxDWORDHost = regexp.MustCompile(`^(\d+)((?:\.+)?(?:\:\d*)?)$`) -var rxOctalHost = regexp.MustCompile(`^(0\d*)\.(0\d*)\.(0\d*)\.(0\d*)((?:\.+)?(?:\:\d*)?)$`) -var rxHexHost = regexp.MustCompile(`^0x([0-9A-Fa-f]+)((?:\.+)?(?:\:\d*)?)$`) -var rxHostDots = regexp.MustCompile(`^(.+?)(:\d+)?$`) -var rxEmptyPort = regexp.MustCompile(`:+$`) - -// Map of flags to implementation function. -// FlagDecodeUnnecessaryEscapes has no action, since it is done automatically -// by parsing the string as an URL. Same for FlagUppercaseEscapes and FlagRemoveEmptyQuerySeparator. - -// Since maps have undefined traversing order, make a slice of ordered keys -var flagsOrder = []NormalizationFlags{ - FlagLowercaseScheme, - FlagLowercaseHost, - FlagRemoveDefaultPort, - FlagRemoveDirectoryIndex, - FlagRemoveDotSegments, - FlagRemoveFragment, - FlagForceHTTP, // Must be after remove default port (because https=443/http=80) - FlagRemoveDuplicateSlashes, - FlagRemoveWWW, - FlagAddWWW, - FlagSortQuery, - FlagDecodeDWORDHost, - FlagDecodeOctalHost, - FlagDecodeHexHost, - FlagRemoveUnnecessaryHostDots, - FlagRemoveEmptyPortSeparator, - FlagRemoveTrailingSlash, // These two (add/remove trailing slash) must be last - FlagAddTrailingSlash, -} - -// ... and then the map, where order is unimportant -var flags = map[NormalizationFlags]func(*url.URL){ - FlagLowercaseScheme: lowercaseScheme, - FlagLowercaseHost: lowercaseHost, - FlagRemoveDefaultPort: removeDefaultPort, - FlagRemoveDirectoryIndex: removeDirectoryIndex, - FlagRemoveDotSegments: removeDotSegments, - FlagRemoveFragment: removeFragment, - FlagForceHTTP: forceHTTP, - FlagRemoveDuplicateSlashes: removeDuplicateSlashes, - FlagRemoveWWW: removeWWW, - FlagAddWWW: addWWW, - FlagSortQuery: sortQuery, - FlagDecodeDWORDHost: decodeDWORDHost, - FlagDecodeOctalHost: decodeOctalHost, - FlagDecodeHexHost: decodeHexHost, - FlagRemoveUnnecessaryHostDots: removeUnncessaryHostDots, - FlagRemoveEmptyPortSeparator: removeEmptyPortSeparator, - FlagRemoveTrailingSlash: removeTrailingSlash, - FlagAddTrailingSlash: addTrailingSlash, -} - -// MustNormalizeURLString returns the normalized string, and panics if an error occurs. -// It takes an URL string as input, as well as the normalization flags. -func MustNormalizeURLString(u string, f NormalizationFlags) string { - result, e := NormalizeURLString(u, f) - if e != nil { - panic(e) - } - return result -} - -// NormalizeURLString returns the normalized string, or an error if it can't be parsed into an URL object. -// It takes an URL string as input, as well as the normalization flags. -func NormalizeURLString(u string, f NormalizationFlags) (string, error) { - parsed, err := url.Parse(u) - if err != nil { - return "", err - } - - if f&FlagLowercaseHost == FlagLowercaseHost { - parsed.Host = strings.ToLower(parsed.Host) - } - - // The idna package doesn't fully conform to RFC 5895 - // (https://tools.ietf.org/html/rfc5895), so we do it here. - // Taken from Go 1.8 cycle source, courtesy of bradfitz. - // TODO: Remove when (if?) idna package conforms to RFC 5895. - parsed.Host = width.Fold.String(parsed.Host) - parsed.Host = norm.NFC.String(parsed.Host) - if parsed.Host, err = idna.ToASCII(parsed.Host); err != nil { - return "", err - } - - return NormalizeURL(parsed, f), nil -} - -// NormalizeURL returns the normalized string. -// It takes a parsed URL object as input, as well as the normalization flags. -func NormalizeURL(u *url.URL, f NormalizationFlags) string { - for _, k := range flagsOrder { - if f&k == k { - flags[k](u) - } - } - return urlesc.Escape(u) -} - -func lowercaseScheme(u *url.URL) { - if len(u.Scheme) > 0 { - u.Scheme = strings.ToLower(u.Scheme) - } -} - -func lowercaseHost(u *url.URL) { - if len(u.Host) > 0 { - u.Host = strings.ToLower(u.Host) - } -} - -func removeDefaultPort(u *url.URL) { - if len(u.Host) > 0 { - scheme := strings.ToLower(u.Scheme) - u.Host = rxPort.ReplaceAllStringFunc(u.Host, func(val string) string { - if (scheme == "http" && val == defaultHttpPort) || (scheme == "https" && val == defaultHttpsPort) { - return "" - } - return val - }) - } -} - -func removeTrailingSlash(u *url.URL) { - if l := len(u.Path); l > 0 { - if strings.HasSuffix(u.Path, "/") { - u.Path = u.Path[:l-1] - } - } else if l = len(u.Host); l > 0 { - if strings.HasSuffix(u.Host, "/") { - u.Host = u.Host[:l-1] - } - } -} - -func addTrailingSlash(u *url.URL) { - if l := len(u.Path); l > 0 { - if !strings.HasSuffix(u.Path, "/") { - u.Path += "/" - } - } else if l = len(u.Host); l > 0 { - if !strings.HasSuffix(u.Host, "/") { - u.Host += "/" - } - } -} - -func removeDotSegments(u *url.URL) { - if len(u.Path) > 0 { - var dotFree []string - var lastIsDot bool - - sections := strings.Split(u.Path, "/") - for _, s := range sections { - if s == ".." { - if len(dotFree) > 0 { - dotFree = dotFree[:len(dotFree)-1] - } - } else if s != "." { - dotFree = append(dotFree, s) - } - lastIsDot = (s == "." || s == "..") - } - // Special case if host does not end with / and new path does not begin with / - u.Path = strings.Join(dotFree, "/") - if u.Host != "" && !strings.HasSuffix(u.Host, "/") && !strings.HasPrefix(u.Path, "/") { - u.Path = "/" + u.Path - } - // Special case if the last segment was a dot, make sure the path ends with a slash - if lastIsDot && !strings.HasSuffix(u.Path, "/") { - u.Path += "/" - } - } -} - -func removeDirectoryIndex(u *url.URL) { - if len(u.Path) > 0 { - u.Path = rxDirIndex.ReplaceAllString(u.Path, "$1") - } -} - -func removeFragment(u *url.URL) { - u.Fragment = "" -} - -func forceHTTP(u *url.URL) { - if strings.ToLower(u.Scheme) == "https" { - u.Scheme = "http" - } -} - -func removeDuplicateSlashes(u *url.URL) { - if len(u.Path) > 0 { - u.Path = rxDupSlashes.ReplaceAllString(u.Path, "/") - } -} - -func removeWWW(u *url.URL) { - if len(u.Host) > 0 && strings.HasPrefix(strings.ToLower(u.Host), "www.") { - u.Host = u.Host[4:] - } -} - -func addWWW(u *url.URL) { - if len(u.Host) > 0 && !strings.HasPrefix(strings.ToLower(u.Host), "www.") { - u.Host = "www." + u.Host - } -} - -func sortQuery(u *url.URL) { - q := u.Query() - - if len(q) > 0 { - arKeys := make([]string, len(q)) - i := 0 - for k := range q { - arKeys[i] = k - i++ - } - sort.Strings(arKeys) - buf := new(bytes.Buffer) - for _, k := range arKeys { - sort.Strings(q[k]) - for _, v := range q[k] { - if buf.Len() > 0 { - buf.WriteRune('&') - } - buf.WriteString(fmt.Sprintf("%s=%s", k, urlesc.QueryEscape(v))) - } - } - - // Rebuild the raw query string - u.RawQuery = buf.String() - } -} - -func decodeDWORDHost(u *url.URL) { - if len(u.Host) > 0 { - if matches := rxDWORDHost.FindStringSubmatch(u.Host); len(matches) > 2 { - var parts [4]int64 - - dword, _ := strconv.ParseInt(matches[1], 10, 0) - for i, shift := range []uint{24, 16, 8, 0} { - parts[i] = dword >> shift & 0xFF - } - u.Host = fmt.Sprintf("%d.%d.%d.%d%s", parts[0], parts[1], parts[2], parts[3], matches[2]) - } - } -} - -func decodeOctalHost(u *url.URL) { - if len(u.Host) > 0 { - if matches := rxOctalHost.FindStringSubmatch(u.Host); len(matches) > 5 { - var parts [4]int64 - - for i := 1; i <= 4; i++ { - parts[i-1], _ = strconv.ParseInt(matches[i], 8, 0) - } - u.Host = fmt.Sprintf("%d.%d.%d.%d%s", parts[0], parts[1], parts[2], parts[3], matches[5]) - } - } -} - -func decodeHexHost(u *url.URL) { - if len(u.Host) > 0 { - if matches := rxHexHost.FindStringSubmatch(u.Host); len(matches) > 2 { - // Conversion is safe because of regex validation - parsed, _ := strconv.ParseInt(matches[1], 16, 0) - // Set host as DWORD (base 10) encoded host - u.Host = fmt.Sprintf("%d%s", parsed, matches[2]) - // The rest is the same as decoding a DWORD host - decodeDWORDHost(u) - } - } -} - -func removeUnncessaryHostDots(u *url.URL) { - if len(u.Host) > 0 { - if matches := rxHostDots.FindStringSubmatch(u.Host); len(matches) > 1 { - // Trim the leading and trailing dots - u.Host = strings.Trim(matches[1], ".") - if len(matches) > 2 { - u.Host += matches[2] - } - } - } -} - -func removeEmptyPortSeparator(u *url.URL) { - if len(u.Host) > 0 { - u.Host = rxEmptyPort.ReplaceAllString(u.Host, "") - } -} diff --git a/vendor/github.com/PuerkitoBio/urlesc/.travis.yml b/vendor/github.com/PuerkitoBio/urlesc/.travis.yml deleted file mode 100644 index ba6b225f9..000000000 --- a/vendor/github.com/PuerkitoBio/urlesc/.travis.yml +++ /dev/null @@ -1,15 +0,0 @@ -language: go - -go: - - 1.4.x - - 1.5.x - - 1.6.x - - 1.7.x - - 1.8.x - - tip - -install: - - go build . - -script: - - go test -v diff --git a/vendor/github.com/PuerkitoBio/urlesc/LICENSE b/vendor/github.com/PuerkitoBio/urlesc/LICENSE deleted file mode 100644 index 744875676..000000000 --- a/vendor/github.com/PuerkitoBio/urlesc/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2012 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/PuerkitoBio/urlesc/README.md b/vendor/github.com/PuerkitoBio/urlesc/README.md deleted file mode 100644 index 57aff0a53..000000000 --- a/vendor/github.com/PuerkitoBio/urlesc/README.md +++ /dev/null @@ -1,16 +0,0 @@ -urlesc [![Build Status](https://travis-ci.org/PuerkitoBio/urlesc.svg?branch=master)](https://travis-ci.org/PuerkitoBio/urlesc) [![GoDoc](http://godoc.org/github.com/PuerkitoBio/urlesc?status.svg)](http://godoc.org/github.com/PuerkitoBio/urlesc) -====== - -Package urlesc implements query escaping as per RFC 3986. - -It contains some parts of the net/url package, modified so as to allow -some reserved characters incorrectly escaped by net/url (see [issue 5684](https://github.com/golang/go/issues/5684)). - -## Install - - go get github.com/PuerkitoBio/urlesc - -## License - -Go license (BSD-3-Clause) - diff --git a/vendor/github.com/PuerkitoBio/urlesc/urlesc.go b/vendor/github.com/PuerkitoBio/urlesc/urlesc.go deleted file mode 100644 index 1b8462459..000000000 --- a/vendor/github.com/PuerkitoBio/urlesc/urlesc.go +++ /dev/null @@ -1,180 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package urlesc implements query escaping as per RFC 3986. -// It contains some parts of the net/url package, modified so as to allow -// some reserved characters incorrectly escaped by net/url. -// See https://github.com/golang/go/issues/5684 -package urlesc - -import ( - "bytes" - "net/url" - "strings" -) - -type encoding int - -const ( - encodePath encoding = 1 + iota - encodeUserPassword - encodeQueryComponent - encodeFragment -) - -// Return true if the specified character should be escaped when -// appearing in a URL string, according to RFC 3986. -func shouldEscape(c byte, mode encoding) bool { - // §2.3 Unreserved characters (alphanum) - if 'A' <= c && c <= 'Z' || 'a' <= c && c <= 'z' || '0' <= c && c <= '9' { - return false - } - - switch c { - case '-', '.', '_', '~': // §2.3 Unreserved characters (mark) - return false - - // §2.2 Reserved characters (reserved) - case ':', '/', '?', '#', '[', ']', '@', // gen-delims - '!', '$', '&', '\'', '(', ')', '*', '+', ',', ';', '=': // sub-delims - // Different sections of the URL allow a few of - // the reserved characters to appear unescaped. - switch mode { - case encodePath: // §3.3 - // The RFC allows sub-delims and : @. - // '/', '[' and ']' can be used to assign meaning to individual path - // segments. This package only manipulates the path as a whole, - // so we allow those as well. That leaves only ? and # to escape. - return c == '?' || c == '#' - - case encodeUserPassword: // §3.2.1 - // The RFC allows : and sub-delims in - // userinfo. The parsing of userinfo treats ':' as special so we must escape - // all the gen-delims. - return c == ':' || c == '/' || c == '?' || c == '#' || c == '[' || c == ']' || c == '@' - - case encodeQueryComponent: // §3.4 - // The RFC allows / and ?. - return c != '/' && c != '?' - - case encodeFragment: // §4.1 - // The RFC text is silent but the grammar allows - // everything, so escape nothing but # - return c == '#' - } - } - - // Everything else must be escaped. - return true -} - -// QueryEscape escapes the string so it can be safely placed -// inside a URL query. -func QueryEscape(s string) string { - return escape(s, encodeQueryComponent) -} - -func escape(s string, mode encoding) string { - spaceCount, hexCount := 0, 0 - for i := 0; i < len(s); i++ { - c := s[i] - if shouldEscape(c, mode) { - if c == ' ' && mode == encodeQueryComponent { - spaceCount++ - } else { - hexCount++ - } - } - } - - if spaceCount == 0 && hexCount == 0 { - return s - } - - t := make([]byte, len(s)+2*hexCount) - j := 0 - for i := 0; i < len(s); i++ { - switch c := s[i]; { - case c == ' ' && mode == encodeQueryComponent: - t[j] = '+' - j++ - case shouldEscape(c, mode): - t[j] = '%' - t[j+1] = "0123456789ABCDEF"[c>>4] - t[j+2] = "0123456789ABCDEF"[c&15] - j += 3 - default: - t[j] = s[i] - j++ - } - } - return string(t) -} - -var uiReplacer = strings.NewReplacer( - "%21", "!", - "%27", "'", - "%28", "(", - "%29", ")", - "%2A", "*", -) - -// unescapeUserinfo unescapes some characters that need not to be escaped as per RFC3986. -func unescapeUserinfo(s string) string { - return uiReplacer.Replace(s) -} - -// Escape reassembles the URL into a valid URL string. -// The general form of the result is one of: -// -// scheme:opaque -// scheme://userinfo@host/path?query#fragment -// -// If u.Opaque is non-empty, String uses the first form; -// otherwise it uses the second form. -// -// In the second form, the following rules apply: -// - if u.Scheme is empty, scheme: is omitted. -// - if u.User is nil, userinfo@ is omitted. -// - if u.Host is empty, host/ is omitted. -// - if u.Scheme and u.Host are empty and u.User is nil, -// the entire scheme://userinfo@host/ is omitted. -// - if u.Host is non-empty and u.Path begins with a /, -// the form host/path does not add its own /. -// - if u.RawQuery is empty, ?query is omitted. -// - if u.Fragment is empty, #fragment is omitted. -func Escape(u *url.URL) string { - var buf bytes.Buffer - if u.Scheme != "" { - buf.WriteString(u.Scheme) - buf.WriteByte(':') - } - if u.Opaque != "" { - buf.WriteString(u.Opaque) - } else { - if u.Scheme != "" || u.Host != "" || u.User != nil { - buf.WriteString("//") - if ui := u.User; ui != nil { - buf.WriteString(unescapeUserinfo(ui.String())) - buf.WriteByte('@') - } - if h := u.Host; h != "" { - buf.WriteString(h) - } - } - if u.Path != "" && u.Path[0] != '/' && u.Host != "" { - buf.WriteByte('/') - } - buf.WriteString(escape(u.Path, encodePath)) - } - if u.RawQuery != "" { - buf.WriteByte('?') - buf.WriteString(u.RawQuery) - } - if u.Fragment != "" { - buf.WriteByte('#') - buf.WriteString(escape(u.Fragment, encodeFragment)) - } - return buf.String() -} diff --git a/vendor/github.com/davecgh/go-spew/LICENSE b/vendor/github.com/davecgh/go-spew/LICENSE deleted file mode 100644 index bc52e96f2..000000000 --- a/vendor/github.com/davecgh/go-spew/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -ISC License - -Copyright (c) 2012-2016 Dave Collins - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/vendor/github.com/davecgh/go-spew/spew/bypass.go b/vendor/github.com/davecgh/go-spew/spew/bypass.go deleted file mode 100644 index 792994785..000000000 --- a/vendor/github.com/davecgh/go-spew/spew/bypass.go +++ /dev/null @@ -1,145 +0,0 @@ -// Copyright (c) 2015-2016 Dave Collins -// -// Permission to use, copy, modify, and distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -// NOTE: Due to the following build constraints, this file will only be compiled -// when the code is not running on Google App Engine, compiled by GopherJS, and -// "-tags safe" is not added to the go build command line. The "disableunsafe" -// tag is deprecated and thus should not be used. -// Go versions prior to 1.4 are disabled because they use a different layout -// for interfaces which make the implementation of unsafeReflectValue more complex. -// +build !js,!appengine,!safe,!disableunsafe,go1.4 - -package spew - -import ( - "reflect" - "unsafe" -) - -const ( - // UnsafeDisabled is a build-time constant which specifies whether or - // not access to the unsafe package is available. - UnsafeDisabled = false - - // ptrSize is the size of a pointer on the current arch. - ptrSize = unsafe.Sizeof((*byte)(nil)) -) - -type flag uintptr - -var ( - // flagRO indicates whether the value field of a reflect.Value - // is read-only. - flagRO flag - - // flagAddr indicates whether the address of the reflect.Value's - // value may be taken. - flagAddr flag -) - -// flagKindMask holds the bits that make up the kind -// part of the flags field. In all the supported versions, -// it is in the lower 5 bits. -const flagKindMask = flag(0x1f) - -// Different versions of Go have used different -// bit layouts for the flags type. This table -// records the known combinations. -var okFlags = []struct { - ro, addr flag -}{{ - // From Go 1.4 to 1.5 - ro: 1 << 5, - addr: 1 << 7, -}, { - // Up to Go tip. - ro: 1<<5 | 1<<6, - addr: 1 << 8, -}} - -var flagValOffset = func() uintptr { - field, ok := reflect.TypeOf(reflect.Value{}).FieldByName("flag") - if !ok { - panic("reflect.Value has no flag field") - } - return field.Offset -}() - -// flagField returns a pointer to the flag field of a reflect.Value. -func flagField(v *reflect.Value) *flag { - return (*flag)(unsafe.Pointer(uintptr(unsafe.Pointer(v)) + flagValOffset)) -} - -// unsafeReflectValue converts the passed reflect.Value into a one that bypasses -// the typical safety restrictions preventing access to unaddressable and -// unexported data. It works by digging the raw pointer to the underlying -// value out of the protected value and generating a new unprotected (unsafe) -// reflect.Value to it. -// -// This allows us to check for implementations of the Stringer and error -// interfaces to be used for pretty printing ordinarily unaddressable and -// inaccessible values such as unexported struct fields. -func unsafeReflectValue(v reflect.Value) reflect.Value { - if !v.IsValid() || (v.CanInterface() && v.CanAddr()) { - return v - } - flagFieldPtr := flagField(&v) - *flagFieldPtr &^= flagRO - *flagFieldPtr |= flagAddr - return v -} - -// Sanity checks against future reflect package changes -// to the type or semantics of the Value.flag field. -func init() { - field, ok := reflect.TypeOf(reflect.Value{}).FieldByName("flag") - if !ok { - panic("reflect.Value has no flag field") - } - if field.Type.Kind() != reflect.TypeOf(flag(0)).Kind() { - panic("reflect.Value flag field has changed kind") - } - type t0 int - var t struct { - A t0 - // t0 will have flagEmbedRO set. - t0 - // a will have flagStickyRO set - a t0 - } - vA := reflect.ValueOf(t).FieldByName("A") - va := reflect.ValueOf(t).FieldByName("a") - vt0 := reflect.ValueOf(t).FieldByName("t0") - - // Infer flagRO from the difference between the flags - // for the (otherwise identical) fields in t. - flagPublic := *flagField(&vA) - flagWithRO := *flagField(&va) | *flagField(&vt0) - flagRO = flagPublic ^ flagWithRO - - // Infer flagAddr from the difference between a value - // taken from a pointer and not. - vPtrA := reflect.ValueOf(&t).Elem().FieldByName("A") - flagNoPtr := *flagField(&vA) - flagPtr := *flagField(&vPtrA) - flagAddr = flagNoPtr ^ flagPtr - - // Check that the inferred flags tally with one of the known versions. - for _, f := range okFlags { - if flagRO == f.ro && flagAddr == f.addr { - return - } - } - panic("reflect.Value read-only flag has changed semantics") -} diff --git a/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go b/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go deleted file mode 100644 index 205c28d68..000000000 --- a/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) 2015-2016 Dave Collins -// -// Permission to use, copy, modify, and distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -// NOTE: Due to the following build constraints, this file will only be compiled -// when the code is running on Google App Engine, compiled by GopherJS, or -// "-tags safe" is added to the go build command line. The "disableunsafe" -// tag is deprecated and thus should not be used. -// +build js appengine safe disableunsafe !go1.4 - -package spew - -import "reflect" - -const ( - // UnsafeDisabled is a build-time constant which specifies whether or - // not access to the unsafe package is available. - UnsafeDisabled = true -) - -// unsafeReflectValue typically converts the passed reflect.Value into a one -// that bypasses the typical safety restrictions preventing access to -// unaddressable and unexported data. However, doing this relies on access to -// the unsafe package. This is a stub version which simply returns the passed -// reflect.Value when the unsafe package is not available. -func unsafeReflectValue(v reflect.Value) reflect.Value { - return v -} diff --git a/vendor/github.com/davecgh/go-spew/spew/common.go b/vendor/github.com/davecgh/go-spew/spew/common.go deleted file mode 100644 index 1be8ce945..000000000 --- a/vendor/github.com/davecgh/go-spew/spew/common.go +++ /dev/null @@ -1,341 +0,0 @@ -/* - * Copyright (c) 2013-2016 Dave Collins - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -package spew - -import ( - "bytes" - "fmt" - "io" - "reflect" - "sort" - "strconv" -) - -// Some constants in the form of bytes to avoid string overhead. This mirrors -// the technique used in the fmt package. -var ( - panicBytes = []byte("(PANIC=") - plusBytes = []byte("+") - iBytes = []byte("i") - trueBytes = []byte("true") - falseBytes = []byte("false") - interfaceBytes = []byte("(interface {})") - commaNewlineBytes = []byte(",\n") - newlineBytes = []byte("\n") - openBraceBytes = []byte("{") - openBraceNewlineBytes = []byte("{\n") - closeBraceBytes = []byte("}") - asteriskBytes = []byte("*") - colonBytes = []byte(":") - colonSpaceBytes = []byte(": ") - openParenBytes = []byte("(") - closeParenBytes = []byte(")") - spaceBytes = []byte(" ") - pointerChainBytes = []byte("->") - nilAngleBytes = []byte("") - maxNewlineBytes = []byte("\n") - maxShortBytes = []byte("") - circularBytes = []byte("") - circularShortBytes = []byte("") - invalidAngleBytes = []byte("") - openBracketBytes = []byte("[") - closeBracketBytes = []byte("]") - percentBytes = []byte("%") - precisionBytes = []byte(".") - openAngleBytes = []byte("<") - closeAngleBytes = []byte(">") - openMapBytes = []byte("map[") - closeMapBytes = []byte("]") - lenEqualsBytes = []byte("len=") - capEqualsBytes = []byte("cap=") -) - -// hexDigits is used to map a decimal value to a hex digit. -var hexDigits = "0123456789abcdef" - -// catchPanic handles any panics that might occur during the handleMethods -// calls. -func catchPanic(w io.Writer, v reflect.Value) { - if err := recover(); err != nil { - w.Write(panicBytes) - fmt.Fprintf(w, "%v", err) - w.Write(closeParenBytes) - } -} - -// handleMethods attempts to call the Error and String methods on the underlying -// type the passed reflect.Value represents and outputes the result to Writer w. -// -// It handles panics in any called methods by catching and displaying the error -// as the formatted value. -func handleMethods(cs *ConfigState, w io.Writer, v reflect.Value) (handled bool) { - // We need an interface to check if the type implements the error or - // Stringer interface. However, the reflect package won't give us an - // interface on certain things like unexported struct fields in order - // to enforce visibility rules. We use unsafe, when it's available, - // to bypass these restrictions since this package does not mutate the - // values. - if !v.CanInterface() { - if UnsafeDisabled { - return false - } - - v = unsafeReflectValue(v) - } - - // Choose whether or not to do error and Stringer interface lookups against - // the base type or a pointer to the base type depending on settings. - // Technically calling one of these methods with a pointer receiver can - // mutate the value, however, types which choose to satisify an error or - // Stringer interface with a pointer receiver should not be mutating their - // state inside these interface methods. - if !cs.DisablePointerMethods && !UnsafeDisabled && !v.CanAddr() { - v = unsafeReflectValue(v) - } - if v.CanAddr() { - v = v.Addr() - } - - // Is it an error or Stringer? - switch iface := v.Interface().(type) { - case error: - defer catchPanic(w, v) - if cs.ContinueOnMethod { - w.Write(openParenBytes) - w.Write([]byte(iface.Error())) - w.Write(closeParenBytes) - w.Write(spaceBytes) - return false - } - - w.Write([]byte(iface.Error())) - return true - - case fmt.Stringer: - defer catchPanic(w, v) - if cs.ContinueOnMethod { - w.Write(openParenBytes) - w.Write([]byte(iface.String())) - w.Write(closeParenBytes) - w.Write(spaceBytes) - return false - } - w.Write([]byte(iface.String())) - return true - } - return false -} - -// printBool outputs a boolean value as true or false to Writer w. -func printBool(w io.Writer, val bool) { - if val { - w.Write(trueBytes) - } else { - w.Write(falseBytes) - } -} - -// printInt outputs a signed integer value to Writer w. -func printInt(w io.Writer, val int64, base int) { - w.Write([]byte(strconv.FormatInt(val, base))) -} - -// printUint outputs an unsigned integer value to Writer w. -func printUint(w io.Writer, val uint64, base int) { - w.Write([]byte(strconv.FormatUint(val, base))) -} - -// printFloat outputs a floating point value using the specified precision, -// which is expected to be 32 or 64bit, to Writer w. -func printFloat(w io.Writer, val float64, precision int) { - w.Write([]byte(strconv.FormatFloat(val, 'g', -1, precision))) -} - -// printComplex outputs a complex value using the specified float precision -// for the real and imaginary parts to Writer w. -func printComplex(w io.Writer, c complex128, floatPrecision int) { - r := real(c) - w.Write(openParenBytes) - w.Write([]byte(strconv.FormatFloat(r, 'g', -1, floatPrecision))) - i := imag(c) - if i >= 0 { - w.Write(plusBytes) - } - w.Write([]byte(strconv.FormatFloat(i, 'g', -1, floatPrecision))) - w.Write(iBytes) - w.Write(closeParenBytes) -} - -// printHexPtr outputs a uintptr formatted as hexadecimal with a leading '0x' -// prefix to Writer w. -func printHexPtr(w io.Writer, p uintptr) { - // Null pointer. - num := uint64(p) - if num == 0 { - w.Write(nilAngleBytes) - return - } - - // Max uint64 is 16 bytes in hex + 2 bytes for '0x' prefix - buf := make([]byte, 18) - - // It's simpler to construct the hex string right to left. - base := uint64(16) - i := len(buf) - 1 - for num >= base { - buf[i] = hexDigits[num%base] - num /= base - i-- - } - buf[i] = hexDigits[num] - - // Add '0x' prefix. - i-- - buf[i] = 'x' - i-- - buf[i] = '0' - - // Strip unused leading bytes. - buf = buf[i:] - w.Write(buf) -} - -// valuesSorter implements sort.Interface to allow a slice of reflect.Value -// elements to be sorted. -type valuesSorter struct { - values []reflect.Value - strings []string // either nil or same len and values - cs *ConfigState -} - -// newValuesSorter initializes a valuesSorter instance, which holds a set of -// surrogate keys on which the data should be sorted. It uses flags in -// ConfigState to decide if and how to populate those surrogate keys. -func newValuesSorter(values []reflect.Value, cs *ConfigState) sort.Interface { - vs := &valuesSorter{values: values, cs: cs} - if canSortSimply(vs.values[0].Kind()) { - return vs - } - if !cs.DisableMethods { - vs.strings = make([]string, len(values)) - for i := range vs.values { - b := bytes.Buffer{} - if !handleMethods(cs, &b, vs.values[i]) { - vs.strings = nil - break - } - vs.strings[i] = b.String() - } - } - if vs.strings == nil && cs.SpewKeys { - vs.strings = make([]string, len(values)) - for i := range vs.values { - vs.strings[i] = Sprintf("%#v", vs.values[i].Interface()) - } - } - return vs -} - -// canSortSimply tests whether a reflect.Kind is a primitive that can be sorted -// directly, or whether it should be considered for sorting by surrogate keys -// (if the ConfigState allows it). -func canSortSimply(kind reflect.Kind) bool { - // This switch parallels valueSortLess, except for the default case. - switch kind { - case reflect.Bool: - return true - case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int: - return true - case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint: - return true - case reflect.Float32, reflect.Float64: - return true - case reflect.String: - return true - case reflect.Uintptr: - return true - case reflect.Array: - return true - } - return false -} - -// Len returns the number of values in the slice. It is part of the -// sort.Interface implementation. -func (s *valuesSorter) Len() int { - return len(s.values) -} - -// Swap swaps the values at the passed indices. It is part of the -// sort.Interface implementation. -func (s *valuesSorter) Swap(i, j int) { - s.values[i], s.values[j] = s.values[j], s.values[i] - if s.strings != nil { - s.strings[i], s.strings[j] = s.strings[j], s.strings[i] - } -} - -// valueSortLess returns whether the first value should sort before the second -// value. It is used by valueSorter.Less as part of the sort.Interface -// implementation. -func valueSortLess(a, b reflect.Value) bool { - switch a.Kind() { - case reflect.Bool: - return !a.Bool() && b.Bool() - case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int: - return a.Int() < b.Int() - case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint: - return a.Uint() < b.Uint() - case reflect.Float32, reflect.Float64: - return a.Float() < b.Float() - case reflect.String: - return a.String() < b.String() - case reflect.Uintptr: - return a.Uint() < b.Uint() - case reflect.Array: - // Compare the contents of both arrays. - l := a.Len() - for i := 0; i < l; i++ { - av := a.Index(i) - bv := b.Index(i) - if av.Interface() == bv.Interface() { - continue - } - return valueSortLess(av, bv) - } - } - return a.String() < b.String() -} - -// Less returns whether the value at index i should sort before the -// value at index j. It is part of the sort.Interface implementation. -func (s *valuesSorter) Less(i, j int) bool { - if s.strings == nil { - return valueSortLess(s.values[i], s.values[j]) - } - return s.strings[i] < s.strings[j] -} - -// sortValues is a sort function that handles both native types and any type that -// can be converted to error or Stringer. Other inputs are sorted according to -// their Value.String() value to ensure display stability. -func sortValues(values []reflect.Value, cs *ConfigState) { - if len(values) == 0 { - return - } - sort.Sort(newValuesSorter(values, cs)) -} diff --git a/vendor/github.com/davecgh/go-spew/spew/config.go b/vendor/github.com/davecgh/go-spew/spew/config.go deleted file mode 100644 index 2e3d22f31..000000000 --- a/vendor/github.com/davecgh/go-spew/spew/config.go +++ /dev/null @@ -1,306 +0,0 @@ -/* - * Copyright (c) 2013-2016 Dave Collins - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -package spew - -import ( - "bytes" - "fmt" - "io" - "os" -) - -// ConfigState houses the configuration options used by spew to format and -// display values. There is a global instance, Config, that is used to control -// all top-level Formatter and Dump functionality. Each ConfigState instance -// provides methods equivalent to the top-level functions. -// -// The zero value for ConfigState provides no indentation. You would typically -// want to set it to a space or a tab. -// -// Alternatively, you can use NewDefaultConfig to get a ConfigState instance -// with default settings. See the documentation of NewDefaultConfig for default -// values. -type ConfigState struct { - // Indent specifies the string to use for each indentation level. The - // global config instance that all top-level functions use set this to a - // single space by default. If you would like more indentation, you might - // set this to a tab with "\t" or perhaps two spaces with " ". - Indent string - - // MaxDepth controls the maximum number of levels to descend into nested - // data structures. The default, 0, means there is no limit. - // - // NOTE: Circular data structures are properly detected, so it is not - // necessary to set this value unless you specifically want to limit deeply - // nested data structures. - MaxDepth int - - // DisableMethods specifies whether or not error and Stringer interfaces are - // invoked for types that implement them. - DisableMethods bool - - // DisablePointerMethods specifies whether or not to check for and invoke - // error and Stringer interfaces on types which only accept a pointer - // receiver when the current type is not a pointer. - // - // NOTE: This might be an unsafe action since calling one of these methods - // with a pointer receiver could technically mutate the value, however, - // in practice, types which choose to satisify an error or Stringer - // interface with a pointer receiver should not be mutating their state - // inside these interface methods. As a result, this option relies on - // access to the unsafe package, so it will not have any effect when - // running in environments without access to the unsafe package such as - // Google App Engine or with the "safe" build tag specified. - DisablePointerMethods bool - - // DisablePointerAddresses specifies whether to disable the printing of - // pointer addresses. This is useful when diffing data structures in tests. - DisablePointerAddresses bool - - // DisableCapacities specifies whether to disable the printing of capacities - // for arrays, slices, maps and channels. This is useful when diffing - // data structures in tests. - DisableCapacities bool - - // ContinueOnMethod specifies whether or not recursion should continue once - // a custom error or Stringer interface is invoked. The default, false, - // means it will print the results of invoking the custom error or Stringer - // interface and return immediately instead of continuing to recurse into - // the internals of the data type. - // - // NOTE: This flag does not have any effect if method invocation is disabled - // via the DisableMethods or DisablePointerMethods options. - ContinueOnMethod bool - - // SortKeys specifies map keys should be sorted before being printed. Use - // this to have a more deterministic, diffable output. Note that only - // native types (bool, int, uint, floats, uintptr and string) and types - // that support the error or Stringer interfaces (if methods are - // enabled) are supported, with other types sorted according to the - // reflect.Value.String() output which guarantees display stability. - SortKeys bool - - // SpewKeys specifies that, as a last resort attempt, map keys should - // be spewed to strings and sorted by those strings. This is only - // considered if SortKeys is true. - SpewKeys bool -} - -// Config is the active configuration of the top-level functions. -// The configuration can be changed by modifying the contents of spew.Config. -var Config = ConfigState{Indent: " "} - -// Errorf is a wrapper for fmt.Errorf that treats each argument as if it were -// passed with a Formatter interface returned by c.NewFormatter. It returns -// the formatted string as a value that satisfies error. See NewFormatter -// for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Errorf(format, c.NewFormatter(a), c.NewFormatter(b)) -func (c *ConfigState) Errorf(format string, a ...interface{}) (err error) { - return fmt.Errorf(format, c.convertArgs(a)...) -} - -// Fprint is a wrapper for fmt.Fprint that treats each argument as if it were -// passed with a Formatter interface returned by c.NewFormatter. It returns -// the number of bytes written and any write error encountered. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Fprint(w, c.NewFormatter(a), c.NewFormatter(b)) -func (c *ConfigState) Fprint(w io.Writer, a ...interface{}) (n int, err error) { - return fmt.Fprint(w, c.convertArgs(a)...) -} - -// Fprintf is a wrapper for fmt.Fprintf that treats each argument as if it were -// passed with a Formatter interface returned by c.NewFormatter. It returns -// the number of bytes written and any write error encountered. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Fprintf(w, format, c.NewFormatter(a), c.NewFormatter(b)) -func (c *ConfigState) Fprintf(w io.Writer, format string, a ...interface{}) (n int, err error) { - return fmt.Fprintf(w, format, c.convertArgs(a)...) -} - -// Fprintln is a wrapper for fmt.Fprintln that treats each argument as if it -// passed with a Formatter interface returned by c.NewFormatter. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Fprintln(w, c.NewFormatter(a), c.NewFormatter(b)) -func (c *ConfigState) Fprintln(w io.Writer, a ...interface{}) (n int, err error) { - return fmt.Fprintln(w, c.convertArgs(a)...) -} - -// Print is a wrapper for fmt.Print that treats each argument as if it were -// passed with a Formatter interface returned by c.NewFormatter. It returns -// the number of bytes written and any write error encountered. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Print(c.NewFormatter(a), c.NewFormatter(b)) -func (c *ConfigState) Print(a ...interface{}) (n int, err error) { - return fmt.Print(c.convertArgs(a)...) -} - -// Printf is a wrapper for fmt.Printf that treats each argument as if it were -// passed with a Formatter interface returned by c.NewFormatter. It returns -// the number of bytes written and any write error encountered. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Printf(format, c.NewFormatter(a), c.NewFormatter(b)) -func (c *ConfigState) Printf(format string, a ...interface{}) (n int, err error) { - return fmt.Printf(format, c.convertArgs(a)...) -} - -// Println is a wrapper for fmt.Println that treats each argument as if it were -// passed with a Formatter interface returned by c.NewFormatter. It returns -// the number of bytes written and any write error encountered. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Println(c.NewFormatter(a), c.NewFormatter(b)) -func (c *ConfigState) Println(a ...interface{}) (n int, err error) { - return fmt.Println(c.convertArgs(a)...) -} - -// Sprint is a wrapper for fmt.Sprint that treats each argument as if it were -// passed with a Formatter interface returned by c.NewFormatter. It returns -// the resulting string. See NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Sprint(c.NewFormatter(a), c.NewFormatter(b)) -func (c *ConfigState) Sprint(a ...interface{}) string { - return fmt.Sprint(c.convertArgs(a)...) -} - -// Sprintf is a wrapper for fmt.Sprintf that treats each argument as if it were -// passed with a Formatter interface returned by c.NewFormatter. It returns -// the resulting string. See NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Sprintf(format, c.NewFormatter(a), c.NewFormatter(b)) -func (c *ConfigState) Sprintf(format string, a ...interface{}) string { - return fmt.Sprintf(format, c.convertArgs(a)...) -} - -// Sprintln is a wrapper for fmt.Sprintln that treats each argument as if it -// were passed with a Formatter interface returned by c.NewFormatter. It -// returns the resulting string. See NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Sprintln(c.NewFormatter(a), c.NewFormatter(b)) -func (c *ConfigState) Sprintln(a ...interface{}) string { - return fmt.Sprintln(c.convertArgs(a)...) -} - -/* -NewFormatter returns a custom formatter that satisfies the fmt.Formatter -interface. As a result, it integrates cleanly with standard fmt package -printing functions. The formatter is useful for inline printing of smaller data -types similar to the standard %v format specifier. - -The custom formatter only responds to the %v (most compact), %+v (adds pointer -addresses), %#v (adds types), and %#+v (adds types and pointer addresses) verb -combinations. Any other verbs such as %x and %q will be sent to the the -standard fmt package for formatting. In addition, the custom formatter ignores -the width and precision arguments (however they will still work on the format -specifiers not handled by the custom formatter). - -Typically this function shouldn't be called directly. It is much easier to make -use of the custom formatter by calling one of the convenience functions such as -c.Printf, c.Println, or c.Printf. -*/ -func (c *ConfigState) NewFormatter(v interface{}) fmt.Formatter { - return newFormatter(c, v) -} - -// Fdump formats and displays the passed arguments to io.Writer w. It formats -// exactly the same as Dump. -func (c *ConfigState) Fdump(w io.Writer, a ...interface{}) { - fdump(c, w, a...) -} - -/* -Dump displays the passed parameters to standard out with newlines, customizable -indentation, and additional debug information such as complete types and all -pointer addresses used to indirect to the final value. It provides the -following features over the built-in printing facilities provided by the fmt -package: - - * Pointers are dereferenced and followed - * Circular data structures are detected and handled properly - * Custom Stringer/error interfaces are optionally invoked, including - on unexported types - * Custom types which only implement the Stringer/error interfaces via - a pointer receiver are optionally invoked when passing non-pointer - variables - * Byte arrays and slices are dumped like the hexdump -C command which - includes offsets, byte values in hex, and ASCII output - -The configuration options are controlled by modifying the public members -of c. See ConfigState for options documentation. - -See Fdump if you would prefer dumping to an arbitrary io.Writer or Sdump to -get the formatted result as a string. -*/ -func (c *ConfigState) Dump(a ...interface{}) { - fdump(c, os.Stdout, a...) -} - -// Sdump returns a string with the passed arguments formatted exactly the same -// as Dump. -func (c *ConfigState) Sdump(a ...interface{}) string { - var buf bytes.Buffer - fdump(c, &buf, a...) - return buf.String() -} - -// convertArgs accepts a slice of arguments and returns a slice of the same -// length with each argument converted to a spew Formatter interface using -// the ConfigState associated with s. -func (c *ConfigState) convertArgs(args []interface{}) (formatters []interface{}) { - formatters = make([]interface{}, len(args)) - for index, arg := range args { - formatters[index] = newFormatter(c, arg) - } - return formatters -} - -// NewDefaultConfig returns a ConfigState with the following default settings. -// -// Indent: " " -// MaxDepth: 0 -// DisableMethods: false -// DisablePointerMethods: false -// ContinueOnMethod: false -// SortKeys: false -func NewDefaultConfig() *ConfigState { - return &ConfigState{Indent: " "} -} diff --git a/vendor/github.com/davecgh/go-spew/spew/doc.go b/vendor/github.com/davecgh/go-spew/spew/doc.go deleted file mode 100644 index aacaac6f1..000000000 --- a/vendor/github.com/davecgh/go-spew/spew/doc.go +++ /dev/null @@ -1,211 +0,0 @@ -/* - * Copyright (c) 2013-2016 Dave Collins - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/* -Package spew implements a deep pretty printer for Go data structures to aid in -debugging. - -A quick overview of the additional features spew provides over the built-in -printing facilities for Go data types are as follows: - - * Pointers are dereferenced and followed - * Circular data structures are detected and handled properly - * Custom Stringer/error interfaces are optionally invoked, including - on unexported types - * Custom types which only implement the Stringer/error interfaces via - a pointer receiver are optionally invoked when passing non-pointer - variables - * Byte arrays and slices are dumped like the hexdump -C command which - includes offsets, byte values in hex, and ASCII output (only when using - Dump style) - -There are two different approaches spew allows for dumping Go data structures: - - * Dump style which prints with newlines, customizable indentation, - and additional debug information such as types and all pointer addresses - used to indirect to the final value - * A custom Formatter interface that integrates cleanly with the standard fmt - package and replaces %v, %+v, %#v, and %#+v to provide inline printing - similar to the default %v while providing the additional functionality - outlined above and passing unsupported format verbs such as %x and %q - along to fmt - -Quick Start - -This section demonstrates how to quickly get started with spew. See the -sections below for further details on formatting and configuration options. - -To dump a variable with full newlines, indentation, type, and pointer -information use Dump, Fdump, or Sdump: - spew.Dump(myVar1, myVar2, ...) - spew.Fdump(someWriter, myVar1, myVar2, ...) - str := spew.Sdump(myVar1, myVar2, ...) - -Alternatively, if you would prefer to use format strings with a compacted inline -printing style, use the convenience wrappers Printf, Fprintf, etc with -%v (most compact), %+v (adds pointer addresses), %#v (adds types), or -%#+v (adds types and pointer addresses): - spew.Printf("myVar1: %v -- myVar2: %+v", myVar1, myVar2) - spew.Printf("myVar3: %#v -- myVar4: %#+v", myVar3, myVar4) - spew.Fprintf(someWriter, "myVar1: %v -- myVar2: %+v", myVar1, myVar2) - spew.Fprintf(someWriter, "myVar3: %#v -- myVar4: %#+v", myVar3, myVar4) - -Configuration Options - -Configuration of spew is handled by fields in the ConfigState type. For -convenience, all of the top-level functions use a global state available -via the spew.Config global. - -It is also possible to create a ConfigState instance that provides methods -equivalent to the top-level functions. This allows concurrent configuration -options. See the ConfigState documentation for more details. - -The following configuration options are available: - * Indent - String to use for each indentation level for Dump functions. - It is a single space by default. A popular alternative is "\t". - - * MaxDepth - Maximum number of levels to descend into nested data structures. - There is no limit by default. - - * DisableMethods - Disables invocation of error and Stringer interface methods. - Method invocation is enabled by default. - - * DisablePointerMethods - Disables invocation of error and Stringer interface methods on types - which only accept pointer receivers from non-pointer variables. - Pointer method invocation is enabled by default. - - * DisablePointerAddresses - DisablePointerAddresses specifies whether to disable the printing of - pointer addresses. This is useful when diffing data structures in tests. - - * DisableCapacities - DisableCapacities specifies whether to disable the printing of - capacities for arrays, slices, maps and channels. This is useful when - diffing data structures in tests. - - * ContinueOnMethod - Enables recursion into types after invoking error and Stringer interface - methods. Recursion after method invocation is disabled by default. - - * SortKeys - Specifies map keys should be sorted before being printed. Use - this to have a more deterministic, diffable output. Note that - only native types (bool, int, uint, floats, uintptr and string) - and types which implement error or Stringer interfaces are - supported with other types sorted according to the - reflect.Value.String() output which guarantees display - stability. Natural map order is used by default. - - * SpewKeys - Specifies that, as a last resort attempt, map keys should be - spewed to strings and sorted by those strings. This is only - considered if SortKeys is true. - -Dump Usage - -Simply call spew.Dump with a list of variables you want to dump: - - spew.Dump(myVar1, myVar2, ...) - -You may also call spew.Fdump if you would prefer to output to an arbitrary -io.Writer. For example, to dump to standard error: - - spew.Fdump(os.Stderr, myVar1, myVar2, ...) - -A third option is to call spew.Sdump to get the formatted output as a string: - - str := spew.Sdump(myVar1, myVar2, ...) - -Sample Dump Output - -See the Dump example for details on the setup of the types and variables being -shown here. - - (main.Foo) { - unexportedField: (*main.Bar)(0xf84002e210)({ - flag: (main.Flag) flagTwo, - data: (uintptr) - }), - ExportedField: (map[interface {}]interface {}) (len=1) { - (string) (len=3) "one": (bool) true - } - } - -Byte (and uint8) arrays and slices are displayed uniquely like the hexdump -C -command as shown. - ([]uint8) (len=32 cap=32) { - 00000000 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 |............... | - 00000010 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 |!"#$%&'()*+,-./0| - 00000020 31 32 |12| - } - -Custom Formatter - -Spew provides a custom formatter that implements the fmt.Formatter interface -so that it integrates cleanly with standard fmt package printing functions. The -formatter is useful for inline printing of smaller data types similar to the -standard %v format specifier. - -The custom formatter only responds to the %v (most compact), %+v (adds pointer -addresses), %#v (adds types), or %#+v (adds types and pointer addresses) verb -combinations. Any other verbs such as %x and %q will be sent to the the -standard fmt package for formatting. In addition, the custom formatter ignores -the width and precision arguments (however they will still work on the format -specifiers not handled by the custom formatter). - -Custom Formatter Usage - -The simplest way to make use of the spew custom formatter is to call one of the -convenience functions such as spew.Printf, spew.Println, or spew.Printf. The -functions have syntax you are most likely already familiar with: - - spew.Printf("myVar1: %v -- myVar2: %+v", myVar1, myVar2) - spew.Printf("myVar3: %#v -- myVar4: %#+v", myVar3, myVar4) - spew.Println(myVar, myVar2) - spew.Fprintf(os.Stderr, "myVar1: %v -- myVar2: %+v", myVar1, myVar2) - spew.Fprintf(os.Stderr, "myVar3: %#v -- myVar4: %#+v", myVar3, myVar4) - -See the Index for the full list convenience functions. - -Sample Formatter Output - -Double pointer to a uint8: - %v: <**>5 - %+v: <**>(0xf8400420d0->0xf8400420c8)5 - %#v: (**uint8)5 - %#+v: (**uint8)(0xf8400420d0->0xf8400420c8)5 - -Pointer to circular struct with a uint8 field and a pointer to itself: - %v: <*>{1 <*>} - %+v: <*>(0xf84003e260){ui8:1 c:<*>(0xf84003e260)} - %#v: (*main.circular){ui8:(uint8)1 c:(*main.circular)} - %#+v: (*main.circular)(0xf84003e260){ui8:(uint8)1 c:(*main.circular)(0xf84003e260)} - -See the Printf example for details on the setup of variables being shown -here. - -Errors - -Since it is possible for custom Stringer/error interfaces to panic, spew -detects them and handles them internally by printing the panic information -inline with the output. Since spew is intended to provide deep pretty printing -capabilities on structures, it intentionally does not return any errors. -*/ -package spew diff --git a/vendor/github.com/davecgh/go-spew/spew/dump.go b/vendor/github.com/davecgh/go-spew/spew/dump.go deleted file mode 100644 index f78d89fc1..000000000 --- a/vendor/github.com/davecgh/go-spew/spew/dump.go +++ /dev/null @@ -1,509 +0,0 @@ -/* - * Copyright (c) 2013-2016 Dave Collins - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -package spew - -import ( - "bytes" - "encoding/hex" - "fmt" - "io" - "os" - "reflect" - "regexp" - "strconv" - "strings" -) - -var ( - // uint8Type is a reflect.Type representing a uint8. It is used to - // convert cgo types to uint8 slices for hexdumping. - uint8Type = reflect.TypeOf(uint8(0)) - - // cCharRE is a regular expression that matches a cgo char. - // It is used to detect character arrays to hexdump them. - cCharRE = regexp.MustCompile(`^.*\._Ctype_char$`) - - // cUnsignedCharRE is a regular expression that matches a cgo unsigned - // char. It is used to detect unsigned character arrays to hexdump - // them. - cUnsignedCharRE = regexp.MustCompile(`^.*\._Ctype_unsignedchar$`) - - // cUint8tCharRE is a regular expression that matches a cgo uint8_t. - // It is used to detect uint8_t arrays to hexdump them. - cUint8tCharRE = regexp.MustCompile(`^.*\._Ctype_uint8_t$`) -) - -// dumpState contains information about the state of a dump operation. -type dumpState struct { - w io.Writer - depth int - pointers map[uintptr]int - ignoreNextType bool - ignoreNextIndent bool - cs *ConfigState -} - -// indent performs indentation according to the depth level and cs.Indent -// option. -func (d *dumpState) indent() { - if d.ignoreNextIndent { - d.ignoreNextIndent = false - return - } - d.w.Write(bytes.Repeat([]byte(d.cs.Indent), d.depth)) -} - -// unpackValue returns values inside of non-nil interfaces when possible. -// This is useful for data types like structs, arrays, slices, and maps which -// can contain varying types packed inside an interface. -func (d *dumpState) unpackValue(v reflect.Value) reflect.Value { - if v.Kind() == reflect.Interface && !v.IsNil() { - v = v.Elem() - } - return v -} - -// dumpPtr handles formatting of pointers by indirecting them as necessary. -func (d *dumpState) dumpPtr(v reflect.Value) { - // Remove pointers at or below the current depth from map used to detect - // circular refs. - for k, depth := range d.pointers { - if depth >= d.depth { - delete(d.pointers, k) - } - } - - // Keep list of all dereferenced pointers to show later. - pointerChain := make([]uintptr, 0) - - // Figure out how many levels of indirection there are by dereferencing - // pointers and unpacking interfaces down the chain while detecting circular - // references. - nilFound := false - cycleFound := false - indirects := 0 - ve := v - for ve.Kind() == reflect.Ptr { - if ve.IsNil() { - nilFound = true - break - } - indirects++ - addr := ve.Pointer() - pointerChain = append(pointerChain, addr) - if pd, ok := d.pointers[addr]; ok && pd < d.depth { - cycleFound = true - indirects-- - break - } - d.pointers[addr] = d.depth - - ve = ve.Elem() - if ve.Kind() == reflect.Interface { - if ve.IsNil() { - nilFound = true - break - } - ve = ve.Elem() - } - } - - // Display type information. - d.w.Write(openParenBytes) - d.w.Write(bytes.Repeat(asteriskBytes, indirects)) - d.w.Write([]byte(ve.Type().String())) - d.w.Write(closeParenBytes) - - // Display pointer information. - if !d.cs.DisablePointerAddresses && len(pointerChain) > 0 { - d.w.Write(openParenBytes) - for i, addr := range pointerChain { - if i > 0 { - d.w.Write(pointerChainBytes) - } - printHexPtr(d.w, addr) - } - d.w.Write(closeParenBytes) - } - - // Display dereferenced value. - d.w.Write(openParenBytes) - switch { - case nilFound: - d.w.Write(nilAngleBytes) - - case cycleFound: - d.w.Write(circularBytes) - - default: - d.ignoreNextType = true - d.dump(ve) - } - d.w.Write(closeParenBytes) -} - -// dumpSlice handles formatting of arrays and slices. Byte (uint8 under -// reflection) arrays and slices are dumped in hexdump -C fashion. -func (d *dumpState) dumpSlice(v reflect.Value) { - // Determine whether this type should be hex dumped or not. Also, - // for types which should be hexdumped, try to use the underlying data - // first, then fall back to trying to convert them to a uint8 slice. - var buf []uint8 - doConvert := false - doHexDump := false - numEntries := v.Len() - if numEntries > 0 { - vt := v.Index(0).Type() - vts := vt.String() - switch { - // C types that need to be converted. - case cCharRE.MatchString(vts): - fallthrough - case cUnsignedCharRE.MatchString(vts): - fallthrough - case cUint8tCharRE.MatchString(vts): - doConvert = true - - // Try to use existing uint8 slices and fall back to converting - // and copying if that fails. - case vt.Kind() == reflect.Uint8: - // We need an addressable interface to convert the type - // to a byte slice. However, the reflect package won't - // give us an interface on certain things like - // unexported struct fields in order to enforce - // visibility rules. We use unsafe, when available, to - // bypass these restrictions since this package does not - // mutate the values. - vs := v - if !vs.CanInterface() || !vs.CanAddr() { - vs = unsafeReflectValue(vs) - } - if !UnsafeDisabled { - vs = vs.Slice(0, numEntries) - - // Use the existing uint8 slice if it can be - // type asserted. - iface := vs.Interface() - if slice, ok := iface.([]uint8); ok { - buf = slice - doHexDump = true - break - } - } - - // The underlying data needs to be converted if it can't - // be type asserted to a uint8 slice. - doConvert = true - } - - // Copy and convert the underlying type if needed. - if doConvert && vt.ConvertibleTo(uint8Type) { - // Convert and copy each element into a uint8 byte - // slice. - buf = make([]uint8, numEntries) - for i := 0; i < numEntries; i++ { - vv := v.Index(i) - buf[i] = uint8(vv.Convert(uint8Type).Uint()) - } - doHexDump = true - } - } - - // Hexdump the entire slice as needed. - if doHexDump { - indent := strings.Repeat(d.cs.Indent, d.depth) - str := indent + hex.Dump(buf) - str = strings.Replace(str, "\n", "\n"+indent, -1) - str = strings.TrimRight(str, d.cs.Indent) - d.w.Write([]byte(str)) - return - } - - // Recursively call dump for each item. - for i := 0; i < numEntries; i++ { - d.dump(d.unpackValue(v.Index(i))) - if i < (numEntries - 1) { - d.w.Write(commaNewlineBytes) - } else { - d.w.Write(newlineBytes) - } - } -} - -// dump is the main workhorse for dumping a value. It uses the passed reflect -// value to figure out what kind of object we are dealing with and formats it -// appropriately. It is a recursive function, however circular data structures -// are detected and handled properly. -func (d *dumpState) dump(v reflect.Value) { - // Handle invalid reflect values immediately. - kind := v.Kind() - if kind == reflect.Invalid { - d.w.Write(invalidAngleBytes) - return - } - - // Handle pointers specially. - if kind == reflect.Ptr { - d.indent() - d.dumpPtr(v) - return - } - - // Print type information unless already handled elsewhere. - if !d.ignoreNextType { - d.indent() - d.w.Write(openParenBytes) - d.w.Write([]byte(v.Type().String())) - d.w.Write(closeParenBytes) - d.w.Write(spaceBytes) - } - d.ignoreNextType = false - - // Display length and capacity if the built-in len and cap functions - // work with the value's kind and the len/cap itself is non-zero. - valueLen, valueCap := 0, 0 - switch v.Kind() { - case reflect.Array, reflect.Slice, reflect.Chan: - valueLen, valueCap = v.Len(), v.Cap() - case reflect.Map, reflect.String: - valueLen = v.Len() - } - if valueLen != 0 || !d.cs.DisableCapacities && valueCap != 0 { - d.w.Write(openParenBytes) - if valueLen != 0 { - d.w.Write(lenEqualsBytes) - printInt(d.w, int64(valueLen), 10) - } - if !d.cs.DisableCapacities && valueCap != 0 { - if valueLen != 0 { - d.w.Write(spaceBytes) - } - d.w.Write(capEqualsBytes) - printInt(d.w, int64(valueCap), 10) - } - d.w.Write(closeParenBytes) - d.w.Write(spaceBytes) - } - - // Call Stringer/error interfaces if they exist and the handle methods flag - // is enabled - if !d.cs.DisableMethods { - if (kind != reflect.Invalid) && (kind != reflect.Interface) { - if handled := handleMethods(d.cs, d.w, v); handled { - return - } - } - } - - switch kind { - case reflect.Invalid: - // Do nothing. We should never get here since invalid has already - // been handled above. - - case reflect.Bool: - printBool(d.w, v.Bool()) - - case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int: - printInt(d.w, v.Int(), 10) - - case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint: - printUint(d.w, v.Uint(), 10) - - case reflect.Float32: - printFloat(d.w, v.Float(), 32) - - case reflect.Float64: - printFloat(d.w, v.Float(), 64) - - case reflect.Complex64: - printComplex(d.w, v.Complex(), 32) - - case reflect.Complex128: - printComplex(d.w, v.Complex(), 64) - - case reflect.Slice: - if v.IsNil() { - d.w.Write(nilAngleBytes) - break - } - fallthrough - - case reflect.Array: - d.w.Write(openBraceNewlineBytes) - d.depth++ - if (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) { - d.indent() - d.w.Write(maxNewlineBytes) - } else { - d.dumpSlice(v) - } - d.depth-- - d.indent() - d.w.Write(closeBraceBytes) - - case reflect.String: - d.w.Write([]byte(strconv.Quote(v.String()))) - - case reflect.Interface: - // The only time we should get here is for nil interfaces due to - // unpackValue calls. - if v.IsNil() { - d.w.Write(nilAngleBytes) - } - - case reflect.Ptr: - // Do nothing. We should never get here since pointers have already - // been handled above. - - case reflect.Map: - // nil maps should be indicated as different than empty maps - if v.IsNil() { - d.w.Write(nilAngleBytes) - break - } - - d.w.Write(openBraceNewlineBytes) - d.depth++ - if (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) { - d.indent() - d.w.Write(maxNewlineBytes) - } else { - numEntries := v.Len() - keys := v.MapKeys() - if d.cs.SortKeys { - sortValues(keys, d.cs) - } - for i, key := range keys { - d.dump(d.unpackValue(key)) - d.w.Write(colonSpaceBytes) - d.ignoreNextIndent = true - d.dump(d.unpackValue(v.MapIndex(key))) - if i < (numEntries - 1) { - d.w.Write(commaNewlineBytes) - } else { - d.w.Write(newlineBytes) - } - } - } - d.depth-- - d.indent() - d.w.Write(closeBraceBytes) - - case reflect.Struct: - d.w.Write(openBraceNewlineBytes) - d.depth++ - if (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) { - d.indent() - d.w.Write(maxNewlineBytes) - } else { - vt := v.Type() - numFields := v.NumField() - for i := 0; i < numFields; i++ { - d.indent() - vtf := vt.Field(i) - d.w.Write([]byte(vtf.Name)) - d.w.Write(colonSpaceBytes) - d.ignoreNextIndent = true - d.dump(d.unpackValue(v.Field(i))) - if i < (numFields - 1) { - d.w.Write(commaNewlineBytes) - } else { - d.w.Write(newlineBytes) - } - } - } - d.depth-- - d.indent() - d.w.Write(closeBraceBytes) - - case reflect.Uintptr: - printHexPtr(d.w, uintptr(v.Uint())) - - case reflect.UnsafePointer, reflect.Chan, reflect.Func: - printHexPtr(d.w, v.Pointer()) - - // There were not any other types at the time this code was written, but - // fall back to letting the default fmt package handle it in case any new - // types are added. - default: - if v.CanInterface() { - fmt.Fprintf(d.w, "%v", v.Interface()) - } else { - fmt.Fprintf(d.w, "%v", v.String()) - } - } -} - -// fdump is a helper function to consolidate the logic from the various public -// methods which take varying writers and config states. -func fdump(cs *ConfigState, w io.Writer, a ...interface{}) { - for _, arg := range a { - if arg == nil { - w.Write(interfaceBytes) - w.Write(spaceBytes) - w.Write(nilAngleBytes) - w.Write(newlineBytes) - continue - } - - d := dumpState{w: w, cs: cs} - d.pointers = make(map[uintptr]int) - d.dump(reflect.ValueOf(arg)) - d.w.Write(newlineBytes) - } -} - -// Fdump formats and displays the passed arguments to io.Writer w. It formats -// exactly the same as Dump. -func Fdump(w io.Writer, a ...interface{}) { - fdump(&Config, w, a...) -} - -// Sdump returns a string with the passed arguments formatted exactly the same -// as Dump. -func Sdump(a ...interface{}) string { - var buf bytes.Buffer - fdump(&Config, &buf, a...) - return buf.String() -} - -/* -Dump displays the passed parameters to standard out with newlines, customizable -indentation, and additional debug information such as complete types and all -pointer addresses used to indirect to the final value. It provides the -following features over the built-in printing facilities provided by the fmt -package: - - * Pointers are dereferenced and followed - * Circular data structures are detected and handled properly - * Custom Stringer/error interfaces are optionally invoked, including - on unexported types - * Custom types which only implement the Stringer/error interfaces via - a pointer receiver are optionally invoked when passing non-pointer - variables - * Byte arrays and slices are dumped like the hexdump -C command which - includes offsets, byte values in hex, and ASCII output - -The configuration options are controlled by an exported package global, -spew.Config. See ConfigState for options documentation. - -See Fdump if you would prefer dumping to an arbitrary io.Writer or Sdump to -get the formatted result as a string. -*/ -func Dump(a ...interface{}) { - fdump(&Config, os.Stdout, a...) -} diff --git a/vendor/github.com/davecgh/go-spew/spew/format.go b/vendor/github.com/davecgh/go-spew/spew/format.go deleted file mode 100644 index b04edb7d7..000000000 --- a/vendor/github.com/davecgh/go-spew/spew/format.go +++ /dev/null @@ -1,419 +0,0 @@ -/* - * Copyright (c) 2013-2016 Dave Collins - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -package spew - -import ( - "bytes" - "fmt" - "reflect" - "strconv" - "strings" -) - -// supportedFlags is a list of all the character flags supported by fmt package. -const supportedFlags = "0-+# " - -// formatState implements the fmt.Formatter interface and contains information -// about the state of a formatting operation. The NewFormatter function can -// be used to get a new Formatter which can be used directly as arguments -// in standard fmt package printing calls. -type formatState struct { - value interface{} - fs fmt.State - depth int - pointers map[uintptr]int - ignoreNextType bool - cs *ConfigState -} - -// buildDefaultFormat recreates the original format string without precision -// and width information to pass in to fmt.Sprintf in the case of an -// unrecognized type. Unless new types are added to the language, this -// function won't ever be called. -func (f *formatState) buildDefaultFormat() (format string) { - buf := bytes.NewBuffer(percentBytes) - - for _, flag := range supportedFlags { - if f.fs.Flag(int(flag)) { - buf.WriteRune(flag) - } - } - - buf.WriteRune('v') - - format = buf.String() - return format -} - -// constructOrigFormat recreates the original format string including precision -// and width information to pass along to the standard fmt package. This allows -// automatic deferral of all format strings this package doesn't support. -func (f *formatState) constructOrigFormat(verb rune) (format string) { - buf := bytes.NewBuffer(percentBytes) - - for _, flag := range supportedFlags { - if f.fs.Flag(int(flag)) { - buf.WriteRune(flag) - } - } - - if width, ok := f.fs.Width(); ok { - buf.WriteString(strconv.Itoa(width)) - } - - if precision, ok := f.fs.Precision(); ok { - buf.Write(precisionBytes) - buf.WriteString(strconv.Itoa(precision)) - } - - buf.WriteRune(verb) - - format = buf.String() - return format -} - -// unpackValue returns values inside of non-nil interfaces when possible and -// ensures that types for values which have been unpacked from an interface -// are displayed when the show types flag is also set. -// This is useful for data types like structs, arrays, slices, and maps which -// can contain varying types packed inside an interface. -func (f *formatState) unpackValue(v reflect.Value) reflect.Value { - if v.Kind() == reflect.Interface { - f.ignoreNextType = false - if !v.IsNil() { - v = v.Elem() - } - } - return v -} - -// formatPtr handles formatting of pointers by indirecting them as necessary. -func (f *formatState) formatPtr(v reflect.Value) { - // Display nil if top level pointer is nil. - showTypes := f.fs.Flag('#') - if v.IsNil() && (!showTypes || f.ignoreNextType) { - f.fs.Write(nilAngleBytes) - return - } - - // Remove pointers at or below the current depth from map used to detect - // circular refs. - for k, depth := range f.pointers { - if depth >= f.depth { - delete(f.pointers, k) - } - } - - // Keep list of all dereferenced pointers to possibly show later. - pointerChain := make([]uintptr, 0) - - // Figure out how many levels of indirection there are by derferencing - // pointers and unpacking interfaces down the chain while detecting circular - // references. - nilFound := false - cycleFound := false - indirects := 0 - ve := v - for ve.Kind() == reflect.Ptr { - if ve.IsNil() { - nilFound = true - break - } - indirects++ - addr := ve.Pointer() - pointerChain = append(pointerChain, addr) - if pd, ok := f.pointers[addr]; ok && pd < f.depth { - cycleFound = true - indirects-- - break - } - f.pointers[addr] = f.depth - - ve = ve.Elem() - if ve.Kind() == reflect.Interface { - if ve.IsNil() { - nilFound = true - break - } - ve = ve.Elem() - } - } - - // Display type or indirection level depending on flags. - if showTypes && !f.ignoreNextType { - f.fs.Write(openParenBytes) - f.fs.Write(bytes.Repeat(asteriskBytes, indirects)) - f.fs.Write([]byte(ve.Type().String())) - f.fs.Write(closeParenBytes) - } else { - if nilFound || cycleFound { - indirects += strings.Count(ve.Type().String(), "*") - } - f.fs.Write(openAngleBytes) - f.fs.Write([]byte(strings.Repeat("*", indirects))) - f.fs.Write(closeAngleBytes) - } - - // Display pointer information depending on flags. - if f.fs.Flag('+') && (len(pointerChain) > 0) { - f.fs.Write(openParenBytes) - for i, addr := range pointerChain { - if i > 0 { - f.fs.Write(pointerChainBytes) - } - printHexPtr(f.fs, addr) - } - f.fs.Write(closeParenBytes) - } - - // Display dereferenced value. - switch { - case nilFound: - f.fs.Write(nilAngleBytes) - - case cycleFound: - f.fs.Write(circularShortBytes) - - default: - f.ignoreNextType = true - f.format(ve) - } -} - -// format is the main workhorse for providing the Formatter interface. It -// uses the passed reflect value to figure out what kind of object we are -// dealing with and formats it appropriately. It is a recursive function, -// however circular data structures are detected and handled properly. -func (f *formatState) format(v reflect.Value) { - // Handle invalid reflect values immediately. - kind := v.Kind() - if kind == reflect.Invalid { - f.fs.Write(invalidAngleBytes) - return - } - - // Handle pointers specially. - if kind == reflect.Ptr { - f.formatPtr(v) - return - } - - // Print type information unless already handled elsewhere. - if !f.ignoreNextType && f.fs.Flag('#') { - f.fs.Write(openParenBytes) - f.fs.Write([]byte(v.Type().String())) - f.fs.Write(closeParenBytes) - } - f.ignoreNextType = false - - // Call Stringer/error interfaces if they exist and the handle methods - // flag is enabled. - if !f.cs.DisableMethods { - if (kind != reflect.Invalid) && (kind != reflect.Interface) { - if handled := handleMethods(f.cs, f.fs, v); handled { - return - } - } - } - - switch kind { - case reflect.Invalid: - // Do nothing. We should never get here since invalid has already - // been handled above. - - case reflect.Bool: - printBool(f.fs, v.Bool()) - - case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int: - printInt(f.fs, v.Int(), 10) - - case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint: - printUint(f.fs, v.Uint(), 10) - - case reflect.Float32: - printFloat(f.fs, v.Float(), 32) - - case reflect.Float64: - printFloat(f.fs, v.Float(), 64) - - case reflect.Complex64: - printComplex(f.fs, v.Complex(), 32) - - case reflect.Complex128: - printComplex(f.fs, v.Complex(), 64) - - case reflect.Slice: - if v.IsNil() { - f.fs.Write(nilAngleBytes) - break - } - fallthrough - - case reflect.Array: - f.fs.Write(openBracketBytes) - f.depth++ - if (f.cs.MaxDepth != 0) && (f.depth > f.cs.MaxDepth) { - f.fs.Write(maxShortBytes) - } else { - numEntries := v.Len() - for i := 0; i < numEntries; i++ { - if i > 0 { - f.fs.Write(spaceBytes) - } - f.ignoreNextType = true - f.format(f.unpackValue(v.Index(i))) - } - } - f.depth-- - f.fs.Write(closeBracketBytes) - - case reflect.String: - f.fs.Write([]byte(v.String())) - - case reflect.Interface: - // The only time we should get here is for nil interfaces due to - // unpackValue calls. - if v.IsNil() { - f.fs.Write(nilAngleBytes) - } - - case reflect.Ptr: - // Do nothing. We should never get here since pointers have already - // been handled above. - - case reflect.Map: - // nil maps should be indicated as different than empty maps - if v.IsNil() { - f.fs.Write(nilAngleBytes) - break - } - - f.fs.Write(openMapBytes) - f.depth++ - if (f.cs.MaxDepth != 0) && (f.depth > f.cs.MaxDepth) { - f.fs.Write(maxShortBytes) - } else { - keys := v.MapKeys() - if f.cs.SortKeys { - sortValues(keys, f.cs) - } - for i, key := range keys { - if i > 0 { - f.fs.Write(spaceBytes) - } - f.ignoreNextType = true - f.format(f.unpackValue(key)) - f.fs.Write(colonBytes) - f.ignoreNextType = true - f.format(f.unpackValue(v.MapIndex(key))) - } - } - f.depth-- - f.fs.Write(closeMapBytes) - - case reflect.Struct: - numFields := v.NumField() - f.fs.Write(openBraceBytes) - f.depth++ - if (f.cs.MaxDepth != 0) && (f.depth > f.cs.MaxDepth) { - f.fs.Write(maxShortBytes) - } else { - vt := v.Type() - for i := 0; i < numFields; i++ { - if i > 0 { - f.fs.Write(spaceBytes) - } - vtf := vt.Field(i) - if f.fs.Flag('+') || f.fs.Flag('#') { - f.fs.Write([]byte(vtf.Name)) - f.fs.Write(colonBytes) - } - f.format(f.unpackValue(v.Field(i))) - } - } - f.depth-- - f.fs.Write(closeBraceBytes) - - case reflect.Uintptr: - printHexPtr(f.fs, uintptr(v.Uint())) - - case reflect.UnsafePointer, reflect.Chan, reflect.Func: - printHexPtr(f.fs, v.Pointer()) - - // There were not any other types at the time this code was written, but - // fall back to letting the default fmt package handle it if any get added. - default: - format := f.buildDefaultFormat() - if v.CanInterface() { - fmt.Fprintf(f.fs, format, v.Interface()) - } else { - fmt.Fprintf(f.fs, format, v.String()) - } - } -} - -// Format satisfies the fmt.Formatter interface. See NewFormatter for usage -// details. -func (f *formatState) Format(fs fmt.State, verb rune) { - f.fs = fs - - // Use standard formatting for verbs that are not v. - if verb != 'v' { - format := f.constructOrigFormat(verb) - fmt.Fprintf(fs, format, f.value) - return - } - - if f.value == nil { - if fs.Flag('#') { - fs.Write(interfaceBytes) - } - fs.Write(nilAngleBytes) - return - } - - f.format(reflect.ValueOf(f.value)) -} - -// newFormatter is a helper function to consolidate the logic from the various -// public methods which take varying config states. -func newFormatter(cs *ConfigState, v interface{}) fmt.Formatter { - fs := &formatState{value: v, cs: cs} - fs.pointers = make(map[uintptr]int) - return fs -} - -/* -NewFormatter returns a custom formatter that satisfies the fmt.Formatter -interface. As a result, it integrates cleanly with standard fmt package -printing functions. The formatter is useful for inline printing of smaller data -types similar to the standard %v format specifier. - -The custom formatter only responds to the %v (most compact), %+v (adds pointer -addresses), %#v (adds types), or %#+v (adds types and pointer addresses) verb -combinations. Any other verbs such as %x and %q will be sent to the the -standard fmt package for formatting. In addition, the custom formatter ignores -the width and precision arguments (however they will still work on the format -specifiers not handled by the custom formatter). - -Typically this function shouldn't be called directly. It is much easier to make -use of the custom formatter by calling one of the convenience functions such as -Printf, Println, or Fprintf. -*/ -func NewFormatter(v interface{}) fmt.Formatter { - return newFormatter(&Config, v) -} diff --git a/vendor/github.com/davecgh/go-spew/spew/spew.go b/vendor/github.com/davecgh/go-spew/spew/spew.go deleted file mode 100644 index 32c0e3388..000000000 --- a/vendor/github.com/davecgh/go-spew/spew/spew.go +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (c) 2013-2016 Dave Collins - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -package spew - -import ( - "fmt" - "io" -) - -// Errorf is a wrapper for fmt.Errorf that treats each argument as if it were -// passed with a default Formatter interface returned by NewFormatter. It -// returns the formatted string as a value that satisfies error. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Errorf(format, spew.NewFormatter(a), spew.NewFormatter(b)) -func Errorf(format string, a ...interface{}) (err error) { - return fmt.Errorf(format, convertArgs(a)...) -} - -// Fprint is a wrapper for fmt.Fprint that treats each argument as if it were -// passed with a default Formatter interface returned by NewFormatter. It -// returns the number of bytes written and any write error encountered. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Fprint(w, spew.NewFormatter(a), spew.NewFormatter(b)) -func Fprint(w io.Writer, a ...interface{}) (n int, err error) { - return fmt.Fprint(w, convertArgs(a)...) -} - -// Fprintf is a wrapper for fmt.Fprintf that treats each argument as if it were -// passed with a default Formatter interface returned by NewFormatter. It -// returns the number of bytes written and any write error encountered. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Fprintf(w, format, spew.NewFormatter(a), spew.NewFormatter(b)) -func Fprintf(w io.Writer, format string, a ...interface{}) (n int, err error) { - return fmt.Fprintf(w, format, convertArgs(a)...) -} - -// Fprintln is a wrapper for fmt.Fprintln that treats each argument as if it -// passed with a default Formatter interface returned by NewFormatter. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Fprintln(w, spew.NewFormatter(a), spew.NewFormatter(b)) -func Fprintln(w io.Writer, a ...interface{}) (n int, err error) { - return fmt.Fprintln(w, convertArgs(a)...) -} - -// Print is a wrapper for fmt.Print that treats each argument as if it were -// passed with a default Formatter interface returned by NewFormatter. It -// returns the number of bytes written and any write error encountered. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Print(spew.NewFormatter(a), spew.NewFormatter(b)) -func Print(a ...interface{}) (n int, err error) { - return fmt.Print(convertArgs(a)...) -} - -// Printf is a wrapper for fmt.Printf that treats each argument as if it were -// passed with a default Formatter interface returned by NewFormatter. It -// returns the number of bytes written and any write error encountered. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Printf(format, spew.NewFormatter(a), spew.NewFormatter(b)) -func Printf(format string, a ...interface{}) (n int, err error) { - return fmt.Printf(format, convertArgs(a)...) -} - -// Println is a wrapper for fmt.Println that treats each argument as if it were -// passed with a default Formatter interface returned by NewFormatter. It -// returns the number of bytes written and any write error encountered. See -// NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Println(spew.NewFormatter(a), spew.NewFormatter(b)) -func Println(a ...interface{}) (n int, err error) { - return fmt.Println(convertArgs(a)...) -} - -// Sprint is a wrapper for fmt.Sprint that treats each argument as if it were -// passed with a default Formatter interface returned by NewFormatter. It -// returns the resulting string. See NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Sprint(spew.NewFormatter(a), spew.NewFormatter(b)) -func Sprint(a ...interface{}) string { - return fmt.Sprint(convertArgs(a)...) -} - -// Sprintf is a wrapper for fmt.Sprintf that treats each argument as if it were -// passed with a default Formatter interface returned by NewFormatter. It -// returns the resulting string. See NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Sprintf(format, spew.NewFormatter(a), spew.NewFormatter(b)) -func Sprintf(format string, a ...interface{}) string { - return fmt.Sprintf(format, convertArgs(a)...) -} - -// Sprintln is a wrapper for fmt.Sprintln that treats each argument as if it -// were passed with a default Formatter interface returned by NewFormatter. It -// returns the resulting string. See NewFormatter for formatting details. -// -// This function is shorthand for the following syntax: -// -// fmt.Sprintln(spew.NewFormatter(a), spew.NewFormatter(b)) -func Sprintln(a ...interface{}) string { - return fmt.Sprintln(convertArgs(a)...) -} - -// convertArgs accepts a slice of arguments and returns a slice of the same -// length with each argument converted to a default spew Formatter interface. -func convertArgs(args []interface{}) (formatters []interface{}) { - formatters = make([]interface{}, len(args)) - for index, arg := range args { - formatters[index] = NewFormatter(arg) - } - return formatters -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/.codecov.yml b/vendor/github.com/elastic/go-elasticsearch/v7/.codecov.yml deleted file mode 100644 index e6210f886..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/.codecov.yml +++ /dev/null @@ -1,8 +0,0 @@ -comment: off - -coverage: - status: - patch: off - -ignore: - - "esapi/api.*.go" diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/.dockerignore b/vendor/github.com/elastic/go-elasticsearch/v7/.dockerignore deleted file mode 100644 index 4c8512b08..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/.dockerignore +++ /dev/null @@ -1,2 +0,0 @@ -.git/ -tmp/ diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/.gitignore b/vendor/github.com/elastic/go-elasticsearch/v7/.gitignore deleted file mode 100644 index 7a915a038..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -tmp/ -*.test - -#jetBrains editors -.idea \ No newline at end of file diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/LICENSE b/vendor/github.com/elastic/go-elasticsearch/v7/LICENSE deleted file mode 100644 index b1a731fb5..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018 Elasticsearch BV - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/Makefile b/vendor/github.com/elastic/go-elasticsearch/v7/Makefile deleted file mode 100644 index 74464f81e..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/Makefile +++ /dev/null @@ -1,480 +0,0 @@ -SHELL := /bin/bash - -ELASTICSEARCH_DEFAULT_BUILD_VERSION = "7.13.1-SNAPSHOT" - -##@ Test -test-unit: ## Run unit tests - @printf "\033[2m→ Running unit tests...\033[0m\n" -ifdef race - $(eval testunitargs += "-race") -endif - $(eval testunitargs += "-cover" "-coverprofile=tmp/unit.cov" "./...") - @mkdir -p tmp - @if which gotestsum > /dev/null 2>&1 ; then \ - echo "gotestsum --format=short-verbose --junitfile=tmp/unit-report.xml --" $(testunitargs); \ - gotestsum --format=short-verbose --junitfile=tmp/unit-report.xml -- $(testunitargs); \ - else \ - echo "go test -v" $(testunitargs); \ - go test -v $(testunitargs); \ - fi; -test: test-unit - -test-integ: ## Run integration tests - @printf "\033[2m→ Running integration tests...\033[0m\n" - $(eval testintegtags += "integration") -ifdef multinode - $(eval testintegtags += "multinode") -endif -ifdef race - $(eval testintegargs += "-race") -endif - $(eval testintegargs += "-cover" "-coverprofile=tmp/integration-client.cov" "-tags='$(testintegtags)'" "-timeout=1h") - @mkdir -p tmp - @if which gotestsum > /dev/null 2>&1 ; then \ - echo "gotestsum --format=short-verbose --junitfile=tmp/integration-report.xml --" $(testintegargs); \ - gotestsum --format=short-verbose --junitfile=tmp/integration-report.xml -- $(testintegargs) "."; \ - gotestsum --format=short-verbose --junitfile=tmp/integration-report.xml -- $(testintegargs) "./estransport" "./esapi" "./esutil"; \ - else \ - echo "go test -v" $(testintegargs) "."; \ - go test -v $(testintegargs) "./estransport" "./esapi" "./esutil"; \ - fi; - -test-api: ## Run generated API integration tests - @mkdir -p tmp -ifdef race - $(eval testapiargs += "-race") -endif - $(eval testapiargs += "-cover" "-coverpkg=github.com/elastic/go-elasticsearch/v7/esapi" "-coverprofile=$(PWD)/tmp/integration-api.cov" "-tags='integration'" "-timeout=1h") -ifdef flavor -else - $(eval flavor='free') -endif - @printf "\033[2m→ Running API integration tests for [$(flavor)]...\033[0m\n" -ifeq ($(flavor), platinum) - @{ \ - set -e ; \ - trap "test -d .git && git checkout --quiet $(PWD)/esapi/test/go.mod" INT TERM EXIT; \ - export ELASTICSEARCH_URL='https://elastic:elastic@localhost:9200' && \ - if which gotestsum > /dev/null 2>&1 ; then \ - cd esapi/test && \ - go mod download && \ - gotestsum --format=short-verbose --junitfile=$(PWD)/tmp/integration-api-report.xml -- $(testapiargs) $(PWD)/esapi/test/xpack/*_test.go && \ - gotestsum --format=short-verbose --junitfile=$(PWD)/tmp/integration-api-report.xml -- $(testapiargs) $(PWD)/esapi/test/xpack/ml/*_test.go && \ - gotestsum --format=short-verbose --junitfile=$(PWD)/tmp/integration-api-report.xml -- $(testapiargs) $(PWD)/esapi/test/xpack/ml-crud/*_test.go; \ - else \ - echo "go test -v" $(testapiargs); \ - cd esapi/test && \ - go mod download && \ - go test -v $(testapiargs) $(PWD)/esapi/test/xpack/*_test.go && \ - go test -v $(testapiargs) $(PWD)/esapi/test/xpack/ml/*_test.go && \ - go test -v $(testapiargs) $(PWD)/esapi/test/xpack/ml-crud/*_test.go; \ - fi; \ - } -else - $(eval testapiargs += $(PWD)/esapi/test/*_test.go) - @{ \ - set -e ; \ - trap "test -d .git && git checkout --quiet $(PWD)/esapi/test/go.mod" INT TERM EXIT; \ - if which gotestsum > /dev/null 2>&1 ; then \ - cd esapi/test && \ - go mod download && \ - gotestsum --format=short-verbose --junitfile=$(PWD)/tmp/integration-api-report.xml -- $(testapiargs); \ - else \ - echo "go test -v" $(testapiargs); \ - cd esapi/test && \ - go mod download && \ - go test -v $(testapiargs); \ - fi; \ - } -endif - -test-bench: ## Run benchmarks - @printf "\033[2m→ Running benchmarks...\033[0m\n" - go test -run=none -bench=. -benchmem ./... - -test-examples: ## Execute the _examples - @printf "\033[2m→ Testing the examples...\033[0m\n" - @{ \ - set -e ; \ - trap "test -d .git && git checkout --quiet _examples/**/go.mod" INT TERM EXIT; \ - for d in _examples/*/; do \ - printf "\033[2m────────────────────────────────────────────────────────────────────────────────\n"; \ - printf "\033[1mUpdating dependencies for $$d\033[0m\n"; \ - printf "\033[2m────────────────────────────────────────────────────────────────────────────────\033[0m\n"; \ - (cd $$d && go mod download) || \ - ( \ - printf "\033[31m────────────────────────────────────────────────────────────────────────────────\033[0m\n"; \ - printf "\033[31;1m⨯ ERROR\033[0m\n"; \ - false; \ - ); \ - done; \ - \ - for f in _examples/*.go; do \ - printf "\033[2m────────────────────────────────────────────────────────────────────────────────\n"; \ - printf "\033[1m$$f\033[0m\n"; \ - printf "\033[2m────────────────────────────────────────────────────────────────────────────────\033[0m\n"; \ - (go run $$f && true) || \ - ( \ - printf "\033[31m────────────────────────────────────────────────────────────────────────────────\033[0m\n"; \ - printf "\033[31;1m⨯ ERROR\033[0m\n"; \ - false; \ - ); \ - done; \ - \ - for f in _examples/*/; do \ - printf "\033[2m────────────────────────────────────────────────────────────────────────────────\033[0m\n"; \ - printf "\033[1m$$f\033[0m\n"; \ - printf "\033[2m────────────────────────────────────────────────────────────────────────────────\033[0m\n"; \ - (cd $$f && make test && true) || \ - ( \ - printf "\033[31m────────────────────────────────────────────────────────────────────────────────\033[0m\n"; \ - printf "\033[31;1m⨯ ERROR\033[0m\n"; \ - false; \ - ); \ - done; \ - printf "\033[32m────────────────────────────────────────────────────────────────────────────────\033[0m\n"; \ - \ - printf "\033[32;1mSUCCESS\033[0m\n"; \ - } - -test-coverage: ## Generate test coverage report - @printf "\033[2m→ Generating test coverage report...\033[0m\n" - @go tool cover -html=tmp/unit.cov -o tmp/coverage.html - @go tool cover -func=tmp/unit.cov | 'grep' -v 'esapi/api\.' | sed 's/github.com\/elastic\/go-elasticsearch\///g' - @printf "\033[0m--------------------------------------------------------------------------------\nopen tmp/coverage.html\n\n\033[0m" - -##@ Development -lint: ## Run lint on the package - @printf "\033[2m→ Running lint...\033[0m\n" - go vet github.com/elastic/go-elasticsearch/... - go list github.com/elastic/go-elasticsearch/... | 'grep' -v internal | xargs golint -set_exit_status - @{ \ - set -e ; \ - trap "test -d ../../../.git && git checkout --quiet go.mod" INT TERM EXIT; \ - echo "cd internal/build/ && go vet ./..."; \ - cd "internal/build/" && go mod download && go vet ./...; \ - } - - -apidiff: ## Display API incompabilities - @if ! command -v apidiff > /dev/null; then \ - printf "\033[31;1mERROR: apidiff not installed\033[0m\n"; \ - printf "go get -u github.com/go-modules-by-example/apidiff\n"; \ - printf "\033[2m→ https://github.com/go-modules-by-example/index/blob/master/019_apidiff/README.md\033[0m\n\n"; \ - false; \ - fi; - @rm -rf tmp/apidiff-OLD tmp/apidiff-NEW - @git clone --quiet --local .git/ tmp/apidiff-OLD - @mkdir -p tmp/apidiff-NEW - @tar -c --exclude .git --exclude tmp --exclude cmd . | tar -x -C tmp/apidiff-NEW - @printf "\033[2m→ Running apidiff...\033[0m\n" - @pritnf "tmp/apidiff-OLD/esapi tmp/apidiff-NEW/esapi\n" - @{ \ - set -e ; \ - output=$$(apidiff tmp/apidiff-OLD/esapi tmp/apidiff-NEW/esapi); \ - printf "\n$$output\n\n"; \ - if echo $$output | grep -i -e 'incompatible' - > /dev/null 2>&1; then \ - printf "\n\033[31;1mFAILURE\033[0m\n\n"; \ - false; \ - else \ - printf "\033[32;1mSUCCESS\033[0m\n"; \ - fi; \ - } - -backport: ## Backport one or more commits from master into version branches -ifeq ($(origin commits), undefined) - @echo "Missing commit(s), exiting..." - @exit 2 -endif -ifndef branches - $(eval branches_list = '7.x' '6.x' '5.x') -else - $(eval branches_list = $(shell echo $(branches) | tr ',' ' ') ) -endif - $(eval commits_list = $(shell echo $(commits) | tr ',' ' ')) - @printf "\033[2m→ Backporting commits [$(commits)]\033[0m\n" - @{ \ - set -e -o pipefail; \ - for commit in $(commits_list); do \ - git show --pretty='%h | %s' --no-patch $$commit; \ - done; \ - echo ""; \ - for branch in $(branches_list); do \ - printf "\033[2m→ $$branch\033[0m\n"; \ - git checkout $$branch; \ - for commit in $(commits_list); do \ - git cherry-pick -x $$commit; \ - done; \ - git status --short --branch; \ - echo ""; \ - done; \ - printf "\033[2m→ Push updates to Github:\033[0m\n"; \ - for branch in $(branches_list); do \ - echo "git push --verbose origin $$branch"; \ - done; \ - } - -release: ## Release a new version to Github - $(eval branch = $(shell git rev-parse --abbrev-ref HEAD)) - $(eval current_version = $(shell cat internal/version/version.go | sed -Ee 's/const Client = "(.*)"/\1/' | tail -1)) - @printf "\033[2m→ [$(branch)] Current version: $(current_version)...\033[0m\n" -ifndef version - @printf "\033[31m[!] Missing version argument, exiting...\033[0m\n" - @exit 2 -endif -ifeq ($(version), "") - @printf "\033[31m[!] Empty version argument, exiting...\033[0m\n" - @exit 2 -endif - @printf "\033[2m→ [$(branch)] Creating version $(version)...\033[0m\n" - @{ \ - set -e -o pipefail; \ - cp internal/version/version.go internal/version/version.go.OLD && \ - cat internal/version/version.go.OLD | sed -e 's/Client = ".*"/Client = "$(version)"/' > internal/version/version.go && \ - go vet internal/version/version.go && \ - go fmt internal/version/version.go && \ - git diff --color-words internal/version/version.go | tail -n 1; \ - } - @{ \ - set -e -o pipefail; \ - printf "\033[2m→ Commit and create Git tag? (y/n): \033[0m\c"; \ - read continue; \ - if [[ $$continue == "y" ]]; then \ - git add internal/version/version.go && \ - git commit --no-status --quiet --message "Release $(version)" && \ - git tag --annotate v$(version) --message 'Release $(version)'; \ - printf "\033[2m→ Push `git show --pretty='%h (%s)' --no-patch HEAD` to Github:\033[0m\n\n"; \ - printf "\033[1m git push origin HEAD && git push origin v$(version)\033[0m\n\n"; \ - mv internal/version/version.go.OLD internal/version/version.go && \ - git add internal/version/version.go && \ - original_version=`cat internal/version/version.go | sed -ne 's;^const Client = "\(.*\)"$$;\1;p'` && \ - git commit --no-status --quiet --message "Update version to $$original_version"; \ - printf "\033[2m→ Version updated to [$$original_version].\033[0m\n\n"; \ - else \ - echo "Aborting..."; \ - rm internal/version/version.go.OLD; \ - exit 1; \ - fi; \ - } - -godoc: ## Display documentation for the package - @printf "\033[2m→ Generating documentation...\033[0m\n" - @echo "* http://localhost:6060/pkg/github.com/elastic/go-elasticsearch/v7" - @echo "* http://localhost:6060/pkg/github.com/elastic/go-elasticsearch/v7/esapi" - @echo "* http://localhost:6060/pkg/github.com/elastic/go-elasticsearch/v7/estransport" - @echo "* http://localhost:6060/pkg/github.com/elastic/go-elasticsearch/v7/esutil" - @printf "\n" - godoc --http=localhost:6060 --play - -cluster: ## Launch an Elasticsearch cluster with Docker - $(eval version ?= "elasticsearch:7.13.1-SNAPSHOT") - $(eval flavor ?= "core") - $(eval elasticsearch_url = "http://es1:9200") - -ifdef ELASTICSEARCH_BUILD_VERSION - $(eval version ?= "elasticsearch:"${ELASTICSEARCH_BUILD_VERSION}) -else - $(eval version ?= "elasticsearch:"${ELASTICSEARCH_DEFAULT_BUILD_VERSION}) -endif - -ifeq ($(origin nodes), undefined) - $(eval nodes = 1) -endif - @printf "\033[2m→ Launching %d node(s) of %s...\033[0m\n" $(nodes) $(version) -ifeq ($(shell test $(nodes) && test $(nodes) -gt 1; echo $$?),0) - $(eval detach ?= "true") -else - $(eval detach ?= "false") -endif - -ifeq ($(flavor), platinum) - $(eval elasticsearch_url = "https://elastic:elastic@es1:9200") - $(eval xpack_env += --env "ELASTIC_PASSWORD=elastic") - $(eval xpack_env += --env "xpack.license.self_generated.type=trial") - $(eval xpack_env += --env "xpack.security.enabled=true") - $(eval xpack_env += --env "xpack.security.http.ssl.enabled=true") - $(eval xpack_env += --env "xpack.security.http.ssl.key=certs/testnode.key") - $(eval xpack_env += --env "xpack.security.http.ssl.certificate=certs/testnode.crt") - $(eval xpack_env += --env "xpack.security.http.ssl.certificate_authorities=certs/ca.crt") - $(eval xpack_env += --env "xpack.security.transport.ssl.enabled=true") - $(eval xpack_env += --env "xpack.security.transport.ssl.verification_mode=certificate") - $(eval xpack_env += --env "xpack.security.transport.ssl.key=certs/testnode.key") - $(eval xpack_env += --env "xpack.security.transport.ssl.certificate=certs/testnode.crt") - $(eval xpack_env += --env "xpack.security.transport.ssl.certificate_authorities=certs/ca.crt") - $(eval xpack_volumes += --volume "$(PWD)/.ci/certs/testnode.crt:/usr/share/elasticsearch/config/certs/testnode.crt") - $(eval xpack_volumes += --volume "$(PWD)/.ci/certs/testnode.key:/usr/share/elasticsearch/config/certs/testnode.key") - $(eval xpack_volumes += --volume "$(PWD)/.ci/certs/ca.crt:/usr/share/elasticsearch/config/certs/ca.crt") -endif - @docker network inspect elasticsearch > /dev/null 2>&1 || docker network create elasticsearch; - @{ \ - for n in `seq 1 $(nodes)`; do \ - if [[ -z "$$port" ]]; then \ - hostport=$$((9199+$$n)); \ - else \ - hostport=$$port; \ - fi; \ - docker run \ - --name "es$$n" \ - --network elasticsearch \ - --env "node.name=es$$n" \ - --env "cluster.name=go-elasticsearch" \ - --env "cluster.initial_master_nodes=es1" \ - --env "discovery.seed_hosts=es1" \ - --env "cluster.routing.allocation.disk.threshold_enabled=false" \ - --env "bootstrap.memory_lock=true" \ - --env "node.attr.testattr=test" \ - --env "path.repo=/tmp" \ - --env "repositories.url.allowed_urls=http://snapshot.test*" \ - --env ES_JAVA_OPTS="-Xms1g -Xmx1g" \ - $(xpack_env) \ - --volume `echo $(version) | tr -C "[:alnum:]" '-'`-node-$$n-data:/usr/share/elasticsearch/data \ - $(xpack_volumes) \ - --publish $$hostport:9200 \ - --ulimit nofile=65536:65536 \ - --ulimit memlock=-1:-1 \ - --detach=$(detach) \ - --rm \ - docker.elastic.co/elasticsearch/$(version); \ - done \ - } -ifdef detach - @{ \ - printf "\033[2m→ Waiting for the cluster on $(elasticsearch_url)...\033[0m\n"; \ - docker run --network elasticsearch --rm appropriate/curl --max-time 120 --retry 120 --retry-delay 1 --retry-connrefused --show-error --silent --insecure $(elasticsearch_url); \ - output="\033[2m→ Cluster ready; to remove containers:"; \ - output="$$output docker rm -f"; \ - for n in `seq 1 $(nodes)`; do \ - output="$$output es$$n"; \ - done; \ - printf "$$output\033[0m\n"; \ - } -endif - -cluster-update: ## Update the Docker image -ifdef ELASTICSEARCH_BUILD_VERSION - $(eval version ?= "elasticsearch:"${ELASTICSEARCH_BUILD_VERSION}) -else - $(eval version ?= "elasticsearch:"${ELASTICSEARCH_DEFAULT_BUILD_VERSION}) -endif - @printf "\033[2m→ Updating the Docker image...\033[0m\n" - @docker pull docker.elastic.co/elasticsearch/$(version); - -cluster-clean: ## Remove unused Docker volumes and networks - @printf "\033[2m→ Cleaning up Docker assets...\033[0m\n" - docker volume prune --force - docker network prune --force - -docker: ## Build the Docker image and run it - docker build --file .ci/Dockerfile --tag elastic/go-elasticsearch . - docker run -it --network elasticsearch --volume $(PWD)/tmp:/tmp:rw,delegated --rm elastic/go-elasticsearch - -##@ Generator -gen-api: ## Generate the API package from the JSON specification - $(eval input ?= tmp/rest-api-spec) - $(eval output ?= esapi) -ifdef debug - $(eval args += --debug) -endif -ifdef ELASTICSEARCH_BUILD_VERSION - $(eval version = $(ELASTICSEARCH_BUILD_VERSION)) -else - $(eval version = $(ELASTICSEARCH_DEFAULT_BUILD_VERSION)) -endif -ifdef ELASTICSEARCH_BUILD_HASH - $(eval build_hash = $(ELASTICSEARCH_BUILD_HASH)) -else - $(eval build_hash = $(shell cat tmp/elasticsearch.json | jq ".projects.elasticsearch.commit_hash")) -endif - @printf "\033[2m→ Generating API package from specification ($(version):$(build_hash))...\033[0m\n" - @{ \ - set -e; \ - trap "test -d .git && git checkout --quiet $(PWD)/internal/build/go.mod" INT TERM EXIT; \ - export ELASTICSEARCH_BUILD_VERSION=$(version) && \ - export ELASTICSEARCH_BUILD_HASH=$(build_hash) && \ - cd internal/build && \ - go run main.go apisource --input '$(PWD)/$(input)/api/*.json' --output '$(PWD)/$(output)' $(args) && \ - go run main.go apistruct --output '$(PWD)/$(output)'; \ - } - -gen-tests: ## Generate the API tests from the YAML specification - $(eval input ?= tmp/rest-api-spec) - $(eval output ?= esapi/test) -ifdef debug - $(eval args += --debug) -endif -ifdef ELASTICSEARCH_BUILD_VERSION - $(eval version = $(ELASTICSEARCH_BUILD_VERSION)) -else - $(eval version = $(ELASTICSEARCH_DEFAULT_BUILD_VERSION)) -endif -ifdef ELASTICSEARCH_BUILD_HASH - $(eval build_hash = $(ELASTICSEARCH_BUILD_HASH)) -else - $(eval build_hash = $(shell cat tmp/elasticsearch.json | jq ".projects.elasticsearch.commit_hash")) -endif - @printf "\033[2m→ Generating API tests from specification ($(version):$(build_hash))...\033[0m\n" - @{ \ - set -e; \ - trap "test -d .git && git checkout --quiet $(PWD)/internal/cmd/generate/go.mod" INT TERM EXIT; \ - export ELASTICSEARCH_BUILD_VERSION=$(version) && \ - export ELASTICSEARCH_BUILD_HASH=$(build_hash) && \ - rm -rf $(output)/*_test.go && \ - rm -rf $(output)/xpack && \ - cd internal/build && \ - go get golang.org/x/tools/cmd/goimports && \ - go generate ./... && \ - go run main.go apitests --input '$(PWD)/$(input)/test/free/**/*.y*ml' --output '$(PWD)/$(output)' $(args) && \ - go run main.go apitests --input '$(PWD)/$(input)/test/platinum/**/*.yml' --output '$(PWD)/$(output)/xpack' $(args) && \ - mkdir -p '$(PWD)/esapi/test/xpack/ml' && \ - mkdir -p '$(PWD)/esapi/test/xpack/ml-crud' && \ - mv $(PWD)/esapi/test/xpack/xpack_ml* $(PWD)/esapi/test/xpack/ml/ && \ - mv $(PWD)/esapi/test/xpack/ml/xpack_ml__jobs_crud_test.go $(PWD)/esapi/test/xpack/ml-crud/; \ - } - -gen-docs: ## Generate the skeleton of documentation examples - $(eval input ?= tmp/alternatives_report.json) - $(eval update ?= no) - @{ \ - set -e; \ - trap "test -d .git && git checkout --quiet $(PWD)/internal/cmd/generate/go.mod" INT TERM EXIT; \ - if [[ $(update) == 'yes' ]]; then \ - printf "\033[2m→ Updating the alternatives_report.json file\033[0m\n" && \ - curl -s https://raw.githubusercontent.com/elastic/built-docs/master/raw/en/elasticsearch/reference/master/alternatives_report.json > tmp/alternatives_report.json; \ - fi; \ - printf "\033[2m→ Generating Go source files from Console input in [$(input)]\033[0m\n" && \ - ( cd '$(PWD)/internal/cmd/generate' && \ - go run main.go examples src --debug --input='$(PWD)/$(input)' --output='$(PWD)/.doc/examples/' \ - ) && \ - ( cd '$(PWD)/.doc/examples/src' && \ - if which gotestsum > /dev/null 2>&1 ; then \ - gotestsum --format=short-verbose; \ - else \ - go test -v $(testunitargs); \ - fi; \ - ) && \ - printf "\n\033[2m→ Generating ASCIIDoc files from Go source\033[0m\n" && \ - ( cd '$(PWD)/internal/build' && \ - go run main.go examples doc --debug --input='$(PWD)/.doc/examples/src/' --output='$(PWD)/.doc/examples/' \ - ) \ - } - -download-specs: ## Download the latest specs for the specified Elasticsearch version - $(eval output ?= tmp) - @mkdir -p tmp - @{ \ - set -e; \ - printf "\n\033[2m→ Downloading latest Elasticsearch specs for version [$(ELASTICSEARCH_DEFAULT_BUILD_VERSION)]\033[0m\n" && \ - rm -rf $(output)/rest-api-spec && \ - rm -rf $(output)/elasticsearch.json && \ - cd internal/build && \ - go run main.go download-spec --output '$(PWD)/$(output)'; \ - } - -##@ Other -#------------------------------------------------------------------------------ -help: ## Display help - @awk 'BEGIN {FS = ":.*##"; printf "Usage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) -#------------- -------------- - -.DEFAULT_GOAL := help -.PHONY: help apidiff backport cluster cluster-clean cluster-update coverage docker examples gen-api gen-tests godoc lint release test test-api test-bench test-integ test-unit diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/README.md b/vendor/github.com/elastic/go-elasticsearch/v7/README.md deleted file mode 100644 index 7087eec05..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/README.md +++ /dev/null @@ -1,377 +0,0 @@ -# go-elasticsearch - -The official Go client for [Elasticsearch](https://www.elastic.co/products/elasticsearch). - -[![GoDoc](https://godoc.org/github.com/elastic/go-elasticsearch?status.svg)](https://pkg.go.dev/github.com/elastic/go-elasticsearch/v7) -[![Go Report Card](https://goreportcard.com/badge/github.com/elastic/go-elasticsearch)](https://goreportcard.com/report/github.com/elastic/go-elasticsearch) -[![codecov.io](https://codecov.io/github/elastic/go-elasticsearch/coverage.svg?branch=master)](https://codecov.io/gh/elastic/go-elasticsearch?branch=master) -[![Build](https://github.com/elastic/go-elasticsearch/workflows/Build/badge.svg)](https://github.com/elastic/go-elasticsearch/actions?query=branch%3A7.x) -[![Unit](https://github.com/elastic/go-elasticsearch/workflows/Unit/badge.svg)](https://github.com/elastic/go-elasticsearch/actions?query=branch%3A7.x) -[![Integration](https://github.com/elastic/go-elasticsearch/workflows/Integration/badge.svg)](https://github.com/elastic/go-elasticsearch/actions?query=branch%3A7.x) -[![API](https://github.com/elastic/go-elasticsearch/workflows/API/badge.svg)](https://github.com/elastic/go-elasticsearch/actions?query=branch%3A7.x) - -## Compatibility - -The client major versions correspond to the compatible Elasticsearch major versions: to connect to Elasticsearch `7.x`, use a [`7.x`](https://github.com/elastic/go-elasticsearch/tree/7.x) version of the client, to connect to Elasticsearch `6.x`, use a [`6.x`](https://github.com/elastic/go-elasticsearch/tree/6.x) version of the client. - -When using Go modules, include the version in the import path, and specify either an explicit version or a branch: - - require github.com/elastic/go-elasticsearch/v7 7.x - require github.com/elastic/go-elasticsearch/v7 7.0.0 - -It's possible to use multiple versions of the client in a single project: - - // go.mod - github.com/elastic/go-elasticsearch/v6 6.x - github.com/elastic/go-elasticsearch/v7 7.x - - // main.go - import ( - elasticsearch6 "github.com/elastic/go-elasticsearch/v6" - elasticsearch7 "github.com/elastic/go-elasticsearch/v7" - ) - // ... - es6, _ := elasticsearch6.NewDefaultClient() - es7, _ := elasticsearch7.NewDefaultClient() - -The `master` branch of the client is compatible with the current `master` branch of Elasticsearch. - - - -## Installation - -Add the package to your `go.mod` file: - - require github.com/elastic/go-elasticsearch/v7 7.x - -Or, clone the repository: - - git clone --branch 7.x https://github.com/elastic/go-elasticsearch.git $GOPATH/src/github.com/elastic/go-elasticsearch - -A complete example: - -```bash -mkdir my-elasticsearch-app && cd my-elasticsearch-app - -cat > go.mod <<-END - module my-elasticsearch-app - - require github.com/elastic/go-elasticsearch/v7 7.x -END - -cat > main.go <<-END - package main - - import ( - "log" - - "github.com/elastic/go-elasticsearch/v7" - ) - - func main() { - es, _ := elasticsearch.NewDefaultClient() - log.Println(elasticsearch.Version) - log.Println(es.Info()) - } -END - -go run main.go -``` - - - - -## Usage - -The `elasticsearch` package ties together two separate packages for calling the Elasticsearch APIs and transferring data over HTTP: `esapi` and `estransport`, respectively. - -Use the `elasticsearch.NewDefaultClient()` function to create the client with the default settings. - -```golang -es, err := elasticsearch.NewDefaultClient() -if err != nil { - log.Fatalf("Error creating the client: %s", err) -} - -res, err := es.Info() -if err != nil { - log.Fatalf("Error getting response: %s", err) -} - -defer res.Body.Close() -log.Println(res) - -// [200 OK] { -// "name" : "node-1", -// "cluster_name" : "go-elasticsearch" -// ... -``` - -> NOTE: It is _critical_ to both close the response body _and_ to consume it, in order to re-use persistent TCP connections in the default HTTP transport. If you're not interested in the response body, call `io.Copy(ioutil.Discard, res.Body)`. - -When you export the `ELASTICSEARCH_URL` environment variable, -it will be used to set the cluster endpoint(s). Separate multiple adresses by a comma. - -To set the cluster endpoint(s) programatically, pass a configuration object -to the `elasticsearch.NewClient()` function. - -```golang -cfg := elasticsearch.Config{ - Addresses: []string{ - "http://localhost:9200", - "http://localhost:9201", - }, - // ... -} -es, err := elasticsearch.NewClient(cfg) -``` - -To set the username and password, include them in the endpoint URL, -or use the corresponding configuration options. - -```golang -cfg := elasticsearch.Config{ - // ... - Username: "foo", - Password: "bar", -} -``` - -To set a custom certificate authority used to sign the certificates of cluster nodes, -use the `CACert` configuration option. - -```golang -cert, _ := ioutil.ReadFile(*cacert) - -cfg := elasticsearch.Config{ - // ... - CACert: cert, -} -``` - -To configure other HTTP settings, pass an [`http.Transport`](https://golang.org/pkg/net/http/#Transport) -object in the configuration object. - -```golang -cfg := elasticsearch.Config{ - Transport: &http.Transport{ - MaxIdleConnsPerHost: 10, - ResponseHeaderTimeout: time.Second, - TLSClientConfig: &tls.Config{ - MinVersion: tls.VersionTLS11, - // ... - }, - // ... - }, -} -``` - -See the [`_examples/configuration.go`](_examples/configuration.go) and -[`_examples/customization.go`](_examples/customization.go) files for -more examples of configuration and customization of the client. -See the [`_examples/security`](_examples/security) for an example of a security configuration. - -The following example demonstrates a more complex usage. It fetches the Elasticsearch version from the cluster, indexes a couple of documents concurrently, and prints the search results, using a lightweight wrapper around the response body. - -```golang -// $ go run _examples/main.go - -package main - -import ( - "bytes" - "context" - "encoding/json" - "log" - "strconv" - "strings" - "sync" - - "github.com/elastic/go-elasticsearch/v7" - "github.com/elastic/go-elasticsearch/v7/esapi" -) - -func main() { - log.SetFlags(0) - - var ( - r map[string]interface{} - wg sync.WaitGroup - ) - - // Initialize a client with the default settings. - // - // An `ELASTICSEARCH_URL` environment variable will be used when exported. - // - es, err := elasticsearch.NewDefaultClient() - if err != nil { - log.Fatalf("Error creating the client: %s", err) - } - - // 1. Get cluster info - // - res, err := es.Info() - if err != nil { - log.Fatalf("Error getting response: %s", err) - } - defer res.Body.Close() - // Check response status - if res.IsError() { - log.Fatalf("Error: %s", res.String()) - } - // Deserialize the response into a map. - if err := json.NewDecoder(res.Body).Decode(&r); err != nil { - log.Fatalf("Error parsing the response body: %s", err) - } - // Print client and server version numbers. - log.Printf("Client: %s", elasticsearch.Version) - log.Printf("Server: %s", r["version"].(map[string]interface{})["number"]) - log.Println(strings.Repeat("~", 37)) - - // 2. Index documents concurrently - // - for i, title := range []string{"Test One", "Test Two"} { - wg.Add(1) - - go func(i int, title string) { - defer wg.Done() - - // Build the request body. - var b strings.Builder - b.WriteString(`{"title" : "`) - b.WriteString(title) - b.WriteString(`"}`) - - // Set up the request object. - req := esapi.IndexRequest{ - Index: "test", - DocumentID: strconv.Itoa(i + 1), - Body: strings.NewReader(b.String()), - Refresh: "true", - } - - // Perform the request with the client. - res, err := req.Do(context.Background(), es) - if err != nil { - log.Fatalf("Error getting response: %s", err) - } - defer res.Body.Close() - - if res.IsError() { - log.Printf("[%s] Error indexing document ID=%d", res.Status(), i+1) - } else { - // Deserialize the response into a map. - var r map[string]interface{} - if err := json.NewDecoder(res.Body).Decode(&r); err != nil { - log.Printf("Error parsing the response body: %s", err) - } else { - // Print the response status and indexed document version. - log.Printf("[%s] %s; version=%d", res.Status(), r["result"], int(r["_version"].(float64))) - } - } - }(i, title) - } - wg.Wait() - - log.Println(strings.Repeat("-", 37)) - - // 3. Search for the indexed documents - // - // Build the request body. - var buf bytes.Buffer - query := map[string]interface{}{ - "query": map[string]interface{}{ - "match": map[string]interface{}{ - "title": "test", - }, - }, - } - if err := json.NewEncoder(&buf).Encode(query); err != nil { - log.Fatalf("Error encoding query: %s", err) - } - - // Perform the search request. - res, err = es.Search( - es.Search.WithContext(context.Background()), - es.Search.WithIndex("test"), - es.Search.WithBody(&buf), - es.Search.WithTrackTotalHits(true), - es.Search.WithPretty(), - ) - if err != nil { - log.Fatalf("Error getting response: %s", err) - } - defer res.Body.Close() - - if res.IsError() { - var e map[string]interface{} - if err := json.NewDecoder(res.Body).Decode(&e); err != nil { - log.Fatalf("Error parsing the response body: %s", err) - } else { - // Print the response status and error information. - log.Fatalf("[%s] %s: %s", - res.Status(), - e["error"].(map[string]interface{})["type"], - e["error"].(map[string]interface{})["reason"], - ) - } - } - - if err := json.NewDecoder(res.Body).Decode(&r); err != nil { - log.Fatalf("Error parsing the response body: %s", err) - } - // Print the response status, number of results, and request duration. - log.Printf( - "[%s] %d hits; took: %dms", - res.Status(), - int(r["hits"].(map[string]interface{})["total"].(map[string]interface{})["value"].(float64)), - int(r["took"].(float64)), - ) - // Print the ID and document source for each hit. - for _, hit := range r["hits"].(map[string]interface{})["hits"].([]interface{}) { - log.Printf(" * ID=%s, %s", hit.(map[string]interface{})["_id"], hit.(map[string]interface{})["_source"]) - } - - log.Println(strings.Repeat("=", 37)) -} - -// Client: 7.0.0-SNAPSHOT -// Server: 7.0.0-SNAPSHOT -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// [201 Created] updated; version=1 -// [201 Created] updated; version=1 -// ------------------------------------- -// [200 OK] 2 hits; took: 5ms -// * ID=1, map[title:Test One] -// * ID=2, map[title:Test Two] -// ===================================== -``` - -As you see in the example above, the `esapi` package allows to call the Elasticsearch APIs in two distinct ways: either by creating a struct, such as `IndexRequest`, and calling its `Do()` method by passing it a context and the client, or by calling the `Search()` function on the client directly, using the option functions such as `WithIndex()`. See more information and examples in the -[package documentation](https://godoc.org/github.com/elastic/go-elasticsearch/esapi). - -The `estransport` package handles the transfer of data to and from Elasticsearch, including retrying failed requests, keeping a connection pool, discovering cluster nodes and logging. - -Read more about the client internals and usage in the following blog posts: - -* https://www.elastic.co/blog/the-go-client-for-elasticsearch-introduction -* https://www.elastic.co/blog/the-go-client-for-elasticsearch-configuration-and-customization -* https://www.elastic.co/blog/the-go-client-for-elasticsearch-working-with-data - - - -## Helpers - -The `esutil` package provides convenience helpers for working with the client. At the moment, it provides the `esutil.JSONReader()` and the `esutil.BulkIndexer` helpers. - - - -## Examples - -The **[`_examples`](./_examples)** folder contains a number of recipes and comprehensive examples to get you started with the client, including configuration and customization of the client, using a custom certificate authority (CA) for security (TLS), mocking the transport for unit tests, embedding the client in a custom type, building queries, performing requests individually and in bulk, and parsing the responses. - - - -## License - -(c) 2019 Elasticsearch. Licensed under the Apache License, Version 2.0. diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/doc.go b/vendor/github.com/elastic/go-elasticsearch/v7/doc.go deleted file mode 100644 index 2591cbadf..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/doc.go +++ /dev/null @@ -1,67 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -/* -Package elasticsearch provides a Go client for Elasticsearch. - -Create the client with the NewDefaultClient function: - - elasticsearch.NewDefaultClient() - -The ELASTICSEARCH_URL environment variable is used instead of the default URL, when set. -Use a comma to separate multiple URLs. - -To configure the client, pass a Config object to the NewClient function: - - cfg := elasticsearch.Config{ - Addresses: []string{ - "http://localhost:9200", - "http://localhost:9201", - }, - Username: "foo", - Password: "bar", - Transport: &http.Transport{ - MaxIdleConnsPerHost: 10, - ResponseHeaderTimeout: time.Second, - DialContext: (&net.Dialer{Timeout: time.Second}).DialContext, - TLSClientConfig: &tls.Config{ - MinVersion: tls.VersionTLS11, - }, - }, - } - - elasticsearch.NewClient(cfg) - -When using the Elastic Service (https://elastic.co/cloud), you can use CloudID instead of Addresses. -When either Addresses or CloudID is set, the ELASTICSEARCH_URL environment variable is ignored. - -See the elasticsearch_integration_test.go file and the _examples folder for more information. - -Call the Elasticsearch APIs by invoking the corresponding methods on the client: - - res, err := es.Info() - if err != nil { - log.Fatalf("Error getting response: %s", err) - } - - log.Println(res) - -See the github.com/elastic/go-elasticsearch/esapi package for more information about using the API. - -See the github.com/elastic/go-elasticsearch/estransport package for more information about configuring the transport. -*/ -package elasticsearch diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/elasticsearch.go b/vendor/github.com/elastic/go-elasticsearch/v7/elasticsearch.go deleted file mode 100644 index c0589056b..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/elasticsearch.go +++ /dev/null @@ -1,271 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -package elasticsearch - -import ( - "encoding/base64" - "errors" - "fmt" - "net/http" - "net/url" - "os" - "strings" - "time" - - "github.com/elastic/go-elasticsearch/v7/esapi" - "github.com/elastic/go-elasticsearch/v7/estransport" - "github.com/elastic/go-elasticsearch/v7/internal/version" -) - -const ( - defaultURL = "http://localhost:9200" -) - -// Version returns the package version as a string. -// -const Version = version.Client - -// Config represents the client configuration. -// -type Config struct { - Addresses []string // A list of Elasticsearch nodes to use. - Username string // Username for HTTP Basic Authentication. - Password string // Password for HTTP Basic Authentication. - - CloudID string // Endpoint for the Elastic Service (https://elastic.co/cloud). - APIKey string // Base64-encoded token for authorization; if set, overrides username/password and service token. - ServiceToken string // Service token for authorization; if set, overrides username/password. - - Header http.Header // Global HTTP request header. - - // PEM-encoded certificate authorities. - // When set, an empty certificate pool will be created, and the certificates will be appended to it. - // The option is only valid when the transport is not specified, or when it's http.Transport. - CACert []byte - - RetryOnStatus []int // List of status codes for retry. Default: 502, 503, 504. - DisableRetry bool // Default: false. - EnableRetryOnTimeout bool // Default: false. - MaxRetries int // Default: 3. - - DiscoverNodesOnStart bool // Discover nodes when initializing the client. Default: false. - DiscoverNodesInterval time.Duration // Discover nodes periodically. Default: disabled. - - EnableMetrics bool // Enable the metrics collection. - EnableDebugLogger bool // Enable the debug logging. - - DisableMetaHeader bool // Disable the additional "X-Elastic-Client-Meta" HTTP header. - - RetryBackoff func(attempt int) time.Duration // Optional backoff duration. Default: nil. - - Transport http.RoundTripper // The HTTP transport object. - Logger estransport.Logger // The logger object. - Selector estransport.Selector // The selector object. - - // Optional constructor function for a custom ConnectionPool. Default: nil. - ConnectionPoolFunc func([]*estransport.Connection, estransport.Selector) estransport.ConnectionPool -} - -// Client represents the Elasticsearch client. -// -type Client struct { - *esapi.API // Embeds the API methods - Transport estransport.Interface -} - -// NewDefaultClient creates a new client with default options. -// -// It will use http://localhost:9200 as the default address. -// -// It will use the ELASTICSEARCH_URL environment variable, if set, -// to configure the addresses; use a comma to separate multiple URLs. -// -func NewDefaultClient() (*Client, error) { - return NewClient(Config{}) -} - -// NewClient creates a new client with configuration from cfg. -// -// It will use http://localhost:9200 as the default address. -// -// It will use the ELASTICSEARCH_URL environment variable, if set, -// to configure the addresses; use a comma to separate multiple URLs. -// -// If either cfg.Addresses or cfg.CloudID is set, the ELASTICSEARCH_URL -// environment variable is ignored. -// -// It's an error to set both cfg.Addresses and cfg.CloudID. -// -func NewClient(cfg Config) (*Client, error) { - var addrs []string - - if len(cfg.Addresses) == 0 && cfg.CloudID == "" { - addrs = addrsFromEnvironment() - } else { - if len(cfg.Addresses) > 0 && cfg.CloudID != "" { - return nil, errors.New("cannot create client: both Addresses and CloudID are set") - } - - if cfg.CloudID != "" { - cloudAddr, err := addrFromCloudID(cfg.CloudID) - if err != nil { - return nil, fmt.Errorf("cannot create client: cannot parse CloudID: %s", err) - } - addrs = append(addrs, cloudAddr) - } - - if len(cfg.Addresses) > 0 { - addrs = append(addrs, cfg.Addresses...) - } - } - - urls, err := addrsToURLs(addrs) - if err != nil { - return nil, fmt.Errorf("cannot create client: %s", err) - } - - if len(urls) == 0 { - u, _ := url.Parse(defaultURL) // errcheck exclude - urls = append(urls, u) - } - - // TODO(karmi): Refactor - if urls[0].User != nil { - cfg.Username = urls[0].User.Username() - pw, _ := urls[0].User.Password() - cfg.Password = pw - } - - tp, err := estransport.New(estransport.Config{ - URLs: urls, - Username: cfg.Username, - Password: cfg.Password, - APIKey: cfg.APIKey, - ServiceToken: cfg.ServiceToken, - - Header: cfg.Header, - CACert: cfg.CACert, - - RetryOnStatus: cfg.RetryOnStatus, - DisableRetry: cfg.DisableRetry, - EnableRetryOnTimeout: cfg.EnableRetryOnTimeout, - MaxRetries: cfg.MaxRetries, - RetryBackoff: cfg.RetryBackoff, - - EnableMetrics: cfg.EnableMetrics, - EnableDebugLogger: cfg.EnableDebugLogger, - - DisableMetaHeader: cfg.DisableMetaHeader, - - DiscoverNodesInterval: cfg.DiscoverNodesInterval, - - Transport: cfg.Transport, - Logger: cfg.Logger, - Selector: cfg.Selector, - ConnectionPoolFunc: cfg.ConnectionPoolFunc, - }) - if err != nil { - return nil, fmt.Errorf("error creating transport: %s", err) - } - - client := &Client{Transport: tp, API: esapi.New(tp)} - - if cfg.DiscoverNodesOnStart { - go client.DiscoverNodes() - } - - return client, nil -} - -// Perform delegates to Transport to execute a request and return a response. -// -func (c *Client) Perform(req *http.Request) (*http.Response, error) { - return c.Transport.Perform(req) -} - -// Metrics returns the client metrics. -// -func (c *Client) Metrics() (estransport.Metrics, error) { - if mt, ok := c.Transport.(estransport.Measurable); ok { - return mt.Metrics() - } - return estransport.Metrics{}, errors.New("transport is missing method Metrics()") -} - -// DiscoverNodes reloads the client connections by fetching information from the cluster. -// -func (c *Client) DiscoverNodes() error { - if dt, ok := c.Transport.(estransport.Discoverable); ok { - return dt.DiscoverNodes() - } - return errors.New("transport is missing method DiscoverNodes()") -} - -// addrsFromEnvironment returns a list of addresses by splitting -// the ELASTICSEARCH_URL environment variable with comma, or an empty list. -// -func addrsFromEnvironment() []string { - var addrs []string - - if envURLs, ok := os.LookupEnv("ELASTICSEARCH_URL"); ok && envURLs != "" { - list := strings.Split(envURLs, ",") - for _, u := range list { - addrs = append(addrs, strings.TrimSpace(u)) - } - } - - return addrs -} - -// addrsToURLs creates a list of url.URL structures from url list. -// -func addrsToURLs(addrs []string) ([]*url.URL, error) { - var urls []*url.URL - for _, addr := range addrs { - u, err := url.Parse(strings.TrimRight(addr, "/")) - if err != nil { - return nil, fmt.Errorf("cannot parse url: %v", err) - } - - urls = append(urls, u) - } - return urls, nil -} - -// addrFromCloudID extracts the Elasticsearch URL from CloudID. -// See: https://www.elastic.co/guide/en/cloud/current/ec-cloud-id.html -// -func addrFromCloudID(input string) (string, error) { - var scheme = "https://" - - values := strings.Split(input, ":") - if len(values) != 2 { - return "", fmt.Errorf("unexpected format: %q", input) - } - data, err := base64.StdEncoding.DecodeString(values[1]) - if err != nil { - return "", err - } - parts := strings.Split(string(data), "$") - - if len(parts) < 2 { - return "", fmt.Errorf("invalid encoded value: %s", parts) - } - - return fmt.Sprintf("%s%s.%s", scheme, parts[1], parts[0]), nil -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api._.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api._.go deleted file mode 100644 index a18b2efc0..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api._.go +++ /dev/null @@ -1,937 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1 (9a77580): DO NOT EDIT - -package esapi - -// API contains the Elasticsearch APIs -// -type API struct { - Cat *Cat - Cluster *Cluster - Indices *Indices - Ingest *Ingest - Nodes *Nodes - Remote *Remote - Snapshot *Snapshot - Tasks *Tasks - AsyncSearch *AsyncSearch - CCR *CCR - ILM *ILM - License *License - Migration *Migration - ML *ML - Monitoring *Monitoring - Rollup *Rollup - Security *Security - SQL *SQL - SSL *SSL - Watcher *Watcher - XPack *XPack - - AutoscalingDeleteAutoscalingPolicy AutoscalingDeleteAutoscalingPolicy - AutoscalingGetAutoscalingCapacity AutoscalingGetAutoscalingCapacity - AutoscalingGetAutoscalingDecision AutoscalingGetAutoscalingDecision - AutoscalingGetAutoscalingPolicy AutoscalingGetAutoscalingPolicy - AutoscalingPutAutoscalingPolicy AutoscalingPutAutoscalingPolicy - Bulk Bulk - ClearScroll ClearScroll - ClosePointInTime ClosePointInTime - Count Count - Create Create - DanglingIndicesDeleteDanglingIndex DanglingIndicesDeleteDanglingIndex - DanglingIndicesImportDanglingIndex DanglingIndicesImportDanglingIndex - DanglingIndicesListDanglingIndices DanglingIndicesListDanglingIndices - DataFrameTransformDeprecatedDeleteTransform DataFrameTransformDeprecatedDeleteTransform - DataFrameTransformDeprecatedGetTransform DataFrameTransformDeprecatedGetTransform - DataFrameTransformDeprecatedGetTransformStats DataFrameTransformDeprecatedGetTransformStats - DataFrameTransformDeprecatedPreviewTransform DataFrameTransformDeprecatedPreviewTransform - DataFrameTransformDeprecatedPutTransform DataFrameTransformDeprecatedPutTransform - DataFrameTransformDeprecatedStartTransform DataFrameTransformDeprecatedStartTransform - DataFrameTransformDeprecatedStopTransform DataFrameTransformDeprecatedStopTransform - DataFrameTransformDeprecatedUpdateTransform DataFrameTransformDeprecatedUpdateTransform - DeleteByQuery DeleteByQuery - DeleteByQueryRethrottle DeleteByQueryRethrottle - Delete Delete - DeleteScript DeleteScript - EnrichDeletePolicy EnrichDeletePolicy - EnrichExecutePolicy EnrichExecutePolicy - EnrichGetPolicy EnrichGetPolicy - EnrichPutPolicy EnrichPutPolicy - EnrichStats EnrichStats - EqlDelete EqlDelete - EqlGet EqlGet - EqlGetStatus EqlGetStatus - EqlSearch EqlSearch - Exists Exists - ExistsSource ExistsSource - Explain Explain - FeaturesGetFeatures FeaturesGetFeatures - FeaturesResetFeatures FeaturesResetFeatures - FieldCaps FieldCaps - FleetGlobalCheckpoints FleetGlobalCheckpoints - Get Get - GetScriptContext GetScriptContext - GetScriptLanguages GetScriptLanguages - GetScript GetScript - GetSource GetSource - GraphExplore GraphExplore - Index Index - Info Info - LogstashDeletePipeline LogstashDeletePipeline - LogstashGetPipeline LogstashGetPipeline - LogstashPutPipeline LogstashPutPipeline - Mget Mget - Msearch Msearch - MsearchTemplate MsearchTemplate - Mtermvectors Mtermvectors - OpenPointInTime OpenPointInTime - Ping Ping - PutScript PutScript - RankEval RankEval - Reindex Reindex - ReindexRethrottle ReindexRethrottle - RenderSearchTemplate RenderSearchTemplate - ScriptsPainlessExecute ScriptsPainlessExecute - Scroll Scroll - Search Search - SearchShards SearchShards - SearchTemplate SearchTemplate - SearchableSnapshotsCacheStats SearchableSnapshotsCacheStats - SearchableSnapshotsClearCache SearchableSnapshotsClearCache - SearchableSnapshotsMount SearchableSnapshotsMount - SearchableSnapshotsRepositoryStats SearchableSnapshotsRepositoryStats - SearchableSnapshotsStats SearchableSnapshotsStats - ShutdownDeleteNode ShutdownDeleteNode - ShutdownGetNode ShutdownGetNode - ShutdownPutNode ShutdownPutNode - SlmDeleteLifecycle SlmDeleteLifecycle - SlmExecuteLifecycle SlmExecuteLifecycle - SlmExecuteRetention SlmExecuteRetention - SlmGetLifecycle SlmGetLifecycle - SlmGetStats SlmGetStats - SlmGetStatus SlmGetStatus - SlmPutLifecycle SlmPutLifecycle - SlmStart SlmStart - SlmStop SlmStop - Termvectors Termvectors - TextStructureFindStructure TextStructureFindStructure - TransformDeleteTransform TransformDeleteTransform - TransformGetTransform TransformGetTransform - TransformGetTransformStats TransformGetTransformStats - TransformPreviewTransform TransformPreviewTransform - TransformPutTransform TransformPutTransform - TransformStartTransform TransformStartTransform - TransformStopTransform TransformStopTransform - TransformUpdateTransform TransformUpdateTransform - UpdateByQuery UpdateByQuery - UpdateByQueryRethrottle UpdateByQueryRethrottle - Update Update -} - -// Cat contains the Cat APIs -type Cat struct { - Aliases CatAliases - Allocation CatAllocation - Count CatCount - Fielddata CatFielddata - Health CatHealth - Help CatHelp - Indices CatIndices - MLDataFrameAnalytics CatMLDataFrameAnalytics - MLDatafeeds CatMLDatafeeds - MLJobs CatMLJobs - MLTrainedModels CatMLTrainedModels - Master CatMaster - Nodeattrs CatNodeattrs - Nodes CatNodes - PendingTasks CatPendingTasks - Plugins CatPlugins - Recovery CatRecovery - Repositories CatRepositories - Segments CatSegments - Shards CatShards - Snapshots CatSnapshots - Tasks CatTasks - Templates CatTemplates - ThreadPool CatThreadPool - Transforms CatTransforms -} - -// Cluster contains the Cluster APIs -type Cluster struct { - AllocationExplain ClusterAllocationExplain - DeleteComponentTemplate ClusterDeleteComponentTemplate - DeleteVotingConfigExclusions ClusterDeleteVotingConfigExclusions - ExistsComponentTemplate ClusterExistsComponentTemplate - GetComponentTemplate ClusterGetComponentTemplate - GetSettings ClusterGetSettings - Health ClusterHealth - PendingTasks ClusterPendingTasks - PostVotingConfigExclusions ClusterPostVotingConfigExclusions - PutComponentTemplate ClusterPutComponentTemplate - PutSettings ClusterPutSettings - RemoteInfo ClusterRemoteInfo - Reroute ClusterReroute - State ClusterState - Stats ClusterStats -} - -// Indices contains the Indices APIs -type Indices struct { - AddBlock IndicesAddBlock - Analyze IndicesAnalyze - ClearCache IndicesClearCache - Clone IndicesClone - Close IndicesClose - CreateDataStream IndicesCreateDataStream - Create IndicesCreate - DataStreamsStats IndicesDataStreamsStats - DeleteAlias IndicesDeleteAlias - DeleteDataStream IndicesDeleteDataStream - DeleteIndexTemplate IndicesDeleteIndexTemplate - Delete IndicesDelete - DeleteTemplate IndicesDeleteTemplate - ExistsAlias IndicesExistsAlias - ExistsDocumentType IndicesExistsDocumentType - ExistsIndexTemplate IndicesExistsIndexTemplate - Exists IndicesExists - ExistsTemplate IndicesExistsTemplate - Flush IndicesFlush - FlushSynced IndicesFlushSynced - Forcemerge IndicesForcemerge - Freeze IndicesFreeze - GetAlias IndicesGetAlias - GetDataStream IndicesGetDataStream - GetFieldMapping IndicesGetFieldMapping - GetIndexTemplate IndicesGetIndexTemplate - GetMapping IndicesGetMapping - Get IndicesGet - GetSettings IndicesGetSettings - GetTemplate IndicesGetTemplate - GetUpgrade IndicesGetUpgrade - MigrateToDataStream IndicesMigrateToDataStream - Open IndicesOpen - PromoteDataStream IndicesPromoteDataStream - PutAlias IndicesPutAlias - PutIndexTemplate IndicesPutIndexTemplate - PutMapping IndicesPutMapping - PutSettings IndicesPutSettings - PutTemplate IndicesPutTemplate - Recovery IndicesRecovery - Refresh IndicesRefresh - ReloadSearchAnalyzers IndicesReloadSearchAnalyzers - ResolveIndex IndicesResolveIndex - Rollover IndicesRollover - Segments IndicesSegments - ShardStores IndicesShardStores - Shrink IndicesShrink - SimulateIndexTemplate IndicesSimulateIndexTemplate - SimulateTemplate IndicesSimulateTemplate - Split IndicesSplit - Stats IndicesStats - Unfreeze IndicesUnfreeze - UpdateAliases IndicesUpdateAliases - Upgrade IndicesUpgrade - ValidateQuery IndicesValidateQuery -} - -// Ingest contains the Ingest APIs -type Ingest struct { - DeletePipeline IngestDeletePipeline - GeoIPStats IngestGeoIPStats - GetPipeline IngestGetPipeline - ProcessorGrok IngestProcessorGrok - PutPipeline IngestPutPipeline - Simulate IngestSimulate -} - -// Nodes contains the Nodes APIs -type Nodes struct { - HotThreads NodesHotThreads - Info NodesInfo - ReloadSecureSettings NodesReloadSecureSettings - Stats NodesStats - Usage NodesUsage -} - -// Remote contains the Remote APIs -type Remote struct { -} - -// Snapshot contains the Snapshot APIs -type Snapshot struct { - CleanupRepository SnapshotCleanupRepository - Clone SnapshotClone - CreateRepository SnapshotCreateRepository - Create SnapshotCreate - DeleteRepository SnapshotDeleteRepository - Delete SnapshotDelete - GetRepository SnapshotGetRepository - Get SnapshotGet - RepositoryAnalyze SnapshotRepositoryAnalyze - Restore SnapshotRestore - Status SnapshotStatus - VerifyRepository SnapshotVerifyRepository -} - -// Tasks contains the Tasks APIs -type Tasks struct { - Cancel TasksCancel - Get TasksGet - List TasksList -} - -// AsyncSearch contains the AsyncSearch APIs -type AsyncSearch struct { - Delete AsyncSearchDelete - Get AsyncSearchGet - Status AsyncSearchStatus - Submit AsyncSearchSubmit -} - -// CCR contains the CCR APIs -type CCR struct { - DeleteAutoFollowPattern CCRDeleteAutoFollowPattern - FollowInfo CCRFollowInfo - Follow CCRFollow - FollowStats CCRFollowStats - ForgetFollower CCRForgetFollower - GetAutoFollowPattern CCRGetAutoFollowPattern - PauseAutoFollowPattern CCRPauseAutoFollowPattern - PauseFollow CCRPauseFollow - PutAutoFollowPattern CCRPutAutoFollowPattern - ResumeAutoFollowPattern CCRResumeAutoFollowPattern - ResumeFollow CCRResumeFollow - Stats CCRStats - Unfollow CCRUnfollow -} - -// ILM contains the ILM APIs -type ILM struct { - DeleteLifecycle ILMDeleteLifecycle - ExplainLifecycle ILMExplainLifecycle - GetLifecycle ILMGetLifecycle - GetStatus ILMGetStatus - MoveToStep ILMMoveToStep - PutLifecycle ILMPutLifecycle - RemovePolicy ILMRemovePolicy - Retry ILMRetry - Start ILMStart - Stop ILMStop -} - -// License contains the License APIs -type License struct { - Delete LicenseDelete - GetBasicStatus LicenseGetBasicStatus - Get LicenseGet - GetTrialStatus LicenseGetTrialStatus - Post LicensePost - PostStartBasic LicensePostStartBasic - PostStartTrial LicensePostStartTrial -} - -// Migration contains the Migration APIs -type Migration struct { - Deprecations MigrationDeprecations -} - -// ML contains the ML APIs -type ML struct { - CloseJob MLCloseJob - DeleteCalendarEvent MLDeleteCalendarEvent - DeleteCalendarJob MLDeleteCalendarJob - DeleteCalendar MLDeleteCalendar - DeleteDataFrameAnalytics MLDeleteDataFrameAnalytics - DeleteDatafeed MLDeleteDatafeed - DeleteExpiredData MLDeleteExpiredData - DeleteFilter MLDeleteFilter - DeleteForecast MLDeleteForecast - DeleteJob MLDeleteJob - DeleteModelSnapshot MLDeleteModelSnapshot - DeleteTrainedModelAlias MLDeleteTrainedModelAlias - DeleteTrainedModel MLDeleteTrainedModel - EstimateModelMemory MLEstimateModelMemory - EvaluateDataFrame MLEvaluateDataFrame - ExplainDataFrameAnalytics MLExplainDataFrameAnalytics - FindFileStructure MLFindFileStructure - FlushJob MLFlushJob - Forecast MLForecast - GetBuckets MLGetBuckets - GetCalendarEvents MLGetCalendarEvents - GetCalendars MLGetCalendars - GetCategories MLGetCategories - GetDataFrameAnalytics MLGetDataFrameAnalytics - GetDataFrameAnalyticsStats MLGetDataFrameAnalyticsStats - GetDatafeedStats MLGetDatafeedStats - GetDatafeeds MLGetDatafeeds - GetFilters MLGetFilters - GetInfluencers MLGetInfluencers - GetJobStats MLGetJobStats - GetJobs MLGetJobs - GetModelSnapshots MLGetModelSnapshots - GetOverallBuckets MLGetOverallBuckets - GetRecords MLGetRecords - GetTrainedModels MLGetTrainedModels - GetTrainedModelsStats MLGetTrainedModelsStats - Info MLInfo - OpenJob MLOpenJob - PostCalendarEvents MLPostCalendarEvents - PostData MLPostData - PreviewDataFrameAnalytics MLPreviewDataFrameAnalytics - PreviewDatafeed MLPreviewDatafeed - PutCalendarJob MLPutCalendarJob - PutCalendar MLPutCalendar - PutDataFrameAnalytics MLPutDataFrameAnalytics - PutDatafeed MLPutDatafeed - PutFilter MLPutFilter - PutJob MLPutJob - PutTrainedModelAlias MLPutTrainedModelAlias - PutTrainedModel MLPutTrainedModel - RevertModelSnapshot MLRevertModelSnapshot - SetUpgradeMode MLSetUpgradeMode - StartDataFrameAnalytics MLStartDataFrameAnalytics - StartDatafeed MLStartDatafeed - StopDataFrameAnalytics MLStopDataFrameAnalytics - StopDatafeed MLStopDatafeed - UpdateDataFrameAnalytics MLUpdateDataFrameAnalytics - UpdateDatafeed MLUpdateDatafeed - UpdateFilter MLUpdateFilter - UpdateJob MLUpdateJob - UpdateModelSnapshot MLUpdateModelSnapshot - UpgradeJobSnapshot MLUpgradeJobSnapshot - ValidateDetector MLValidateDetector - Validate MLValidate -} - -// Monitoring contains the Monitoring APIs -type Monitoring struct { - Bulk MonitoringBulk -} - -// Rollup contains the Rollup APIs -type Rollup struct { - DeleteJob RollupDeleteJob - GetJobs RollupGetJobs - GetCaps RollupGetRollupCaps - GetIndexCaps RollupGetRollupIndexCaps - PutJob RollupPutJob - Rollup RollupRollup - Search RollupRollupSearch - StartJob RollupStartJob - StopJob RollupStopJob -} - -// Security contains the Security APIs -type Security struct { - Authenticate SecurityAuthenticate - ChangePassword SecurityChangePassword - ClearAPIKeyCache SecurityClearAPIKeyCache - ClearCachedPrivileges SecurityClearCachedPrivileges - ClearCachedRealms SecurityClearCachedRealms - ClearCachedRoles SecurityClearCachedRoles - ClearCachedServiceTokens SecurityClearCachedServiceTokens - CreateAPIKey SecurityCreateAPIKey - CreateServiceToken SecurityCreateServiceToken - DeletePrivileges SecurityDeletePrivileges - DeleteRoleMapping SecurityDeleteRoleMapping - DeleteRole SecurityDeleteRole - DeleteServiceToken SecurityDeleteServiceToken - DeleteUser SecurityDeleteUser - DisableUser SecurityDisableUser - EnableUser SecurityEnableUser - GetAPIKey SecurityGetAPIKey - GetBuiltinPrivileges SecurityGetBuiltinPrivileges - GetPrivileges SecurityGetPrivileges - GetRoleMapping SecurityGetRoleMapping - GetRole SecurityGetRole - GetServiceAccounts SecurityGetServiceAccounts - GetServiceCredentials SecurityGetServiceCredentials - GetToken SecurityGetToken - GetUserPrivileges SecurityGetUserPrivileges - GetUser SecurityGetUser - GrantAPIKey SecurityGrantAPIKey - HasPrivileges SecurityHasPrivileges - InvalidateAPIKey SecurityInvalidateAPIKey - InvalidateToken SecurityInvalidateToken - PutPrivileges SecurityPutPrivileges - PutRoleMapping SecurityPutRoleMapping - PutRole SecurityPutRole - PutUser SecurityPutUser -} - -// SQL contains the SQL APIs -type SQL struct { - ClearCursor SQLClearCursor - Query SQLQuery - Translate SQLTranslate -} - -// SSL contains the SSL APIs -type SSL struct { - Certificates SSLCertificates -} - -// Watcher contains the Watcher APIs -type Watcher struct { - AckWatch WatcherAckWatch - ActivateWatch WatcherActivateWatch - DeactivateWatch WatcherDeactivateWatch - DeleteWatch WatcherDeleteWatch - ExecuteWatch WatcherExecuteWatch - GetWatch WatcherGetWatch - PutWatch WatcherPutWatch - QueryWatches WatcherQueryWatches - Start WatcherStart - Stats WatcherStats - Stop WatcherStop -} - -// XPack contains the XPack APIs -type XPack struct { - Info XPackInfo - Usage XPackUsage -} - -// New creates new API -// -func New(t Transport) *API { - return &API{ - AutoscalingDeleteAutoscalingPolicy: newAutoscalingDeleteAutoscalingPolicyFunc(t), - AutoscalingGetAutoscalingCapacity: newAutoscalingGetAutoscalingCapacityFunc(t), - AutoscalingGetAutoscalingDecision: newAutoscalingGetAutoscalingDecisionFunc(t), - AutoscalingGetAutoscalingPolicy: newAutoscalingGetAutoscalingPolicyFunc(t), - AutoscalingPutAutoscalingPolicy: newAutoscalingPutAutoscalingPolicyFunc(t), - Bulk: newBulkFunc(t), - ClearScroll: newClearScrollFunc(t), - ClosePointInTime: newClosePointInTimeFunc(t), - Count: newCountFunc(t), - Create: newCreateFunc(t), - DanglingIndicesDeleteDanglingIndex: newDanglingIndicesDeleteDanglingIndexFunc(t), - DanglingIndicesImportDanglingIndex: newDanglingIndicesImportDanglingIndexFunc(t), - DanglingIndicesListDanglingIndices: newDanglingIndicesListDanglingIndicesFunc(t), - DataFrameTransformDeprecatedDeleteTransform: newDataFrameTransformDeprecatedDeleteTransformFunc(t), - DataFrameTransformDeprecatedGetTransform: newDataFrameTransformDeprecatedGetTransformFunc(t), - DataFrameTransformDeprecatedGetTransformStats: newDataFrameTransformDeprecatedGetTransformStatsFunc(t), - DataFrameTransformDeprecatedPreviewTransform: newDataFrameTransformDeprecatedPreviewTransformFunc(t), - DataFrameTransformDeprecatedPutTransform: newDataFrameTransformDeprecatedPutTransformFunc(t), - DataFrameTransformDeprecatedStartTransform: newDataFrameTransformDeprecatedStartTransformFunc(t), - DataFrameTransformDeprecatedStopTransform: newDataFrameTransformDeprecatedStopTransformFunc(t), - DataFrameTransformDeprecatedUpdateTransform: newDataFrameTransformDeprecatedUpdateTransformFunc(t), - DeleteByQuery: newDeleteByQueryFunc(t), - DeleteByQueryRethrottle: newDeleteByQueryRethrottleFunc(t), - Delete: newDeleteFunc(t), - DeleteScript: newDeleteScriptFunc(t), - EnrichDeletePolicy: newEnrichDeletePolicyFunc(t), - EnrichExecutePolicy: newEnrichExecutePolicyFunc(t), - EnrichGetPolicy: newEnrichGetPolicyFunc(t), - EnrichPutPolicy: newEnrichPutPolicyFunc(t), - EnrichStats: newEnrichStatsFunc(t), - EqlDelete: newEqlDeleteFunc(t), - EqlGet: newEqlGetFunc(t), - EqlGetStatus: newEqlGetStatusFunc(t), - EqlSearch: newEqlSearchFunc(t), - Exists: newExistsFunc(t), - ExistsSource: newExistsSourceFunc(t), - Explain: newExplainFunc(t), - FeaturesGetFeatures: newFeaturesGetFeaturesFunc(t), - FeaturesResetFeatures: newFeaturesResetFeaturesFunc(t), - FieldCaps: newFieldCapsFunc(t), - FleetGlobalCheckpoints: newFleetGlobalCheckpointsFunc(t), - Get: newGetFunc(t), - GetScriptContext: newGetScriptContextFunc(t), - GetScriptLanguages: newGetScriptLanguagesFunc(t), - GetScript: newGetScriptFunc(t), - GetSource: newGetSourceFunc(t), - GraphExplore: newGraphExploreFunc(t), - Index: newIndexFunc(t), - Info: newInfoFunc(t), - LogstashDeletePipeline: newLogstashDeletePipelineFunc(t), - LogstashGetPipeline: newLogstashGetPipelineFunc(t), - LogstashPutPipeline: newLogstashPutPipelineFunc(t), - Mget: newMgetFunc(t), - Msearch: newMsearchFunc(t), - MsearchTemplate: newMsearchTemplateFunc(t), - Mtermvectors: newMtermvectorsFunc(t), - OpenPointInTime: newOpenPointInTimeFunc(t), - Ping: newPingFunc(t), - PutScript: newPutScriptFunc(t), - RankEval: newRankEvalFunc(t), - Reindex: newReindexFunc(t), - ReindexRethrottle: newReindexRethrottleFunc(t), - RenderSearchTemplate: newRenderSearchTemplateFunc(t), - ScriptsPainlessExecute: newScriptsPainlessExecuteFunc(t), - Scroll: newScrollFunc(t), - Search: newSearchFunc(t), - SearchShards: newSearchShardsFunc(t), - SearchTemplate: newSearchTemplateFunc(t), - SearchableSnapshotsCacheStats: newSearchableSnapshotsCacheStatsFunc(t), - SearchableSnapshotsClearCache: newSearchableSnapshotsClearCacheFunc(t), - SearchableSnapshotsMount: newSearchableSnapshotsMountFunc(t), - SearchableSnapshotsRepositoryStats: newSearchableSnapshotsRepositoryStatsFunc(t), - SearchableSnapshotsStats: newSearchableSnapshotsStatsFunc(t), - ShutdownDeleteNode: newShutdownDeleteNodeFunc(t), - ShutdownGetNode: newShutdownGetNodeFunc(t), - ShutdownPutNode: newShutdownPutNodeFunc(t), - SlmDeleteLifecycle: newSlmDeleteLifecycleFunc(t), - SlmExecuteLifecycle: newSlmExecuteLifecycleFunc(t), - SlmExecuteRetention: newSlmExecuteRetentionFunc(t), - SlmGetLifecycle: newSlmGetLifecycleFunc(t), - SlmGetStats: newSlmGetStatsFunc(t), - SlmGetStatus: newSlmGetStatusFunc(t), - SlmPutLifecycle: newSlmPutLifecycleFunc(t), - SlmStart: newSlmStartFunc(t), - SlmStop: newSlmStopFunc(t), - Termvectors: newTermvectorsFunc(t), - TextStructureFindStructure: newTextStructureFindStructureFunc(t), - TransformDeleteTransform: newTransformDeleteTransformFunc(t), - TransformGetTransform: newTransformGetTransformFunc(t), - TransformGetTransformStats: newTransformGetTransformStatsFunc(t), - TransformPreviewTransform: newTransformPreviewTransformFunc(t), - TransformPutTransform: newTransformPutTransformFunc(t), - TransformStartTransform: newTransformStartTransformFunc(t), - TransformStopTransform: newTransformStopTransformFunc(t), - TransformUpdateTransform: newTransformUpdateTransformFunc(t), - UpdateByQuery: newUpdateByQueryFunc(t), - UpdateByQueryRethrottle: newUpdateByQueryRethrottleFunc(t), - Update: newUpdateFunc(t), - Cat: &Cat{ - Aliases: newCatAliasesFunc(t), - Allocation: newCatAllocationFunc(t), - Count: newCatCountFunc(t), - Fielddata: newCatFielddataFunc(t), - Health: newCatHealthFunc(t), - Help: newCatHelpFunc(t), - Indices: newCatIndicesFunc(t), - MLDataFrameAnalytics: newCatMLDataFrameAnalyticsFunc(t), - MLDatafeeds: newCatMLDatafeedsFunc(t), - MLJobs: newCatMLJobsFunc(t), - MLTrainedModels: newCatMLTrainedModelsFunc(t), - Master: newCatMasterFunc(t), - Nodeattrs: newCatNodeattrsFunc(t), - Nodes: newCatNodesFunc(t), - PendingTasks: newCatPendingTasksFunc(t), - Plugins: newCatPluginsFunc(t), - Recovery: newCatRecoveryFunc(t), - Repositories: newCatRepositoriesFunc(t), - Segments: newCatSegmentsFunc(t), - Shards: newCatShardsFunc(t), - Snapshots: newCatSnapshotsFunc(t), - Tasks: newCatTasksFunc(t), - Templates: newCatTemplatesFunc(t), - ThreadPool: newCatThreadPoolFunc(t), - Transforms: newCatTransformsFunc(t), - }, - Cluster: &Cluster{ - AllocationExplain: newClusterAllocationExplainFunc(t), - DeleteComponentTemplate: newClusterDeleteComponentTemplateFunc(t), - DeleteVotingConfigExclusions: newClusterDeleteVotingConfigExclusionsFunc(t), - ExistsComponentTemplate: newClusterExistsComponentTemplateFunc(t), - GetComponentTemplate: newClusterGetComponentTemplateFunc(t), - GetSettings: newClusterGetSettingsFunc(t), - Health: newClusterHealthFunc(t), - PendingTasks: newClusterPendingTasksFunc(t), - PostVotingConfigExclusions: newClusterPostVotingConfigExclusionsFunc(t), - PutComponentTemplate: newClusterPutComponentTemplateFunc(t), - PutSettings: newClusterPutSettingsFunc(t), - RemoteInfo: newClusterRemoteInfoFunc(t), - Reroute: newClusterRerouteFunc(t), - State: newClusterStateFunc(t), - Stats: newClusterStatsFunc(t), - }, - Indices: &Indices{ - AddBlock: newIndicesAddBlockFunc(t), - Analyze: newIndicesAnalyzeFunc(t), - ClearCache: newIndicesClearCacheFunc(t), - Clone: newIndicesCloneFunc(t), - Close: newIndicesCloseFunc(t), - CreateDataStream: newIndicesCreateDataStreamFunc(t), - Create: newIndicesCreateFunc(t), - DataStreamsStats: newIndicesDataStreamsStatsFunc(t), - DeleteAlias: newIndicesDeleteAliasFunc(t), - DeleteDataStream: newIndicesDeleteDataStreamFunc(t), - DeleteIndexTemplate: newIndicesDeleteIndexTemplateFunc(t), - Delete: newIndicesDeleteFunc(t), - DeleteTemplate: newIndicesDeleteTemplateFunc(t), - ExistsAlias: newIndicesExistsAliasFunc(t), - ExistsDocumentType: newIndicesExistsDocumentTypeFunc(t), - ExistsIndexTemplate: newIndicesExistsIndexTemplateFunc(t), - Exists: newIndicesExistsFunc(t), - ExistsTemplate: newIndicesExistsTemplateFunc(t), - Flush: newIndicesFlushFunc(t), - FlushSynced: newIndicesFlushSyncedFunc(t), - Forcemerge: newIndicesForcemergeFunc(t), - Freeze: newIndicesFreezeFunc(t), - GetAlias: newIndicesGetAliasFunc(t), - GetDataStream: newIndicesGetDataStreamFunc(t), - GetFieldMapping: newIndicesGetFieldMappingFunc(t), - GetIndexTemplate: newIndicesGetIndexTemplateFunc(t), - GetMapping: newIndicesGetMappingFunc(t), - Get: newIndicesGetFunc(t), - GetSettings: newIndicesGetSettingsFunc(t), - GetTemplate: newIndicesGetTemplateFunc(t), - GetUpgrade: newIndicesGetUpgradeFunc(t), - MigrateToDataStream: newIndicesMigrateToDataStreamFunc(t), - Open: newIndicesOpenFunc(t), - PromoteDataStream: newIndicesPromoteDataStreamFunc(t), - PutAlias: newIndicesPutAliasFunc(t), - PutIndexTemplate: newIndicesPutIndexTemplateFunc(t), - PutMapping: newIndicesPutMappingFunc(t), - PutSettings: newIndicesPutSettingsFunc(t), - PutTemplate: newIndicesPutTemplateFunc(t), - Recovery: newIndicesRecoveryFunc(t), - Refresh: newIndicesRefreshFunc(t), - ReloadSearchAnalyzers: newIndicesReloadSearchAnalyzersFunc(t), - ResolveIndex: newIndicesResolveIndexFunc(t), - Rollover: newIndicesRolloverFunc(t), - Segments: newIndicesSegmentsFunc(t), - ShardStores: newIndicesShardStoresFunc(t), - Shrink: newIndicesShrinkFunc(t), - SimulateIndexTemplate: newIndicesSimulateIndexTemplateFunc(t), - SimulateTemplate: newIndicesSimulateTemplateFunc(t), - Split: newIndicesSplitFunc(t), - Stats: newIndicesStatsFunc(t), - Unfreeze: newIndicesUnfreezeFunc(t), - UpdateAliases: newIndicesUpdateAliasesFunc(t), - Upgrade: newIndicesUpgradeFunc(t), - ValidateQuery: newIndicesValidateQueryFunc(t), - }, - Ingest: &Ingest{ - DeletePipeline: newIngestDeletePipelineFunc(t), - GeoIPStats: newIngestGeoIPStatsFunc(t), - GetPipeline: newIngestGetPipelineFunc(t), - ProcessorGrok: newIngestProcessorGrokFunc(t), - PutPipeline: newIngestPutPipelineFunc(t), - Simulate: newIngestSimulateFunc(t), - }, - Nodes: &Nodes{ - HotThreads: newNodesHotThreadsFunc(t), - Info: newNodesInfoFunc(t), - ReloadSecureSettings: newNodesReloadSecureSettingsFunc(t), - Stats: newNodesStatsFunc(t), - Usage: newNodesUsageFunc(t), - }, - Remote: &Remote{}, - Snapshot: &Snapshot{ - CleanupRepository: newSnapshotCleanupRepositoryFunc(t), - Clone: newSnapshotCloneFunc(t), - CreateRepository: newSnapshotCreateRepositoryFunc(t), - Create: newSnapshotCreateFunc(t), - DeleteRepository: newSnapshotDeleteRepositoryFunc(t), - Delete: newSnapshotDeleteFunc(t), - GetRepository: newSnapshotGetRepositoryFunc(t), - Get: newSnapshotGetFunc(t), - RepositoryAnalyze: newSnapshotRepositoryAnalyzeFunc(t), - Restore: newSnapshotRestoreFunc(t), - Status: newSnapshotStatusFunc(t), - VerifyRepository: newSnapshotVerifyRepositoryFunc(t), - }, - Tasks: &Tasks{ - Cancel: newTasksCancelFunc(t), - Get: newTasksGetFunc(t), - List: newTasksListFunc(t), - }, - AsyncSearch: &AsyncSearch{ - Delete: newAsyncSearchDeleteFunc(t), - Get: newAsyncSearchGetFunc(t), - Status: newAsyncSearchStatusFunc(t), - Submit: newAsyncSearchSubmitFunc(t), - }, - CCR: &CCR{ - DeleteAutoFollowPattern: newCCRDeleteAutoFollowPatternFunc(t), - FollowInfo: newCCRFollowInfoFunc(t), - Follow: newCCRFollowFunc(t), - FollowStats: newCCRFollowStatsFunc(t), - ForgetFollower: newCCRForgetFollowerFunc(t), - GetAutoFollowPattern: newCCRGetAutoFollowPatternFunc(t), - PauseAutoFollowPattern: newCCRPauseAutoFollowPatternFunc(t), - PauseFollow: newCCRPauseFollowFunc(t), - PutAutoFollowPattern: newCCRPutAutoFollowPatternFunc(t), - ResumeAutoFollowPattern: newCCRResumeAutoFollowPatternFunc(t), - ResumeFollow: newCCRResumeFollowFunc(t), - Stats: newCCRStatsFunc(t), - Unfollow: newCCRUnfollowFunc(t), - }, - ILM: &ILM{ - DeleteLifecycle: newILMDeleteLifecycleFunc(t), - ExplainLifecycle: newILMExplainLifecycleFunc(t), - GetLifecycle: newILMGetLifecycleFunc(t), - GetStatus: newILMGetStatusFunc(t), - MoveToStep: newILMMoveToStepFunc(t), - PutLifecycle: newILMPutLifecycleFunc(t), - RemovePolicy: newILMRemovePolicyFunc(t), - Retry: newILMRetryFunc(t), - Start: newILMStartFunc(t), - Stop: newILMStopFunc(t), - }, - License: &License{ - Delete: newLicenseDeleteFunc(t), - GetBasicStatus: newLicenseGetBasicStatusFunc(t), - Get: newLicenseGetFunc(t), - GetTrialStatus: newLicenseGetTrialStatusFunc(t), - Post: newLicensePostFunc(t), - PostStartBasic: newLicensePostStartBasicFunc(t), - PostStartTrial: newLicensePostStartTrialFunc(t), - }, - Migration: &Migration{ - Deprecations: newMigrationDeprecationsFunc(t), - }, - ML: &ML{ - CloseJob: newMLCloseJobFunc(t), - DeleteCalendarEvent: newMLDeleteCalendarEventFunc(t), - DeleteCalendarJob: newMLDeleteCalendarJobFunc(t), - DeleteCalendar: newMLDeleteCalendarFunc(t), - DeleteDataFrameAnalytics: newMLDeleteDataFrameAnalyticsFunc(t), - DeleteDatafeed: newMLDeleteDatafeedFunc(t), - DeleteExpiredData: newMLDeleteExpiredDataFunc(t), - DeleteFilter: newMLDeleteFilterFunc(t), - DeleteForecast: newMLDeleteForecastFunc(t), - DeleteJob: newMLDeleteJobFunc(t), - DeleteModelSnapshot: newMLDeleteModelSnapshotFunc(t), - DeleteTrainedModelAlias: newMLDeleteTrainedModelAliasFunc(t), - DeleteTrainedModel: newMLDeleteTrainedModelFunc(t), - EstimateModelMemory: newMLEstimateModelMemoryFunc(t), - EvaluateDataFrame: newMLEvaluateDataFrameFunc(t), - ExplainDataFrameAnalytics: newMLExplainDataFrameAnalyticsFunc(t), - FindFileStructure: newMLFindFileStructureFunc(t), - FlushJob: newMLFlushJobFunc(t), - Forecast: newMLForecastFunc(t), - GetBuckets: newMLGetBucketsFunc(t), - GetCalendarEvents: newMLGetCalendarEventsFunc(t), - GetCalendars: newMLGetCalendarsFunc(t), - GetCategories: newMLGetCategoriesFunc(t), - GetDataFrameAnalytics: newMLGetDataFrameAnalyticsFunc(t), - GetDataFrameAnalyticsStats: newMLGetDataFrameAnalyticsStatsFunc(t), - GetDatafeedStats: newMLGetDatafeedStatsFunc(t), - GetDatafeeds: newMLGetDatafeedsFunc(t), - GetFilters: newMLGetFiltersFunc(t), - GetInfluencers: newMLGetInfluencersFunc(t), - GetJobStats: newMLGetJobStatsFunc(t), - GetJobs: newMLGetJobsFunc(t), - GetModelSnapshots: newMLGetModelSnapshotsFunc(t), - GetOverallBuckets: newMLGetOverallBucketsFunc(t), - GetRecords: newMLGetRecordsFunc(t), - GetTrainedModels: newMLGetTrainedModelsFunc(t), - GetTrainedModelsStats: newMLGetTrainedModelsStatsFunc(t), - Info: newMLInfoFunc(t), - OpenJob: newMLOpenJobFunc(t), - PostCalendarEvents: newMLPostCalendarEventsFunc(t), - PostData: newMLPostDataFunc(t), - PreviewDataFrameAnalytics: newMLPreviewDataFrameAnalyticsFunc(t), - PreviewDatafeed: newMLPreviewDatafeedFunc(t), - PutCalendarJob: newMLPutCalendarJobFunc(t), - PutCalendar: newMLPutCalendarFunc(t), - PutDataFrameAnalytics: newMLPutDataFrameAnalyticsFunc(t), - PutDatafeed: newMLPutDatafeedFunc(t), - PutFilter: newMLPutFilterFunc(t), - PutJob: newMLPutJobFunc(t), - PutTrainedModelAlias: newMLPutTrainedModelAliasFunc(t), - PutTrainedModel: newMLPutTrainedModelFunc(t), - RevertModelSnapshot: newMLRevertModelSnapshotFunc(t), - SetUpgradeMode: newMLSetUpgradeModeFunc(t), - StartDataFrameAnalytics: newMLStartDataFrameAnalyticsFunc(t), - StartDatafeed: newMLStartDatafeedFunc(t), - StopDataFrameAnalytics: newMLStopDataFrameAnalyticsFunc(t), - StopDatafeed: newMLStopDatafeedFunc(t), - UpdateDataFrameAnalytics: newMLUpdateDataFrameAnalyticsFunc(t), - UpdateDatafeed: newMLUpdateDatafeedFunc(t), - UpdateFilter: newMLUpdateFilterFunc(t), - UpdateJob: newMLUpdateJobFunc(t), - UpdateModelSnapshot: newMLUpdateModelSnapshotFunc(t), - UpgradeJobSnapshot: newMLUpgradeJobSnapshotFunc(t), - ValidateDetector: newMLValidateDetectorFunc(t), - Validate: newMLValidateFunc(t), - }, - Monitoring: &Monitoring{ - Bulk: newMonitoringBulkFunc(t), - }, - Rollup: &Rollup{ - DeleteJob: newRollupDeleteJobFunc(t), - GetJobs: newRollupGetJobsFunc(t), - GetCaps: newRollupGetRollupCapsFunc(t), - GetIndexCaps: newRollupGetRollupIndexCapsFunc(t), - PutJob: newRollupPutJobFunc(t), - Rollup: newRollupRollupFunc(t), - Search: newRollupRollupSearchFunc(t), - StartJob: newRollupStartJobFunc(t), - StopJob: newRollupStopJobFunc(t), - }, - Security: &Security{ - Authenticate: newSecurityAuthenticateFunc(t), - ChangePassword: newSecurityChangePasswordFunc(t), - ClearAPIKeyCache: newSecurityClearAPIKeyCacheFunc(t), - ClearCachedPrivileges: newSecurityClearCachedPrivilegesFunc(t), - ClearCachedRealms: newSecurityClearCachedRealmsFunc(t), - ClearCachedRoles: newSecurityClearCachedRolesFunc(t), - ClearCachedServiceTokens: newSecurityClearCachedServiceTokensFunc(t), - CreateAPIKey: newSecurityCreateAPIKeyFunc(t), - CreateServiceToken: newSecurityCreateServiceTokenFunc(t), - DeletePrivileges: newSecurityDeletePrivilegesFunc(t), - DeleteRoleMapping: newSecurityDeleteRoleMappingFunc(t), - DeleteRole: newSecurityDeleteRoleFunc(t), - DeleteServiceToken: newSecurityDeleteServiceTokenFunc(t), - DeleteUser: newSecurityDeleteUserFunc(t), - DisableUser: newSecurityDisableUserFunc(t), - EnableUser: newSecurityEnableUserFunc(t), - GetAPIKey: newSecurityGetAPIKeyFunc(t), - GetBuiltinPrivileges: newSecurityGetBuiltinPrivilegesFunc(t), - GetPrivileges: newSecurityGetPrivilegesFunc(t), - GetRoleMapping: newSecurityGetRoleMappingFunc(t), - GetRole: newSecurityGetRoleFunc(t), - GetServiceAccounts: newSecurityGetServiceAccountsFunc(t), - GetServiceCredentials: newSecurityGetServiceCredentialsFunc(t), - GetToken: newSecurityGetTokenFunc(t), - GetUserPrivileges: newSecurityGetUserPrivilegesFunc(t), - GetUser: newSecurityGetUserFunc(t), - GrantAPIKey: newSecurityGrantAPIKeyFunc(t), - HasPrivileges: newSecurityHasPrivilegesFunc(t), - InvalidateAPIKey: newSecurityInvalidateAPIKeyFunc(t), - InvalidateToken: newSecurityInvalidateTokenFunc(t), - PutPrivileges: newSecurityPutPrivilegesFunc(t), - PutRoleMapping: newSecurityPutRoleMappingFunc(t), - PutRole: newSecurityPutRoleFunc(t), - PutUser: newSecurityPutUserFunc(t), - }, - SQL: &SQL{ - ClearCursor: newSQLClearCursorFunc(t), - Query: newSQLQueryFunc(t), - Translate: newSQLTranslateFunc(t), - }, - SSL: &SSL{ - Certificates: newSSLCertificatesFunc(t), - }, - Watcher: &Watcher{ - AckWatch: newWatcherAckWatchFunc(t), - ActivateWatch: newWatcherActivateWatchFunc(t), - DeactivateWatch: newWatcherDeactivateWatchFunc(t), - DeleteWatch: newWatcherDeleteWatchFunc(t), - ExecuteWatch: newWatcherExecuteWatchFunc(t), - GetWatch: newWatcherGetWatchFunc(t), - PutWatch: newWatcherPutWatchFunc(t), - QueryWatches: newWatcherQueryWatchesFunc(t), - Start: newWatcherStartFunc(t), - Stats: newWatcherStatsFunc(t), - Stop: newWatcherStopFunc(t), - }, - XPack: &XPack{ - Info: newXPackInfoFunc(t), - Usage: newXPackUsageFunc(t), - }, - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.bulk.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.bulk.go deleted file mode 100644 index df0aed8ca..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.bulk.go +++ /dev/null @@ -1,355 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" - "time" -) - -func newBulkFunc(t Transport) Bulk { - return func(body io.Reader, o ...func(*BulkRequest)) (*Response, error) { - var r = BulkRequest{Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// Bulk allows to perform multiple index/update/delete operations in a single request. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-bulk.html. -// -type Bulk func(body io.Reader, o ...func(*BulkRequest)) (*Response, error) - -// BulkRequest configures the Bulk API request. -// -type BulkRequest struct { - Index string - DocumentType string - - Body io.Reader - - Pipeline string - Refresh string - RequireAlias *bool - Routing string - Source []string - SourceExcludes []string - SourceIncludes []string - Timeout time.Duration - WaitForActiveShards string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r BulkRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len(r.Index) + 1 + len(r.DocumentType) + 1 + len("_bulk")) - if r.Index != "" { - path.WriteString("/") - path.WriteString(r.Index) - } - if r.DocumentType != "" { - path.WriteString("/") - path.WriteString(r.DocumentType) - } - path.WriteString("/") - path.WriteString("_bulk") - - params = make(map[string]string) - - if r.Pipeline != "" { - params["pipeline"] = r.Pipeline - } - - if r.Refresh != "" { - params["refresh"] = r.Refresh - } - - if r.RequireAlias != nil { - params["require_alias"] = strconv.FormatBool(*r.RequireAlias) - } - - if r.Routing != "" { - params["routing"] = r.Routing - } - - if len(r.Source) > 0 { - params["_source"] = strings.Join(r.Source, ",") - } - - if len(r.SourceExcludes) > 0 { - params["_source_excludes"] = strings.Join(r.SourceExcludes, ",") - } - - if len(r.SourceIncludes) > 0 { - params["_source_includes"] = strings.Join(r.SourceIncludes, ",") - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.DocumentType != "" { - params["type"] = r.DocumentType - } - - if r.WaitForActiveShards != "" { - params["wait_for_active_shards"] = r.WaitForActiveShards - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f Bulk) WithContext(v context.Context) func(*BulkRequest) { - return func(r *BulkRequest) { - r.ctx = v - } -} - -// WithIndex - default index for items which don't provide one. -// -func (f Bulk) WithIndex(v string) func(*BulkRequest) { - return func(r *BulkRequest) { - r.Index = v - } -} - -// WithDocumentType - default document type for items which don't provide one. -// -func (f Bulk) WithDocumentType(v string) func(*BulkRequest) { - return func(r *BulkRequest) { - r.DocumentType = v - } -} - -// WithPipeline - the pipeline ID to preprocess incoming documents with. -// -func (f Bulk) WithPipeline(v string) func(*BulkRequest) { - return func(r *BulkRequest) { - r.Pipeline = v - } -} - -// WithRefresh - if `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes.. -// -func (f Bulk) WithRefresh(v string) func(*BulkRequest) { - return func(r *BulkRequest) { - r.Refresh = v - } -} - -// WithRequireAlias - sets require_alias for all incoming documents. defaults to unset (false). -// -func (f Bulk) WithRequireAlias(v bool) func(*BulkRequest) { - return func(r *BulkRequest) { - r.RequireAlias = &v - } -} - -// WithRouting - specific routing value. -// -func (f Bulk) WithRouting(v string) func(*BulkRequest) { - return func(r *BulkRequest) { - r.Routing = v - } -} - -// WithSource - true or false to return the _source field or not, or default list of fields to return, can be overridden on each sub-request. -// -func (f Bulk) WithSource(v ...string) func(*BulkRequest) { - return func(r *BulkRequest) { - r.Source = v - } -} - -// WithSourceExcludes - default list of fields to exclude from the returned _source field, can be overridden on each sub-request. -// -func (f Bulk) WithSourceExcludes(v ...string) func(*BulkRequest) { - return func(r *BulkRequest) { - r.SourceExcludes = v - } -} - -// WithSourceIncludes - default list of fields to extract and return from the _source field, can be overridden on each sub-request. -// -func (f Bulk) WithSourceIncludes(v ...string) func(*BulkRequest) { - return func(r *BulkRequest) { - r.SourceIncludes = v - } -} - -// WithTimeout - explicit operation timeout. -// -func (f Bulk) WithTimeout(v time.Duration) func(*BulkRequest) { - return func(r *BulkRequest) { - r.Timeout = v - } -} - -// WithWaitForActiveShards - sets the number of shard copies that must be active before proceeding with the bulk operation. defaults to 1, meaning the primary shard only. set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1). -// -func (f Bulk) WithWaitForActiveShards(v string) func(*BulkRequest) { - return func(r *BulkRequest) { - r.WaitForActiveShards = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f Bulk) WithPretty() func(*BulkRequest) { - return func(r *BulkRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f Bulk) WithHuman() func(*BulkRequest) { - return func(r *BulkRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f Bulk) WithErrorTrace() func(*BulkRequest) { - return func(r *BulkRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f Bulk) WithFilterPath(v ...string) func(*BulkRequest) { - return func(r *BulkRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f Bulk) WithHeader(h map[string]string) func(*BulkRequest) { - return func(r *BulkRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f Bulk) WithOpaqueID(s string) func(*BulkRequest) { - return func(r *BulkRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.aliases.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.aliases.go deleted file mode 100644 index a3acf8512..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.aliases.go +++ /dev/null @@ -1,306 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newCatAliasesFunc(t Transport) CatAliases { - return func(o ...func(*CatAliasesRequest)) (*Response, error) { - var r = CatAliasesRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// CatAliases shows information about currently configured aliases to indices including filter and routing infos. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-alias.html. -// -type CatAliases func(o ...func(*CatAliasesRequest)) (*Response, error) - -// CatAliasesRequest configures the Cat Aliases API request. -// -type CatAliasesRequest struct { - Name []string - - ExpandWildcards string - Format string - H []string - Help *bool - Local *bool - S []string - V *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r CatAliasesRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_cat") + 1 + len("aliases") + 1 + len(strings.Join(r.Name, ","))) - path.WriteString("/") - path.WriteString("_cat") - path.WriteString("/") - path.WriteString("aliases") - if len(r.Name) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Name, ",")) - } - - params = make(map[string]string) - - if r.ExpandWildcards != "" { - params["expand_wildcards"] = r.ExpandWildcards - } - - if r.Format != "" { - params["format"] = r.Format - } - - if len(r.H) > 0 { - params["h"] = strings.Join(r.H, ",") - } - - if r.Help != nil { - params["help"] = strconv.FormatBool(*r.Help) - } - - if r.Local != nil { - params["local"] = strconv.FormatBool(*r.Local) - } - - if len(r.S) > 0 { - params["s"] = strings.Join(r.S, ",") - } - - if r.V != nil { - params["v"] = strconv.FormatBool(*r.V) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f CatAliases) WithContext(v context.Context) func(*CatAliasesRequest) { - return func(r *CatAliasesRequest) { - r.ctx = v - } -} - -// WithName - a list of alias names to return. -// -func (f CatAliases) WithName(v ...string) func(*CatAliasesRequest) { - return func(r *CatAliasesRequest) { - r.Name = v - } -} - -// WithExpandWildcards - whether to expand wildcard expression to concrete indices that are open, closed or both.. -// -func (f CatAliases) WithExpandWildcards(v string) func(*CatAliasesRequest) { - return func(r *CatAliasesRequest) { - r.ExpandWildcards = v - } -} - -// WithFormat - a short version of the accept header, e.g. json, yaml. -// -func (f CatAliases) WithFormat(v string) func(*CatAliasesRequest) { - return func(r *CatAliasesRequest) { - r.Format = v - } -} - -// WithH - comma-separated list of column names to display. -// -func (f CatAliases) WithH(v ...string) func(*CatAliasesRequest) { - return func(r *CatAliasesRequest) { - r.H = v - } -} - -// WithHelp - return help information. -// -func (f CatAliases) WithHelp(v bool) func(*CatAliasesRequest) { - return func(r *CatAliasesRequest) { - r.Help = &v - } -} - -// WithLocal - return local information, do not retrieve the state from master node (default: false). -// -func (f CatAliases) WithLocal(v bool) func(*CatAliasesRequest) { - return func(r *CatAliasesRequest) { - r.Local = &v - } -} - -// WithS - comma-separated list of column names or column aliases to sort by. -// -func (f CatAliases) WithS(v ...string) func(*CatAliasesRequest) { - return func(r *CatAliasesRequest) { - r.S = v - } -} - -// WithV - verbose mode. display column headers. -// -func (f CatAliases) WithV(v bool) func(*CatAliasesRequest) { - return func(r *CatAliasesRequest) { - r.V = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f CatAliases) WithPretty() func(*CatAliasesRequest) { - return func(r *CatAliasesRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f CatAliases) WithHuman() func(*CatAliasesRequest) { - return func(r *CatAliasesRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f CatAliases) WithErrorTrace() func(*CatAliasesRequest) { - return func(r *CatAliasesRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f CatAliases) WithFilterPath(v ...string) func(*CatAliasesRequest) { - return func(r *CatAliasesRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f CatAliases) WithHeader(h map[string]string) func(*CatAliasesRequest) { - return func(r *CatAliasesRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f CatAliases) WithOpaqueID(s string) func(*CatAliasesRequest) { - return func(r *CatAliasesRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.allocation.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.allocation.go deleted file mode 100644 index d6c748aad..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.allocation.go +++ /dev/null @@ -1,320 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" - "time" -) - -func newCatAllocationFunc(t Transport) CatAllocation { - return func(o ...func(*CatAllocationRequest)) (*Response, error) { - var r = CatAllocationRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// CatAllocation provides a snapshot of how many shards are allocated to each data node and how much disk space they are using. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-allocation.html. -// -type CatAllocation func(o ...func(*CatAllocationRequest)) (*Response, error) - -// CatAllocationRequest configures the Cat Allocation API request. -// -type CatAllocationRequest struct { - NodeID []string - - Bytes string - Format string - H []string - Help *bool - Local *bool - MasterTimeout time.Duration - S []string - V *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r CatAllocationRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_cat") + 1 + len("allocation") + 1 + len(strings.Join(r.NodeID, ","))) - path.WriteString("/") - path.WriteString("_cat") - path.WriteString("/") - path.WriteString("allocation") - if len(r.NodeID) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.NodeID, ",")) - } - - params = make(map[string]string) - - if r.Bytes != "" { - params["bytes"] = r.Bytes - } - - if r.Format != "" { - params["format"] = r.Format - } - - if len(r.H) > 0 { - params["h"] = strings.Join(r.H, ",") - } - - if r.Help != nil { - params["help"] = strconv.FormatBool(*r.Help) - } - - if r.Local != nil { - params["local"] = strconv.FormatBool(*r.Local) - } - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if len(r.S) > 0 { - params["s"] = strings.Join(r.S, ",") - } - - if r.V != nil { - params["v"] = strconv.FormatBool(*r.V) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f CatAllocation) WithContext(v context.Context) func(*CatAllocationRequest) { - return func(r *CatAllocationRequest) { - r.ctx = v - } -} - -// WithNodeID - a list of node ids or names to limit the returned information. -// -func (f CatAllocation) WithNodeID(v ...string) func(*CatAllocationRequest) { - return func(r *CatAllocationRequest) { - r.NodeID = v - } -} - -// WithBytes - the unit in which to display byte values. -// -func (f CatAllocation) WithBytes(v string) func(*CatAllocationRequest) { - return func(r *CatAllocationRequest) { - r.Bytes = v - } -} - -// WithFormat - a short version of the accept header, e.g. json, yaml. -// -func (f CatAllocation) WithFormat(v string) func(*CatAllocationRequest) { - return func(r *CatAllocationRequest) { - r.Format = v - } -} - -// WithH - comma-separated list of column names to display. -// -func (f CatAllocation) WithH(v ...string) func(*CatAllocationRequest) { - return func(r *CatAllocationRequest) { - r.H = v - } -} - -// WithHelp - return help information. -// -func (f CatAllocation) WithHelp(v bool) func(*CatAllocationRequest) { - return func(r *CatAllocationRequest) { - r.Help = &v - } -} - -// WithLocal - return local information, do not retrieve the state from master node (default: false). -// -func (f CatAllocation) WithLocal(v bool) func(*CatAllocationRequest) { - return func(r *CatAllocationRequest) { - r.Local = &v - } -} - -// WithMasterTimeout - explicit operation timeout for connection to master node. -// -func (f CatAllocation) WithMasterTimeout(v time.Duration) func(*CatAllocationRequest) { - return func(r *CatAllocationRequest) { - r.MasterTimeout = v - } -} - -// WithS - comma-separated list of column names or column aliases to sort by. -// -func (f CatAllocation) WithS(v ...string) func(*CatAllocationRequest) { - return func(r *CatAllocationRequest) { - r.S = v - } -} - -// WithV - verbose mode. display column headers. -// -func (f CatAllocation) WithV(v bool) func(*CatAllocationRequest) { - return func(r *CatAllocationRequest) { - r.V = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f CatAllocation) WithPretty() func(*CatAllocationRequest) { - return func(r *CatAllocationRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f CatAllocation) WithHuman() func(*CatAllocationRequest) { - return func(r *CatAllocationRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f CatAllocation) WithErrorTrace() func(*CatAllocationRequest) { - return func(r *CatAllocationRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f CatAllocation) WithFilterPath(v ...string) func(*CatAllocationRequest) { - return func(r *CatAllocationRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f CatAllocation) WithHeader(h map[string]string) func(*CatAllocationRequest) { - return func(r *CatAllocationRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f CatAllocation) WithOpaqueID(s string) func(*CatAllocationRequest) { - return func(r *CatAllocationRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.count.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.count.go deleted file mode 100644 index 7e013965f..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.count.go +++ /dev/null @@ -1,280 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newCatCountFunc(t Transport) CatCount { - return func(o ...func(*CatCountRequest)) (*Response, error) { - var r = CatCountRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// CatCount provides quick access to the document count of the entire cluster, or individual indices. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-count.html. -// -type CatCount func(o ...func(*CatCountRequest)) (*Response, error) - -// CatCountRequest configures the Cat Count API request. -// -type CatCountRequest struct { - Index []string - - Format string - H []string - Help *bool - S []string - V *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r CatCountRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_cat") + 1 + len("count") + 1 + len(strings.Join(r.Index, ","))) - path.WriteString("/") - path.WriteString("_cat") - path.WriteString("/") - path.WriteString("count") - if len(r.Index) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Index, ",")) - } - - params = make(map[string]string) - - if r.Format != "" { - params["format"] = r.Format - } - - if len(r.H) > 0 { - params["h"] = strings.Join(r.H, ",") - } - - if r.Help != nil { - params["help"] = strconv.FormatBool(*r.Help) - } - - if len(r.S) > 0 { - params["s"] = strings.Join(r.S, ",") - } - - if r.V != nil { - params["v"] = strconv.FormatBool(*r.V) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f CatCount) WithContext(v context.Context) func(*CatCountRequest) { - return func(r *CatCountRequest) { - r.ctx = v - } -} - -// WithIndex - a list of index names to limit the returned information. -// -func (f CatCount) WithIndex(v ...string) func(*CatCountRequest) { - return func(r *CatCountRequest) { - r.Index = v - } -} - -// WithFormat - a short version of the accept header, e.g. json, yaml. -// -func (f CatCount) WithFormat(v string) func(*CatCountRequest) { - return func(r *CatCountRequest) { - r.Format = v - } -} - -// WithH - comma-separated list of column names to display. -// -func (f CatCount) WithH(v ...string) func(*CatCountRequest) { - return func(r *CatCountRequest) { - r.H = v - } -} - -// WithHelp - return help information. -// -func (f CatCount) WithHelp(v bool) func(*CatCountRequest) { - return func(r *CatCountRequest) { - r.Help = &v - } -} - -// WithS - comma-separated list of column names or column aliases to sort by. -// -func (f CatCount) WithS(v ...string) func(*CatCountRequest) { - return func(r *CatCountRequest) { - r.S = v - } -} - -// WithV - verbose mode. display column headers. -// -func (f CatCount) WithV(v bool) func(*CatCountRequest) { - return func(r *CatCountRequest) { - r.V = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f CatCount) WithPretty() func(*CatCountRequest) { - return func(r *CatCountRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f CatCount) WithHuman() func(*CatCountRequest) { - return func(r *CatCountRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f CatCount) WithErrorTrace() func(*CatCountRequest) { - return func(r *CatCountRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f CatCount) WithFilterPath(v ...string) func(*CatCountRequest) { - return func(r *CatCountRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f CatCount) WithHeader(h map[string]string) func(*CatCountRequest) { - return func(r *CatCountRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f CatCount) WithOpaqueID(s string) func(*CatCountRequest) { - return func(r *CatCountRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.fielddata.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.fielddata.go deleted file mode 100644 index 208f88507..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.fielddata.go +++ /dev/null @@ -1,297 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newCatFielddataFunc(t Transport) CatFielddata { - return func(o ...func(*CatFielddataRequest)) (*Response, error) { - var r = CatFielddataRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// CatFielddata shows how much heap memory is currently being used by fielddata on every data node in the cluster. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-fielddata.html. -// -type CatFielddata func(o ...func(*CatFielddataRequest)) (*Response, error) - -// CatFielddataRequest configures the Cat Fielddata API request. -// -type CatFielddataRequest struct { - Fields []string - - Bytes string - Format string - H []string - Help *bool - S []string - V *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r CatFielddataRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_cat") + 1 + len("fielddata") + 1 + len(strings.Join(r.Fields, ","))) - path.WriteString("/") - path.WriteString("_cat") - path.WriteString("/") - path.WriteString("fielddata") - if len(r.Fields) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Fields, ",")) - } - - params = make(map[string]string) - - if r.Bytes != "" { - params["bytes"] = r.Bytes - } - - if len(r.Fields) > 0 { - params["fields"] = strings.Join(r.Fields, ",") - } - - if r.Format != "" { - params["format"] = r.Format - } - - if len(r.H) > 0 { - params["h"] = strings.Join(r.H, ",") - } - - if r.Help != nil { - params["help"] = strconv.FormatBool(*r.Help) - } - - if len(r.S) > 0 { - params["s"] = strings.Join(r.S, ",") - } - - if r.V != nil { - params["v"] = strconv.FormatBool(*r.V) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f CatFielddata) WithContext(v context.Context) func(*CatFielddataRequest) { - return func(r *CatFielddataRequest) { - r.ctx = v - } -} - -// WithFields - a list of fields to return the fielddata size. -// -func (f CatFielddata) WithFields(v ...string) func(*CatFielddataRequest) { - return func(r *CatFielddataRequest) { - r.Fields = v - } -} - -// WithBytes - the unit in which to display byte values. -// -func (f CatFielddata) WithBytes(v string) func(*CatFielddataRequest) { - return func(r *CatFielddataRequest) { - r.Bytes = v - } -} - -// WithFormat - a short version of the accept header, e.g. json, yaml. -// -func (f CatFielddata) WithFormat(v string) func(*CatFielddataRequest) { - return func(r *CatFielddataRequest) { - r.Format = v - } -} - -// WithH - comma-separated list of column names to display. -// -func (f CatFielddata) WithH(v ...string) func(*CatFielddataRequest) { - return func(r *CatFielddataRequest) { - r.H = v - } -} - -// WithHelp - return help information. -// -func (f CatFielddata) WithHelp(v bool) func(*CatFielddataRequest) { - return func(r *CatFielddataRequest) { - r.Help = &v - } -} - -// WithS - comma-separated list of column names or column aliases to sort by. -// -func (f CatFielddata) WithS(v ...string) func(*CatFielddataRequest) { - return func(r *CatFielddataRequest) { - r.S = v - } -} - -// WithV - verbose mode. display column headers. -// -func (f CatFielddata) WithV(v bool) func(*CatFielddataRequest) { - return func(r *CatFielddataRequest) { - r.V = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f CatFielddata) WithPretty() func(*CatFielddataRequest) { - return func(r *CatFielddataRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f CatFielddata) WithHuman() func(*CatFielddataRequest) { - return func(r *CatFielddataRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f CatFielddata) WithErrorTrace() func(*CatFielddataRequest) { - return func(r *CatFielddataRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f CatFielddata) WithFilterPath(v ...string) func(*CatFielddataRequest) { - return func(r *CatFielddataRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f CatFielddata) WithHeader(h map[string]string) func(*CatFielddataRequest) { - return func(r *CatFielddataRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f CatFielddata) WithOpaqueID(s string) func(*CatFielddataRequest) { - return func(r *CatFielddataRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.health.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.health.go deleted file mode 100644 index a72dc462d..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.health.go +++ /dev/null @@ -1,289 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newCatHealthFunc(t Transport) CatHealth { - return func(o ...func(*CatHealthRequest)) (*Response, error) { - var r = CatHealthRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// CatHealth returns a concise representation of the cluster health. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-health.html. -// -type CatHealth func(o ...func(*CatHealthRequest)) (*Response, error) - -// CatHealthRequest configures the Cat Health API request. -// -type CatHealthRequest struct { - Format string - H []string - Help *bool - S []string - Time string - Ts *bool - V *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r CatHealthRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(len("/_cat/health")) - path.WriteString("/_cat/health") - - params = make(map[string]string) - - if r.Format != "" { - params["format"] = r.Format - } - - if len(r.H) > 0 { - params["h"] = strings.Join(r.H, ",") - } - - if r.Help != nil { - params["help"] = strconv.FormatBool(*r.Help) - } - - if len(r.S) > 0 { - params["s"] = strings.Join(r.S, ",") - } - - if r.Time != "" { - params["time"] = r.Time - } - - if r.Ts != nil { - params["ts"] = strconv.FormatBool(*r.Ts) - } - - if r.V != nil { - params["v"] = strconv.FormatBool(*r.V) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f CatHealth) WithContext(v context.Context) func(*CatHealthRequest) { - return func(r *CatHealthRequest) { - r.ctx = v - } -} - -// WithFormat - a short version of the accept header, e.g. json, yaml. -// -func (f CatHealth) WithFormat(v string) func(*CatHealthRequest) { - return func(r *CatHealthRequest) { - r.Format = v - } -} - -// WithH - comma-separated list of column names to display. -// -func (f CatHealth) WithH(v ...string) func(*CatHealthRequest) { - return func(r *CatHealthRequest) { - r.H = v - } -} - -// WithHelp - return help information. -// -func (f CatHealth) WithHelp(v bool) func(*CatHealthRequest) { - return func(r *CatHealthRequest) { - r.Help = &v - } -} - -// WithS - comma-separated list of column names or column aliases to sort by. -// -func (f CatHealth) WithS(v ...string) func(*CatHealthRequest) { - return func(r *CatHealthRequest) { - r.S = v - } -} - -// WithTime - the unit in which to display time values. -// -func (f CatHealth) WithTime(v string) func(*CatHealthRequest) { - return func(r *CatHealthRequest) { - r.Time = v - } -} - -// WithTs - set to false to disable timestamping. -// -func (f CatHealth) WithTs(v bool) func(*CatHealthRequest) { - return func(r *CatHealthRequest) { - r.Ts = &v - } -} - -// WithV - verbose mode. display column headers. -// -func (f CatHealth) WithV(v bool) func(*CatHealthRequest) { - return func(r *CatHealthRequest) { - r.V = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f CatHealth) WithPretty() func(*CatHealthRequest) { - return func(r *CatHealthRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f CatHealth) WithHuman() func(*CatHealthRequest) { - return func(r *CatHealthRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f CatHealth) WithErrorTrace() func(*CatHealthRequest) { - return func(r *CatHealthRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f CatHealth) WithFilterPath(v ...string) func(*CatHealthRequest) { - return func(r *CatHealthRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f CatHealth) WithHeader(h map[string]string) func(*CatHealthRequest) { - return func(r *CatHealthRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f CatHealth) WithOpaqueID(s string) func(*CatHealthRequest) { - return func(r *CatHealthRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.help.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.help.go deleted file mode 100644 index 62ce861bd..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.help.go +++ /dev/null @@ -1,224 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newCatHelpFunc(t Transport) CatHelp { - return func(o ...func(*CatHelpRequest)) (*Response, error) { - var r = CatHelpRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// CatHelp returns help for the Cat APIs. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/cat.html. -// -type CatHelp func(o ...func(*CatHelpRequest)) (*Response, error) - -// CatHelpRequest configures the Cat Help API request. -// -type CatHelpRequest struct { - Help *bool - S []string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r CatHelpRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(len("/_cat")) - path.WriteString("/_cat") - - params = make(map[string]string) - - if r.Help != nil { - params["help"] = strconv.FormatBool(*r.Help) - } - - if len(r.S) > 0 { - params["s"] = strings.Join(r.S, ",") - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f CatHelp) WithContext(v context.Context) func(*CatHelpRequest) { - return func(r *CatHelpRequest) { - r.ctx = v - } -} - -// WithHelp - return help information. -// -func (f CatHelp) WithHelp(v bool) func(*CatHelpRequest) { - return func(r *CatHelpRequest) { - r.Help = &v - } -} - -// WithS - comma-separated list of column names or column aliases to sort by. -// -func (f CatHelp) WithS(v ...string) func(*CatHelpRequest) { - return func(r *CatHelpRequest) { - r.S = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f CatHelp) WithPretty() func(*CatHelpRequest) { - return func(r *CatHelpRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f CatHelp) WithHuman() func(*CatHelpRequest) { - return func(r *CatHelpRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f CatHelp) WithErrorTrace() func(*CatHelpRequest) { - return func(r *CatHelpRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f CatHelp) WithFilterPath(v ...string) func(*CatHelpRequest) { - return func(r *CatHelpRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f CatHelp) WithHeader(h map[string]string) func(*CatHelpRequest) { - return func(r *CatHelpRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f CatHelp) WithOpaqueID(s string) func(*CatHelpRequest) { - return func(r *CatHelpRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.indices.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.indices.go deleted file mode 100644 index 4caa15b50..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.indices.go +++ /dev/null @@ -1,385 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" - "time" -) - -func newCatIndicesFunc(t Transport) CatIndices { - return func(o ...func(*CatIndicesRequest)) (*Response, error) { - var r = CatIndicesRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// CatIndices returns information about indices: number of primaries and replicas, document counts, disk size, ... -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-indices.html. -// -type CatIndices func(o ...func(*CatIndicesRequest)) (*Response, error) - -// CatIndicesRequest configures the Cat Indices API request. -// -type CatIndicesRequest struct { - Index []string - - Bytes string - ExpandWildcards string - Format string - H []string - Health string - Help *bool - IncludeUnloadedSegments *bool - Local *bool - MasterTimeout time.Duration - Pri *bool - S []string - Time string - V *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r CatIndicesRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_cat") + 1 + len("indices") + 1 + len(strings.Join(r.Index, ","))) - path.WriteString("/") - path.WriteString("_cat") - path.WriteString("/") - path.WriteString("indices") - if len(r.Index) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Index, ",")) - } - - params = make(map[string]string) - - if r.Bytes != "" { - params["bytes"] = r.Bytes - } - - if r.ExpandWildcards != "" { - params["expand_wildcards"] = r.ExpandWildcards - } - - if r.Format != "" { - params["format"] = r.Format - } - - if len(r.H) > 0 { - params["h"] = strings.Join(r.H, ",") - } - - if r.Health != "" { - params["health"] = r.Health - } - - if r.Help != nil { - params["help"] = strconv.FormatBool(*r.Help) - } - - if r.IncludeUnloadedSegments != nil { - params["include_unloaded_segments"] = strconv.FormatBool(*r.IncludeUnloadedSegments) - } - - if r.Local != nil { - params["local"] = strconv.FormatBool(*r.Local) - } - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Pri != nil { - params["pri"] = strconv.FormatBool(*r.Pri) - } - - if len(r.S) > 0 { - params["s"] = strings.Join(r.S, ",") - } - - if r.Time != "" { - params["time"] = r.Time - } - - if r.V != nil { - params["v"] = strconv.FormatBool(*r.V) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f CatIndices) WithContext(v context.Context) func(*CatIndicesRequest) { - return func(r *CatIndicesRequest) { - r.ctx = v - } -} - -// WithIndex - a list of index names to limit the returned information. -// -func (f CatIndices) WithIndex(v ...string) func(*CatIndicesRequest) { - return func(r *CatIndicesRequest) { - r.Index = v - } -} - -// WithBytes - the unit in which to display byte values. -// -func (f CatIndices) WithBytes(v string) func(*CatIndicesRequest) { - return func(r *CatIndicesRequest) { - r.Bytes = v - } -} - -// WithExpandWildcards - whether to expand wildcard expression to concrete indices that are open, closed or both.. -// -func (f CatIndices) WithExpandWildcards(v string) func(*CatIndicesRequest) { - return func(r *CatIndicesRequest) { - r.ExpandWildcards = v - } -} - -// WithFormat - a short version of the accept header, e.g. json, yaml. -// -func (f CatIndices) WithFormat(v string) func(*CatIndicesRequest) { - return func(r *CatIndicesRequest) { - r.Format = v - } -} - -// WithH - comma-separated list of column names to display. -// -func (f CatIndices) WithH(v ...string) func(*CatIndicesRequest) { - return func(r *CatIndicesRequest) { - r.H = v - } -} - -// WithHealth - a health status ("green", "yellow", or "red" to filter only indices matching the specified health status. -// -func (f CatIndices) WithHealth(v string) func(*CatIndicesRequest) { - return func(r *CatIndicesRequest) { - r.Health = v - } -} - -// WithHelp - return help information. -// -func (f CatIndices) WithHelp(v bool) func(*CatIndicesRequest) { - return func(r *CatIndicesRequest) { - r.Help = &v - } -} - -// WithIncludeUnloadedSegments - if set to true segment stats will include stats for segments that are not currently loaded into memory. -// -func (f CatIndices) WithIncludeUnloadedSegments(v bool) func(*CatIndicesRequest) { - return func(r *CatIndicesRequest) { - r.IncludeUnloadedSegments = &v - } -} - -// WithLocal - return local information, do not retrieve the state from master node (default: false). -// -func (f CatIndices) WithLocal(v bool) func(*CatIndicesRequest) { - return func(r *CatIndicesRequest) { - r.Local = &v - } -} - -// WithMasterTimeout - explicit operation timeout for connection to master node. -// -func (f CatIndices) WithMasterTimeout(v time.Duration) func(*CatIndicesRequest) { - return func(r *CatIndicesRequest) { - r.MasterTimeout = v - } -} - -// WithPri - set to true to return stats only for primary shards. -// -func (f CatIndices) WithPri(v bool) func(*CatIndicesRequest) { - return func(r *CatIndicesRequest) { - r.Pri = &v - } -} - -// WithS - comma-separated list of column names or column aliases to sort by. -// -func (f CatIndices) WithS(v ...string) func(*CatIndicesRequest) { - return func(r *CatIndicesRequest) { - r.S = v - } -} - -// WithTime - the unit in which to display time values. -// -func (f CatIndices) WithTime(v string) func(*CatIndicesRequest) { - return func(r *CatIndicesRequest) { - r.Time = v - } -} - -// WithV - verbose mode. display column headers. -// -func (f CatIndices) WithV(v bool) func(*CatIndicesRequest) { - return func(r *CatIndicesRequest) { - r.V = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f CatIndices) WithPretty() func(*CatIndicesRequest) { - return func(r *CatIndicesRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f CatIndices) WithHuman() func(*CatIndicesRequest) { - return func(r *CatIndicesRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f CatIndices) WithErrorTrace() func(*CatIndicesRequest) { - return func(r *CatIndicesRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f CatIndices) WithFilterPath(v ...string) func(*CatIndicesRequest) { - return func(r *CatIndicesRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f CatIndices) WithHeader(h map[string]string) func(*CatIndicesRequest) { - return func(r *CatIndicesRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f CatIndices) WithOpaqueID(s string) func(*CatIndicesRequest) { - return func(r *CatIndicesRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.master.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.master.go deleted file mode 100644 index 45ea7ef94..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.master.go +++ /dev/null @@ -1,290 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" - "time" -) - -func newCatMasterFunc(t Transport) CatMaster { - return func(o ...func(*CatMasterRequest)) (*Response, error) { - var r = CatMasterRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// CatMaster returns information about the master node. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-master.html. -// -type CatMaster func(o ...func(*CatMasterRequest)) (*Response, error) - -// CatMasterRequest configures the Cat Master API request. -// -type CatMasterRequest struct { - Format string - H []string - Help *bool - Local *bool - MasterTimeout time.Duration - S []string - V *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r CatMasterRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(len("/_cat/master")) - path.WriteString("/_cat/master") - - params = make(map[string]string) - - if r.Format != "" { - params["format"] = r.Format - } - - if len(r.H) > 0 { - params["h"] = strings.Join(r.H, ",") - } - - if r.Help != nil { - params["help"] = strconv.FormatBool(*r.Help) - } - - if r.Local != nil { - params["local"] = strconv.FormatBool(*r.Local) - } - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if len(r.S) > 0 { - params["s"] = strings.Join(r.S, ",") - } - - if r.V != nil { - params["v"] = strconv.FormatBool(*r.V) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f CatMaster) WithContext(v context.Context) func(*CatMasterRequest) { - return func(r *CatMasterRequest) { - r.ctx = v - } -} - -// WithFormat - a short version of the accept header, e.g. json, yaml. -// -func (f CatMaster) WithFormat(v string) func(*CatMasterRequest) { - return func(r *CatMasterRequest) { - r.Format = v - } -} - -// WithH - comma-separated list of column names to display. -// -func (f CatMaster) WithH(v ...string) func(*CatMasterRequest) { - return func(r *CatMasterRequest) { - r.H = v - } -} - -// WithHelp - return help information. -// -func (f CatMaster) WithHelp(v bool) func(*CatMasterRequest) { - return func(r *CatMasterRequest) { - r.Help = &v - } -} - -// WithLocal - return local information, do not retrieve the state from master node (default: false). -// -func (f CatMaster) WithLocal(v bool) func(*CatMasterRequest) { - return func(r *CatMasterRequest) { - r.Local = &v - } -} - -// WithMasterTimeout - explicit operation timeout for connection to master node. -// -func (f CatMaster) WithMasterTimeout(v time.Duration) func(*CatMasterRequest) { - return func(r *CatMasterRequest) { - r.MasterTimeout = v - } -} - -// WithS - comma-separated list of column names or column aliases to sort by. -// -func (f CatMaster) WithS(v ...string) func(*CatMasterRequest) { - return func(r *CatMasterRequest) { - r.S = v - } -} - -// WithV - verbose mode. display column headers. -// -func (f CatMaster) WithV(v bool) func(*CatMasterRequest) { - return func(r *CatMasterRequest) { - r.V = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f CatMaster) WithPretty() func(*CatMasterRequest) { - return func(r *CatMasterRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f CatMaster) WithHuman() func(*CatMasterRequest) { - return func(r *CatMasterRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f CatMaster) WithErrorTrace() func(*CatMasterRequest) { - return func(r *CatMasterRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f CatMaster) WithFilterPath(v ...string) func(*CatMasterRequest) { - return func(r *CatMasterRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f CatMaster) WithHeader(h map[string]string) func(*CatMasterRequest) { - return func(r *CatMasterRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f CatMaster) WithOpaqueID(s string) func(*CatMasterRequest) { - return func(r *CatMasterRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.nodeattrs.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.nodeattrs.go deleted file mode 100644 index f31c4294c..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.nodeattrs.go +++ /dev/null @@ -1,290 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" - "time" -) - -func newCatNodeattrsFunc(t Transport) CatNodeattrs { - return func(o ...func(*CatNodeattrsRequest)) (*Response, error) { - var r = CatNodeattrsRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// CatNodeattrs returns information about custom node attributes. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-nodeattrs.html. -// -type CatNodeattrs func(o ...func(*CatNodeattrsRequest)) (*Response, error) - -// CatNodeattrsRequest configures the Cat Nodeattrs API request. -// -type CatNodeattrsRequest struct { - Format string - H []string - Help *bool - Local *bool - MasterTimeout time.Duration - S []string - V *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r CatNodeattrsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(len("/_cat/nodeattrs")) - path.WriteString("/_cat/nodeattrs") - - params = make(map[string]string) - - if r.Format != "" { - params["format"] = r.Format - } - - if len(r.H) > 0 { - params["h"] = strings.Join(r.H, ",") - } - - if r.Help != nil { - params["help"] = strconv.FormatBool(*r.Help) - } - - if r.Local != nil { - params["local"] = strconv.FormatBool(*r.Local) - } - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if len(r.S) > 0 { - params["s"] = strings.Join(r.S, ",") - } - - if r.V != nil { - params["v"] = strconv.FormatBool(*r.V) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f CatNodeattrs) WithContext(v context.Context) func(*CatNodeattrsRequest) { - return func(r *CatNodeattrsRequest) { - r.ctx = v - } -} - -// WithFormat - a short version of the accept header, e.g. json, yaml. -// -func (f CatNodeattrs) WithFormat(v string) func(*CatNodeattrsRequest) { - return func(r *CatNodeattrsRequest) { - r.Format = v - } -} - -// WithH - comma-separated list of column names to display. -// -func (f CatNodeattrs) WithH(v ...string) func(*CatNodeattrsRequest) { - return func(r *CatNodeattrsRequest) { - r.H = v - } -} - -// WithHelp - return help information. -// -func (f CatNodeattrs) WithHelp(v bool) func(*CatNodeattrsRequest) { - return func(r *CatNodeattrsRequest) { - r.Help = &v - } -} - -// WithLocal - return local information, do not retrieve the state from master node (default: false). -// -func (f CatNodeattrs) WithLocal(v bool) func(*CatNodeattrsRequest) { - return func(r *CatNodeattrsRequest) { - r.Local = &v - } -} - -// WithMasterTimeout - explicit operation timeout for connection to master node. -// -func (f CatNodeattrs) WithMasterTimeout(v time.Duration) func(*CatNodeattrsRequest) { - return func(r *CatNodeattrsRequest) { - r.MasterTimeout = v - } -} - -// WithS - comma-separated list of column names or column aliases to sort by. -// -func (f CatNodeattrs) WithS(v ...string) func(*CatNodeattrsRequest) { - return func(r *CatNodeattrsRequest) { - r.S = v - } -} - -// WithV - verbose mode. display column headers. -// -func (f CatNodeattrs) WithV(v bool) func(*CatNodeattrsRequest) { - return func(r *CatNodeattrsRequest) { - r.V = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f CatNodeattrs) WithPretty() func(*CatNodeattrsRequest) { - return func(r *CatNodeattrsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f CatNodeattrs) WithHuman() func(*CatNodeattrsRequest) { - return func(r *CatNodeattrsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f CatNodeattrs) WithErrorTrace() func(*CatNodeattrsRequest) { - return func(r *CatNodeattrsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f CatNodeattrs) WithFilterPath(v ...string) func(*CatNodeattrsRequest) { - return func(r *CatNodeattrsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f CatNodeattrs) WithHeader(h map[string]string) func(*CatNodeattrsRequest) { - return func(r *CatNodeattrsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f CatNodeattrs) WithOpaqueID(s string) func(*CatNodeattrsRequest) { - return func(r *CatNodeattrsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.nodes.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.nodes.go deleted file mode 100644 index 73519572f..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.nodes.go +++ /dev/null @@ -1,342 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" - "time" -) - -func newCatNodesFunc(t Transport) CatNodes { - return func(o ...func(*CatNodesRequest)) (*Response, error) { - var r = CatNodesRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// CatNodes returns basic statistics about performance of cluster nodes. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-nodes.html. -// -type CatNodes func(o ...func(*CatNodesRequest)) (*Response, error) - -// CatNodesRequest configures the Cat Nodes API request. -// -type CatNodesRequest struct { - Bytes string - Format string - FullID *bool - H []string - Help *bool - IncludeUnloadedSegments *bool - Local *bool - MasterTimeout time.Duration - S []string - Time string - V *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r CatNodesRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(len("/_cat/nodes")) - path.WriteString("/_cat/nodes") - - params = make(map[string]string) - - if r.Bytes != "" { - params["bytes"] = r.Bytes - } - - if r.Format != "" { - params["format"] = r.Format - } - - if r.FullID != nil { - params["full_id"] = strconv.FormatBool(*r.FullID) - } - - if len(r.H) > 0 { - params["h"] = strings.Join(r.H, ",") - } - - if r.Help != nil { - params["help"] = strconv.FormatBool(*r.Help) - } - - if r.IncludeUnloadedSegments != nil { - params["include_unloaded_segments"] = strconv.FormatBool(*r.IncludeUnloadedSegments) - } - - if r.Local != nil { - params["local"] = strconv.FormatBool(*r.Local) - } - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if len(r.S) > 0 { - params["s"] = strings.Join(r.S, ",") - } - - if r.Time != "" { - params["time"] = r.Time - } - - if r.V != nil { - params["v"] = strconv.FormatBool(*r.V) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f CatNodes) WithContext(v context.Context) func(*CatNodesRequest) { - return func(r *CatNodesRequest) { - r.ctx = v - } -} - -// WithBytes - the unit in which to display byte values. -// -func (f CatNodes) WithBytes(v string) func(*CatNodesRequest) { - return func(r *CatNodesRequest) { - r.Bytes = v - } -} - -// WithFormat - a short version of the accept header, e.g. json, yaml. -// -func (f CatNodes) WithFormat(v string) func(*CatNodesRequest) { - return func(r *CatNodesRequest) { - r.Format = v - } -} - -// WithFullID - return the full node ID instead of the shortened version (default: false). -// -func (f CatNodes) WithFullID(v bool) func(*CatNodesRequest) { - return func(r *CatNodesRequest) { - r.FullID = &v - } -} - -// WithH - comma-separated list of column names to display. -// -func (f CatNodes) WithH(v ...string) func(*CatNodesRequest) { - return func(r *CatNodesRequest) { - r.H = v - } -} - -// WithHelp - return help information. -// -func (f CatNodes) WithHelp(v bool) func(*CatNodesRequest) { - return func(r *CatNodesRequest) { - r.Help = &v - } -} - -// WithIncludeUnloadedSegments - if set to true segment stats will include stats for segments that are not currently loaded into memory. -// -func (f CatNodes) WithIncludeUnloadedSegments(v bool) func(*CatNodesRequest) { - return func(r *CatNodesRequest) { - r.IncludeUnloadedSegments = &v - } -} - -// WithLocal - calculate the selected nodes using the local cluster state rather than the state from master node (default: false). -// -func (f CatNodes) WithLocal(v bool) func(*CatNodesRequest) { - return func(r *CatNodesRequest) { - r.Local = &v - } -} - -// WithMasterTimeout - explicit operation timeout for connection to master node. -// -func (f CatNodes) WithMasterTimeout(v time.Duration) func(*CatNodesRequest) { - return func(r *CatNodesRequest) { - r.MasterTimeout = v - } -} - -// WithS - comma-separated list of column names or column aliases to sort by. -// -func (f CatNodes) WithS(v ...string) func(*CatNodesRequest) { - return func(r *CatNodesRequest) { - r.S = v - } -} - -// WithTime - the unit in which to display time values. -// -func (f CatNodes) WithTime(v string) func(*CatNodesRequest) { - return func(r *CatNodesRequest) { - r.Time = v - } -} - -// WithV - verbose mode. display column headers. -// -func (f CatNodes) WithV(v bool) func(*CatNodesRequest) { - return func(r *CatNodesRequest) { - r.V = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f CatNodes) WithPretty() func(*CatNodesRequest) { - return func(r *CatNodesRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f CatNodes) WithHuman() func(*CatNodesRequest) { - return func(r *CatNodesRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f CatNodes) WithErrorTrace() func(*CatNodesRequest) { - return func(r *CatNodesRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f CatNodes) WithFilterPath(v ...string) func(*CatNodesRequest) { - return func(r *CatNodesRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f CatNodes) WithHeader(h map[string]string) func(*CatNodesRequest) { - return func(r *CatNodesRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f CatNodes) WithOpaqueID(s string) func(*CatNodesRequest) { - return func(r *CatNodesRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.pending_tasks.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.pending_tasks.go deleted file mode 100644 index d669b1628..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.pending_tasks.go +++ /dev/null @@ -1,303 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" - "time" -) - -func newCatPendingTasksFunc(t Transport) CatPendingTasks { - return func(o ...func(*CatPendingTasksRequest)) (*Response, error) { - var r = CatPendingTasksRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// CatPendingTasks returns a concise representation of the cluster pending tasks. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-pending-tasks.html. -// -type CatPendingTasks func(o ...func(*CatPendingTasksRequest)) (*Response, error) - -// CatPendingTasksRequest configures the Cat Pending Tasks API request. -// -type CatPendingTasksRequest struct { - Format string - H []string - Help *bool - Local *bool - MasterTimeout time.Duration - S []string - Time string - V *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r CatPendingTasksRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(len("/_cat/pending_tasks")) - path.WriteString("/_cat/pending_tasks") - - params = make(map[string]string) - - if r.Format != "" { - params["format"] = r.Format - } - - if len(r.H) > 0 { - params["h"] = strings.Join(r.H, ",") - } - - if r.Help != nil { - params["help"] = strconv.FormatBool(*r.Help) - } - - if r.Local != nil { - params["local"] = strconv.FormatBool(*r.Local) - } - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if len(r.S) > 0 { - params["s"] = strings.Join(r.S, ",") - } - - if r.Time != "" { - params["time"] = r.Time - } - - if r.V != nil { - params["v"] = strconv.FormatBool(*r.V) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f CatPendingTasks) WithContext(v context.Context) func(*CatPendingTasksRequest) { - return func(r *CatPendingTasksRequest) { - r.ctx = v - } -} - -// WithFormat - a short version of the accept header, e.g. json, yaml. -// -func (f CatPendingTasks) WithFormat(v string) func(*CatPendingTasksRequest) { - return func(r *CatPendingTasksRequest) { - r.Format = v - } -} - -// WithH - comma-separated list of column names to display. -// -func (f CatPendingTasks) WithH(v ...string) func(*CatPendingTasksRequest) { - return func(r *CatPendingTasksRequest) { - r.H = v - } -} - -// WithHelp - return help information. -// -func (f CatPendingTasks) WithHelp(v bool) func(*CatPendingTasksRequest) { - return func(r *CatPendingTasksRequest) { - r.Help = &v - } -} - -// WithLocal - return local information, do not retrieve the state from master node (default: false). -// -func (f CatPendingTasks) WithLocal(v bool) func(*CatPendingTasksRequest) { - return func(r *CatPendingTasksRequest) { - r.Local = &v - } -} - -// WithMasterTimeout - explicit operation timeout for connection to master node. -// -func (f CatPendingTasks) WithMasterTimeout(v time.Duration) func(*CatPendingTasksRequest) { - return func(r *CatPendingTasksRequest) { - r.MasterTimeout = v - } -} - -// WithS - comma-separated list of column names or column aliases to sort by. -// -func (f CatPendingTasks) WithS(v ...string) func(*CatPendingTasksRequest) { - return func(r *CatPendingTasksRequest) { - r.S = v - } -} - -// WithTime - the unit in which to display time values. -// -func (f CatPendingTasks) WithTime(v string) func(*CatPendingTasksRequest) { - return func(r *CatPendingTasksRequest) { - r.Time = v - } -} - -// WithV - verbose mode. display column headers. -// -func (f CatPendingTasks) WithV(v bool) func(*CatPendingTasksRequest) { - return func(r *CatPendingTasksRequest) { - r.V = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f CatPendingTasks) WithPretty() func(*CatPendingTasksRequest) { - return func(r *CatPendingTasksRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f CatPendingTasks) WithHuman() func(*CatPendingTasksRequest) { - return func(r *CatPendingTasksRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f CatPendingTasks) WithErrorTrace() func(*CatPendingTasksRequest) { - return func(r *CatPendingTasksRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f CatPendingTasks) WithFilterPath(v ...string) func(*CatPendingTasksRequest) { - return func(r *CatPendingTasksRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f CatPendingTasks) WithHeader(h map[string]string) func(*CatPendingTasksRequest) { - return func(r *CatPendingTasksRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f CatPendingTasks) WithOpaqueID(s string) func(*CatPendingTasksRequest) { - return func(r *CatPendingTasksRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.plugins.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.plugins.go deleted file mode 100644 index ddab22f53..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.plugins.go +++ /dev/null @@ -1,303 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" - "time" -) - -func newCatPluginsFunc(t Transport) CatPlugins { - return func(o ...func(*CatPluginsRequest)) (*Response, error) { - var r = CatPluginsRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// CatPlugins returns information about installed plugins across nodes node. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-plugins.html. -// -type CatPlugins func(o ...func(*CatPluginsRequest)) (*Response, error) - -// CatPluginsRequest configures the Cat Plugins API request. -// -type CatPluginsRequest struct { - Format string - H []string - Help *bool - IncludeBootstrap *bool - Local *bool - MasterTimeout time.Duration - S []string - V *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r CatPluginsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(len("/_cat/plugins")) - path.WriteString("/_cat/plugins") - - params = make(map[string]string) - - if r.Format != "" { - params["format"] = r.Format - } - - if len(r.H) > 0 { - params["h"] = strings.Join(r.H, ",") - } - - if r.Help != nil { - params["help"] = strconv.FormatBool(*r.Help) - } - - if r.IncludeBootstrap != nil { - params["include_bootstrap"] = strconv.FormatBool(*r.IncludeBootstrap) - } - - if r.Local != nil { - params["local"] = strconv.FormatBool(*r.Local) - } - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if len(r.S) > 0 { - params["s"] = strings.Join(r.S, ",") - } - - if r.V != nil { - params["v"] = strconv.FormatBool(*r.V) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f CatPlugins) WithContext(v context.Context) func(*CatPluginsRequest) { - return func(r *CatPluginsRequest) { - r.ctx = v - } -} - -// WithFormat - a short version of the accept header, e.g. json, yaml. -// -func (f CatPlugins) WithFormat(v string) func(*CatPluginsRequest) { - return func(r *CatPluginsRequest) { - r.Format = v - } -} - -// WithH - comma-separated list of column names to display. -// -func (f CatPlugins) WithH(v ...string) func(*CatPluginsRequest) { - return func(r *CatPluginsRequest) { - r.H = v - } -} - -// WithHelp - return help information. -// -func (f CatPlugins) WithHelp(v bool) func(*CatPluginsRequest) { - return func(r *CatPluginsRequest) { - r.Help = &v - } -} - -// WithIncludeBootstrap - include bootstrap plugins in the response. -// -func (f CatPlugins) WithIncludeBootstrap(v bool) func(*CatPluginsRequest) { - return func(r *CatPluginsRequest) { - r.IncludeBootstrap = &v - } -} - -// WithLocal - return local information, do not retrieve the state from master node (default: false). -// -func (f CatPlugins) WithLocal(v bool) func(*CatPluginsRequest) { - return func(r *CatPluginsRequest) { - r.Local = &v - } -} - -// WithMasterTimeout - explicit operation timeout for connection to master node. -// -func (f CatPlugins) WithMasterTimeout(v time.Duration) func(*CatPluginsRequest) { - return func(r *CatPluginsRequest) { - r.MasterTimeout = v - } -} - -// WithS - comma-separated list of column names or column aliases to sort by. -// -func (f CatPlugins) WithS(v ...string) func(*CatPluginsRequest) { - return func(r *CatPluginsRequest) { - r.S = v - } -} - -// WithV - verbose mode. display column headers. -// -func (f CatPlugins) WithV(v bool) func(*CatPluginsRequest) { - return func(r *CatPluginsRequest) { - r.V = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f CatPlugins) WithPretty() func(*CatPluginsRequest) { - return func(r *CatPluginsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f CatPlugins) WithHuman() func(*CatPluginsRequest) { - return func(r *CatPluginsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f CatPlugins) WithErrorTrace() func(*CatPluginsRequest) { - return func(r *CatPluginsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f CatPlugins) WithFilterPath(v ...string) func(*CatPluginsRequest) { - return func(r *CatPluginsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f CatPlugins) WithHeader(h map[string]string) func(*CatPluginsRequest) { - return func(r *CatPluginsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f CatPlugins) WithOpaqueID(s string) func(*CatPluginsRequest) { - return func(r *CatPluginsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.recovery.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.recovery.go deleted file mode 100644 index e30ff6bac..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.recovery.go +++ /dev/null @@ -1,336 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newCatRecoveryFunc(t Transport) CatRecovery { - return func(o ...func(*CatRecoveryRequest)) (*Response, error) { - var r = CatRecoveryRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// CatRecovery returns information about index shard recoveries, both on-going completed. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-recovery.html. -// -type CatRecovery func(o ...func(*CatRecoveryRequest)) (*Response, error) - -// CatRecoveryRequest configures the Cat Recovery API request. -// -type CatRecoveryRequest struct { - Index []string - - ActiveOnly *bool - Bytes string - Detailed *bool - Format string - H []string - Help *bool - S []string - Time string - V *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r CatRecoveryRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_cat") + 1 + len("recovery") + 1 + len(strings.Join(r.Index, ","))) - path.WriteString("/") - path.WriteString("_cat") - path.WriteString("/") - path.WriteString("recovery") - if len(r.Index) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Index, ",")) - } - - params = make(map[string]string) - - if r.ActiveOnly != nil { - params["active_only"] = strconv.FormatBool(*r.ActiveOnly) - } - - if r.Bytes != "" { - params["bytes"] = r.Bytes - } - - if r.Detailed != nil { - params["detailed"] = strconv.FormatBool(*r.Detailed) - } - - if r.Format != "" { - params["format"] = r.Format - } - - if len(r.H) > 0 { - params["h"] = strings.Join(r.H, ",") - } - - if r.Help != nil { - params["help"] = strconv.FormatBool(*r.Help) - } - - if len(r.Index) > 0 { - params["index"] = strings.Join(r.Index, ",") - } - - if len(r.S) > 0 { - params["s"] = strings.Join(r.S, ",") - } - - if r.Time != "" { - params["time"] = r.Time - } - - if r.V != nil { - params["v"] = strconv.FormatBool(*r.V) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f CatRecovery) WithContext(v context.Context) func(*CatRecoveryRequest) { - return func(r *CatRecoveryRequest) { - r.ctx = v - } -} - -// WithIndex - comma-separated list or wildcard expression of index names to limit the returned information. -// -func (f CatRecovery) WithIndex(v ...string) func(*CatRecoveryRequest) { - return func(r *CatRecoveryRequest) { - r.Index = v - } -} - -// WithActiveOnly - if `true`, the response only includes ongoing shard recoveries. -// -func (f CatRecovery) WithActiveOnly(v bool) func(*CatRecoveryRequest) { - return func(r *CatRecoveryRequest) { - r.ActiveOnly = &v - } -} - -// WithBytes - the unit in which to display byte values. -// -func (f CatRecovery) WithBytes(v string) func(*CatRecoveryRequest) { - return func(r *CatRecoveryRequest) { - r.Bytes = v - } -} - -// WithDetailed - if `true`, the response includes detailed information about shard recoveries. -// -func (f CatRecovery) WithDetailed(v bool) func(*CatRecoveryRequest) { - return func(r *CatRecoveryRequest) { - r.Detailed = &v - } -} - -// WithFormat - a short version of the accept header, e.g. json, yaml. -// -func (f CatRecovery) WithFormat(v string) func(*CatRecoveryRequest) { - return func(r *CatRecoveryRequest) { - r.Format = v - } -} - -// WithH - comma-separated list of column names to display. -// -func (f CatRecovery) WithH(v ...string) func(*CatRecoveryRequest) { - return func(r *CatRecoveryRequest) { - r.H = v - } -} - -// WithHelp - return help information. -// -func (f CatRecovery) WithHelp(v bool) func(*CatRecoveryRequest) { - return func(r *CatRecoveryRequest) { - r.Help = &v - } -} - -// WithS - comma-separated list of column names or column aliases to sort by. -// -func (f CatRecovery) WithS(v ...string) func(*CatRecoveryRequest) { - return func(r *CatRecoveryRequest) { - r.S = v - } -} - -// WithTime - the unit in which to display time values. -// -func (f CatRecovery) WithTime(v string) func(*CatRecoveryRequest) { - return func(r *CatRecoveryRequest) { - r.Time = v - } -} - -// WithV - verbose mode. display column headers. -// -func (f CatRecovery) WithV(v bool) func(*CatRecoveryRequest) { - return func(r *CatRecoveryRequest) { - r.V = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f CatRecovery) WithPretty() func(*CatRecoveryRequest) { - return func(r *CatRecoveryRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f CatRecovery) WithHuman() func(*CatRecoveryRequest) { - return func(r *CatRecoveryRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f CatRecovery) WithErrorTrace() func(*CatRecoveryRequest) { - return func(r *CatRecoveryRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f CatRecovery) WithFilterPath(v ...string) func(*CatRecoveryRequest) { - return func(r *CatRecoveryRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f CatRecovery) WithHeader(h map[string]string) func(*CatRecoveryRequest) { - return func(r *CatRecoveryRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f CatRecovery) WithOpaqueID(s string) func(*CatRecoveryRequest) { - return func(r *CatRecoveryRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.repositories.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.repositories.go deleted file mode 100644 index 286c300cd..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.repositories.go +++ /dev/null @@ -1,290 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" - "time" -) - -func newCatRepositoriesFunc(t Transport) CatRepositories { - return func(o ...func(*CatRepositoriesRequest)) (*Response, error) { - var r = CatRepositoriesRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// CatRepositories returns information about snapshot repositories registered in the cluster. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-repositories.html. -// -type CatRepositories func(o ...func(*CatRepositoriesRequest)) (*Response, error) - -// CatRepositoriesRequest configures the Cat Repositories API request. -// -type CatRepositoriesRequest struct { - Format string - H []string - Help *bool - Local *bool - MasterTimeout time.Duration - S []string - V *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r CatRepositoriesRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(len("/_cat/repositories")) - path.WriteString("/_cat/repositories") - - params = make(map[string]string) - - if r.Format != "" { - params["format"] = r.Format - } - - if len(r.H) > 0 { - params["h"] = strings.Join(r.H, ",") - } - - if r.Help != nil { - params["help"] = strconv.FormatBool(*r.Help) - } - - if r.Local != nil { - params["local"] = strconv.FormatBool(*r.Local) - } - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if len(r.S) > 0 { - params["s"] = strings.Join(r.S, ",") - } - - if r.V != nil { - params["v"] = strconv.FormatBool(*r.V) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f CatRepositories) WithContext(v context.Context) func(*CatRepositoriesRequest) { - return func(r *CatRepositoriesRequest) { - r.ctx = v - } -} - -// WithFormat - a short version of the accept header, e.g. json, yaml. -// -func (f CatRepositories) WithFormat(v string) func(*CatRepositoriesRequest) { - return func(r *CatRepositoriesRequest) { - r.Format = v - } -} - -// WithH - comma-separated list of column names to display. -// -func (f CatRepositories) WithH(v ...string) func(*CatRepositoriesRequest) { - return func(r *CatRepositoriesRequest) { - r.H = v - } -} - -// WithHelp - return help information. -// -func (f CatRepositories) WithHelp(v bool) func(*CatRepositoriesRequest) { - return func(r *CatRepositoriesRequest) { - r.Help = &v - } -} - -// WithLocal - return local information, do not retrieve the state from master node. -// -func (f CatRepositories) WithLocal(v bool) func(*CatRepositoriesRequest) { - return func(r *CatRepositoriesRequest) { - r.Local = &v - } -} - -// WithMasterTimeout - explicit operation timeout for connection to master node. -// -func (f CatRepositories) WithMasterTimeout(v time.Duration) func(*CatRepositoriesRequest) { - return func(r *CatRepositoriesRequest) { - r.MasterTimeout = v - } -} - -// WithS - comma-separated list of column names or column aliases to sort by. -// -func (f CatRepositories) WithS(v ...string) func(*CatRepositoriesRequest) { - return func(r *CatRepositoriesRequest) { - r.S = v - } -} - -// WithV - verbose mode. display column headers. -// -func (f CatRepositories) WithV(v bool) func(*CatRepositoriesRequest) { - return func(r *CatRepositoriesRequest) { - r.V = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f CatRepositories) WithPretty() func(*CatRepositoriesRequest) { - return func(r *CatRepositoriesRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f CatRepositories) WithHuman() func(*CatRepositoriesRequest) { - return func(r *CatRepositoriesRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f CatRepositories) WithErrorTrace() func(*CatRepositoriesRequest) { - return func(r *CatRepositoriesRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f CatRepositories) WithFilterPath(v ...string) func(*CatRepositoriesRequest) { - return func(r *CatRepositoriesRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f CatRepositories) WithHeader(h map[string]string) func(*CatRepositoriesRequest) { - return func(r *CatRepositoriesRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f CatRepositories) WithOpaqueID(s string) func(*CatRepositoriesRequest) { - return func(r *CatRepositoriesRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.segments.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.segments.go deleted file mode 100644 index f330b38f0..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.segments.go +++ /dev/null @@ -1,293 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newCatSegmentsFunc(t Transport) CatSegments { - return func(o ...func(*CatSegmentsRequest)) (*Response, error) { - var r = CatSegmentsRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// CatSegments provides low-level information about the segments in the shards of an index. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-segments.html. -// -type CatSegments func(o ...func(*CatSegmentsRequest)) (*Response, error) - -// CatSegmentsRequest configures the Cat Segments API request. -// -type CatSegmentsRequest struct { - Index []string - - Bytes string - Format string - H []string - Help *bool - S []string - V *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r CatSegmentsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_cat") + 1 + len("segments") + 1 + len(strings.Join(r.Index, ","))) - path.WriteString("/") - path.WriteString("_cat") - path.WriteString("/") - path.WriteString("segments") - if len(r.Index) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Index, ",")) - } - - params = make(map[string]string) - - if r.Bytes != "" { - params["bytes"] = r.Bytes - } - - if r.Format != "" { - params["format"] = r.Format - } - - if len(r.H) > 0 { - params["h"] = strings.Join(r.H, ",") - } - - if r.Help != nil { - params["help"] = strconv.FormatBool(*r.Help) - } - - if len(r.S) > 0 { - params["s"] = strings.Join(r.S, ",") - } - - if r.V != nil { - params["v"] = strconv.FormatBool(*r.V) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f CatSegments) WithContext(v context.Context) func(*CatSegmentsRequest) { - return func(r *CatSegmentsRequest) { - r.ctx = v - } -} - -// WithIndex - a list of index names to limit the returned information. -// -func (f CatSegments) WithIndex(v ...string) func(*CatSegmentsRequest) { - return func(r *CatSegmentsRequest) { - r.Index = v - } -} - -// WithBytes - the unit in which to display byte values. -// -func (f CatSegments) WithBytes(v string) func(*CatSegmentsRequest) { - return func(r *CatSegmentsRequest) { - r.Bytes = v - } -} - -// WithFormat - a short version of the accept header, e.g. json, yaml. -// -func (f CatSegments) WithFormat(v string) func(*CatSegmentsRequest) { - return func(r *CatSegmentsRequest) { - r.Format = v - } -} - -// WithH - comma-separated list of column names to display. -// -func (f CatSegments) WithH(v ...string) func(*CatSegmentsRequest) { - return func(r *CatSegmentsRequest) { - r.H = v - } -} - -// WithHelp - return help information. -// -func (f CatSegments) WithHelp(v bool) func(*CatSegmentsRequest) { - return func(r *CatSegmentsRequest) { - r.Help = &v - } -} - -// WithS - comma-separated list of column names or column aliases to sort by. -// -func (f CatSegments) WithS(v ...string) func(*CatSegmentsRequest) { - return func(r *CatSegmentsRequest) { - r.S = v - } -} - -// WithV - verbose mode. display column headers. -// -func (f CatSegments) WithV(v bool) func(*CatSegmentsRequest) { - return func(r *CatSegmentsRequest) { - r.V = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f CatSegments) WithPretty() func(*CatSegmentsRequest) { - return func(r *CatSegmentsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f CatSegments) WithHuman() func(*CatSegmentsRequest) { - return func(r *CatSegmentsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f CatSegments) WithErrorTrace() func(*CatSegmentsRequest) { - return func(r *CatSegmentsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f CatSegments) WithFilterPath(v ...string) func(*CatSegmentsRequest) { - return func(r *CatSegmentsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f CatSegments) WithHeader(h map[string]string) func(*CatSegmentsRequest) { - return func(r *CatSegmentsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f CatSegments) WithOpaqueID(s string) func(*CatSegmentsRequest) { - return func(r *CatSegmentsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.shards.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.shards.go deleted file mode 100644 index 1ffdac652..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.shards.go +++ /dev/null @@ -1,333 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" - "time" -) - -func newCatShardsFunc(t Transport) CatShards { - return func(o ...func(*CatShardsRequest)) (*Response, error) { - var r = CatShardsRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// CatShards provides a detailed view of shard allocation on nodes. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-shards.html. -// -type CatShards func(o ...func(*CatShardsRequest)) (*Response, error) - -// CatShardsRequest configures the Cat Shards API request. -// -type CatShardsRequest struct { - Index []string - - Bytes string - Format string - H []string - Help *bool - Local *bool - MasterTimeout time.Duration - S []string - Time string - V *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r CatShardsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_cat") + 1 + len("shards") + 1 + len(strings.Join(r.Index, ","))) - path.WriteString("/") - path.WriteString("_cat") - path.WriteString("/") - path.WriteString("shards") - if len(r.Index) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Index, ",")) - } - - params = make(map[string]string) - - if r.Bytes != "" { - params["bytes"] = r.Bytes - } - - if r.Format != "" { - params["format"] = r.Format - } - - if len(r.H) > 0 { - params["h"] = strings.Join(r.H, ",") - } - - if r.Help != nil { - params["help"] = strconv.FormatBool(*r.Help) - } - - if r.Local != nil { - params["local"] = strconv.FormatBool(*r.Local) - } - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if len(r.S) > 0 { - params["s"] = strings.Join(r.S, ",") - } - - if r.Time != "" { - params["time"] = r.Time - } - - if r.V != nil { - params["v"] = strconv.FormatBool(*r.V) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f CatShards) WithContext(v context.Context) func(*CatShardsRequest) { - return func(r *CatShardsRequest) { - r.ctx = v - } -} - -// WithIndex - a list of index names to limit the returned information. -// -func (f CatShards) WithIndex(v ...string) func(*CatShardsRequest) { - return func(r *CatShardsRequest) { - r.Index = v - } -} - -// WithBytes - the unit in which to display byte values. -// -func (f CatShards) WithBytes(v string) func(*CatShardsRequest) { - return func(r *CatShardsRequest) { - r.Bytes = v - } -} - -// WithFormat - a short version of the accept header, e.g. json, yaml. -// -func (f CatShards) WithFormat(v string) func(*CatShardsRequest) { - return func(r *CatShardsRequest) { - r.Format = v - } -} - -// WithH - comma-separated list of column names to display. -// -func (f CatShards) WithH(v ...string) func(*CatShardsRequest) { - return func(r *CatShardsRequest) { - r.H = v - } -} - -// WithHelp - return help information. -// -func (f CatShards) WithHelp(v bool) func(*CatShardsRequest) { - return func(r *CatShardsRequest) { - r.Help = &v - } -} - -// WithLocal - return local information, do not retrieve the state from master node (default: false). -// -func (f CatShards) WithLocal(v bool) func(*CatShardsRequest) { - return func(r *CatShardsRequest) { - r.Local = &v - } -} - -// WithMasterTimeout - explicit operation timeout for connection to master node. -// -func (f CatShards) WithMasterTimeout(v time.Duration) func(*CatShardsRequest) { - return func(r *CatShardsRequest) { - r.MasterTimeout = v - } -} - -// WithS - comma-separated list of column names or column aliases to sort by. -// -func (f CatShards) WithS(v ...string) func(*CatShardsRequest) { - return func(r *CatShardsRequest) { - r.S = v - } -} - -// WithTime - the unit in which to display time values. -// -func (f CatShards) WithTime(v string) func(*CatShardsRequest) { - return func(r *CatShardsRequest) { - r.Time = v - } -} - -// WithV - verbose mode. display column headers. -// -func (f CatShards) WithV(v bool) func(*CatShardsRequest) { - return func(r *CatShardsRequest) { - r.V = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f CatShards) WithPretty() func(*CatShardsRequest) { - return func(r *CatShardsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f CatShards) WithHuman() func(*CatShardsRequest) { - return func(r *CatShardsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f CatShards) WithErrorTrace() func(*CatShardsRequest) { - return func(r *CatShardsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f CatShards) WithFilterPath(v ...string) func(*CatShardsRequest) { - return func(r *CatShardsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f CatShards) WithHeader(h map[string]string) func(*CatShardsRequest) { - return func(r *CatShardsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f CatShards) WithOpaqueID(s string) func(*CatShardsRequest) { - return func(r *CatShardsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.snapshots.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.snapshots.go deleted file mode 100644 index 2f7672afc..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.snapshots.go +++ /dev/null @@ -1,320 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" - "time" -) - -func newCatSnapshotsFunc(t Transport) CatSnapshots { - return func(o ...func(*CatSnapshotsRequest)) (*Response, error) { - var r = CatSnapshotsRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// CatSnapshots returns all snapshots in a specific repository. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-snapshots.html. -// -type CatSnapshots func(o ...func(*CatSnapshotsRequest)) (*Response, error) - -// CatSnapshotsRequest configures the Cat Snapshots API request. -// -type CatSnapshotsRequest struct { - Repository []string - - Format string - H []string - Help *bool - IgnoreUnavailable *bool - MasterTimeout time.Duration - S []string - Time string - V *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r CatSnapshotsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_cat") + 1 + len("snapshots") + 1 + len(strings.Join(r.Repository, ","))) - path.WriteString("/") - path.WriteString("_cat") - path.WriteString("/") - path.WriteString("snapshots") - if len(r.Repository) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Repository, ",")) - } - - params = make(map[string]string) - - if r.Format != "" { - params["format"] = r.Format - } - - if len(r.H) > 0 { - params["h"] = strings.Join(r.H, ",") - } - - if r.Help != nil { - params["help"] = strconv.FormatBool(*r.Help) - } - - if r.IgnoreUnavailable != nil { - params["ignore_unavailable"] = strconv.FormatBool(*r.IgnoreUnavailable) - } - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if len(r.S) > 0 { - params["s"] = strings.Join(r.S, ",") - } - - if r.Time != "" { - params["time"] = r.Time - } - - if r.V != nil { - params["v"] = strconv.FormatBool(*r.V) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f CatSnapshots) WithContext(v context.Context) func(*CatSnapshotsRequest) { - return func(r *CatSnapshotsRequest) { - r.ctx = v - } -} - -// WithRepository - name of repository from which to fetch the snapshot information. -// -func (f CatSnapshots) WithRepository(v ...string) func(*CatSnapshotsRequest) { - return func(r *CatSnapshotsRequest) { - r.Repository = v - } -} - -// WithFormat - a short version of the accept header, e.g. json, yaml. -// -func (f CatSnapshots) WithFormat(v string) func(*CatSnapshotsRequest) { - return func(r *CatSnapshotsRequest) { - r.Format = v - } -} - -// WithH - comma-separated list of column names to display. -// -func (f CatSnapshots) WithH(v ...string) func(*CatSnapshotsRequest) { - return func(r *CatSnapshotsRequest) { - r.H = v - } -} - -// WithHelp - return help information. -// -func (f CatSnapshots) WithHelp(v bool) func(*CatSnapshotsRequest) { - return func(r *CatSnapshotsRequest) { - r.Help = &v - } -} - -// WithIgnoreUnavailable - set to true to ignore unavailable snapshots. -// -func (f CatSnapshots) WithIgnoreUnavailable(v bool) func(*CatSnapshotsRequest) { - return func(r *CatSnapshotsRequest) { - r.IgnoreUnavailable = &v - } -} - -// WithMasterTimeout - explicit operation timeout for connection to master node. -// -func (f CatSnapshots) WithMasterTimeout(v time.Duration) func(*CatSnapshotsRequest) { - return func(r *CatSnapshotsRequest) { - r.MasterTimeout = v - } -} - -// WithS - comma-separated list of column names or column aliases to sort by. -// -func (f CatSnapshots) WithS(v ...string) func(*CatSnapshotsRequest) { - return func(r *CatSnapshotsRequest) { - r.S = v - } -} - -// WithTime - the unit in which to display time values. -// -func (f CatSnapshots) WithTime(v string) func(*CatSnapshotsRequest) { - return func(r *CatSnapshotsRequest) { - r.Time = v - } -} - -// WithV - verbose mode. display column headers. -// -func (f CatSnapshots) WithV(v bool) func(*CatSnapshotsRequest) { - return func(r *CatSnapshotsRequest) { - r.V = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f CatSnapshots) WithPretty() func(*CatSnapshotsRequest) { - return func(r *CatSnapshotsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f CatSnapshots) WithHuman() func(*CatSnapshotsRequest) { - return func(r *CatSnapshotsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f CatSnapshots) WithErrorTrace() func(*CatSnapshotsRequest) { - return func(r *CatSnapshotsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f CatSnapshots) WithFilterPath(v ...string) func(*CatSnapshotsRequest) { - return func(r *CatSnapshotsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f CatSnapshots) WithHeader(h map[string]string) func(*CatSnapshotsRequest) { - return func(r *CatSnapshotsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f CatSnapshots) WithOpaqueID(s string) func(*CatSnapshotsRequest) { - return func(r *CatSnapshotsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.tasks.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.tasks.go deleted file mode 100644 index 19262f909..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.tasks.go +++ /dev/null @@ -1,328 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newCatTasksFunc(t Transport) CatTasks { - return func(o ...func(*CatTasksRequest)) (*Response, error) { - var r = CatTasksRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// CatTasks returns information about the tasks currently executing on one or more nodes in the cluster. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html. -// -type CatTasks func(o ...func(*CatTasksRequest)) (*Response, error) - -// CatTasksRequest configures the Cat Tasks API request. -// -type CatTasksRequest struct { - Actions []string - Detailed *bool - Format string - H []string - Help *bool - Nodes []string - ParentTaskID string - S []string - Time string - V *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r CatTasksRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(len("/_cat/tasks")) - path.WriteString("/_cat/tasks") - - params = make(map[string]string) - - if len(r.Actions) > 0 { - params["actions"] = strings.Join(r.Actions, ",") - } - - if r.Detailed != nil { - params["detailed"] = strconv.FormatBool(*r.Detailed) - } - - if r.Format != "" { - params["format"] = r.Format - } - - if len(r.H) > 0 { - params["h"] = strings.Join(r.H, ",") - } - - if r.Help != nil { - params["help"] = strconv.FormatBool(*r.Help) - } - - if len(r.Nodes) > 0 { - params["nodes"] = strings.Join(r.Nodes, ",") - } - - if r.ParentTaskID != "" { - params["parent_task_id"] = r.ParentTaskID - } - - if len(r.S) > 0 { - params["s"] = strings.Join(r.S, ",") - } - - if r.Time != "" { - params["time"] = r.Time - } - - if r.V != nil { - params["v"] = strconv.FormatBool(*r.V) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f CatTasks) WithContext(v context.Context) func(*CatTasksRequest) { - return func(r *CatTasksRequest) { - r.ctx = v - } -} - -// WithActions - a list of actions that should be returned. leave empty to return all.. -// -func (f CatTasks) WithActions(v ...string) func(*CatTasksRequest) { - return func(r *CatTasksRequest) { - r.Actions = v - } -} - -// WithDetailed - return detailed task information (default: false). -// -func (f CatTasks) WithDetailed(v bool) func(*CatTasksRequest) { - return func(r *CatTasksRequest) { - r.Detailed = &v - } -} - -// WithFormat - a short version of the accept header, e.g. json, yaml. -// -func (f CatTasks) WithFormat(v string) func(*CatTasksRequest) { - return func(r *CatTasksRequest) { - r.Format = v - } -} - -// WithH - comma-separated list of column names to display. -// -func (f CatTasks) WithH(v ...string) func(*CatTasksRequest) { - return func(r *CatTasksRequest) { - r.H = v - } -} - -// WithHelp - return help information. -// -func (f CatTasks) WithHelp(v bool) func(*CatTasksRequest) { - return func(r *CatTasksRequest) { - r.Help = &v - } -} - -// WithNodes - a list of node ids or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes. -// -func (f CatTasks) WithNodes(v ...string) func(*CatTasksRequest) { - return func(r *CatTasksRequest) { - r.Nodes = v - } -} - -// WithParentTaskID - return tasks with specified parent task ID (node_id:task_number). set to -1 to return all.. -// -func (f CatTasks) WithParentTaskID(v string) func(*CatTasksRequest) { - return func(r *CatTasksRequest) { - r.ParentTaskID = v - } -} - -// WithS - comma-separated list of column names or column aliases to sort by. -// -func (f CatTasks) WithS(v ...string) func(*CatTasksRequest) { - return func(r *CatTasksRequest) { - r.S = v - } -} - -// WithTime - the unit in which to display time values. -// -func (f CatTasks) WithTime(v string) func(*CatTasksRequest) { - return func(r *CatTasksRequest) { - r.Time = v - } -} - -// WithV - verbose mode. display column headers. -// -func (f CatTasks) WithV(v bool) func(*CatTasksRequest) { - return func(r *CatTasksRequest) { - r.V = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f CatTasks) WithPretty() func(*CatTasksRequest) { - return func(r *CatTasksRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f CatTasks) WithHuman() func(*CatTasksRequest) { - return func(r *CatTasksRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f CatTasks) WithErrorTrace() func(*CatTasksRequest) { - return func(r *CatTasksRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f CatTasks) WithFilterPath(v ...string) func(*CatTasksRequest) { - return func(r *CatTasksRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f CatTasks) WithHeader(h map[string]string) func(*CatTasksRequest) { - return func(r *CatTasksRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f CatTasks) WithOpaqueID(s string) func(*CatTasksRequest) { - return func(r *CatTasksRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.templates.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.templates.go deleted file mode 100644 index 2586fdd18..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.templates.go +++ /dev/null @@ -1,307 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" - "time" -) - -func newCatTemplatesFunc(t Transport) CatTemplates { - return func(o ...func(*CatTemplatesRequest)) (*Response, error) { - var r = CatTemplatesRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// CatTemplates returns information about existing templates. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-templates.html. -// -type CatTemplates func(o ...func(*CatTemplatesRequest)) (*Response, error) - -// CatTemplatesRequest configures the Cat Templates API request. -// -type CatTemplatesRequest struct { - Name string - - Format string - H []string - Help *bool - Local *bool - MasterTimeout time.Duration - S []string - V *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r CatTemplatesRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_cat") + 1 + len("templates") + 1 + len(r.Name)) - path.WriteString("/") - path.WriteString("_cat") - path.WriteString("/") - path.WriteString("templates") - if r.Name != "" { - path.WriteString("/") - path.WriteString(r.Name) - } - - params = make(map[string]string) - - if r.Format != "" { - params["format"] = r.Format - } - - if len(r.H) > 0 { - params["h"] = strings.Join(r.H, ",") - } - - if r.Help != nil { - params["help"] = strconv.FormatBool(*r.Help) - } - - if r.Local != nil { - params["local"] = strconv.FormatBool(*r.Local) - } - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if len(r.S) > 0 { - params["s"] = strings.Join(r.S, ",") - } - - if r.V != nil { - params["v"] = strconv.FormatBool(*r.V) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f CatTemplates) WithContext(v context.Context) func(*CatTemplatesRequest) { - return func(r *CatTemplatesRequest) { - r.ctx = v - } -} - -// WithName - a pattern that returned template names must match. -// -func (f CatTemplates) WithName(v string) func(*CatTemplatesRequest) { - return func(r *CatTemplatesRequest) { - r.Name = v - } -} - -// WithFormat - a short version of the accept header, e.g. json, yaml. -// -func (f CatTemplates) WithFormat(v string) func(*CatTemplatesRequest) { - return func(r *CatTemplatesRequest) { - r.Format = v - } -} - -// WithH - comma-separated list of column names to display. -// -func (f CatTemplates) WithH(v ...string) func(*CatTemplatesRequest) { - return func(r *CatTemplatesRequest) { - r.H = v - } -} - -// WithHelp - return help information. -// -func (f CatTemplates) WithHelp(v bool) func(*CatTemplatesRequest) { - return func(r *CatTemplatesRequest) { - r.Help = &v - } -} - -// WithLocal - return local information, do not retrieve the state from master node (default: false). -// -func (f CatTemplates) WithLocal(v bool) func(*CatTemplatesRequest) { - return func(r *CatTemplatesRequest) { - r.Local = &v - } -} - -// WithMasterTimeout - explicit operation timeout for connection to master node. -// -func (f CatTemplates) WithMasterTimeout(v time.Duration) func(*CatTemplatesRequest) { - return func(r *CatTemplatesRequest) { - r.MasterTimeout = v - } -} - -// WithS - comma-separated list of column names or column aliases to sort by. -// -func (f CatTemplates) WithS(v ...string) func(*CatTemplatesRequest) { - return func(r *CatTemplatesRequest) { - r.S = v - } -} - -// WithV - verbose mode. display column headers. -// -func (f CatTemplates) WithV(v bool) func(*CatTemplatesRequest) { - return func(r *CatTemplatesRequest) { - r.V = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f CatTemplates) WithPretty() func(*CatTemplatesRequest) { - return func(r *CatTemplatesRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f CatTemplates) WithHuman() func(*CatTemplatesRequest) { - return func(r *CatTemplatesRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f CatTemplates) WithErrorTrace() func(*CatTemplatesRequest) { - return func(r *CatTemplatesRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f CatTemplates) WithFilterPath(v ...string) func(*CatTemplatesRequest) { - return func(r *CatTemplatesRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f CatTemplates) WithHeader(h map[string]string) func(*CatTemplatesRequest) { - return func(r *CatTemplatesRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f CatTemplates) WithOpaqueID(s string) func(*CatTemplatesRequest) { - return func(r *CatTemplatesRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.thread_pool.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.thread_pool.go deleted file mode 100644 index e40a90e36..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cat.thread_pool.go +++ /dev/null @@ -1,321 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" - "time" -) - -func newCatThreadPoolFunc(t Transport) CatThreadPool { - return func(o ...func(*CatThreadPoolRequest)) (*Response, error) { - var r = CatThreadPoolRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// CatThreadPool returns cluster-wide thread pool statistics per node. -// By default the active, queue and rejected statistics are returned for all thread pools. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-thread-pool.html. -// -type CatThreadPool func(o ...func(*CatThreadPoolRequest)) (*Response, error) - -// CatThreadPoolRequest configures the Cat Thread Pool API request. -// -type CatThreadPoolRequest struct { - ThreadPoolPatterns []string - - Format string - H []string - Help *bool - Local *bool - MasterTimeout time.Duration - S []string - Size string - V *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r CatThreadPoolRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_cat") + 1 + len("thread_pool") + 1 + len(strings.Join(r.ThreadPoolPatterns, ","))) - path.WriteString("/") - path.WriteString("_cat") - path.WriteString("/") - path.WriteString("thread_pool") - if len(r.ThreadPoolPatterns) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.ThreadPoolPatterns, ",")) - } - - params = make(map[string]string) - - if r.Format != "" { - params["format"] = r.Format - } - - if len(r.H) > 0 { - params["h"] = strings.Join(r.H, ",") - } - - if r.Help != nil { - params["help"] = strconv.FormatBool(*r.Help) - } - - if r.Local != nil { - params["local"] = strconv.FormatBool(*r.Local) - } - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if len(r.S) > 0 { - params["s"] = strings.Join(r.S, ",") - } - - if r.Size != "" { - params["size"] = r.Size - } - - if r.V != nil { - params["v"] = strconv.FormatBool(*r.V) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f CatThreadPool) WithContext(v context.Context) func(*CatThreadPoolRequest) { - return func(r *CatThreadPoolRequest) { - r.ctx = v - } -} - -// WithThreadPoolPatterns - a list of regular-expressions to filter the thread pools in the output. -// -func (f CatThreadPool) WithThreadPoolPatterns(v ...string) func(*CatThreadPoolRequest) { - return func(r *CatThreadPoolRequest) { - r.ThreadPoolPatterns = v - } -} - -// WithFormat - a short version of the accept header, e.g. json, yaml. -// -func (f CatThreadPool) WithFormat(v string) func(*CatThreadPoolRequest) { - return func(r *CatThreadPoolRequest) { - r.Format = v - } -} - -// WithH - comma-separated list of column names to display. -// -func (f CatThreadPool) WithH(v ...string) func(*CatThreadPoolRequest) { - return func(r *CatThreadPoolRequest) { - r.H = v - } -} - -// WithHelp - return help information. -// -func (f CatThreadPool) WithHelp(v bool) func(*CatThreadPoolRequest) { - return func(r *CatThreadPoolRequest) { - r.Help = &v - } -} - -// WithLocal - return local information, do not retrieve the state from master node (default: false). -// -func (f CatThreadPool) WithLocal(v bool) func(*CatThreadPoolRequest) { - return func(r *CatThreadPoolRequest) { - r.Local = &v - } -} - -// WithMasterTimeout - explicit operation timeout for connection to master node. -// -func (f CatThreadPool) WithMasterTimeout(v time.Duration) func(*CatThreadPoolRequest) { - return func(r *CatThreadPoolRequest) { - r.MasterTimeout = v - } -} - -// WithS - comma-separated list of column names or column aliases to sort by. -// -func (f CatThreadPool) WithS(v ...string) func(*CatThreadPoolRequest) { - return func(r *CatThreadPoolRequest) { - r.S = v - } -} - -// WithSize - the multiplier in which to display values. -// -func (f CatThreadPool) WithSize(v string) func(*CatThreadPoolRequest) { - return func(r *CatThreadPoolRequest) { - r.Size = v - } -} - -// WithV - verbose mode. display column headers. -// -func (f CatThreadPool) WithV(v bool) func(*CatThreadPoolRequest) { - return func(r *CatThreadPoolRequest) { - r.V = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f CatThreadPool) WithPretty() func(*CatThreadPoolRequest) { - return func(r *CatThreadPoolRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f CatThreadPool) WithHuman() func(*CatThreadPoolRequest) { - return func(r *CatThreadPoolRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f CatThreadPool) WithErrorTrace() func(*CatThreadPoolRequest) { - return func(r *CatThreadPoolRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f CatThreadPool) WithFilterPath(v ...string) func(*CatThreadPoolRequest) { - return func(r *CatThreadPoolRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f CatThreadPool) WithHeader(h map[string]string) func(*CatThreadPoolRequest) { - return func(r *CatThreadPoolRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f CatThreadPool) WithOpaqueID(s string) func(*CatThreadPoolRequest) { - return func(r *CatThreadPoolRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.clear_scroll.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.clear_scroll.go deleted file mode 100644 index dd6655ccd..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.clear_scroll.go +++ /dev/null @@ -1,228 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" -) - -func newClearScrollFunc(t Transport) ClearScroll { - return func(o ...func(*ClearScrollRequest)) (*Response, error) { - var r = ClearScrollRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// ClearScroll explicitly clears the search context for a scroll. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/clear-scroll-api.html. -// -type ClearScroll func(o ...func(*ClearScrollRequest)) (*Response, error) - -// ClearScrollRequest configures the Clear Scroll API request. -// -type ClearScrollRequest struct { - Body io.Reader - - ScrollID []string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r ClearScrollRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "DELETE" - - path.Grow(1 + len("_search") + 1 + len("scroll") + 1 + len(strings.Join(r.ScrollID, ","))) - path.WriteString("/") - path.WriteString("_search") - path.WriteString("/") - path.WriteString("scroll") - if len(r.ScrollID) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.ScrollID, ",")) - } - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f ClearScroll) WithContext(v context.Context) func(*ClearScrollRequest) { - return func(r *ClearScrollRequest) { - r.ctx = v - } -} - -// WithBody - A comma-separated list of scroll IDs to clear if none was specified via the scroll_id parameter. -// -func (f ClearScroll) WithBody(v io.Reader) func(*ClearScrollRequest) { - return func(r *ClearScrollRequest) { - r.Body = v - } -} - -// WithScrollID - a list of scroll ids to clear. -// -func (f ClearScroll) WithScrollID(v ...string) func(*ClearScrollRequest) { - return func(r *ClearScrollRequest) { - r.ScrollID = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f ClearScroll) WithPretty() func(*ClearScrollRequest) { - return func(r *ClearScrollRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f ClearScroll) WithHuman() func(*ClearScrollRequest) { - return func(r *ClearScrollRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f ClearScroll) WithErrorTrace() func(*ClearScrollRequest) { - return func(r *ClearScrollRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f ClearScroll) WithFilterPath(v ...string) func(*ClearScrollRequest) { - return func(r *ClearScrollRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f ClearScroll) WithHeader(h map[string]string) func(*ClearScrollRequest) { - return func(r *ClearScrollRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f ClearScroll) WithOpaqueID(s string) func(*ClearScrollRequest) { - return func(r *ClearScrollRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.allocation_explain.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.allocation_explain.go deleted file mode 100644 index f671d8a0b..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.allocation_explain.go +++ /dev/null @@ -1,239 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" -) - -func newClusterAllocationExplainFunc(t Transport) ClusterAllocationExplain { - return func(o ...func(*ClusterAllocationExplainRequest)) (*Response, error) { - var r = ClusterAllocationExplainRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// ClusterAllocationExplain provides explanations for shard allocations in the cluster. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-allocation-explain.html. -// -type ClusterAllocationExplain func(o ...func(*ClusterAllocationExplainRequest)) (*Response, error) - -// ClusterAllocationExplainRequest configures the Cluster Allocation Explain API request. -// -type ClusterAllocationExplainRequest struct { - Body io.Reader - - IncludeDiskInfo *bool - IncludeYesDecisions *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r ClusterAllocationExplainRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(len("/_cluster/allocation/explain")) - path.WriteString("/_cluster/allocation/explain") - - params = make(map[string]string) - - if r.IncludeDiskInfo != nil { - params["include_disk_info"] = strconv.FormatBool(*r.IncludeDiskInfo) - } - - if r.IncludeYesDecisions != nil { - params["include_yes_decisions"] = strconv.FormatBool(*r.IncludeYesDecisions) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f ClusterAllocationExplain) WithContext(v context.Context) func(*ClusterAllocationExplainRequest) { - return func(r *ClusterAllocationExplainRequest) { - r.ctx = v - } -} - -// WithBody - The index, shard, and primary flag to explain. Empty means 'explain the first unassigned shard'. -// -func (f ClusterAllocationExplain) WithBody(v io.Reader) func(*ClusterAllocationExplainRequest) { - return func(r *ClusterAllocationExplainRequest) { - r.Body = v - } -} - -// WithIncludeDiskInfo - return information about disk usage and shard sizes (default: false). -// -func (f ClusterAllocationExplain) WithIncludeDiskInfo(v bool) func(*ClusterAllocationExplainRequest) { - return func(r *ClusterAllocationExplainRequest) { - r.IncludeDiskInfo = &v - } -} - -// WithIncludeYesDecisions - return 'yes' decisions in explanation (default: false). -// -func (f ClusterAllocationExplain) WithIncludeYesDecisions(v bool) func(*ClusterAllocationExplainRequest) { - return func(r *ClusterAllocationExplainRequest) { - r.IncludeYesDecisions = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f ClusterAllocationExplain) WithPretty() func(*ClusterAllocationExplainRequest) { - return func(r *ClusterAllocationExplainRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f ClusterAllocationExplain) WithHuman() func(*ClusterAllocationExplainRequest) { - return func(r *ClusterAllocationExplainRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f ClusterAllocationExplain) WithErrorTrace() func(*ClusterAllocationExplainRequest) { - return func(r *ClusterAllocationExplainRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f ClusterAllocationExplain) WithFilterPath(v ...string) func(*ClusterAllocationExplainRequest) { - return func(r *ClusterAllocationExplainRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f ClusterAllocationExplain) WithHeader(h map[string]string) func(*ClusterAllocationExplainRequest) { - return func(r *ClusterAllocationExplainRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f ClusterAllocationExplain) WithOpaqueID(s string) func(*ClusterAllocationExplainRequest) { - return func(r *ClusterAllocationExplainRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.delete_component_template.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.delete_component_template.go deleted file mode 100644 index 1432b1b36..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.delete_component_template.go +++ /dev/null @@ -1,229 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" - "time" -) - -func newClusterDeleteComponentTemplateFunc(t Transport) ClusterDeleteComponentTemplate { - return func(name string, o ...func(*ClusterDeleteComponentTemplateRequest)) (*Response, error) { - var r = ClusterDeleteComponentTemplateRequest{Name: name} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// ClusterDeleteComponentTemplate deletes a component template -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-component-template.html. -// -type ClusterDeleteComponentTemplate func(name string, o ...func(*ClusterDeleteComponentTemplateRequest)) (*Response, error) - -// ClusterDeleteComponentTemplateRequest configures the Cluster Delete Component Template API request. -// -type ClusterDeleteComponentTemplateRequest struct { - Name string - - MasterTimeout time.Duration - Timeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r ClusterDeleteComponentTemplateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "DELETE" - - path.Grow(1 + len("_component_template") + 1 + len(r.Name)) - path.WriteString("/") - path.WriteString("_component_template") - path.WriteString("/") - path.WriteString(r.Name) - - params = make(map[string]string) - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f ClusterDeleteComponentTemplate) WithContext(v context.Context) func(*ClusterDeleteComponentTemplateRequest) { - return func(r *ClusterDeleteComponentTemplateRequest) { - r.ctx = v - } -} - -// WithMasterTimeout - specify timeout for connection to master. -// -func (f ClusterDeleteComponentTemplate) WithMasterTimeout(v time.Duration) func(*ClusterDeleteComponentTemplateRequest) { - return func(r *ClusterDeleteComponentTemplateRequest) { - r.MasterTimeout = v - } -} - -// WithTimeout - explicit operation timeout. -// -func (f ClusterDeleteComponentTemplate) WithTimeout(v time.Duration) func(*ClusterDeleteComponentTemplateRequest) { - return func(r *ClusterDeleteComponentTemplateRequest) { - r.Timeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f ClusterDeleteComponentTemplate) WithPretty() func(*ClusterDeleteComponentTemplateRequest) { - return func(r *ClusterDeleteComponentTemplateRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f ClusterDeleteComponentTemplate) WithHuman() func(*ClusterDeleteComponentTemplateRequest) { - return func(r *ClusterDeleteComponentTemplateRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f ClusterDeleteComponentTemplate) WithErrorTrace() func(*ClusterDeleteComponentTemplateRequest) { - return func(r *ClusterDeleteComponentTemplateRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f ClusterDeleteComponentTemplate) WithFilterPath(v ...string) func(*ClusterDeleteComponentTemplateRequest) { - return func(r *ClusterDeleteComponentTemplateRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f ClusterDeleteComponentTemplate) WithHeader(h map[string]string) func(*ClusterDeleteComponentTemplateRequest) { - return func(r *ClusterDeleteComponentTemplateRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f ClusterDeleteComponentTemplate) WithOpaqueID(s string) func(*ClusterDeleteComponentTemplateRequest) { - return func(r *ClusterDeleteComponentTemplateRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.delete_voting_config_exclusions.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.delete_voting_config_exclusions.go deleted file mode 100644 index 40ff62bfd..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.delete_voting_config_exclusions.go +++ /dev/null @@ -1,211 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newClusterDeleteVotingConfigExclusionsFunc(t Transport) ClusterDeleteVotingConfigExclusions { - return func(o ...func(*ClusterDeleteVotingConfigExclusionsRequest)) (*Response, error) { - var r = ClusterDeleteVotingConfigExclusionsRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// ClusterDeleteVotingConfigExclusions clears cluster voting config exclusions. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/voting-config-exclusions.html. -// -type ClusterDeleteVotingConfigExclusions func(o ...func(*ClusterDeleteVotingConfigExclusionsRequest)) (*Response, error) - -// ClusterDeleteVotingConfigExclusionsRequest configures the Cluster Delete Voting Config Exclusions API request. -// -type ClusterDeleteVotingConfigExclusionsRequest struct { - WaitForRemoval *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r ClusterDeleteVotingConfigExclusionsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "DELETE" - - path.Grow(len("/_cluster/voting_config_exclusions")) - path.WriteString("/_cluster/voting_config_exclusions") - - params = make(map[string]string) - - if r.WaitForRemoval != nil { - params["wait_for_removal"] = strconv.FormatBool(*r.WaitForRemoval) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f ClusterDeleteVotingConfigExclusions) WithContext(v context.Context) func(*ClusterDeleteVotingConfigExclusionsRequest) { - return func(r *ClusterDeleteVotingConfigExclusionsRequest) { - r.ctx = v - } -} - -// WithWaitForRemoval - specifies whether to wait for all excluded nodes to be removed from the cluster before clearing the voting configuration exclusions list.. -// -func (f ClusterDeleteVotingConfigExclusions) WithWaitForRemoval(v bool) func(*ClusterDeleteVotingConfigExclusionsRequest) { - return func(r *ClusterDeleteVotingConfigExclusionsRequest) { - r.WaitForRemoval = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f ClusterDeleteVotingConfigExclusions) WithPretty() func(*ClusterDeleteVotingConfigExclusionsRequest) { - return func(r *ClusterDeleteVotingConfigExclusionsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f ClusterDeleteVotingConfigExclusions) WithHuman() func(*ClusterDeleteVotingConfigExclusionsRequest) { - return func(r *ClusterDeleteVotingConfigExclusionsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f ClusterDeleteVotingConfigExclusions) WithErrorTrace() func(*ClusterDeleteVotingConfigExclusionsRequest) { - return func(r *ClusterDeleteVotingConfigExclusionsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f ClusterDeleteVotingConfigExclusions) WithFilterPath(v ...string) func(*ClusterDeleteVotingConfigExclusionsRequest) { - return func(r *ClusterDeleteVotingConfigExclusionsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f ClusterDeleteVotingConfigExclusions) WithHeader(h map[string]string) func(*ClusterDeleteVotingConfigExclusionsRequest) { - return func(r *ClusterDeleteVotingConfigExclusionsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f ClusterDeleteVotingConfigExclusions) WithOpaqueID(s string) func(*ClusterDeleteVotingConfigExclusionsRequest) { - return func(r *ClusterDeleteVotingConfigExclusionsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.exists_component_template.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.exists_component_template.go deleted file mode 100644 index c1d40bab0..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.exists_component_template.go +++ /dev/null @@ -1,230 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" - "time" -) - -func newClusterExistsComponentTemplateFunc(t Transport) ClusterExistsComponentTemplate { - return func(name string, o ...func(*ClusterExistsComponentTemplateRequest)) (*Response, error) { - var r = ClusterExistsComponentTemplateRequest{Name: name} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// ClusterExistsComponentTemplate returns information about whether a particular component template exist -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-component-template.html. -// -type ClusterExistsComponentTemplate func(name string, o ...func(*ClusterExistsComponentTemplateRequest)) (*Response, error) - -// ClusterExistsComponentTemplateRequest configures the Cluster Exists Component Template API request. -// -type ClusterExistsComponentTemplateRequest struct { - Name string - - Local *bool - MasterTimeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r ClusterExistsComponentTemplateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "HEAD" - - path.Grow(1 + len("_component_template") + 1 + len(r.Name)) - path.WriteString("/") - path.WriteString("_component_template") - path.WriteString("/") - path.WriteString(r.Name) - - params = make(map[string]string) - - if r.Local != nil { - params["local"] = strconv.FormatBool(*r.Local) - } - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f ClusterExistsComponentTemplate) WithContext(v context.Context) func(*ClusterExistsComponentTemplateRequest) { - return func(r *ClusterExistsComponentTemplateRequest) { - r.ctx = v - } -} - -// WithLocal - return local information, do not retrieve the state from master node (default: false). -// -func (f ClusterExistsComponentTemplate) WithLocal(v bool) func(*ClusterExistsComponentTemplateRequest) { - return func(r *ClusterExistsComponentTemplateRequest) { - r.Local = &v - } -} - -// WithMasterTimeout - explicit operation timeout for connection to master node. -// -func (f ClusterExistsComponentTemplate) WithMasterTimeout(v time.Duration) func(*ClusterExistsComponentTemplateRequest) { - return func(r *ClusterExistsComponentTemplateRequest) { - r.MasterTimeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f ClusterExistsComponentTemplate) WithPretty() func(*ClusterExistsComponentTemplateRequest) { - return func(r *ClusterExistsComponentTemplateRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f ClusterExistsComponentTemplate) WithHuman() func(*ClusterExistsComponentTemplateRequest) { - return func(r *ClusterExistsComponentTemplateRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f ClusterExistsComponentTemplate) WithErrorTrace() func(*ClusterExistsComponentTemplateRequest) { - return func(r *ClusterExistsComponentTemplateRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f ClusterExistsComponentTemplate) WithFilterPath(v ...string) func(*ClusterExistsComponentTemplateRequest) { - return func(r *ClusterExistsComponentTemplateRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f ClusterExistsComponentTemplate) WithHeader(h map[string]string) func(*ClusterExistsComponentTemplateRequest) { - return func(r *ClusterExistsComponentTemplateRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f ClusterExistsComponentTemplate) WithOpaqueID(s string) func(*ClusterExistsComponentTemplateRequest) { - return func(r *ClusterExistsComponentTemplateRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.get_component_template.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.get_component_template.go deleted file mode 100644 index a98bde2a3..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.get_component_template.go +++ /dev/null @@ -1,240 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" - "time" -) - -func newClusterGetComponentTemplateFunc(t Transport) ClusterGetComponentTemplate { - return func(o ...func(*ClusterGetComponentTemplateRequest)) (*Response, error) { - var r = ClusterGetComponentTemplateRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// ClusterGetComponentTemplate returns one or more component templates -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-component-template.html. -// -type ClusterGetComponentTemplate func(o ...func(*ClusterGetComponentTemplateRequest)) (*Response, error) - -// ClusterGetComponentTemplateRequest configures the Cluster Get Component Template API request. -// -type ClusterGetComponentTemplateRequest struct { - Name []string - - Local *bool - MasterTimeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r ClusterGetComponentTemplateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_component_template") + 1 + len(strings.Join(r.Name, ","))) - path.WriteString("/") - path.WriteString("_component_template") - if len(r.Name) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Name, ",")) - } - - params = make(map[string]string) - - if r.Local != nil { - params["local"] = strconv.FormatBool(*r.Local) - } - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f ClusterGetComponentTemplate) WithContext(v context.Context) func(*ClusterGetComponentTemplateRequest) { - return func(r *ClusterGetComponentTemplateRequest) { - r.ctx = v - } -} - -// WithName - the comma separated names of the component templates. -// -func (f ClusterGetComponentTemplate) WithName(v ...string) func(*ClusterGetComponentTemplateRequest) { - return func(r *ClusterGetComponentTemplateRequest) { - r.Name = v - } -} - -// WithLocal - return local information, do not retrieve the state from master node (default: false). -// -func (f ClusterGetComponentTemplate) WithLocal(v bool) func(*ClusterGetComponentTemplateRequest) { - return func(r *ClusterGetComponentTemplateRequest) { - r.Local = &v - } -} - -// WithMasterTimeout - explicit operation timeout for connection to master node. -// -func (f ClusterGetComponentTemplate) WithMasterTimeout(v time.Duration) func(*ClusterGetComponentTemplateRequest) { - return func(r *ClusterGetComponentTemplateRequest) { - r.MasterTimeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f ClusterGetComponentTemplate) WithPretty() func(*ClusterGetComponentTemplateRequest) { - return func(r *ClusterGetComponentTemplateRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f ClusterGetComponentTemplate) WithHuman() func(*ClusterGetComponentTemplateRequest) { - return func(r *ClusterGetComponentTemplateRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f ClusterGetComponentTemplate) WithErrorTrace() func(*ClusterGetComponentTemplateRequest) { - return func(r *ClusterGetComponentTemplateRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f ClusterGetComponentTemplate) WithFilterPath(v ...string) func(*ClusterGetComponentTemplateRequest) { - return func(r *ClusterGetComponentTemplateRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f ClusterGetComponentTemplate) WithHeader(h map[string]string) func(*ClusterGetComponentTemplateRequest) { - return func(r *ClusterGetComponentTemplateRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f ClusterGetComponentTemplate) WithOpaqueID(s string) func(*ClusterGetComponentTemplateRequest) { - return func(r *ClusterGetComponentTemplateRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.get_settings.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.get_settings.go deleted file mode 100644 index 2abb1ca82..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.get_settings.go +++ /dev/null @@ -1,251 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" - "time" -) - -func newClusterGetSettingsFunc(t Transport) ClusterGetSettings { - return func(o ...func(*ClusterGetSettingsRequest)) (*Response, error) { - var r = ClusterGetSettingsRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// ClusterGetSettings returns cluster settings. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-get-settings.html. -// -type ClusterGetSettings func(o ...func(*ClusterGetSettingsRequest)) (*Response, error) - -// ClusterGetSettingsRequest configures the Cluster Get Settings API request. -// -type ClusterGetSettingsRequest struct { - FlatSettings *bool - IncludeDefaults *bool - MasterTimeout time.Duration - Timeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r ClusterGetSettingsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(len("/_cluster/settings")) - path.WriteString("/_cluster/settings") - - params = make(map[string]string) - - if r.FlatSettings != nil { - params["flat_settings"] = strconv.FormatBool(*r.FlatSettings) - } - - if r.IncludeDefaults != nil { - params["include_defaults"] = strconv.FormatBool(*r.IncludeDefaults) - } - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f ClusterGetSettings) WithContext(v context.Context) func(*ClusterGetSettingsRequest) { - return func(r *ClusterGetSettingsRequest) { - r.ctx = v - } -} - -// WithFlatSettings - return settings in flat format (default: false). -// -func (f ClusterGetSettings) WithFlatSettings(v bool) func(*ClusterGetSettingsRequest) { - return func(r *ClusterGetSettingsRequest) { - r.FlatSettings = &v - } -} - -// WithIncludeDefaults - whether to return all default clusters setting.. -// -func (f ClusterGetSettings) WithIncludeDefaults(v bool) func(*ClusterGetSettingsRequest) { - return func(r *ClusterGetSettingsRequest) { - r.IncludeDefaults = &v - } -} - -// WithMasterTimeout - explicit operation timeout for connection to master node. -// -func (f ClusterGetSettings) WithMasterTimeout(v time.Duration) func(*ClusterGetSettingsRequest) { - return func(r *ClusterGetSettingsRequest) { - r.MasterTimeout = v - } -} - -// WithTimeout - explicit operation timeout. -// -func (f ClusterGetSettings) WithTimeout(v time.Duration) func(*ClusterGetSettingsRequest) { - return func(r *ClusterGetSettingsRequest) { - r.Timeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f ClusterGetSettings) WithPretty() func(*ClusterGetSettingsRequest) { - return func(r *ClusterGetSettingsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f ClusterGetSettings) WithHuman() func(*ClusterGetSettingsRequest) { - return func(r *ClusterGetSettingsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f ClusterGetSettings) WithErrorTrace() func(*ClusterGetSettingsRequest) { - return func(r *ClusterGetSettingsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f ClusterGetSettings) WithFilterPath(v ...string) func(*ClusterGetSettingsRequest) { - return func(r *ClusterGetSettingsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f ClusterGetSettings) WithHeader(h map[string]string) func(*ClusterGetSettingsRequest) { - return func(r *ClusterGetSettingsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f ClusterGetSettings) WithOpaqueID(s string) func(*ClusterGetSettingsRequest) { - return func(r *ClusterGetSettingsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.health.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.health.go deleted file mode 100644 index 4ba34092e..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.health.go +++ /dev/null @@ -1,359 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" - "time" -) - -func newClusterHealthFunc(t Transport) ClusterHealth { - return func(o ...func(*ClusterHealthRequest)) (*Response, error) { - var r = ClusterHealthRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// ClusterHealth returns basic information about the health of the cluster. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-health.html. -// -type ClusterHealth func(o ...func(*ClusterHealthRequest)) (*Response, error) - -// ClusterHealthRequest configures the Cluster Health API request. -// -type ClusterHealthRequest struct { - Index []string - - ExpandWildcards string - Level string - Local *bool - MasterTimeout time.Duration - Timeout time.Duration - WaitForActiveShards string - WaitForEvents string - WaitForNoInitializingShards *bool - WaitForNoRelocatingShards *bool - WaitForNodes string - WaitForStatus string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r ClusterHealthRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_cluster") + 1 + len("health") + 1 + len(strings.Join(r.Index, ","))) - path.WriteString("/") - path.WriteString("_cluster") - path.WriteString("/") - path.WriteString("health") - if len(r.Index) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Index, ",")) - } - - params = make(map[string]string) - - if r.ExpandWildcards != "" { - params["expand_wildcards"] = r.ExpandWildcards - } - - if r.Level != "" { - params["level"] = r.Level - } - - if r.Local != nil { - params["local"] = strconv.FormatBool(*r.Local) - } - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.WaitForActiveShards != "" { - params["wait_for_active_shards"] = r.WaitForActiveShards - } - - if r.WaitForEvents != "" { - params["wait_for_events"] = r.WaitForEvents - } - - if r.WaitForNoInitializingShards != nil { - params["wait_for_no_initializing_shards"] = strconv.FormatBool(*r.WaitForNoInitializingShards) - } - - if r.WaitForNoRelocatingShards != nil { - params["wait_for_no_relocating_shards"] = strconv.FormatBool(*r.WaitForNoRelocatingShards) - } - - if r.WaitForNodes != "" { - params["wait_for_nodes"] = r.WaitForNodes - } - - if r.WaitForStatus != "" { - params["wait_for_status"] = r.WaitForStatus - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f ClusterHealth) WithContext(v context.Context) func(*ClusterHealthRequest) { - return func(r *ClusterHealthRequest) { - r.ctx = v - } -} - -// WithIndex - limit the information returned to a specific index. -// -func (f ClusterHealth) WithIndex(v ...string) func(*ClusterHealthRequest) { - return func(r *ClusterHealthRequest) { - r.Index = v - } -} - -// WithExpandWildcards - whether to expand wildcard expression to concrete indices that are open, closed or both.. -// -func (f ClusterHealth) WithExpandWildcards(v string) func(*ClusterHealthRequest) { - return func(r *ClusterHealthRequest) { - r.ExpandWildcards = v - } -} - -// WithLevel - specify the level of detail for returned information. -// -func (f ClusterHealth) WithLevel(v string) func(*ClusterHealthRequest) { - return func(r *ClusterHealthRequest) { - r.Level = v - } -} - -// WithLocal - return local information, do not retrieve the state from master node (default: false). -// -func (f ClusterHealth) WithLocal(v bool) func(*ClusterHealthRequest) { - return func(r *ClusterHealthRequest) { - r.Local = &v - } -} - -// WithMasterTimeout - explicit operation timeout for connection to master node. -// -func (f ClusterHealth) WithMasterTimeout(v time.Duration) func(*ClusterHealthRequest) { - return func(r *ClusterHealthRequest) { - r.MasterTimeout = v - } -} - -// WithTimeout - explicit operation timeout. -// -func (f ClusterHealth) WithTimeout(v time.Duration) func(*ClusterHealthRequest) { - return func(r *ClusterHealthRequest) { - r.Timeout = v - } -} - -// WithWaitForActiveShards - wait until the specified number of shards is active. -// -func (f ClusterHealth) WithWaitForActiveShards(v string) func(*ClusterHealthRequest) { - return func(r *ClusterHealthRequest) { - r.WaitForActiveShards = v - } -} - -// WithWaitForEvents - wait until all currently queued events with the given priority are processed. -// -func (f ClusterHealth) WithWaitForEvents(v string) func(*ClusterHealthRequest) { - return func(r *ClusterHealthRequest) { - r.WaitForEvents = v - } -} - -// WithWaitForNoInitializingShards - whether to wait until there are no initializing shards in the cluster. -// -func (f ClusterHealth) WithWaitForNoInitializingShards(v bool) func(*ClusterHealthRequest) { - return func(r *ClusterHealthRequest) { - r.WaitForNoInitializingShards = &v - } -} - -// WithWaitForNoRelocatingShards - whether to wait until there are no relocating shards in the cluster. -// -func (f ClusterHealth) WithWaitForNoRelocatingShards(v bool) func(*ClusterHealthRequest) { - return func(r *ClusterHealthRequest) { - r.WaitForNoRelocatingShards = &v - } -} - -// WithWaitForNodes - wait until the specified number of nodes is available. -// -func (f ClusterHealth) WithWaitForNodes(v string) func(*ClusterHealthRequest) { - return func(r *ClusterHealthRequest) { - r.WaitForNodes = v - } -} - -// WithWaitForStatus - wait until cluster is in a specific state. -// -func (f ClusterHealth) WithWaitForStatus(v string) func(*ClusterHealthRequest) { - return func(r *ClusterHealthRequest) { - r.WaitForStatus = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f ClusterHealth) WithPretty() func(*ClusterHealthRequest) { - return func(r *ClusterHealthRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f ClusterHealth) WithHuman() func(*ClusterHealthRequest) { - return func(r *ClusterHealthRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f ClusterHealth) WithErrorTrace() func(*ClusterHealthRequest) { - return func(r *ClusterHealthRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f ClusterHealth) WithFilterPath(v ...string) func(*ClusterHealthRequest) { - return func(r *ClusterHealthRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f ClusterHealth) WithHeader(h map[string]string) func(*ClusterHealthRequest) { - return func(r *ClusterHealthRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f ClusterHealth) WithOpaqueID(s string) func(*ClusterHealthRequest) { - return func(r *ClusterHealthRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.pending_tasks.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.pending_tasks.go deleted file mode 100644 index 8c0ae503e..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.pending_tasks.go +++ /dev/null @@ -1,226 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" - "time" -) - -func newClusterPendingTasksFunc(t Transport) ClusterPendingTasks { - return func(o ...func(*ClusterPendingTasksRequest)) (*Response, error) { - var r = ClusterPendingTasksRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// ClusterPendingTasks returns a list of any cluster-level changes (e.g. create index, update mapping, -// allocate or fail shard) which have not yet been executed. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-pending.html. -// -type ClusterPendingTasks func(o ...func(*ClusterPendingTasksRequest)) (*Response, error) - -// ClusterPendingTasksRequest configures the Cluster Pending Tasks API request. -// -type ClusterPendingTasksRequest struct { - Local *bool - MasterTimeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r ClusterPendingTasksRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(len("/_cluster/pending_tasks")) - path.WriteString("/_cluster/pending_tasks") - - params = make(map[string]string) - - if r.Local != nil { - params["local"] = strconv.FormatBool(*r.Local) - } - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f ClusterPendingTasks) WithContext(v context.Context) func(*ClusterPendingTasksRequest) { - return func(r *ClusterPendingTasksRequest) { - r.ctx = v - } -} - -// WithLocal - return local information, do not retrieve the state from master node (default: false). -// -func (f ClusterPendingTasks) WithLocal(v bool) func(*ClusterPendingTasksRequest) { - return func(r *ClusterPendingTasksRequest) { - r.Local = &v - } -} - -// WithMasterTimeout - specify timeout for connection to master. -// -func (f ClusterPendingTasks) WithMasterTimeout(v time.Duration) func(*ClusterPendingTasksRequest) { - return func(r *ClusterPendingTasksRequest) { - r.MasterTimeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f ClusterPendingTasks) WithPretty() func(*ClusterPendingTasksRequest) { - return func(r *ClusterPendingTasksRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f ClusterPendingTasks) WithHuman() func(*ClusterPendingTasksRequest) { - return func(r *ClusterPendingTasksRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f ClusterPendingTasks) WithErrorTrace() func(*ClusterPendingTasksRequest) { - return func(r *ClusterPendingTasksRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f ClusterPendingTasks) WithFilterPath(v ...string) func(*ClusterPendingTasksRequest) { - return func(r *ClusterPendingTasksRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f ClusterPendingTasks) WithHeader(h map[string]string) func(*ClusterPendingTasksRequest) { - return func(r *ClusterPendingTasksRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f ClusterPendingTasks) WithOpaqueID(s string) func(*ClusterPendingTasksRequest) { - return func(r *ClusterPendingTasksRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.post_voting_config_exclusions.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.post_voting_config_exclusions.go deleted file mode 100644 index 99a0147f0..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.post_voting_config_exclusions.go +++ /dev/null @@ -1,237 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" - "time" -) - -func newClusterPostVotingConfigExclusionsFunc(t Transport) ClusterPostVotingConfigExclusions { - return func(o ...func(*ClusterPostVotingConfigExclusionsRequest)) (*Response, error) { - var r = ClusterPostVotingConfigExclusionsRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// ClusterPostVotingConfigExclusions updates the cluster voting config exclusions by node ids or node names. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/voting-config-exclusions.html. -// -type ClusterPostVotingConfigExclusions func(o ...func(*ClusterPostVotingConfigExclusionsRequest)) (*Response, error) - -// ClusterPostVotingConfigExclusionsRequest configures the Cluster Post Voting Config Exclusions API request. -// -type ClusterPostVotingConfigExclusionsRequest struct { - NodeIds string - NodeNames string - Timeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r ClusterPostVotingConfigExclusionsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(len("/_cluster/voting_config_exclusions")) - path.WriteString("/_cluster/voting_config_exclusions") - - params = make(map[string]string) - - if r.NodeIds != "" { - params["node_ids"] = r.NodeIds - } - - if r.NodeNames != "" { - params["node_names"] = r.NodeNames - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f ClusterPostVotingConfigExclusions) WithContext(v context.Context) func(*ClusterPostVotingConfigExclusionsRequest) { - return func(r *ClusterPostVotingConfigExclusionsRequest) { - r.ctx = v - } -} - -// WithNodeIds - a list of the persistent ids of the nodes to exclude from the voting configuration. if specified, you may not also specify ?node_names.. -// -func (f ClusterPostVotingConfigExclusions) WithNodeIds(v string) func(*ClusterPostVotingConfigExclusionsRequest) { - return func(r *ClusterPostVotingConfigExclusionsRequest) { - r.NodeIds = v - } -} - -// WithNodeNames - a list of the names of the nodes to exclude from the voting configuration. if specified, you may not also specify ?node_ids.. -// -func (f ClusterPostVotingConfigExclusions) WithNodeNames(v string) func(*ClusterPostVotingConfigExclusionsRequest) { - return func(r *ClusterPostVotingConfigExclusionsRequest) { - r.NodeNames = v - } -} - -// WithTimeout - explicit operation timeout. -// -func (f ClusterPostVotingConfigExclusions) WithTimeout(v time.Duration) func(*ClusterPostVotingConfigExclusionsRequest) { - return func(r *ClusterPostVotingConfigExclusionsRequest) { - r.Timeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f ClusterPostVotingConfigExclusions) WithPretty() func(*ClusterPostVotingConfigExclusionsRequest) { - return func(r *ClusterPostVotingConfigExclusionsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f ClusterPostVotingConfigExclusions) WithHuman() func(*ClusterPostVotingConfigExclusionsRequest) { - return func(r *ClusterPostVotingConfigExclusionsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f ClusterPostVotingConfigExclusions) WithErrorTrace() func(*ClusterPostVotingConfigExclusionsRequest) { - return func(r *ClusterPostVotingConfigExclusionsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f ClusterPostVotingConfigExclusions) WithFilterPath(v ...string) func(*ClusterPostVotingConfigExclusionsRequest) { - return func(r *ClusterPostVotingConfigExclusionsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f ClusterPostVotingConfigExclusions) WithHeader(h map[string]string) func(*ClusterPostVotingConfigExclusionsRequest) { - return func(r *ClusterPostVotingConfigExclusionsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f ClusterPostVotingConfigExclusions) WithOpaqueID(s string) func(*ClusterPostVotingConfigExclusionsRequest) { - return func(r *ClusterPostVotingConfigExclusionsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.put_component_template.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.put_component_template.go deleted file mode 100644 index c084fab1a..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.put_component_template.go +++ /dev/null @@ -1,250 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" - "time" -) - -func newClusterPutComponentTemplateFunc(t Transport) ClusterPutComponentTemplate { - return func(name string, body io.Reader, o ...func(*ClusterPutComponentTemplateRequest)) (*Response, error) { - var r = ClusterPutComponentTemplateRequest{Name: name, Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// ClusterPutComponentTemplate creates or updates a component template -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-component-template.html. -// -type ClusterPutComponentTemplate func(name string, body io.Reader, o ...func(*ClusterPutComponentTemplateRequest)) (*Response, error) - -// ClusterPutComponentTemplateRequest configures the Cluster Put Component Template API request. -// -type ClusterPutComponentTemplateRequest struct { - Body io.Reader - - Name string - - Create *bool - MasterTimeout time.Duration - Timeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r ClusterPutComponentTemplateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - path.Grow(1 + len("_component_template") + 1 + len(r.Name)) - path.WriteString("/") - path.WriteString("_component_template") - path.WriteString("/") - path.WriteString(r.Name) - - params = make(map[string]string) - - if r.Create != nil { - params["create"] = strconv.FormatBool(*r.Create) - } - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f ClusterPutComponentTemplate) WithContext(v context.Context) func(*ClusterPutComponentTemplateRequest) { - return func(r *ClusterPutComponentTemplateRequest) { - r.ctx = v - } -} - -// WithCreate - whether the index template should only be added if new or can also replace an existing one. -// -func (f ClusterPutComponentTemplate) WithCreate(v bool) func(*ClusterPutComponentTemplateRequest) { - return func(r *ClusterPutComponentTemplateRequest) { - r.Create = &v - } -} - -// WithMasterTimeout - specify timeout for connection to master. -// -func (f ClusterPutComponentTemplate) WithMasterTimeout(v time.Duration) func(*ClusterPutComponentTemplateRequest) { - return func(r *ClusterPutComponentTemplateRequest) { - r.MasterTimeout = v - } -} - -// WithTimeout - explicit operation timeout. -// -func (f ClusterPutComponentTemplate) WithTimeout(v time.Duration) func(*ClusterPutComponentTemplateRequest) { - return func(r *ClusterPutComponentTemplateRequest) { - r.Timeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f ClusterPutComponentTemplate) WithPretty() func(*ClusterPutComponentTemplateRequest) { - return func(r *ClusterPutComponentTemplateRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f ClusterPutComponentTemplate) WithHuman() func(*ClusterPutComponentTemplateRequest) { - return func(r *ClusterPutComponentTemplateRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f ClusterPutComponentTemplate) WithErrorTrace() func(*ClusterPutComponentTemplateRequest) { - return func(r *ClusterPutComponentTemplateRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f ClusterPutComponentTemplate) WithFilterPath(v ...string) func(*ClusterPutComponentTemplateRequest) { - return func(r *ClusterPutComponentTemplateRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f ClusterPutComponentTemplate) WithHeader(h map[string]string) func(*ClusterPutComponentTemplateRequest) { - return func(r *ClusterPutComponentTemplateRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f ClusterPutComponentTemplate) WithOpaqueID(s string) func(*ClusterPutComponentTemplateRequest) { - return func(r *ClusterPutComponentTemplateRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.put_settings.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.put_settings.go deleted file mode 100644 index d6f192a11..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.put_settings.go +++ /dev/null @@ -1,245 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" - "time" -) - -func newClusterPutSettingsFunc(t Transport) ClusterPutSettings { - return func(body io.Reader, o ...func(*ClusterPutSettingsRequest)) (*Response, error) { - var r = ClusterPutSettingsRequest{Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// ClusterPutSettings updates the cluster settings. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-update-settings.html. -// -type ClusterPutSettings func(body io.Reader, o ...func(*ClusterPutSettingsRequest)) (*Response, error) - -// ClusterPutSettingsRequest configures the Cluster Put Settings API request. -// -type ClusterPutSettingsRequest struct { - Body io.Reader - - FlatSettings *bool - MasterTimeout time.Duration - Timeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r ClusterPutSettingsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - path.Grow(len("/_cluster/settings")) - path.WriteString("/_cluster/settings") - - params = make(map[string]string) - - if r.FlatSettings != nil { - params["flat_settings"] = strconv.FormatBool(*r.FlatSettings) - } - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f ClusterPutSettings) WithContext(v context.Context) func(*ClusterPutSettingsRequest) { - return func(r *ClusterPutSettingsRequest) { - r.ctx = v - } -} - -// WithFlatSettings - return settings in flat format (default: false). -// -func (f ClusterPutSettings) WithFlatSettings(v bool) func(*ClusterPutSettingsRequest) { - return func(r *ClusterPutSettingsRequest) { - r.FlatSettings = &v - } -} - -// WithMasterTimeout - explicit operation timeout for connection to master node. -// -func (f ClusterPutSettings) WithMasterTimeout(v time.Duration) func(*ClusterPutSettingsRequest) { - return func(r *ClusterPutSettingsRequest) { - r.MasterTimeout = v - } -} - -// WithTimeout - explicit operation timeout. -// -func (f ClusterPutSettings) WithTimeout(v time.Duration) func(*ClusterPutSettingsRequest) { - return func(r *ClusterPutSettingsRequest) { - r.Timeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f ClusterPutSettings) WithPretty() func(*ClusterPutSettingsRequest) { - return func(r *ClusterPutSettingsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f ClusterPutSettings) WithHuman() func(*ClusterPutSettingsRequest) { - return func(r *ClusterPutSettingsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f ClusterPutSettings) WithErrorTrace() func(*ClusterPutSettingsRequest) { - return func(r *ClusterPutSettingsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f ClusterPutSettings) WithFilterPath(v ...string) func(*ClusterPutSettingsRequest) { - return func(r *ClusterPutSettingsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f ClusterPutSettings) WithHeader(h map[string]string) func(*ClusterPutSettingsRequest) { - return func(r *ClusterPutSettingsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f ClusterPutSettings) WithOpaqueID(s string) func(*ClusterPutSettingsRequest) { - return func(r *ClusterPutSettingsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.remote_info.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.remote_info.go deleted file mode 100644 index 0b96bf764..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.remote_info.go +++ /dev/null @@ -1,196 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newClusterRemoteInfoFunc(t Transport) ClusterRemoteInfo { - return func(o ...func(*ClusterRemoteInfoRequest)) (*Response, error) { - var r = ClusterRemoteInfoRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// ClusterRemoteInfo returns the information about configured remote clusters. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-remote-info.html. -// -type ClusterRemoteInfo func(o ...func(*ClusterRemoteInfoRequest)) (*Response, error) - -// ClusterRemoteInfoRequest configures the Cluster Remote Info API request. -// -type ClusterRemoteInfoRequest struct { - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r ClusterRemoteInfoRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(len("/_remote/info")) - path.WriteString("/_remote/info") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f ClusterRemoteInfo) WithContext(v context.Context) func(*ClusterRemoteInfoRequest) { - return func(r *ClusterRemoteInfoRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f ClusterRemoteInfo) WithPretty() func(*ClusterRemoteInfoRequest) { - return func(r *ClusterRemoteInfoRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f ClusterRemoteInfo) WithHuman() func(*ClusterRemoteInfoRequest) { - return func(r *ClusterRemoteInfoRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f ClusterRemoteInfo) WithErrorTrace() func(*ClusterRemoteInfoRequest) { - return func(r *ClusterRemoteInfoRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f ClusterRemoteInfo) WithFilterPath(v ...string) func(*ClusterRemoteInfoRequest) { - return func(r *ClusterRemoteInfoRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f ClusterRemoteInfo) WithHeader(h map[string]string) func(*ClusterRemoteInfoRequest) { - return func(r *ClusterRemoteInfoRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f ClusterRemoteInfo) WithOpaqueID(s string) func(*ClusterRemoteInfoRequest) { - return func(r *ClusterRemoteInfoRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.reroute.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.reroute.go deleted file mode 100644 index 96f5f68ea..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.reroute.go +++ /dev/null @@ -1,292 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" - "time" -) - -func newClusterRerouteFunc(t Transport) ClusterReroute { - return func(o ...func(*ClusterRerouteRequest)) (*Response, error) { - var r = ClusterRerouteRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// ClusterReroute allows to manually change the allocation of individual shards in the cluster. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-reroute.html. -// -type ClusterReroute func(o ...func(*ClusterRerouteRequest)) (*Response, error) - -// ClusterRerouteRequest configures the Cluster Reroute API request. -// -type ClusterRerouteRequest struct { - Body io.Reader - - DryRun *bool - Explain *bool - MasterTimeout time.Duration - Metric []string - RetryFailed *bool - Timeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r ClusterRerouteRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(len("/_cluster/reroute")) - path.WriteString("/_cluster/reroute") - - params = make(map[string]string) - - if r.DryRun != nil { - params["dry_run"] = strconv.FormatBool(*r.DryRun) - } - - if r.Explain != nil { - params["explain"] = strconv.FormatBool(*r.Explain) - } - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if len(r.Metric) > 0 { - params["metric"] = strings.Join(r.Metric, ",") - } - - if r.RetryFailed != nil { - params["retry_failed"] = strconv.FormatBool(*r.RetryFailed) - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f ClusterReroute) WithContext(v context.Context) func(*ClusterRerouteRequest) { - return func(r *ClusterRerouteRequest) { - r.ctx = v - } -} - -// WithBody - The definition of `commands` to perform (`move`, `cancel`, `allocate`). -// -func (f ClusterReroute) WithBody(v io.Reader) func(*ClusterRerouteRequest) { - return func(r *ClusterRerouteRequest) { - r.Body = v - } -} - -// WithDryRun - simulate the operation only and return the resulting state. -// -func (f ClusterReroute) WithDryRun(v bool) func(*ClusterRerouteRequest) { - return func(r *ClusterRerouteRequest) { - r.DryRun = &v - } -} - -// WithExplain - return an explanation of why the commands can or cannot be executed. -// -func (f ClusterReroute) WithExplain(v bool) func(*ClusterRerouteRequest) { - return func(r *ClusterRerouteRequest) { - r.Explain = &v - } -} - -// WithMasterTimeout - explicit operation timeout for connection to master node. -// -func (f ClusterReroute) WithMasterTimeout(v time.Duration) func(*ClusterRerouteRequest) { - return func(r *ClusterRerouteRequest) { - r.MasterTimeout = v - } -} - -// WithMetric - limit the information returned to the specified metrics. defaults to all but metadata. -// -func (f ClusterReroute) WithMetric(v ...string) func(*ClusterRerouteRequest) { - return func(r *ClusterRerouteRequest) { - r.Metric = v - } -} - -// WithRetryFailed - retries allocation of shards that are blocked due to too many subsequent allocation failures. -// -func (f ClusterReroute) WithRetryFailed(v bool) func(*ClusterRerouteRequest) { - return func(r *ClusterRerouteRequest) { - r.RetryFailed = &v - } -} - -// WithTimeout - explicit operation timeout. -// -func (f ClusterReroute) WithTimeout(v time.Duration) func(*ClusterRerouteRequest) { - return func(r *ClusterRerouteRequest) { - r.Timeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f ClusterReroute) WithPretty() func(*ClusterRerouteRequest) { - return func(r *ClusterRerouteRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f ClusterReroute) WithHuman() func(*ClusterRerouteRequest) { - return func(r *ClusterRerouteRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f ClusterReroute) WithErrorTrace() func(*ClusterRerouteRequest) { - return func(r *ClusterRerouteRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f ClusterReroute) WithFilterPath(v ...string) func(*ClusterRerouteRequest) { - return func(r *ClusterRerouteRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f ClusterReroute) WithHeader(h map[string]string) func(*ClusterRerouteRequest) { - return func(r *ClusterRerouteRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f ClusterReroute) WithOpaqueID(s string) func(*ClusterRerouteRequest) { - return func(r *ClusterRerouteRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.state.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.state.go deleted file mode 100644 index d5f56ce48..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.state.go +++ /dev/null @@ -1,334 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" - "time" -) - -func newClusterStateFunc(t Transport) ClusterState { - return func(o ...func(*ClusterStateRequest)) (*Response, error) { - var r = ClusterStateRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// ClusterState returns a comprehensive information about the state of the cluster. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-state.html. -// -type ClusterState func(o ...func(*ClusterStateRequest)) (*Response, error) - -// ClusterStateRequest configures the Cluster State API request. -// -type ClusterStateRequest struct { - Index []string - - Metric []string - - AllowNoIndices *bool - ExpandWildcards string - FlatSettings *bool - IgnoreUnavailable *bool - Local *bool - MasterTimeout time.Duration - WaitForMetadataVersion *int - WaitForTimeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r ClusterStateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_cluster") + 1 + len("state") + 1 + len(strings.Join(r.Metric, ",")) + 1 + len(strings.Join(r.Index, ","))) - path.WriteString("/") - path.WriteString("_cluster") - path.WriteString("/") - path.WriteString("state") - if len(r.Metric) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Metric, ",")) - } - if len(r.Index) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Index, ",")) - } - - params = make(map[string]string) - - if r.AllowNoIndices != nil { - params["allow_no_indices"] = strconv.FormatBool(*r.AllowNoIndices) - } - - if r.ExpandWildcards != "" { - params["expand_wildcards"] = r.ExpandWildcards - } - - if r.FlatSettings != nil { - params["flat_settings"] = strconv.FormatBool(*r.FlatSettings) - } - - if r.IgnoreUnavailable != nil { - params["ignore_unavailable"] = strconv.FormatBool(*r.IgnoreUnavailable) - } - - if r.Local != nil { - params["local"] = strconv.FormatBool(*r.Local) - } - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.WaitForMetadataVersion != nil { - params["wait_for_metadata_version"] = strconv.FormatInt(int64(*r.WaitForMetadataVersion), 10) - } - - if r.WaitForTimeout != 0 { - params["wait_for_timeout"] = formatDuration(r.WaitForTimeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f ClusterState) WithContext(v context.Context) func(*ClusterStateRequest) { - return func(r *ClusterStateRequest) { - r.ctx = v - } -} - -// WithIndex - a list of index names; use _all to perform the operation on all indices. -// -func (f ClusterState) WithIndex(v ...string) func(*ClusterStateRequest) { - return func(r *ClusterStateRequest) { - r.Index = v - } -} - -// WithMetric - limit the information returned to the specified metrics. -// -func (f ClusterState) WithMetric(v ...string) func(*ClusterStateRequest) { - return func(r *ClusterStateRequest) { - r.Metric = v - } -} - -// WithAllowNoIndices - whether to ignore if a wildcard indices expression resolves into no concrete indices. (this includes `_all` string or when no indices have been specified). -// -func (f ClusterState) WithAllowNoIndices(v bool) func(*ClusterStateRequest) { - return func(r *ClusterStateRequest) { - r.AllowNoIndices = &v - } -} - -// WithExpandWildcards - whether to expand wildcard expression to concrete indices that are open, closed or both.. -// -func (f ClusterState) WithExpandWildcards(v string) func(*ClusterStateRequest) { - return func(r *ClusterStateRequest) { - r.ExpandWildcards = v - } -} - -// WithFlatSettings - return settings in flat format (default: false). -// -func (f ClusterState) WithFlatSettings(v bool) func(*ClusterStateRequest) { - return func(r *ClusterStateRequest) { - r.FlatSettings = &v - } -} - -// WithIgnoreUnavailable - whether specified concrete indices should be ignored when unavailable (missing or closed). -// -func (f ClusterState) WithIgnoreUnavailable(v bool) func(*ClusterStateRequest) { - return func(r *ClusterStateRequest) { - r.IgnoreUnavailable = &v - } -} - -// WithLocal - return local information, do not retrieve the state from master node (default: false). -// -func (f ClusterState) WithLocal(v bool) func(*ClusterStateRequest) { - return func(r *ClusterStateRequest) { - r.Local = &v - } -} - -// WithMasterTimeout - specify timeout for connection to master. -// -func (f ClusterState) WithMasterTimeout(v time.Duration) func(*ClusterStateRequest) { - return func(r *ClusterStateRequest) { - r.MasterTimeout = v - } -} - -// WithWaitForMetadataVersion - wait for the metadata version to be equal or greater than the specified metadata version. -// -func (f ClusterState) WithWaitForMetadataVersion(v int) func(*ClusterStateRequest) { - return func(r *ClusterStateRequest) { - r.WaitForMetadataVersion = &v - } -} - -// WithWaitForTimeout - the maximum time to wait for wait_for_metadata_version before timing out. -// -func (f ClusterState) WithWaitForTimeout(v time.Duration) func(*ClusterStateRequest) { - return func(r *ClusterStateRequest) { - r.WaitForTimeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f ClusterState) WithPretty() func(*ClusterStateRequest) { - return func(r *ClusterStateRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f ClusterState) WithHuman() func(*ClusterStateRequest) { - return func(r *ClusterStateRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f ClusterState) WithErrorTrace() func(*ClusterStateRequest) { - return func(r *ClusterStateRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f ClusterState) WithFilterPath(v ...string) func(*ClusterStateRequest) { - return func(r *ClusterStateRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f ClusterState) WithHeader(h map[string]string) func(*ClusterStateRequest) { - return func(r *ClusterStateRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f ClusterState) WithOpaqueID(s string) func(*ClusterStateRequest) { - return func(r *ClusterStateRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.stats.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.stats.go deleted file mode 100644 index 2b7d294ce..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.cluster.stats.go +++ /dev/null @@ -1,244 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" - "time" -) - -func newClusterStatsFunc(t Transport) ClusterStats { - return func(o ...func(*ClusterStatsRequest)) (*Response, error) { - var r = ClusterStatsRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// ClusterStats returns high-level overview of cluster statistics. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-stats.html. -// -type ClusterStats func(o ...func(*ClusterStatsRequest)) (*Response, error) - -// ClusterStatsRequest configures the Cluster Stats API request. -// -type ClusterStatsRequest struct { - NodeID []string - - FlatSettings *bool - Timeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r ClusterStatsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(len("/nodes/_cluster/stats/nodes/") + len(strings.Join(r.NodeID, ","))) - path.WriteString("/") - path.WriteString("_cluster") - path.WriteString("/") - path.WriteString("stats") - if len(r.NodeID) > 0 { - path.WriteString("/") - path.WriteString("nodes") - path.WriteString("/") - path.WriteString(strings.Join(r.NodeID, ",")) - } - - params = make(map[string]string) - - if r.FlatSettings != nil { - params["flat_settings"] = strconv.FormatBool(*r.FlatSettings) - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f ClusterStats) WithContext(v context.Context) func(*ClusterStatsRequest) { - return func(r *ClusterStatsRequest) { - r.ctx = v - } -} - -// WithNodeID - a list of node ids or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes. -// -func (f ClusterStats) WithNodeID(v ...string) func(*ClusterStatsRequest) { - return func(r *ClusterStatsRequest) { - r.NodeID = v - } -} - -// WithFlatSettings - return settings in flat format (default: false). -// -func (f ClusterStats) WithFlatSettings(v bool) func(*ClusterStatsRequest) { - return func(r *ClusterStatsRequest) { - r.FlatSettings = &v - } -} - -// WithTimeout - explicit operation timeout. -// -func (f ClusterStats) WithTimeout(v time.Duration) func(*ClusterStatsRequest) { - return func(r *ClusterStatsRequest) { - r.Timeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f ClusterStats) WithPretty() func(*ClusterStatsRequest) { - return func(r *ClusterStatsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f ClusterStats) WithHuman() func(*ClusterStatsRequest) { - return func(r *ClusterStatsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f ClusterStats) WithErrorTrace() func(*ClusterStatsRequest) { - return func(r *ClusterStatsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f ClusterStats) WithFilterPath(v ...string) func(*ClusterStatsRequest) { - return func(r *ClusterStatsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f ClusterStats) WithHeader(h map[string]string) func(*ClusterStatsRequest) { - return func(r *ClusterStatsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f ClusterStats) WithOpaqueID(s string) func(*ClusterStatsRequest) { - return func(r *ClusterStatsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.count.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.count.go deleted file mode 100644 index 0bd3febdc..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.count.go +++ /dev/null @@ -1,423 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" -) - -func newCountFunc(t Transport) Count { - return func(o ...func(*CountRequest)) (*Response, error) { - var r = CountRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// Count returns number of documents matching a query. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/search-count.html. -// -type Count func(o ...func(*CountRequest)) (*Response, error) - -// CountRequest configures the Count API request. -// -type CountRequest struct { - Index []string - DocumentType []string - - Body io.Reader - - AllowNoIndices *bool - Analyzer string - AnalyzeWildcard *bool - DefaultOperator string - Df string - ExpandWildcards string - IgnoreThrottled *bool - IgnoreUnavailable *bool - Lenient *bool - MinScore *int - Preference string - Query string - Routing []string - TerminateAfter *int - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r CountRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len(strings.Join(r.Index, ",")) + 1 + len(strings.Join(r.DocumentType, ",")) + 1 + len("_count")) - if len(r.Index) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Index, ",")) - } - if len(r.DocumentType) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.DocumentType, ",")) - } - path.WriteString("/") - path.WriteString("_count") - - params = make(map[string]string) - - if r.AllowNoIndices != nil { - params["allow_no_indices"] = strconv.FormatBool(*r.AllowNoIndices) - } - - if r.Analyzer != "" { - params["analyzer"] = r.Analyzer - } - - if r.AnalyzeWildcard != nil { - params["analyze_wildcard"] = strconv.FormatBool(*r.AnalyzeWildcard) - } - - if r.DefaultOperator != "" { - params["default_operator"] = r.DefaultOperator - } - - if r.Df != "" { - params["df"] = r.Df - } - - if r.ExpandWildcards != "" { - params["expand_wildcards"] = r.ExpandWildcards - } - - if r.IgnoreThrottled != nil { - params["ignore_throttled"] = strconv.FormatBool(*r.IgnoreThrottled) - } - - if r.IgnoreUnavailable != nil { - params["ignore_unavailable"] = strconv.FormatBool(*r.IgnoreUnavailable) - } - - if r.Lenient != nil { - params["lenient"] = strconv.FormatBool(*r.Lenient) - } - - if r.MinScore != nil { - params["min_score"] = strconv.FormatInt(int64(*r.MinScore), 10) - } - - if r.Preference != "" { - params["preference"] = r.Preference - } - - if r.Query != "" { - params["q"] = r.Query - } - - if len(r.Routing) > 0 { - params["routing"] = strings.Join(r.Routing, ",") - } - - if r.TerminateAfter != nil { - params["terminate_after"] = strconv.FormatInt(int64(*r.TerminateAfter), 10) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f Count) WithContext(v context.Context) func(*CountRequest) { - return func(r *CountRequest) { - r.ctx = v - } -} - -// WithBody - A query to restrict the results specified with the Query DSL (optional). -// -func (f Count) WithBody(v io.Reader) func(*CountRequest) { - return func(r *CountRequest) { - r.Body = v - } -} - -// WithIndex - a list of indices to restrict the results. -// -func (f Count) WithIndex(v ...string) func(*CountRequest) { - return func(r *CountRequest) { - r.Index = v - } -} - -// WithDocumentType - a list of types to restrict the results. -// -func (f Count) WithDocumentType(v ...string) func(*CountRequest) { - return func(r *CountRequest) { - r.DocumentType = v - } -} - -// WithAllowNoIndices - whether to ignore if a wildcard indices expression resolves into no concrete indices. (this includes `_all` string or when no indices have been specified). -// -func (f Count) WithAllowNoIndices(v bool) func(*CountRequest) { - return func(r *CountRequest) { - r.AllowNoIndices = &v - } -} - -// WithAnalyzer - the analyzer to use for the query string. -// -func (f Count) WithAnalyzer(v string) func(*CountRequest) { - return func(r *CountRequest) { - r.Analyzer = v - } -} - -// WithAnalyzeWildcard - specify whether wildcard and prefix queries should be analyzed (default: false). -// -func (f Count) WithAnalyzeWildcard(v bool) func(*CountRequest) { - return func(r *CountRequest) { - r.AnalyzeWildcard = &v - } -} - -// WithDefaultOperator - the default operator for query string query (and or or). -// -func (f Count) WithDefaultOperator(v string) func(*CountRequest) { - return func(r *CountRequest) { - r.DefaultOperator = v - } -} - -// WithDf - the field to use as default where no field prefix is given in the query string. -// -func (f Count) WithDf(v string) func(*CountRequest) { - return func(r *CountRequest) { - r.Df = v - } -} - -// WithExpandWildcards - whether to expand wildcard expression to concrete indices that are open, closed or both.. -// -func (f Count) WithExpandWildcards(v string) func(*CountRequest) { - return func(r *CountRequest) { - r.ExpandWildcards = v - } -} - -// WithIgnoreThrottled - whether specified concrete, expanded or aliased indices should be ignored when throttled. -// -func (f Count) WithIgnoreThrottled(v bool) func(*CountRequest) { - return func(r *CountRequest) { - r.IgnoreThrottled = &v - } -} - -// WithIgnoreUnavailable - whether specified concrete indices should be ignored when unavailable (missing or closed). -// -func (f Count) WithIgnoreUnavailable(v bool) func(*CountRequest) { - return func(r *CountRequest) { - r.IgnoreUnavailable = &v - } -} - -// WithLenient - specify whether format-based query failures (such as providing text to a numeric field) should be ignored. -// -func (f Count) WithLenient(v bool) func(*CountRequest) { - return func(r *CountRequest) { - r.Lenient = &v - } -} - -// WithMinScore - include only documents with a specific `_score` value in the result. -// -func (f Count) WithMinScore(v int) func(*CountRequest) { - return func(r *CountRequest) { - r.MinScore = &v - } -} - -// WithPreference - specify the node or shard the operation should be performed on (default: random). -// -func (f Count) WithPreference(v string) func(*CountRequest) { - return func(r *CountRequest) { - r.Preference = v - } -} - -// WithQuery - query in the lucene query string syntax. -// -func (f Count) WithQuery(v string) func(*CountRequest) { - return func(r *CountRequest) { - r.Query = v - } -} - -// WithRouting - a list of specific routing values. -// -func (f Count) WithRouting(v ...string) func(*CountRequest) { - return func(r *CountRequest) { - r.Routing = v - } -} - -// WithTerminateAfter - the maximum count for each shard, upon reaching which the query execution will terminate early. -// -func (f Count) WithTerminateAfter(v int) func(*CountRequest) { - return func(r *CountRequest) { - r.TerminateAfter = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f Count) WithPretty() func(*CountRequest) { - return func(r *CountRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f Count) WithHuman() func(*CountRequest) { - return func(r *CountRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f Count) WithErrorTrace() func(*CountRequest) { - return func(r *CountRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f Count) WithFilterPath(v ...string) func(*CountRequest) { - return func(r *CountRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f Count) WithHeader(h map[string]string) func(*CountRequest) { - return func(r *CountRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f Count) WithOpaqueID(s string) func(*CountRequest) { - return func(r *CountRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.create.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.create.go deleted file mode 100644 index 578b645ea..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.create.go +++ /dev/null @@ -1,324 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" - "time" -) - -func newCreateFunc(t Transport) Create { - return func(index string, id string, body io.Reader, o ...func(*CreateRequest)) (*Response, error) { - var r = CreateRequest{Index: index, DocumentID: id, Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// Create creates a new document in the index. -// -// Returns a 409 response when a document with a same ID already exists in the index. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-index_.html. -// -type Create func(index string, id string, body io.Reader, o ...func(*CreateRequest)) (*Response, error) - -// CreateRequest configures the Create API request. -// -type CreateRequest struct { - Index string - DocumentType string - DocumentID string - - Body io.Reader - - Pipeline string - Refresh string - Routing string - Timeout time.Duration - Version *int - VersionType string - WaitForActiveShards string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r CreateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - if r.DocumentType == "" { - r.DocumentType = "_doc" - } - - path.Grow(1 + len(r.Index) + 1 + len(r.DocumentType) + 1 + len(r.DocumentID) + 1 + len("_create")) - path.WriteString("/") - path.WriteString(r.Index) - if r.DocumentType != "" { - path.WriteString("/") - path.WriteString(r.DocumentType) - } - path.WriteString("/") - path.WriteString(r.DocumentID) - path.WriteString("/") - path.WriteString("_create") - - params = make(map[string]string) - - if r.Pipeline != "" { - params["pipeline"] = r.Pipeline - } - - if r.Refresh != "" { - params["refresh"] = r.Refresh - } - - if r.Routing != "" { - params["routing"] = r.Routing - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.Version != nil { - params["version"] = strconv.FormatInt(int64(*r.Version), 10) - } - - if r.VersionType != "" { - params["version_type"] = r.VersionType - } - - if r.WaitForActiveShards != "" { - params["wait_for_active_shards"] = r.WaitForActiveShards - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f Create) WithContext(v context.Context) func(*CreateRequest) { - return func(r *CreateRequest) { - r.ctx = v - } -} - -// WithDocumentType - the type of the document. -// -func (f Create) WithDocumentType(v string) func(*CreateRequest) { - return func(r *CreateRequest) { - r.DocumentType = v - } -} - -// WithPipeline - the pipeline ID to preprocess incoming documents with. -// -func (f Create) WithPipeline(v string) func(*CreateRequest) { - return func(r *CreateRequest) { - r.Pipeline = v - } -} - -// WithRefresh - if `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes.. -// -func (f Create) WithRefresh(v string) func(*CreateRequest) { - return func(r *CreateRequest) { - r.Refresh = v - } -} - -// WithRouting - specific routing value. -// -func (f Create) WithRouting(v string) func(*CreateRequest) { - return func(r *CreateRequest) { - r.Routing = v - } -} - -// WithTimeout - explicit operation timeout. -// -func (f Create) WithTimeout(v time.Duration) func(*CreateRequest) { - return func(r *CreateRequest) { - r.Timeout = v - } -} - -// WithVersion - explicit version number for concurrency control. -// -func (f Create) WithVersion(v int) func(*CreateRequest) { - return func(r *CreateRequest) { - r.Version = &v - } -} - -// WithVersionType - specific version type. -// -func (f Create) WithVersionType(v string) func(*CreateRequest) { - return func(r *CreateRequest) { - r.VersionType = v - } -} - -// WithWaitForActiveShards - sets the number of shard copies that must be active before proceeding with the index operation. defaults to 1, meaning the primary shard only. set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1). -// -func (f Create) WithWaitForActiveShards(v string) func(*CreateRequest) { - return func(r *CreateRequest) { - r.WaitForActiveShards = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f Create) WithPretty() func(*CreateRequest) { - return func(r *CreateRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f Create) WithHuman() func(*CreateRequest) { - return func(r *CreateRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f Create) WithErrorTrace() func(*CreateRequest) { - return func(r *CreateRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f Create) WithFilterPath(v ...string) func(*CreateRequest) { - return func(r *CreateRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f Create) WithHeader(h map[string]string) func(*CreateRequest) { - return func(r *CreateRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f Create) WithOpaqueID(s string) func(*CreateRequest) { - return func(r *CreateRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.dangling_indices.delete_dangling_index.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.dangling_indices.delete_dangling_index.go deleted file mode 100644 index 018f33e8e..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.dangling_indices.delete_dangling_index.go +++ /dev/null @@ -1,243 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" - "time" -) - -func newDanglingIndicesDeleteDanglingIndexFunc(t Transport) DanglingIndicesDeleteDanglingIndex { - return func(index_uuid string, o ...func(*DanglingIndicesDeleteDanglingIndexRequest)) (*Response, error) { - var r = DanglingIndicesDeleteDanglingIndexRequest{IndexUUID: index_uuid} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// DanglingIndicesDeleteDanglingIndex deletes the specified dangling index -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-gateway-dangling-indices.html. -// -type DanglingIndicesDeleteDanglingIndex func(index_uuid string, o ...func(*DanglingIndicesDeleteDanglingIndexRequest)) (*Response, error) - -// DanglingIndicesDeleteDanglingIndexRequest configures the Dangling Indices Delete Dangling Index API request. -// -type DanglingIndicesDeleteDanglingIndexRequest struct { - IndexUUID string - - AcceptDataLoss *bool - MasterTimeout time.Duration - Timeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r DanglingIndicesDeleteDanglingIndexRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "DELETE" - - path.Grow(1 + len("_dangling") + 1 + len(r.IndexUUID)) - path.WriteString("/") - path.WriteString("_dangling") - path.WriteString("/") - path.WriteString(r.IndexUUID) - - params = make(map[string]string) - - if r.AcceptDataLoss != nil { - params["accept_data_loss"] = strconv.FormatBool(*r.AcceptDataLoss) - } - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f DanglingIndicesDeleteDanglingIndex) WithContext(v context.Context) func(*DanglingIndicesDeleteDanglingIndexRequest) { - return func(r *DanglingIndicesDeleteDanglingIndexRequest) { - r.ctx = v - } -} - -// WithAcceptDataLoss - must be set to true in order to delete the dangling index. -// -func (f DanglingIndicesDeleteDanglingIndex) WithAcceptDataLoss(v bool) func(*DanglingIndicesDeleteDanglingIndexRequest) { - return func(r *DanglingIndicesDeleteDanglingIndexRequest) { - r.AcceptDataLoss = &v - } -} - -// WithMasterTimeout - specify timeout for connection to master. -// -func (f DanglingIndicesDeleteDanglingIndex) WithMasterTimeout(v time.Duration) func(*DanglingIndicesDeleteDanglingIndexRequest) { - return func(r *DanglingIndicesDeleteDanglingIndexRequest) { - r.MasterTimeout = v - } -} - -// WithTimeout - explicit operation timeout. -// -func (f DanglingIndicesDeleteDanglingIndex) WithTimeout(v time.Duration) func(*DanglingIndicesDeleteDanglingIndexRequest) { - return func(r *DanglingIndicesDeleteDanglingIndexRequest) { - r.Timeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f DanglingIndicesDeleteDanglingIndex) WithPretty() func(*DanglingIndicesDeleteDanglingIndexRequest) { - return func(r *DanglingIndicesDeleteDanglingIndexRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f DanglingIndicesDeleteDanglingIndex) WithHuman() func(*DanglingIndicesDeleteDanglingIndexRequest) { - return func(r *DanglingIndicesDeleteDanglingIndexRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f DanglingIndicesDeleteDanglingIndex) WithErrorTrace() func(*DanglingIndicesDeleteDanglingIndexRequest) { - return func(r *DanglingIndicesDeleteDanglingIndexRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f DanglingIndicesDeleteDanglingIndex) WithFilterPath(v ...string) func(*DanglingIndicesDeleteDanglingIndexRequest) { - return func(r *DanglingIndicesDeleteDanglingIndexRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f DanglingIndicesDeleteDanglingIndex) WithHeader(h map[string]string) func(*DanglingIndicesDeleteDanglingIndexRequest) { - return func(r *DanglingIndicesDeleteDanglingIndexRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f DanglingIndicesDeleteDanglingIndex) WithOpaqueID(s string) func(*DanglingIndicesDeleteDanglingIndexRequest) { - return func(r *DanglingIndicesDeleteDanglingIndexRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.dangling_indices.import_dangling_index.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.dangling_indices.import_dangling_index.go deleted file mode 100644 index 8848bf41f..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.dangling_indices.import_dangling_index.go +++ /dev/null @@ -1,243 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" - "time" -) - -func newDanglingIndicesImportDanglingIndexFunc(t Transport) DanglingIndicesImportDanglingIndex { - return func(index_uuid string, o ...func(*DanglingIndicesImportDanglingIndexRequest)) (*Response, error) { - var r = DanglingIndicesImportDanglingIndexRequest{IndexUUID: index_uuid} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// DanglingIndicesImportDanglingIndex imports the specified dangling index -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-gateway-dangling-indices.html. -// -type DanglingIndicesImportDanglingIndex func(index_uuid string, o ...func(*DanglingIndicesImportDanglingIndexRequest)) (*Response, error) - -// DanglingIndicesImportDanglingIndexRequest configures the Dangling Indices Import Dangling Index API request. -// -type DanglingIndicesImportDanglingIndexRequest struct { - IndexUUID string - - AcceptDataLoss *bool - MasterTimeout time.Duration - Timeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r DanglingIndicesImportDanglingIndexRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_dangling") + 1 + len(r.IndexUUID)) - path.WriteString("/") - path.WriteString("_dangling") - path.WriteString("/") - path.WriteString(r.IndexUUID) - - params = make(map[string]string) - - if r.AcceptDataLoss != nil { - params["accept_data_loss"] = strconv.FormatBool(*r.AcceptDataLoss) - } - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f DanglingIndicesImportDanglingIndex) WithContext(v context.Context) func(*DanglingIndicesImportDanglingIndexRequest) { - return func(r *DanglingIndicesImportDanglingIndexRequest) { - r.ctx = v - } -} - -// WithAcceptDataLoss - must be set to true in order to import the dangling index. -// -func (f DanglingIndicesImportDanglingIndex) WithAcceptDataLoss(v bool) func(*DanglingIndicesImportDanglingIndexRequest) { - return func(r *DanglingIndicesImportDanglingIndexRequest) { - r.AcceptDataLoss = &v - } -} - -// WithMasterTimeout - specify timeout for connection to master. -// -func (f DanglingIndicesImportDanglingIndex) WithMasterTimeout(v time.Duration) func(*DanglingIndicesImportDanglingIndexRequest) { - return func(r *DanglingIndicesImportDanglingIndexRequest) { - r.MasterTimeout = v - } -} - -// WithTimeout - explicit operation timeout. -// -func (f DanglingIndicesImportDanglingIndex) WithTimeout(v time.Duration) func(*DanglingIndicesImportDanglingIndexRequest) { - return func(r *DanglingIndicesImportDanglingIndexRequest) { - r.Timeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f DanglingIndicesImportDanglingIndex) WithPretty() func(*DanglingIndicesImportDanglingIndexRequest) { - return func(r *DanglingIndicesImportDanglingIndexRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f DanglingIndicesImportDanglingIndex) WithHuman() func(*DanglingIndicesImportDanglingIndexRequest) { - return func(r *DanglingIndicesImportDanglingIndexRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f DanglingIndicesImportDanglingIndex) WithErrorTrace() func(*DanglingIndicesImportDanglingIndexRequest) { - return func(r *DanglingIndicesImportDanglingIndexRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f DanglingIndicesImportDanglingIndex) WithFilterPath(v ...string) func(*DanglingIndicesImportDanglingIndexRequest) { - return func(r *DanglingIndicesImportDanglingIndexRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f DanglingIndicesImportDanglingIndex) WithHeader(h map[string]string) func(*DanglingIndicesImportDanglingIndexRequest) { - return func(r *DanglingIndicesImportDanglingIndexRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f DanglingIndicesImportDanglingIndex) WithOpaqueID(s string) func(*DanglingIndicesImportDanglingIndexRequest) { - return func(r *DanglingIndicesImportDanglingIndexRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.dangling_indices.list_dangling_indices.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.dangling_indices.list_dangling_indices.go deleted file mode 100644 index 4ad2915f5..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.dangling_indices.list_dangling_indices.go +++ /dev/null @@ -1,196 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newDanglingIndicesListDanglingIndicesFunc(t Transport) DanglingIndicesListDanglingIndices { - return func(o ...func(*DanglingIndicesListDanglingIndicesRequest)) (*Response, error) { - var r = DanglingIndicesListDanglingIndicesRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// DanglingIndicesListDanglingIndices returns all dangling indices. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-gateway-dangling-indices.html. -// -type DanglingIndicesListDanglingIndices func(o ...func(*DanglingIndicesListDanglingIndicesRequest)) (*Response, error) - -// DanglingIndicesListDanglingIndicesRequest configures the Dangling Indices List Dangling Indices API request. -// -type DanglingIndicesListDanglingIndicesRequest struct { - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r DanglingIndicesListDanglingIndicesRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(len("/_dangling")) - path.WriteString("/_dangling") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f DanglingIndicesListDanglingIndices) WithContext(v context.Context) func(*DanglingIndicesListDanglingIndicesRequest) { - return func(r *DanglingIndicesListDanglingIndicesRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f DanglingIndicesListDanglingIndices) WithPretty() func(*DanglingIndicesListDanglingIndicesRequest) { - return func(r *DanglingIndicesListDanglingIndicesRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f DanglingIndicesListDanglingIndices) WithHuman() func(*DanglingIndicesListDanglingIndicesRequest) { - return func(r *DanglingIndicesListDanglingIndicesRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f DanglingIndicesListDanglingIndices) WithErrorTrace() func(*DanglingIndicesListDanglingIndicesRequest) { - return func(r *DanglingIndicesListDanglingIndicesRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f DanglingIndicesListDanglingIndices) WithFilterPath(v ...string) func(*DanglingIndicesListDanglingIndicesRequest) { - return func(r *DanglingIndicesListDanglingIndicesRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f DanglingIndicesListDanglingIndices) WithHeader(h map[string]string) func(*DanglingIndicesListDanglingIndicesRequest) { - return func(r *DanglingIndicesListDanglingIndicesRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f DanglingIndicesListDanglingIndices) WithOpaqueID(s string) func(*DanglingIndicesListDanglingIndicesRequest) { - return func(r *DanglingIndicesListDanglingIndicesRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.delete.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.delete.go deleted file mode 100644 index aae893186..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.delete.go +++ /dev/null @@ -1,326 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" - "time" -) - -func newDeleteFunc(t Transport) Delete { - return func(index string, id string, o ...func(*DeleteRequest)) (*Response, error) { - var r = DeleteRequest{Index: index, DocumentID: id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// Delete removes a document from the index. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete.html. -// -type Delete func(index string, id string, o ...func(*DeleteRequest)) (*Response, error) - -// DeleteRequest configures the Delete API request. -// -type DeleteRequest struct { - Index string - DocumentType string - DocumentID string - - IfPrimaryTerm *int - IfSeqNo *int - Refresh string - Routing string - Timeout time.Duration - Version *int - VersionType string - WaitForActiveShards string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r DeleteRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "DELETE" - - if r.DocumentType == "" { - r.DocumentType = "_doc" - } - - path.Grow(1 + len(r.Index) + 1 + len(r.DocumentType) + 1 + len(r.DocumentID)) - path.WriteString("/") - path.WriteString(r.Index) - if r.DocumentType != "" { - path.WriteString("/") - path.WriteString(r.DocumentType) - } - path.WriteString("/") - path.WriteString(r.DocumentID) - - params = make(map[string]string) - - if r.IfPrimaryTerm != nil { - params["if_primary_term"] = strconv.FormatInt(int64(*r.IfPrimaryTerm), 10) - } - - if r.IfSeqNo != nil { - params["if_seq_no"] = strconv.FormatInt(int64(*r.IfSeqNo), 10) - } - - if r.Refresh != "" { - params["refresh"] = r.Refresh - } - - if r.Routing != "" { - params["routing"] = r.Routing - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.Version != nil { - params["version"] = strconv.FormatInt(int64(*r.Version), 10) - } - - if r.VersionType != "" { - params["version_type"] = r.VersionType - } - - if r.WaitForActiveShards != "" { - params["wait_for_active_shards"] = r.WaitForActiveShards - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f Delete) WithContext(v context.Context) func(*DeleteRequest) { - return func(r *DeleteRequest) { - r.ctx = v - } -} - -// WithDocumentType - the type of the document. -// -func (f Delete) WithDocumentType(v string) func(*DeleteRequest) { - return func(r *DeleteRequest) { - r.DocumentType = v - } -} - -// WithIfPrimaryTerm - only perform the delete operation if the last operation that has changed the document has the specified primary term. -// -func (f Delete) WithIfPrimaryTerm(v int) func(*DeleteRequest) { - return func(r *DeleteRequest) { - r.IfPrimaryTerm = &v - } -} - -// WithIfSeqNo - only perform the delete operation if the last operation that has changed the document has the specified sequence number. -// -func (f Delete) WithIfSeqNo(v int) func(*DeleteRequest) { - return func(r *DeleteRequest) { - r.IfSeqNo = &v - } -} - -// WithRefresh - if `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes.. -// -func (f Delete) WithRefresh(v string) func(*DeleteRequest) { - return func(r *DeleteRequest) { - r.Refresh = v - } -} - -// WithRouting - specific routing value. -// -func (f Delete) WithRouting(v string) func(*DeleteRequest) { - return func(r *DeleteRequest) { - r.Routing = v - } -} - -// WithTimeout - explicit operation timeout. -// -func (f Delete) WithTimeout(v time.Duration) func(*DeleteRequest) { - return func(r *DeleteRequest) { - r.Timeout = v - } -} - -// WithVersion - explicit version number for concurrency control. -// -func (f Delete) WithVersion(v int) func(*DeleteRequest) { - return func(r *DeleteRequest) { - r.Version = &v - } -} - -// WithVersionType - specific version type. -// -func (f Delete) WithVersionType(v string) func(*DeleteRequest) { - return func(r *DeleteRequest) { - r.VersionType = v - } -} - -// WithWaitForActiveShards - sets the number of shard copies that must be active before proceeding with the delete operation. defaults to 1, meaning the primary shard only. set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1). -// -func (f Delete) WithWaitForActiveShards(v string) func(*DeleteRequest) { - return func(r *DeleteRequest) { - r.WaitForActiveShards = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f Delete) WithPretty() func(*DeleteRequest) { - return func(r *DeleteRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f Delete) WithHuman() func(*DeleteRequest) { - return func(r *DeleteRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f Delete) WithErrorTrace() func(*DeleteRequest) { - return func(r *DeleteRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f Delete) WithFilterPath(v ...string) func(*DeleteRequest) { - return func(r *DeleteRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f Delete) WithHeader(h map[string]string) func(*DeleteRequest) { - return func(r *DeleteRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f Delete) WithOpaqueID(s string) func(*DeleteRequest) { - return func(r *DeleteRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.delete_by_query.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.delete_by_query.go deleted file mode 100644 index 9936a8cf6..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.delete_by_query.go +++ /dev/null @@ -1,654 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "fmt" - "io" - "net/http" - "strconv" - "strings" - "time" -) - -func newDeleteByQueryFunc(t Transport) DeleteByQuery { - return func(index []string, body io.Reader, o ...func(*DeleteByQueryRequest)) (*Response, error) { - var r = DeleteByQueryRequest{Index: index, Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// DeleteByQuery deletes documents matching the provided query. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete-by-query.html. -// -type DeleteByQuery func(index []string, body io.Reader, o ...func(*DeleteByQueryRequest)) (*Response, error) - -// DeleteByQueryRequest configures the Delete By Query API request. -// -type DeleteByQueryRequest struct { - Index []string - DocumentType []string - - Body io.Reader - - AllowNoIndices *bool - Analyzer string - AnalyzeWildcard *bool - Conflicts string - DefaultOperator string - Df string - ExpandWildcards string - From *int - IgnoreUnavailable *bool - Lenient *bool - MaxDocs *int - Preference string - Query string - Refresh *bool - RequestCache *bool - RequestsPerSecond *int - Routing []string - Scroll time.Duration - ScrollSize *int - SearchTimeout time.Duration - SearchType string - Size *int - Slices interface{} - Sort []string - Source []string - SourceExcludes []string - SourceIncludes []string - Stats []string - TerminateAfter *int - Timeout time.Duration - Version *bool - WaitForActiveShards string - WaitForCompletion *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r DeleteByQueryRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len(strings.Join(r.Index, ",")) + 1 + len(strings.Join(r.DocumentType, ",")) + 1 + len("_delete_by_query")) - path.WriteString("/") - path.WriteString(strings.Join(r.Index, ",")) - if len(r.DocumentType) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.DocumentType, ",")) - } - path.WriteString("/") - path.WriteString("_delete_by_query") - - params = make(map[string]string) - - if r.AllowNoIndices != nil { - params["allow_no_indices"] = strconv.FormatBool(*r.AllowNoIndices) - } - - if r.Analyzer != "" { - params["analyzer"] = r.Analyzer - } - - if r.AnalyzeWildcard != nil { - params["analyze_wildcard"] = strconv.FormatBool(*r.AnalyzeWildcard) - } - - if r.Conflicts != "" { - params["conflicts"] = r.Conflicts - } - - if r.DefaultOperator != "" { - params["default_operator"] = r.DefaultOperator - } - - if r.Df != "" { - params["df"] = r.Df - } - - if r.ExpandWildcards != "" { - params["expand_wildcards"] = r.ExpandWildcards - } - - if r.From != nil { - params["from"] = strconv.FormatInt(int64(*r.From), 10) - } - - if r.IgnoreUnavailable != nil { - params["ignore_unavailable"] = strconv.FormatBool(*r.IgnoreUnavailable) - } - - if r.Lenient != nil { - params["lenient"] = strconv.FormatBool(*r.Lenient) - } - - if r.MaxDocs != nil { - params["max_docs"] = strconv.FormatInt(int64(*r.MaxDocs), 10) - } - - if r.Preference != "" { - params["preference"] = r.Preference - } - - if r.Query != "" { - params["q"] = r.Query - } - - if r.Refresh != nil { - params["refresh"] = strconv.FormatBool(*r.Refresh) - } - - if r.RequestCache != nil { - params["request_cache"] = strconv.FormatBool(*r.RequestCache) - } - - if r.RequestsPerSecond != nil { - params["requests_per_second"] = strconv.FormatInt(int64(*r.RequestsPerSecond), 10) - } - - if len(r.Routing) > 0 { - params["routing"] = strings.Join(r.Routing, ",") - } - - if r.Scroll != 0 { - params["scroll"] = formatDuration(r.Scroll) - } - - if r.ScrollSize != nil { - params["scroll_size"] = strconv.FormatInt(int64(*r.ScrollSize), 10) - } - - if r.SearchTimeout != 0 { - params["search_timeout"] = formatDuration(r.SearchTimeout) - } - - if r.SearchType != "" { - params["search_type"] = r.SearchType - } - - if r.Size != nil { - params["size"] = strconv.FormatInt(int64(*r.Size), 10) - } - - if r.Slices != nil { - params["slices"] = fmt.Sprintf("%v", r.Slices) - } - - if len(r.Sort) > 0 { - params["sort"] = strings.Join(r.Sort, ",") - } - - if len(r.Source) > 0 { - params["_source"] = strings.Join(r.Source, ",") - } - - if len(r.SourceExcludes) > 0 { - params["_source_excludes"] = strings.Join(r.SourceExcludes, ",") - } - - if len(r.SourceIncludes) > 0 { - params["_source_includes"] = strings.Join(r.SourceIncludes, ",") - } - - if len(r.Stats) > 0 { - params["stats"] = strings.Join(r.Stats, ",") - } - - if r.TerminateAfter != nil { - params["terminate_after"] = strconv.FormatInt(int64(*r.TerminateAfter), 10) - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.Version != nil { - params["version"] = strconv.FormatBool(*r.Version) - } - - if r.WaitForActiveShards != "" { - params["wait_for_active_shards"] = r.WaitForActiveShards - } - - if r.WaitForCompletion != nil { - params["wait_for_completion"] = strconv.FormatBool(*r.WaitForCompletion) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f DeleteByQuery) WithContext(v context.Context) func(*DeleteByQueryRequest) { - return func(r *DeleteByQueryRequest) { - r.ctx = v - } -} - -// WithDocumentType - a list of document types to search; leave empty to perform the operation on all types. -// -func (f DeleteByQuery) WithDocumentType(v ...string) func(*DeleteByQueryRequest) { - return func(r *DeleteByQueryRequest) { - r.DocumentType = v - } -} - -// WithAllowNoIndices - whether to ignore if a wildcard indices expression resolves into no concrete indices. (this includes `_all` string or when no indices have been specified). -// -func (f DeleteByQuery) WithAllowNoIndices(v bool) func(*DeleteByQueryRequest) { - return func(r *DeleteByQueryRequest) { - r.AllowNoIndices = &v - } -} - -// WithAnalyzer - the analyzer to use for the query string. -// -func (f DeleteByQuery) WithAnalyzer(v string) func(*DeleteByQueryRequest) { - return func(r *DeleteByQueryRequest) { - r.Analyzer = v - } -} - -// WithAnalyzeWildcard - specify whether wildcard and prefix queries should be analyzed (default: false). -// -func (f DeleteByQuery) WithAnalyzeWildcard(v bool) func(*DeleteByQueryRequest) { - return func(r *DeleteByQueryRequest) { - r.AnalyzeWildcard = &v - } -} - -// WithConflicts - what to do when the delete by query hits version conflicts?. -// -func (f DeleteByQuery) WithConflicts(v string) func(*DeleteByQueryRequest) { - return func(r *DeleteByQueryRequest) { - r.Conflicts = v - } -} - -// WithDefaultOperator - the default operator for query string query (and or or). -// -func (f DeleteByQuery) WithDefaultOperator(v string) func(*DeleteByQueryRequest) { - return func(r *DeleteByQueryRequest) { - r.DefaultOperator = v - } -} - -// WithDf - the field to use as default where no field prefix is given in the query string. -// -func (f DeleteByQuery) WithDf(v string) func(*DeleteByQueryRequest) { - return func(r *DeleteByQueryRequest) { - r.Df = v - } -} - -// WithExpandWildcards - whether to expand wildcard expression to concrete indices that are open, closed or both.. -// -func (f DeleteByQuery) WithExpandWildcards(v string) func(*DeleteByQueryRequest) { - return func(r *DeleteByQueryRequest) { - r.ExpandWildcards = v - } -} - -// WithFrom - starting offset (default: 0). -// -func (f DeleteByQuery) WithFrom(v int) func(*DeleteByQueryRequest) { - return func(r *DeleteByQueryRequest) { - r.From = &v - } -} - -// WithIgnoreUnavailable - whether specified concrete indices should be ignored when unavailable (missing or closed). -// -func (f DeleteByQuery) WithIgnoreUnavailable(v bool) func(*DeleteByQueryRequest) { - return func(r *DeleteByQueryRequest) { - r.IgnoreUnavailable = &v - } -} - -// WithLenient - specify whether format-based query failures (such as providing text to a numeric field) should be ignored. -// -func (f DeleteByQuery) WithLenient(v bool) func(*DeleteByQueryRequest) { - return func(r *DeleteByQueryRequest) { - r.Lenient = &v - } -} - -// WithMaxDocs - maximum number of documents to process (default: all documents). -// -func (f DeleteByQuery) WithMaxDocs(v int) func(*DeleteByQueryRequest) { - return func(r *DeleteByQueryRequest) { - r.MaxDocs = &v - } -} - -// WithPreference - specify the node or shard the operation should be performed on (default: random). -// -func (f DeleteByQuery) WithPreference(v string) func(*DeleteByQueryRequest) { - return func(r *DeleteByQueryRequest) { - r.Preference = v - } -} - -// WithQuery - query in the lucene query string syntax. -// -func (f DeleteByQuery) WithQuery(v string) func(*DeleteByQueryRequest) { - return func(r *DeleteByQueryRequest) { - r.Query = v - } -} - -// WithRefresh - should the effected indexes be refreshed?. -// -func (f DeleteByQuery) WithRefresh(v bool) func(*DeleteByQueryRequest) { - return func(r *DeleteByQueryRequest) { - r.Refresh = &v - } -} - -// WithRequestCache - specify if request cache should be used for this request or not, defaults to index level setting. -// -func (f DeleteByQuery) WithRequestCache(v bool) func(*DeleteByQueryRequest) { - return func(r *DeleteByQueryRequest) { - r.RequestCache = &v - } -} - -// WithRequestsPerSecond - the throttle for this request in sub-requests per second. -1 means no throttle.. -// -func (f DeleteByQuery) WithRequestsPerSecond(v int) func(*DeleteByQueryRequest) { - return func(r *DeleteByQueryRequest) { - r.RequestsPerSecond = &v - } -} - -// WithRouting - a list of specific routing values. -// -func (f DeleteByQuery) WithRouting(v ...string) func(*DeleteByQueryRequest) { - return func(r *DeleteByQueryRequest) { - r.Routing = v - } -} - -// WithScroll - specify how long a consistent view of the index should be maintained for scrolled search. -// -func (f DeleteByQuery) WithScroll(v time.Duration) func(*DeleteByQueryRequest) { - return func(r *DeleteByQueryRequest) { - r.Scroll = v - } -} - -// WithScrollSize - size on the scroll request powering the delete by query. -// -func (f DeleteByQuery) WithScrollSize(v int) func(*DeleteByQueryRequest) { - return func(r *DeleteByQueryRequest) { - r.ScrollSize = &v - } -} - -// WithSearchTimeout - explicit timeout for each search request. defaults to no timeout.. -// -func (f DeleteByQuery) WithSearchTimeout(v time.Duration) func(*DeleteByQueryRequest) { - return func(r *DeleteByQueryRequest) { - r.SearchTimeout = v - } -} - -// WithSearchType - search operation type. -// -func (f DeleteByQuery) WithSearchType(v string) func(*DeleteByQueryRequest) { - return func(r *DeleteByQueryRequest) { - r.SearchType = v - } -} - -// WithSize - deprecated, please use `max_docs` instead. -// -func (f DeleteByQuery) WithSize(v int) func(*DeleteByQueryRequest) { - return func(r *DeleteByQueryRequest) { - r.Size = &v - } -} - -// WithSlices - the number of slices this task should be divided into. defaults to 1, meaning the task isn't sliced into subtasks. can be set to `auto`.. -// -func (f DeleteByQuery) WithSlices(v interface{}) func(*DeleteByQueryRequest) { - return func(r *DeleteByQueryRequest) { - r.Slices = v - } -} - -// WithSort - a list of : pairs. -// -func (f DeleteByQuery) WithSort(v ...string) func(*DeleteByQueryRequest) { - return func(r *DeleteByQueryRequest) { - r.Sort = v - } -} - -// WithSource - true or false to return the _source field or not, or a list of fields to return. -// -func (f DeleteByQuery) WithSource(v ...string) func(*DeleteByQueryRequest) { - return func(r *DeleteByQueryRequest) { - r.Source = v - } -} - -// WithSourceExcludes - a list of fields to exclude from the returned _source field. -// -func (f DeleteByQuery) WithSourceExcludes(v ...string) func(*DeleteByQueryRequest) { - return func(r *DeleteByQueryRequest) { - r.SourceExcludes = v - } -} - -// WithSourceIncludes - a list of fields to extract and return from the _source field. -// -func (f DeleteByQuery) WithSourceIncludes(v ...string) func(*DeleteByQueryRequest) { - return func(r *DeleteByQueryRequest) { - r.SourceIncludes = v - } -} - -// WithStats - specific 'tag' of the request for logging and statistical purposes. -// -func (f DeleteByQuery) WithStats(v ...string) func(*DeleteByQueryRequest) { - return func(r *DeleteByQueryRequest) { - r.Stats = v - } -} - -// WithTerminateAfter - the maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early.. -// -func (f DeleteByQuery) WithTerminateAfter(v int) func(*DeleteByQueryRequest) { - return func(r *DeleteByQueryRequest) { - r.TerminateAfter = &v - } -} - -// WithTimeout - time each individual bulk request should wait for shards that are unavailable.. -// -func (f DeleteByQuery) WithTimeout(v time.Duration) func(*DeleteByQueryRequest) { - return func(r *DeleteByQueryRequest) { - r.Timeout = v - } -} - -// WithVersion - specify whether to return document version as part of a hit. -// -func (f DeleteByQuery) WithVersion(v bool) func(*DeleteByQueryRequest) { - return func(r *DeleteByQueryRequest) { - r.Version = &v - } -} - -// WithWaitForActiveShards - sets the number of shard copies that must be active before proceeding with the delete by query operation. defaults to 1, meaning the primary shard only. set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1). -// -func (f DeleteByQuery) WithWaitForActiveShards(v string) func(*DeleteByQueryRequest) { - return func(r *DeleteByQueryRequest) { - r.WaitForActiveShards = v - } -} - -// WithWaitForCompletion - should the request should block until the delete by query is complete.. -// -func (f DeleteByQuery) WithWaitForCompletion(v bool) func(*DeleteByQueryRequest) { - return func(r *DeleteByQueryRequest) { - r.WaitForCompletion = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f DeleteByQuery) WithPretty() func(*DeleteByQueryRequest) { - return func(r *DeleteByQueryRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f DeleteByQuery) WithHuman() func(*DeleteByQueryRequest) { - return func(r *DeleteByQueryRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f DeleteByQuery) WithErrorTrace() func(*DeleteByQueryRequest) { - return func(r *DeleteByQueryRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f DeleteByQuery) WithFilterPath(v ...string) func(*DeleteByQueryRequest) { - return func(r *DeleteByQueryRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f DeleteByQuery) WithHeader(h map[string]string) func(*DeleteByQueryRequest) { - return func(r *DeleteByQueryRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f DeleteByQuery) WithOpaqueID(s string) func(*DeleteByQueryRequest) { - return func(r *DeleteByQueryRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.delete_by_query_rethrottle.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.delete_by_query_rethrottle.go deleted file mode 100644 index 97666dfe1..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.delete_by_query_rethrottle.go +++ /dev/null @@ -1,218 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newDeleteByQueryRethrottleFunc(t Transport) DeleteByQueryRethrottle { - return func(task_id string, requests_per_second *int, o ...func(*DeleteByQueryRethrottleRequest)) (*Response, error) { - var r = DeleteByQueryRethrottleRequest{TaskID: task_id, RequestsPerSecond: requests_per_second} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// DeleteByQueryRethrottle changes the number of requests per second for a particular Delete By Query operation. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html. -// -type DeleteByQueryRethrottle func(task_id string, requests_per_second *int, o ...func(*DeleteByQueryRethrottleRequest)) (*Response, error) - -// DeleteByQueryRethrottleRequest configures the Delete By Query Rethrottle API request. -// -type DeleteByQueryRethrottleRequest struct { - TaskID string - - RequestsPerSecond *int - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r DeleteByQueryRethrottleRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_delete_by_query") + 1 + len(r.TaskID) + 1 + len("_rethrottle")) - path.WriteString("/") - path.WriteString("_delete_by_query") - path.WriteString("/") - path.WriteString(r.TaskID) - path.WriteString("/") - path.WriteString("_rethrottle") - - params = make(map[string]string) - - if r.RequestsPerSecond != nil { - params["requests_per_second"] = strconv.FormatInt(int64(*r.RequestsPerSecond), 10) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f DeleteByQueryRethrottle) WithContext(v context.Context) func(*DeleteByQueryRethrottleRequest) { - return func(r *DeleteByQueryRethrottleRequest) { - r.ctx = v - } -} - -// WithRequestsPerSecond - the throttle to set on this request in floating sub-requests per second. -1 means set no throttle.. -// -func (f DeleteByQueryRethrottle) WithRequestsPerSecond(v int) func(*DeleteByQueryRethrottleRequest) { - return func(r *DeleteByQueryRethrottleRequest) { - r.RequestsPerSecond = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f DeleteByQueryRethrottle) WithPretty() func(*DeleteByQueryRethrottleRequest) { - return func(r *DeleteByQueryRethrottleRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f DeleteByQueryRethrottle) WithHuman() func(*DeleteByQueryRethrottleRequest) { - return func(r *DeleteByQueryRethrottleRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f DeleteByQueryRethrottle) WithErrorTrace() func(*DeleteByQueryRethrottleRequest) { - return func(r *DeleteByQueryRethrottleRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f DeleteByQueryRethrottle) WithFilterPath(v ...string) func(*DeleteByQueryRethrottleRequest) { - return func(r *DeleteByQueryRethrottleRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f DeleteByQueryRethrottle) WithHeader(h map[string]string) func(*DeleteByQueryRethrottleRequest) { - return func(r *DeleteByQueryRethrottleRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f DeleteByQueryRethrottle) WithOpaqueID(s string) func(*DeleteByQueryRethrottleRequest) { - return func(r *DeleteByQueryRethrottleRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.delete_script.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.delete_script.go deleted file mode 100644 index fc46b7faf..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.delete_script.go +++ /dev/null @@ -1,229 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" - "time" -) - -func newDeleteScriptFunc(t Transport) DeleteScript { - return func(id string, o ...func(*DeleteScriptRequest)) (*Response, error) { - var r = DeleteScriptRequest{ScriptID: id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// DeleteScript deletes a script. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html. -// -type DeleteScript func(id string, o ...func(*DeleteScriptRequest)) (*Response, error) - -// DeleteScriptRequest configures the Delete Script API request. -// -type DeleteScriptRequest struct { - ScriptID string - - MasterTimeout time.Duration - Timeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r DeleteScriptRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "DELETE" - - path.Grow(1 + len("_scripts") + 1 + len(r.ScriptID)) - path.WriteString("/") - path.WriteString("_scripts") - path.WriteString("/") - path.WriteString(r.ScriptID) - - params = make(map[string]string) - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f DeleteScript) WithContext(v context.Context) func(*DeleteScriptRequest) { - return func(r *DeleteScriptRequest) { - r.ctx = v - } -} - -// WithMasterTimeout - specify timeout for connection to master. -// -func (f DeleteScript) WithMasterTimeout(v time.Duration) func(*DeleteScriptRequest) { - return func(r *DeleteScriptRequest) { - r.MasterTimeout = v - } -} - -// WithTimeout - explicit operation timeout. -// -func (f DeleteScript) WithTimeout(v time.Duration) func(*DeleteScriptRequest) { - return func(r *DeleteScriptRequest) { - r.Timeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f DeleteScript) WithPretty() func(*DeleteScriptRequest) { - return func(r *DeleteScriptRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f DeleteScript) WithHuman() func(*DeleteScriptRequest) { - return func(r *DeleteScriptRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f DeleteScript) WithErrorTrace() func(*DeleteScriptRequest) { - return func(r *DeleteScriptRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f DeleteScript) WithFilterPath(v ...string) func(*DeleteScriptRequest) { - return func(r *DeleteScriptRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f DeleteScript) WithHeader(h map[string]string) func(*DeleteScriptRequest) { - return func(r *DeleteScriptRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f DeleteScript) WithOpaqueID(s string) func(*DeleteScriptRequest) { - return func(r *DeleteScriptRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.exists.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.exists.go deleted file mode 100644 index 7b152827d..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.exists.go +++ /dev/null @@ -1,351 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newExistsFunc(t Transport) Exists { - return func(index string, id string, o ...func(*ExistsRequest)) (*Response, error) { - var r = ExistsRequest{Index: index, DocumentID: id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// Exists returns information about whether a document exists in an index. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html. -// -type Exists func(index string, id string, o ...func(*ExistsRequest)) (*Response, error) - -// ExistsRequest configures the Exists API request. -// -type ExistsRequest struct { - Index string - DocumentType string - DocumentID string - - Preference string - Realtime *bool - Refresh *bool - Routing string - Source []string - SourceExcludes []string - SourceIncludes []string - StoredFields []string - Version *int - VersionType string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r ExistsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "HEAD" - - if r.DocumentType == "" { - r.DocumentType = "_doc" - } - - path.Grow(1 + len(r.Index) + 1 + len(r.DocumentType) + 1 + len(r.DocumentID)) - path.WriteString("/") - path.WriteString(r.Index) - if r.DocumentType != "" { - path.WriteString("/") - path.WriteString(r.DocumentType) - } - path.WriteString("/") - path.WriteString(r.DocumentID) - - params = make(map[string]string) - - if r.Preference != "" { - params["preference"] = r.Preference - } - - if r.Realtime != nil { - params["realtime"] = strconv.FormatBool(*r.Realtime) - } - - if r.Refresh != nil { - params["refresh"] = strconv.FormatBool(*r.Refresh) - } - - if r.Routing != "" { - params["routing"] = r.Routing - } - - if len(r.Source) > 0 { - params["_source"] = strings.Join(r.Source, ",") - } - - if len(r.SourceExcludes) > 0 { - params["_source_excludes"] = strings.Join(r.SourceExcludes, ",") - } - - if len(r.SourceIncludes) > 0 { - params["_source_includes"] = strings.Join(r.SourceIncludes, ",") - } - - if len(r.StoredFields) > 0 { - params["stored_fields"] = strings.Join(r.StoredFields, ",") - } - - if r.Version != nil { - params["version"] = strconv.FormatInt(int64(*r.Version), 10) - } - - if r.VersionType != "" { - params["version_type"] = r.VersionType - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f Exists) WithContext(v context.Context) func(*ExistsRequest) { - return func(r *ExistsRequest) { - r.ctx = v - } -} - -// WithDocumentType - the type of the document (use `_all` to fetch the first document matching the ID across all types). -// -func (f Exists) WithDocumentType(v string) func(*ExistsRequest) { - return func(r *ExistsRequest) { - r.DocumentType = v - } -} - -// WithPreference - specify the node or shard the operation should be performed on (default: random). -// -func (f Exists) WithPreference(v string) func(*ExistsRequest) { - return func(r *ExistsRequest) { - r.Preference = v - } -} - -// WithRealtime - specify whether to perform the operation in realtime or search mode. -// -func (f Exists) WithRealtime(v bool) func(*ExistsRequest) { - return func(r *ExistsRequest) { - r.Realtime = &v - } -} - -// WithRefresh - refresh the shard containing the document before performing the operation. -// -func (f Exists) WithRefresh(v bool) func(*ExistsRequest) { - return func(r *ExistsRequest) { - r.Refresh = &v - } -} - -// WithRouting - specific routing value. -// -func (f Exists) WithRouting(v string) func(*ExistsRequest) { - return func(r *ExistsRequest) { - r.Routing = v - } -} - -// WithSource - true or false to return the _source field or not, or a list of fields to return. -// -func (f Exists) WithSource(v ...string) func(*ExistsRequest) { - return func(r *ExistsRequest) { - r.Source = v - } -} - -// WithSourceExcludes - a list of fields to exclude from the returned _source field. -// -func (f Exists) WithSourceExcludes(v ...string) func(*ExistsRequest) { - return func(r *ExistsRequest) { - r.SourceExcludes = v - } -} - -// WithSourceIncludes - a list of fields to extract and return from the _source field. -// -func (f Exists) WithSourceIncludes(v ...string) func(*ExistsRequest) { - return func(r *ExistsRequest) { - r.SourceIncludes = v - } -} - -// WithStoredFields - a list of stored fields to return in the response. -// -func (f Exists) WithStoredFields(v ...string) func(*ExistsRequest) { - return func(r *ExistsRequest) { - r.StoredFields = v - } -} - -// WithVersion - explicit version number for concurrency control. -// -func (f Exists) WithVersion(v int) func(*ExistsRequest) { - return func(r *ExistsRequest) { - r.Version = &v - } -} - -// WithVersionType - specific version type. -// -func (f Exists) WithVersionType(v string) func(*ExistsRequest) { - return func(r *ExistsRequest) { - r.VersionType = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f Exists) WithPretty() func(*ExistsRequest) { - return func(r *ExistsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f Exists) WithHuman() func(*ExistsRequest) { - return func(r *ExistsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f Exists) WithErrorTrace() func(*ExistsRequest) { - return func(r *ExistsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f Exists) WithFilterPath(v ...string) func(*ExistsRequest) { - return func(r *ExistsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f Exists) WithHeader(h map[string]string) func(*ExistsRequest) { - return func(r *ExistsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f Exists) WithOpaqueID(s string) func(*ExistsRequest) { - return func(r *ExistsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.exists_source.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.exists_source.go deleted file mode 100644 index 9ab206bd4..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.exists_source.go +++ /dev/null @@ -1,336 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newExistsSourceFunc(t Transport) ExistsSource { - return func(index string, id string, o ...func(*ExistsSourceRequest)) (*Response, error) { - var r = ExistsSourceRequest{Index: index, DocumentID: id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// ExistsSource returns information about whether a document source exists in an index. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html. -// -type ExistsSource func(index string, id string, o ...func(*ExistsSourceRequest)) (*Response, error) - -// ExistsSourceRequest configures the Exists Source API request. -// -type ExistsSourceRequest struct { - Index string - DocumentType string - DocumentID string - - Preference string - Realtime *bool - Refresh *bool - Routing string - Source []string - SourceExcludes []string - SourceIncludes []string - Version *int - VersionType string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r ExistsSourceRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "HEAD" - - path.Grow(1 + len(r.Index) + 1 + len(r.DocumentType) + 1 + len(r.DocumentID) + 1 + len("_source")) - path.WriteString("/") - path.WriteString(r.Index) - if r.DocumentType != "" { - path.WriteString("/") - path.WriteString(r.DocumentType) - } - path.WriteString("/") - path.WriteString(r.DocumentID) - path.WriteString("/") - path.WriteString("_source") - - params = make(map[string]string) - - if r.Preference != "" { - params["preference"] = r.Preference - } - - if r.Realtime != nil { - params["realtime"] = strconv.FormatBool(*r.Realtime) - } - - if r.Refresh != nil { - params["refresh"] = strconv.FormatBool(*r.Refresh) - } - - if r.Routing != "" { - params["routing"] = r.Routing - } - - if len(r.Source) > 0 { - params["_source"] = strings.Join(r.Source, ",") - } - - if len(r.SourceExcludes) > 0 { - params["_source_excludes"] = strings.Join(r.SourceExcludes, ",") - } - - if len(r.SourceIncludes) > 0 { - params["_source_includes"] = strings.Join(r.SourceIncludes, ",") - } - - if r.Version != nil { - params["version"] = strconv.FormatInt(int64(*r.Version), 10) - } - - if r.VersionType != "" { - params["version_type"] = r.VersionType - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f ExistsSource) WithContext(v context.Context) func(*ExistsSourceRequest) { - return func(r *ExistsSourceRequest) { - r.ctx = v - } -} - -// WithDocumentType - the type of the document; deprecated and optional starting with 7.0. -// -func (f ExistsSource) WithDocumentType(v string) func(*ExistsSourceRequest) { - return func(r *ExistsSourceRequest) { - r.DocumentType = v - } -} - -// WithPreference - specify the node or shard the operation should be performed on (default: random). -// -func (f ExistsSource) WithPreference(v string) func(*ExistsSourceRequest) { - return func(r *ExistsSourceRequest) { - r.Preference = v - } -} - -// WithRealtime - specify whether to perform the operation in realtime or search mode. -// -func (f ExistsSource) WithRealtime(v bool) func(*ExistsSourceRequest) { - return func(r *ExistsSourceRequest) { - r.Realtime = &v - } -} - -// WithRefresh - refresh the shard containing the document before performing the operation. -// -func (f ExistsSource) WithRefresh(v bool) func(*ExistsSourceRequest) { - return func(r *ExistsSourceRequest) { - r.Refresh = &v - } -} - -// WithRouting - specific routing value. -// -func (f ExistsSource) WithRouting(v string) func(*ExistsSourceRequest) { - return func(r *ExistsSourceRequest) { - r.Routing = v - } -} - -// WithSource - true or false to return the _source field or not, or a list of fields to return. -// -func (f ExistsSource) WithSource(v ...string) func(*ExistsSourceRequest) { - return func(r *ExistsSourceRequest) { - r.Source = v - } -} - -// WithSourceExcludes - a list of fields to exclude from the returned _source field. -// -func (f ExistsSource) WithSourceExcludes(v ...string) func(*ExistsSourceRequest) { - return func(r *ExistsSourceRequest) { - r.SourceExcludes = v - } -} - -// WithSourceIncludes - a list of fields to extract and return from the _source field. -// -func (f ExistsSource) WithSourceIncludes(v ...string) func(*ExistsSourceRequest) { - return func(r *ExistsSourceRequest) { - r.SourceIncludes = v - } -} - -// WithVersion - explicit version number for concurrency control. -// -func (f ExistsSource) WithVersion(v int) func(*ExistsSourceRequest) { - return func(r *ExistsSourceRequest) { - r.Version = &v - } -} - -// WithVersionType - specific version type. -// -func (f ExistsSource) WithVersionType(v string) func(*ExistsSourceRequest) { - return func(r *ExistsSourceRequest) { - r.VersionType = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f ExistsSource) WithPretty() func(*ExistsSourceRequest) { - return func(r *ExistsSourceRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f ExistsSource) WithHuman() func(*ExistsSourceRequest) { - return func(r *ExistsSourceRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f ExistsSource) WithErrorTrace() func(*ExistsSourceRequest) { - return func(r *ExistsSourceRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f ExistsSource) WithFilterPath(v ...string) func(*ExistsSourceRequest) { - return func(r *ExistsSourceRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f ExistsSource) WithHeader(h map[string]string) func(*ExistsSourceRequest) { - return func(r *ExistsSourceRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f ExistsSource) WithOpaqueID(s string) func(*ExistsSourceRequest) { - return func(r *ExistsSourceRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.explain.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.explain.go deleted file mode 100644 index 51ab4623e..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.explain.go +++ /dev/null @@ -1,394 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" -) - -func newExplainFunc(t Transport) Explain { - return func(index string, id string, o ...func(*ExplainRequest)) (*Response, error) { - var r = ExplainRequest{Index: index, DocumentID: id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// Explain returns information about why a specific matches (or doesn't match) a query. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/search-explain.html. -// -type Explain func(index string, id string, o ...func(*ExplainRequest)) (*Response, error) - -// ExplainRequest configures the Explain API request. -// -type ExplainRequest struct { - Index string - DocumentType string - DocumentID string - - Body io.Reader - - Analyzer string - AnalyzeWildcard *bool - DefaultOperator string - Df string - Lenient *bool - Preference string - Query string - Routing string - Source []string - SourceExcludes []string - SourceIncludes []string - StoredFields []string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r ExplainRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - if r.DocumentType == "" { - r.DocumentType = "_doc" - } - - path.Grow(1 + len(r.Index) + 1 + len(r.DocumentType) + 1 + len(r.DocumentID) + 1 + len("_explain")) - path.WriteString("/") - path.WriteString(r.Index) - if r.DocumentType != "" { - path.WriteString("/") - path.WriteString(r.DocumentType) - } - path.WriteString("/") - path.WriteString(r.DocumentID) - path.WriteString("/") - path.WriteString("_explain") - - params = make(map[string]string) - - if r.Analyzer != "" { - params["analyzer"] = r.Analyzer - } - - if r.AnalyzeWildcard != nil { - params["analyze_wildcard"] = strconv.FormatBool(*r.AnalyzeWildcard) - } - - if r.DefaultOperator != "" { - params["default_operator"] = r.DefaultOperator - } - - if r.Df != "" { - params["df"] = r.Df - } - - if r.Lenient != nil { - params["lenient"] = strconv.FormatBool(*r.Lenient) - } - - if r.Preference != "" { - params["preference"] = r.Preference - } - - if r.Query != "" { - params["q"] = r.Query - } - - if r.Routing != "" { - params["routing"] = r.Routing - } - - if len(r.Source) > 0 { - params["_source"] = strings.Join(r.Source, ",") - } - - if len(r.SourceExcludes) > 0 { - params["_source_excludes"] = strings.Join(r.SourceExcludes, ",") - } - - if len(r.SourceIncludes) > 0 { - params["_source_includes"] = strings.Join(r.SourceIncludes, ",") - } - - if len(r.StoredFields) > 0 { - params["stored_fields"] = strings.Join(r.StoredFields, ",") - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f Explain) WithContext(v context.Context) func(*ExplainRequest) { - return func(r *ExplainRequest) { - r.ctx = v - } -} - -// WithBody - The query definition using the Query DSL. -// -func (f Explain) WithBody(v io.Reader) func(*ExplainRequest) { - return func(r *ExplainRequest) { - r.Body = v - } -} - -// WithDocumentType - the type of the document. -// -func (f Explain) WithDocumentType(v string) func(*ExplainRequest) { - return func(r *ExplainRequest) { - r.DocumentType = v - } -} - -// WithAnalyzer - the analyzer for the query string query. -// -func (f Explain) WithAnalyzer(v string) func(*ExplainRequest) { - return func(r *ExplainRequest) { - r.Analyzer = v - } -} - -// WithAnalyzeWildcard - specify whether wildcards and prefix queries in the query string query should be analyzed (default: false). -// -func (f Explain) WithAnalyzeWildcard(v bool) func(*ExplainRequest) { - return func(r *ExplainRequest) { - r.AnalyzeWildcard = &v - } -} - -// WithDefaultOperator - the default operator for query string query (and or or). -// -func (f Explain) WithDefaultOperator(v string) func(*ExplainRequest) { - return func(r *ExplainRequest) { - r.DefaultOperator = v - } -} - -// WithDf - the default field for query string query (default: _all). -// -func (f Explain) WithDf(v string) func(*ExplainRequest) { - return func(r *ExplainRequest) { - r.Df = v - } -} - -// WithLenient - specify whether format-based query failures (such as providing text to a numeric field) should be ignored. -// -func (f Explain) WithLenient(v bool) func(*ExplainRequest) { - return func(r *ExplainRequest) { - r.Lenient = &v - } -} - -// WithPreference - specify the node or shard the operation should be performed on (default: random). -// -func (f Explain) WithPreference(v string) func(*ExplainRequest) { - return func(r *ExplainRequest) { - r.Preference = v - } -} - -// WithQuery - query in the lucene query string syntax. -// -func (f Explain) WithQuery(v string) func(*ExplainRequest) { - return func(r *ExplainRequest) { - r.Query = v - } -} - -// WithRouting - specific routing value. -// -func (f Explain) WithRouting(v string) func(*ExplainRequest) { - return func(r *ExplainRequest) { - r.Routing = v - } -} - -// WithSource - true or false to return the _source field or not, or a list of fields to return. -// -func (f Explain) WithSource(v ...string) func(*ExplainRequest) { - return func(r *ExplainRequest) { - r.Source = v - } -} - -// WithSourceExcludes - a list of fields to exclude from the returned _source field. -// -func (f Explain) WithSourceExcludes(v ...string) func(*ExplainRequest) { - return func(r *ExplainRequest) { - r.SourceExcludes = v - } -} - -// WithSourceIncludes - a list of fields to extract and return from the _source field. -// -func (f Explain) WithSourceIncludes(v ...string) func(*ExplainRequest) { - return func(r *ExplainRequest) { - r.SourceIncludes = v - } -} - -// WithStoredFields - a list of stored fields to return in the response. -// -func (f Explain) WithStoredFields(v ...string) func(*ExplainRequest) { - return func(r *ExplainRequest) { - r.StoredFields = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f Explain) WithPretty() func(*ExplainRequest) { - return func(r *ExplainRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f Explain) WithHuman() func(*ExplainRequest) { - return func(r *ExplainRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f Explain) WithErrorTrace() func(*ExplainRequest) { - return func(r *ExplainRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f Explain) WithFilterPath(v ...string) func(*ExplainRequest) { - return func(r *ExplainRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f Explain) WithHeader(h map[string]string) func(*ExplainRequest) { - return func(r *ExplainRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f Explain) WithOpaqueID(s string) func(*ExplainRequest) { - return func(r *ExplainRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.features.get_features.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.features.get_features.go deleted file mode 100644 index 40393e706..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.features.get_features.go +++ /dev/null @@ -1,211 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" - "time" -) - -func newFeaturesGetFeaturesFunc(t Transport) FeaturesGetFeatures { - return func(o ...func(*FeaturesGetFeaturesRequest)) (*Response, error) { - var r = FeaturesGetFeaturesRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// FeaturesGetFeatures gets a list of features which can be included in snapshots using the feature_states field when creating a snapshot -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/get-features-api.html. -// -type FeaturesGetFeatures func(o ...func(*FeaturesGetFeaturesRequest)) (*Response, error) - -// FeaturesGetFeaturesRequest configures the Features Get Features API request. -// -type FeaturesGetFeaturesRequest struct { - MasterTimeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r FeaturesGetFeaturesRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(len("/_features")) - path.WriteString("/_features") - - params = make(map[string]string) - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f FeaturesGetFeatures) WithContext(v context.Context) func(*FeaturesGetFeaturesRequest) { - return func(r *FeaturesGetFeaturesRequest) { - r.ctx = v - } -} - -// WithMasterTimeout - explicit operation timeout for connection to master node. -// -func (f FeaturesGetFeatures) WithMasterTimeout(v time.Duration) func(*FeaturesGetFeaturesRequest) { - return func(r *FeaturesGetFeaturesRequest) { - r.MasterTimeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f FeaturesGetFeatures) WithPretty() func(*FeaturesGetFeaturesRequest) { - return func(r *FeaturesGetFeaturesRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f FeaturesGetFeatures) WithHuman() func(*FeaturesGetFeaturesRequest) { - return func(r *FeaturesGetFeaturesRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f FeaturesGetFeatures) WithErrorTrace() func(*FeaturesGetFeaturesRequest) { - return func(r *FeaturesGetFeaturesRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f FeaturesGetFeatures) WithFilterPath(v ...string) func(*FeaturesGetFeaturesRequest) { - return func(r *FeaturesGetFeaturesRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f FeaturesGetFeatures) WithHeader(h map[string]string) func(*FeaturesGetFeaturesRequest) { - return func(r *FeaturesGetFeaturesRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f FeaturesGetFeatures) WithOpaqueID(s string) func(*FeaturesGetFeaturesRequest) { - return func(r *FeaturesGetFeaturesRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.features.reset_features.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.features.reset_features.go deleted file mode 100644 index 35395fc50..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.features.reset_features.go +++ /dev/null @@ -1,198 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newFeaturesResetFeaturesFunc(t Transport) FeaturesResetFeatures { - return func(o ...func(*FeaturesResetFeaturesRequest)) (*Response, error) { - var r = FeaturesResetFeaturesRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// FeaturesResetFeatures resets the internal state of features, usually by deleting system indices -// -// This API is experimental. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html. -// -type FeaturesResetFeatures func(o ...func(*FeaturesResetFeaturesRequest)) (*Response, error) - -// FeaturesResetFeaturesRequest configures the Features Reset Features API request. -// -type FeaturesResetFeaturesRequest struct { - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r FeaturesResetFeaturesRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(len("/_features/_reset")) - path.WriteString("/_features/_reset") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f FeaturesResetFeatures) WithContext(v context.Context) func(*FeaturesResetFeaturesRequest) { - return func(r *FeaturesResetFeaturesRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f FeaturesResetFeatures) WithPretty() func(*FeaturesResetFeaturesRequest) { - return func(r *FeaturesResetFeaturesRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f FeaturesResetFeatures) WithHuman() func(*FeaturesResetFeaturesRequest) { - return func(r *FeaturesResetFeaturesRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f FeaturesResetFeatures) WithErrorTrace() func(*FeaturesResetFeaturesRequest) { - return func(r *FeaturesResetFeaturesRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f FeaturesResetFeatures) WithFilterPath(v ...string) func(*FeaturesResetFeaturesRequest) { - return func(r *FeaturesResetFeaturesRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f FeaturesResetFeatures) WithHeader(h map[string]string) func(*FeaturesResetFeaturesRequest) { - return func(r *FeaturesResetFeaturesRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f FeaturesResetFeatures) WithOpaqueID(s string) func(*FeaturesResetFeaturesRequest) { - return func(r *FeaturesResetFeaturesRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.field_caps.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.field_caps.go deleted file mode 100644 index 9989ca264..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.field_caps.go +++ /dev/null @@ -1,293 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" -) - -func newFieldCapsFunc(t Transport) FieldCaps { - return func(o ...func(*FieldCapsRequest)) (*Response, error) { - var r = FieldCapsRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// FieldCaps returns the information about the capabilities of fields among multiple indices. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/search-field-caps.html. -// -type FieldCaps func(o ...func(*FieldCapsRequest)) (*Response, error) - -// FieldCapsRequest configures the Field Caps API request. -// -type FieldCapsRequest struct { - Index []string - - Body io.Reader - - AllowNoIndices *bool - ExpandWildcards string - Fields []string - IgnoreUnavailable *bool - IncludeUnmapped *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r FieldCapsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len(strings.Join(r.Index, ",")) + 1 + len("_field_caps")) - if len(r.Index) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Index, ",")) - } - path.WriteString("/") - path.WriteString("_field_caps") - - params = make(map[string]string) - - if r.AllowNoIndices != nil { - params["allow_no_indices"] = strconv.FormatBool(*r.AllowNoIndices) - } - - if r.ExpandWildcards != "" { - params["expand_wildcards"] = r.ExpandWildcards - } - - if len(r.Fields) > 0 { - params["fields"] = strings.Join(r.Fields, ",") - } - - if r.IgnoreUnavailable != nil { - params["ignore_unavailable"] = strconv.FormatBool(*r.IgnoreUnavailable) - } - - if r.IncludeUnmapped != nil { - params["include_unmapped"] = strconv.FormatBool(*r.IncludeUnmapped) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f FieldCaps) WithContext(v context.Context) func(*FieldCapsRequest) { - return func(r *FieldCapsRequest) { - r.ctx = v - } -} - -// WithBody - An index filter specified with the Query DSL. -// -func (f FieldCaps) WithBody(v io.Reader) func(*FieldCapsRequest) { - return func(r *FieldCapsRequest) { - r.Body = v - } -} - -// WithIndex - a list of index names; use _all to perform the operation on all indices. -// -func (f FieldCaps) WithIndex(v ...string) func(*FieldCapsRequest) { - return func(r *FieldCapsRequest) { - r.Index = v - } -} - -// WithAllowNoIndices - whether to ignore if a wildcard indices expression resolves into no concrete indices. (this includes `_all` string or when no indices have been specified). -// -func (f FieldCaps) WithAllowNoIndices(v bool) func(*FieldCapsRequest) { - return func(r *FieldCapsRequest) { - r.AllowNoIndices = &v - } -} - -// WithExpandWildcards - whether to expand wildcard expression to concrete indices that are open, closed or both.. -// -func (f FieldCaps) WithExpandWildcards(v string) func(*FieldCapsRequest) { - return func(r *FieldCapsRequest) { - r.ExpandWildcards = v - } -} - -// WithFields - a list of field names. -// -func (f FieldCaps) WithFields(v ...string) func(*FieldCapsRequest) { - return func(r *FieldCapsRequest) { - r.Fields = v - } -} - -// WithIgnoreUnavailable - whether specified concrete indices should be ignored when unavailable (missing or closed). -// -func (f FieldCaps) WithIgnoreUnavailable(v bool) func(*FieldCapsRequest) { - return func(r *FieldCapsRequest) { - r.IgnoreUnavailable = &v - } -} - -// WithIncludeUnmapped - indicates whether unmapped fields should be included in the response.. -// -func (f FieldCaps) WithIncludeUnmapped(v bool) func(*FieldCapsRequest) { - return func(r *FieldCapsRequest) { - r.IncludeUnmapped = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f FieldCaps) WithPretty() func(*FieldCapsRequest) { - return func(r *FieldCapsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f FieldCaps) WithHuman() func(*FieldCapsRequest) { - return func(r *FieldCapsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f FieldCaps) WithErrorTrace() func(*FieldCapsRequest) { - return func(r *FieldCapsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f FieldCaps) WithFilterPath(v ...string) func(*FieldCapsRequest) { - return func(r *FieldCapsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f FieldCaps) WithHeader(h map[string]string) func(*FieldCapsRequest) { - return func(r *FieldCapsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f FieldCaps) WithOpaqueID(s string) func(*FieldCapsRequest) { - return func(r *FieldCapsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.fleet.global_checkpoints.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.fleet.global_checkpoints.go deleted file mode 100644 index 585f3f972..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.fleet.global_checkpoints.go +++ /dev/null @@ -1,258 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" - "time" -) - -func newFleetGlobalCheckpointsFunc(t Transport) FleetGlobalCheckpoints { - return func(index string, o ...func(*FleetGlobalCheckpointsRequest)) (*Response, error) { - var r = FleetGlobalCheckpointsRequest{Index: index} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// FleetGlobalCheckpoints returns the current global checkpoints for an index. This API is design for internal use by the fleet server project. -// -// This API is experimental. -// -type FleetGlobalCheckpoints func(index string, o ...func(*FleetGlobalCheckpointsRequest)) (*Response, error) - -// FleetGlobalCheckpointsRequest configures the Fleet Global Checkpoints API request. -// -type FleetGlobalCheckpointsRequest struct { - Index string - - Checkpoints []string - Timeout time.Duration - WaitForAdvance *bool - WaitForIndex *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r FleetGlobalCheckpointsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len(r.Index) + 1 + len("_fleet") + 1 + len("global_checkpoints")) - path.WriteString("/") - path.WriteString(r.Index) - path.WriteString("/") - path.WriteString("_fleet") - path.WriteString("/") - path.WriteString("global_checkpoints") - - params = make(map[string]string) - - if len(r.Checkpoints) > 0 { - params["checkpoints"] = strings.Join(r.Checkpoints, ",") - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.WaitForAdvance != nil { - params["wait_for_advance"] = strconv.FormatBool(*r.WaitForAdvance) - } - - if r.WaitForIndex != nil { - params["wait_for_index"] = strconv.FormatBool(*r.WaitForIndex) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f FleetGlobalCheckpoints) WithContext(v context.Context) func(*FleetGlobalCheckpointsRequest) { - return func(r *FleetGlobalCheckpointsRequest) { - r.ctx = v - } -} - -// WithCheckpoints - comma separated list of checkpoints. -// -func (f FleetGlobalCheckpoints) WithCheckpoints(v ...string) func(*FleetGlobalCheckpointsRequest) { - return func(r *FleetGlobalCheckpointsRequest) { - r.Checkpoints = v - } -} - -// WithTimeout - timeout to wait for global checkpoint to advance. -// -func (f FleetGlobalCheckpoints) WithTimeout(v time.Duration) func(*FleetGlobalCheckpointsRequest) { - return func(r *FleetGlobalCheckpointsRequest) { - r.Timeout = v - } -} - -// WithWaitForAdvance - whether to wait for the global checkpoint to advance past the specified current checkpoints. -// -func (f FleetGlobalCheckpoints) WithWaitForAdvance(v bool) func(*FleetGlobalCheckpointsRequest) { - return func(r *FleetGlobalCheckpointsRequest) { - r.WaitForAdvance = &v - } -} - -// WithWaitForIndex - whether to wait for the target index to exist and all primary shards be active. -// -func (f FleetGlobalCheckpoints) WithWaitForIndex(v bool) func(*FleetGlobalCheckpointsRequest) { - return func(r *FleetGlobalCheckpointsRequest) { - r.WaitForIndex = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f FleetGlobalCheckpoints) WithPretty() func(*FleetGlobalCheckpointsRequest) { - return func(r *FleetGlobalCheckpointsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f FleetGlobalCheckpoints) WithHuman() func(*FleetGlobalCheckpointsRequest) { - return func(r *FleetGlobalCheckpointsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f FleetGlobalCheckpoints) WithErrorTrace() func(*FleetGlobalCheckpointsRequest) { - return func(r *FleetGlobalCheckpointsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f FleetGlobalCheckpoints) WithFilterPath(v ...string) func(*FleetGlobalCheckpointsRequest) { - return func(r *FleetGlobalCheckpointsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f FleetGlobalCheckpoints) WithHeader(h map[string]string) func(*FleetGlobalCheckpointsRequest) { - return func(r *FleetGlobalCheckpointsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f FleetGlobalCheckpoints) WithOpaqueID(s string) func(*FleetGlobalCheckpointsRequest) { - return func(r *FleetGlobalCheckpointsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.get.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.get.go deleted file mode 100644 index 72e936b9e..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.get.go +++ /dev/null @@ -1,351 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newGetFunc(t Transport) Get { - return func(index string, id string, o ...func(*GetRequest)) (*Response, error) { - var r = GetRequest{Index: index, DocumentID: id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// Get returns a document. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html. -// -type Get func(index string, id string, o ...func(*GetRequest)) (*Response, error) - -// GetRequest configures the Get API request. -// -type GetRequest struct { - Index string - DocumentType string - DocumentID string - - Preference string - Realtime *bool - Refresh *bool - Routing string - Source []string - SourceExcludes []string - SourceIncludes []string - StoredFields []string - Version *int - VersionType string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r GetRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - if r.DocumentType == "" { - r.DocumentType = "_doc" - } - - path.Grow(1 + len(r.Index) + 1 + len(r.DocumentType) + 1 + len(r.DocumentID)) - path.WriteString("/") - path.WriteString(r.Index) - if r.DocumentType != "" { - path.WriteString("/") - path.WriteString(r.DocumentType) - } - path.WriteString("/") - path.WriteString(r.DocumentID) - - params = make(map[string]string) - - if r.Preference != "" { - params["preference"] = r.Preference - } - - if r.Realtime != nil { - params["realtime"] = strconv.FormatBool(*r.Realtime) - } - - if r.Refresh != nil { - params["refresh"] = strconv.FormatBool(*r.Refresh) - } - - if r.Routing != "" { - params["routing"] = r.Routing - } - - if len(r.Source) > 0 { - params["_source"] = strings.Join(r.Source, ",") - } - - if len(r.SourceExcludes) > 0 { - params["_source_excludes"] = strings.Join(r.SourceExcludes, ",") - } - - if len(r.SourceIncludes) > 0 { - params["_source_includes"] = strings.Join(r.SourceIncludes, ",") - } - - if len(r.StoredFields) > 0 { - params["stored_fields"] = strings.Join(r.StoredFields, ",") - } - - if r.Version != nil { - params["version"] = strconv.FormatInt(int64(*r.Version), 10) - } - - if r.VersionType != "" { - params["version_type"] = r.VersionType - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f Get) WithContext(v context.Context) func(*GetRequest) { - return func(r *GetRequest) { - r.ctx = v - } -} - -// WithDocumentType - the type of the document (use `_all` to fetch the first document matching the ID across all types). -// -func (f Get) WithDocumentType(v string) func(*GetRequest) { - return func(r *GetRequest) { - r.DocumentType = v - } -} - -// WithPreference - specify the node or shard the operation should be performed on (default: random). -// -func (f Get) WithPreference(v string) func(*GetRequest) { - return func(r *GetRequest) { - r.Preference = v - } -} - -// WithRealtime - specify whether to perform the operation in realtime or search mode. -// -func (f Get) WithRealtime(v bool) func(*GetRequest) { - return func(r *GetRequest) { - r.Realtime = &v - } -} - -// WithRefresh - refresh the shard containing the document before performing the operation. -// -func (f Get) WithRefresh(v bool) func(*GetRequest) { - return func(r *GetRequest) { - r.Refresh = &v - } -} - -// WithRouting - specific routing value. -// -func (f Get) WithRouting(v string) func(*GetRequest) { - return func(r *GetRequest) { - r.Routing = v - } -} - -// WithSource - true or false to return the _source field or not, or a list of fields to return. -// -func (f Get) WithSource(v ...string) func(*GetRequest) { - return func(r *GetRequest) { - r.Source = v - } -} - -// WithSourceExcludes - a list of fields to exclude from the returned _source field. -// -func (f Get) WithSourceExcludes(v ...string) func(*GetRequest) { - return func(r *GetRequest) { - r.SourceExcludes = v - } -} - -// WithSourceIncludes - a list of fields to extract and return from the _source field. -// -func (f Get) WithSourceIncludes(v ...string) func(*GetRequest) { - return func(r *GetRequest) { - r.SourceIncludes = v - } -} - -// WithStoredFields - a list of stored fields to return in the response. -// -func (f Get) WithStoredFields(v ...string) func(*GetRequest) { - return func(r *GetRequest) { - r.StoredFields = v - } -} - -// WithVersion - explicit version number for concurrency control. -// -func (f Get) WithVersion(v int) func(*GetRequest) { - return func(r *GetRequest) { - r.Version = &v - } -} - -// WithVersionType - specific version type. -// -func (f Get) WithVersionType(v string) func(*GetRequest) { - return func(r *GetRequest) { - r.VersionType = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f Get) WithPretty() func(*GetRequest) { - return func(r *GetRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f Get) WithHuman() func(*GetRequest) { - return func(r *GetRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f Get) WithErrorTrace() func(*GetRequest) { - return func(r *GetRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f Get) WithFilterPath(v ...string) func(*GetRequest) { - return func(r *GetRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f Get) WithHeader(h map[string]string) func(*GetRequest) { - return func(r *GetRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f Get) WithOpaqueID(s string) func(*GetRequest) { - return func(r *GetRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.get_script.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.get_script.go deleted file mode 100644 index 2f3541939..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.get_script.go +++ /dev/null @@ -1,216 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" - "time" -) - -func newGetScriptFunc(t Transport) GetScript { - return func(id string, o ...func(*GetScriptRequest)) (*Response, error) { - var r = GetScriptRequest{ScriptID: id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// GetScript returns a script. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html. -// -type GetScript func(id string, o ...func(*GetScriptRequest)) (*Response, error) - -// GetScriptRequest configures the Get Script API request. -// -type GetScriptRequest struct { - ScriptID string - - MasterTimeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r GetScriptRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_scripts") + 1 + len(r.ScriptID)) - path.WriteString("/") - path.WriteString("_scripts") - path.WriteString("/") - path.WriteString(r.ScriptID) - - params = make(map[string]string) - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f GetScript) WithContext(v context.Context) func(*GetScriptRequest) { - return func(r *GetScriptRequest) { - r.ctx = v - } -} - -// WithMasterTimeout - specify timeout for connection to master. -// -func (f GetScript) WithMasterTimeout(v time.Duration) func(*GetScriptRequest) { - return func(r *GetScriptRequest) { - r.MasterTimeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f GetScript) WithPretty() func(*GetScriptRequest) { - return func(r *GetScriptRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f GetScript) WithHuman() func(*GetScriptRequest) { - return func(r *GetScriptRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f GetScript) WithErrorTrace() func(*GetScriptRequest) { - return func(r *GetScriptRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f GetScript) WithFilterPath(v ...string) func(*GetScriptRequest) { - return func(r *GetScriptRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f GetScript) WithHeader(h map[string]string) func(*GetScriptRequest) { - return func(r *GetScriptRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f GetScript) WithOpaqueID(s string) func(*GetScriptRequest) { - return func(r *GetScriptRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.get_script_context.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.get_script_context.go deleted file mode 100644 index ed6d17b6a..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.get_script_context.go +++ /dev/null @@ -1,198 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newGetScriptContextFunc(t Transport) GetScriptContext { - return func(o ...func(*GetScriptContextRequest)) (*Response, error) { - var r = GetScriptContextRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// GetScriptContext returns all script contexts. -// -// This API is experimental. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/painless/master/painless-contexts.html. -// -type GetScriptContext func(o ...func(*GetScriptContextRequest)) (*Response, error) - -// GetScriptContextRequest configures the Get Script Context API request. -// -type GetScriptContextRequest struct { - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r GetScriptContextRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(len("/_script_context")) - path.WriteString("/_script_context") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f GetScriptContext) WithContext(v context.Context) func(*GetScriptContextRequest) { - return func(r *GetScriptContextRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f GetScriptContext) WithPretty() func(*GetScriptContextRequest) { - return func(r *GetScriptContextRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f GetScriptContext) WithHuman() func(*GetScriptContextRequest) { - return func(r *GetScriptContextRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f GetScriptContext) WithErrorTrace() func(*GetScriptContextRequest) { - return func(r *GetScriptContextRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f GetScriptContext) WithFilterPath(v ...string) func(*GetScriptContextRequest) { - return func(r *GetScriptContextRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f GetScriptContext) WithHeader(h map[string]string) func(*GetScriptContextRequest) { - return func(r *GetScriptContextRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f GetScriptContext) WithOpaqueID(s string) func(*GetScriptContextRequest) { - return func(r *GetScriptContextRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.get_script_languages.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.get_script_languages.go deleted file mode 100644 index ed3cbea54..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.get_script_languages.go +++ /dev/null @@ -1,198 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newGetScriptLanguagesFunc(t Transport) GetScriptLanguages { - return func(o ...func(*GetScriptLanguagesRequest)) (*Response, error) { - var r = GetScriptLanguagesRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// GetScriptLanguages returns available script types, languages and contexts -// -// This API is experimental. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html. -// -type GetScriptLanguages func(o ...func(*GetScriptLanguagesRequest)) (*Response, error) - -// GetScriptLanguagesRequest configures the Get Script Languages API request. -// -type GetScriptLanguagesRequest struct { - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r GetScriptLanguagesRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(len("/_script_language")) - path.WriteString("/_script_language") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f GetScriptLanguages) WithContext(v context.Context) func(*GetScriptLanguagesRequest) { - return func(r *GetScriptLanguagesRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f GetScriptLanguages) WithPretty() func(*GetScriptLanguagesRequest) { - return func(r *GetScriptLanguagesRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f GetScriptLanguages) WithHuman() func(*GetScriptLanguagesRequest) { - return func(r *GetScriptLanguagesRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f GetScriptLanguages) WithErrorTrace() func(*GetScriptLanguagesRequest) { - return func(r *GetScriptLanguagesRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f GetScriptLanguages) WithFilterPath(v ...string) func(*GetScriptLanguagesRequest) { - return func(r *GetScriptLanguagesRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f GetScriptLanguages) WithHeader(h map[string]string) func(*GetScriptLanguagesRequest) { - return func(r *GetScriptLanguagesRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f GetScriptLanguages) WithOpaqueID(s string) func(*GetScriptLanguagesRequest) { - return func(r *GetScriptLanguagesRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.get_source.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.get_source.go deleted file mode 100644 index 41450634c..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.get_source.go +++ /dev/null @@ -1,340 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newGetSourceFunc(t Transport) GetSource { - return func(index string, id string, o ...func(*GetSourceRequest)) (*Response, error) { - var r = GetSourceRequest{Index: index, DocumentID: id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// GetSource returns the source of a document. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html. -// -type GetSource func(index string, id string, o ...func(*GetSourceRequest)) (*Response, error) - -// GetSourceRequest configures the Get Source API request. -// -type GetSourceRequest struct { - Index string - DocumentType string - DocumentID string - - Preference string - Realtime *bool - Refresh *bool - Routing string - Source []string - SourceExcludes []string - SourceIncludes []string - Version *int - VersionType string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r GetSourceRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - if r.DocumentType == "" { - r.DocumentType = "_doc" - } - - path.Grow(1 + len(r.Index) + 1 + len(r.DocumentType) + 1 + len(r.DocumentID) + 1 + len("_source")) - path.WriteString("/") - path.WriteString(r.Index) - if r.DocumentType != "" { - path.WriteString("/") - path.WriteString(r.DocumentType) - } - path.WriteString("/") - path.WriteString(r.DocumentID) - path.WriteString("/") - path.WriteString("_source") - - params = make(map[string]string) - - if r.Preference != "" { - params["preference"] = r.Preference - } - - if r.Realtime != nil { - params["realtime"] = strconv.FormatBool(*r.Realtime) - } - - if r.Refresh != nil { - params["refresh"] = strconv.FormatBool(*r.Refresh) - } - - if r.Routing != "" { - params["routing"] = r.Routing - } - - if len(r.Source) > 0 { - params["_source"] = strings.Join(r.Source, ",") - } - - if len(r.SourceExcludes) > 0 { - params["_source_excludes"] = strings.Join(r.SourceExcludes, ",") - } - - if len(r.SourceIncludes) > 0 { - params["_source_includes"] = strings.Join(r.SourceIncludes, ",") - } - - if r.Version != nil { - params["version"] = strconv.FormatInt(int64(*r.Version), 10) - } - - if r.VersionType != "" { - params["version_type"] = r.VersionType - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f GetSource) WithContext(v context.Context) func(*GetSourceRequest) { - return func(r *GetSourceRequest) { - r.ctx = v - } -} - -// WithDocumentType - the type of the document; deprecated and optional starting with 7.0. -// -func (f GetSource) WithDocumentType(v string) func(*GetSourceRequest) { - return func(r *GetSourceRequest) { - r.DocumentType = v - } -} - -// WithPreference - specify the node or shard the operation should be performed on (default: random). -// -func (f GetSource) WithPreference(v string) func(*GetSourceRequest) { - return func(r *GetSourceRequest) { - r.Preference = v - } -} - -// WithRealtime - specify whether to perform the operation in realtime or search mode. -// -func (f GetSource) WithRealtime(v bool) func(*GetSourceRequest) { - return func(r *GetSourceRequest) { - r.Realtime = &v - } -} - -// WithRefresh - refresh the shard containing the document before performing the operation. -// -func (f GetSource) WithRefresh(v bool) func(*GetSourceRequest) { - return func(r *GetSourceRequest) { - r.Refresh = &v - } -} - -// WithRouting - specific routing value. -// -func (f GetSource) WithRouting(v string) func(*GetSourceRequest) { - return func(r *GetSourceRequest) { - r.Routing = v - } -} - -// WithSource - true or false to return the _source field or not, or a list of fields to return. -// -func (f GetSource) WithSource(v ...string) func(*GetSourceRequest) { - return func(r *GetSourceRequest) { - r.Source = v - } -} - -// WithSourceExcludes - a list of fields to exclude from the returned _source field. -// -func (f GetSource) WithSourceExcludes(v ...string) func(*GetSourceRequest) { - return func(r *GetSourceRequest) { - r.SourceExcludes = v - } -} - -// WithSourceIncludes - a list of fields to extract and return from the _source field. -// -func (f GetSource) WithSourceIncludes(v ...string) func(*GetSourceRequest) { - return func(r *GetSourceRequest) { - r.SourceIncludes = v - } -} - -// WithVersion - explicit version number for concurrency control. -// -func (f GetSource) WithVersion(v int) func(*GetSourceRequest) { - return func(r *GetSourceRequest) { - r.Version = &v - } -} - -// WithVersionType - specific version type. -// -func (f GetSource) WithVersionType(v string) func(*GetSourceRequest) { - return func(r *GetSourceRequest) { - r.VersionType = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f GetSource) WithPretty() func(*GetSourceRequest) { - return func(r *GetSourceRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f GetSource) WithHuman() func(*GetSourceRequest) { - return func(r *GetSourceRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f GetSource) WithErrorTrace() func(*GetSourceRequest) { - return func(r *GetSourceRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f GetSource) WithFilterPath(v ...string) func(*GetSourceRequest) { - return func(r *GetSourceRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f GetSource) WithHeader(h map[string]string) func(*GetSourceRequest) { - return func(r *GetSourceRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f GetSource) WithOpaqueID(s string) func(*GetSourceRequest) { - return func(r *GetSourceRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.index.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.index.go deleted file mode 100644 index f9188e52b..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.index.go +++ /dev/null @@ -1,386 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" - "time" -) - -func newIndexFunc(t Transport) Index { - return func(index string, body io.Reader, o ...func(*IndexRequest)) (*Response, error) { - var r = IndexRequest{Index: index, Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// Index creates or updates a document in an index. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-index_.html. -// -type Index func(index string, body io.Reader, o ...func(*IndexRequest)) (*Response, error) - -// IndexRequest configures the Index API request. -// -type IndexRequest struct { - Index string - DocumentType string - DocumentID string - - Body io.Reader - - IfPrimaryTerm *int - IfSeqNo *int - OpType string - Pipeline string - Refresh string - RequireAlias *bool - Routing string - Timeout time.Duration - Version *int - VersionType string - WaitForActiveShards string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndexRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - if r.DocumentID != "" { - method = "PUT" - } else { - method = "POST" - } - - if r.DocumentType == "" { - r.DocumentType = "_doc" - } - - path.Grow(1 + len(r.Index) + 1 + len(r.DocumentType) + 1 + len(r.DocumentID)) - path.WriteString("/") - path.WriteString(r.Index) - if r.DocumentType != "" { - path.WriteString("/") - path.WriteString(r.DocumentType) - } - if r.DocumentID != "" { - path.WriteString("/") - path.WriteString(r.DocumentID) - } - - params = make(map[string]string) - - if r.IfPrimaryTerm != nil { - params["if_primary_term"] = strconv.FormatInt(int64(*r.IfPrimaryTerm), 10) - } - - if r.IfSeqNo != nil { - params["if_seq_no"] = strconv.FormatInt(int64(*r.IfSeqNo), 10) - } - - if r.OpType != "" { - params["op_type"] = r.OpType - } - - if r.Pipeline != "" { - params["pipeline"] = r.Pipeline - } - - if r.Refresh != "" { - params["refresh"] = r.Refresh - } - - if r.RequireAlias != nil { - params["require_alias"] = strconv.FormatBool(*r.RequireAlias) - } - - if r.Routing != "" { - params["routing"] = r.Routing - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.Version != nil { - params["version"] = strconv.FormatInt(int64(*r.Version), 10) - } - - if r.VersionType != "" { - params["version_type"] = r.VersionType - } - - if r.WaitForActiveShards != "" { - params["wait_for_active_shards"] = r.WaitForActiveShards - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f Index) WithContext(v context.Context) func(*IndexRequest) { - return func(r *IndexRequest) { - r.ctx = v - } -} - -// WithDocumentID - document ID. -// -func (f Index) WithDocumentID(v string) func(*IndexRequest) { - return func(r *IndexRequest) { - r.DocumentID = v - } -} - -// WithDocumentType - the type of the document. -// -func (f Index) WithDocumentType(v string) func(*IndexRequest) { - return func(r *IndexRequest) { - r.DocumentType = v - } -} - -// WithIfPrimaryTerm - only perform the index operation if the last operation that has changed the document has the specified primary term. -// -func (f Index) WithIfPrimaryTerm(v int) func(*IndexRequest) { - return func(r *IndexRequest) { - r.IfPrimaryTerm = &v - } -} - -// WithIfSeqNo - only perform the index operation if the last operation that has changed the document has the specified sequence number. -// -func (f Index) WithIfSeqNo(v int) func(*IndexRequest) { - return func(r *IndexRequest) { - r.IfSeqNo = &v - } -} - -// WithOpType - explicit operation type. defaults to `index` for requests with an explicit document ID, and to `create`for requests without an explicit document ID. -// -func (f Index) WithOpType(v string) func(*IndexRequest) { - return func(r *IndexRequest) { - r.OpType = v - } -} - -// WithPipeline - the pipeline ID to preprocess incoming documents with. -// -func (f Index) WithPipeline(v string) func(*IndexRequest) { - return func(r *IndexRequest) { - r.Pipeline = v - } -} - -// WithRefresh - if `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes.. -// -func (f Index) WithRefresh(v string) func(*IndexRequest) { - return func(r *IndexRequest) { - r.Refresh = v - } -} - -// WithRequireAlias - when true, requires destination to be an alias. default is false. -// -func (f Index) WithRequireAlias(v bool) func(*IndexRequest) { - return func(r *IndexRequest) { - r.RequireAlias = &v - } -} - -// WithRouting - specific routing value. -// -func (f Index) WithRouting(v string) func(*IndexRequest) { - return func(r *IndexRequest) { - r.Routing = v - } -} - -// WithTimeout - explicit operation timeout. -// -func (f Index) WithTimeout(v time.Duration) func(*IndexRequest) { - return func(r *IndexRequest) { - r.Timeout = v - } -} - -// WithVersion - explicit version number for concurrency control. -// -func (f Index) WithVersion(v int) func(*IndexRequest) { - return func(r *IndexRequest) { - r.Version = &v - } -} - -// WithVersionType - specific version type. -// -func (f Index) WithVersionType(v string) func(*IndexRequest) { - return func(r *IndexRequest) { - r.VersionType = v - } -} - -// WithWaitForActiveShards - sets the number of shard copies that must be active before proceeding with the index operation. defaults to 1, meaning the primary shard only. set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1). -// -func (f Index) WithWaitForActiveShards(v string) func(*IndexRequest) { - return func(r *IndexRequest) { - r.WaitForActiveShards = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f Index) WithPretty() func(*IndexRequest) { - return func(r *IndexRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f Index) WithHuman() func(*IndexRequest) { - return func(r *IndexRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f Index) WithErrorTrace() func(*IndexRequest) { - return func(r *IndexRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f Index) WithFilterPath(v ...string) func(*IndexRequest) { - return func(r *IndexRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f Index) WithHeader(h map[string]string) func(*IndexRequest) { - return func(r *IndexRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f Index) WithOpaqueID(s string) func(*IndexRequest) { - return func(r *IndexRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.add_block.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.add_block.go deleted file mode 100644 index df22d8a22..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.add_block.go +++ /dev/null @@ -1,273 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" - "time" -) - -func newIndicesAddBlockFunc(t Transport) IndicesAddBlock { - return func(index []string, block string, o ...func(*IndicesAddBlockRequest)) (*Response, error) { - var r = IndicesAddBlockRequest{Index: index, Block: block} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesAddBlock adds a block to an index. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/index-modules-blocks.html. -// -type IndicesAddBlock func(index []string, block string, o ...func(*IndicesAddBlockRequest)) (*Response, error) - -// IndicesAddBlockRequest configures the Indices Add Block API request. -// -type IndicesAddBlockRequest struct { - Index []string - - Block string - - AllowNoIndices *bool - ExpandWildcards string - IgnoreUnavailable *bool - MasterTimeout time.Duration - Timeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesAddBlockRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - path.Grow(1 + len(strings.Join(r.Index, ",")) + 1 + len("_block") + 1 + len(r.Block)) - path.WriteString("/") - path.WriteString(strings.Join(r.Index, ",")) - path.WriteString("/") - path.WriteString("_block") - path.WriteString("/") - path.WriteString(r.Block) - - params = make(map[string]string) - - if r.AllowNoIndices != nil { - params["allow_no_indices"] = strconv.FormatBool(*r.AllowNoIndices) - } - - if r.ExpandWildcards != "" { - params["expand_wildcards"] = r.ExpandWildcards - } - - if r.IgnoreUnavailable != nil { - params["ignore_unavailable"] = strconv.FormatBool(*r.IgnoreUnavailable) - } - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesAddBlock) WithContext(v context.Context) func(*IndicesAddBlockRequest) { - return func(r *IndicesAddBlockRequest) { - r.ctx = v - } -} - -// WithAllowNoIndices - whether to ignore if a wildcard indices expression resolves into no concrete indices. (this includes `_all` string or when no indices have been specified). -// -func (f IndicesAddBlock) WithAllowNoIndices(v bool) func(*IndicesAddBlockRequest) { - return func(r *IndicesAddBlockRequest) { - r.AllowNoIndices = &v - } -} - -// WithExpandWildcards - whether to expand wildcard expression to concrete indices that are open, closed or both.. -// -func (f IndicesAddBlock) WithExpandWildcards(v string) func(*IndicesAddBlockRequest) { - return func(r *IndicesAddBlockRequest) { - r.ExpandWildcards = v - } -} - -// WithIgnoreUnavailable - whether specified concrete indices should be ignored when unavailable (missing or closed). -// -func (f IndicesAddBlock) WithIgnoreUnavailable(v bool) func(*IndicesAddBlockRequest) { - return func(r *IndicesAddBlockRequest) { - r.IgnoreUnavailable = &v - } -} - -// WithMasterTimeout - specify timeout for connection to master. -// -func (f IndicesAddBlock) WithMasterTimeout(v time.Duration) func(*IndicesAddBlockRequest) { - return func(r *IndicesAddBlockRequest) { - r.MasterTimeout = v - } -} - -// WithTimeout - explicit operation timeout. -// -func (f IndicesAddBlock) WithTimeout(v time.Duration) func(*IndicesAddBlockRequest) { - return func(r *IndicesAddBlockRequest) { - r.Timeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesAddBlock) WithPretty() func(*IndicesAddBlockRequest) { - return func(r *IndicesAddBlockRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesAddBlock) WithHuman() func(*IndicesAddBlockRequest) { - return func(r *IndicesAddBlockRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesAddBlock) WithErrorTrace() func(*IndicesAddBlockRequest) { - return func(r *IndicesAddBlockRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesAddBlock) WithFilterPath(v ...string) func(*IndicesAddBlockRequest) { - return func(r *IndicesAddBlockRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesAddBlock) WithHeader(h map[string]string) func(*IndicesAddBlockRequest) { - return func(r *IndicesAddBlockRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesAddBlock) WithOpaqueID(s string) func(*IndicesAddBlockRequest) { - return func(r *IndicesAddBlockRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.analyze.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.analyze.go deleted file mode 100644 index 4d91bb93b..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.analyze.go +++ /dev/null @@ -1,230 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" -) - -func newIndicesAnalyzeFunc(t Transport) IndicesAnalyze { - return func(o ...func(*IndicesAnalyzeRequest)) (*Response, error) { - var r = IndicesAnalyzeRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesAnalyze performs the analysis process on a text and return the tokens breakdown of the text. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-analyze.html. -// -type IndicesAnalyze func(o ...func(*IndicesAnalyzeRequest)) (*Response, error) - -// IndicesAnalyzeRequest configures the Indices Analyze API request. -// -type IndicesAnalyzeRequest struct { - Index string - - Body io.Reader - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesAnalyzeRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len(r.Index) + 1 + len("_analyze")) - if r.Index != "" { - path.WriteString("/") - path.WriteString(r.Index) - } - path.WriteString("/") - path.WriteString("_analyze") - - params = make(map[string]string) - - if r.Index != "" { - params["index"] = r.Index - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesAnalyze) WithContext(v context.Context) func(*IndicesAnalyzeRequest) { - return func(r *IndicesAnalyzeRequest) { - r.ctx = v - } -} - -// WithBody - Define analyzer/tokenizer parameters and the text on which the analysis should be performed. -// -func (f IndicesAnalyze) WithBody(v io.Reader) func(*IndicesAnalyzeRequest) { - return func(r *IndicesAnalyzeRequest) { - r.Body = v - } -} - -// WithIndex - the name of the index to scope the operation. -// -func (f IndicesAnalyze) WithIndex(v string) func(*IndicesAnalyzeRequest) { - return func(r *IndicesAnalyzeRequest) { - r.Index = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesAnalyze) WithPretty() func(*IndicesAnalyzeRequest) { - return func(r *IndicesAnalyzeRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesAnalyze) WithHuman() func(*IndicesAnalyzeRequest) { - return func(r *IndicesAnalyzeRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesAnalyze) WithErrorTrace() func(*IndicesAnalyzeRequest) { - return func(r *IndicesAnalyzeRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesAnalyze) WithFilterPath(v ...string) func(*IndicesAnalyzeRequest) { - return func(r *IndicesAnalyzeRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesAnalyze) WithHeader(h map[string]string) func(*IndicesAnalyzeRequest) { - return func(r *IndicesAnalyzeRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesAnalyze) WithOpaqueID(s string) func(*IndicesAnalyzeRequest) { - return func(r *IndicesAnalyzeRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.clear_cache.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.clear_cache.go deleted file mode 100644 index 1e51ad8ef..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.clear_cache.go +++ /dev/null @@ -1,310 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newIndicesClearCacheFunc(t Transport) IndicesClearCache { - return func(o ...func(*IndicesClearCacheRequest)) (*Response, error) { - var r = IndicesClearCacheRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesClearCache clears all or specific caches for one or more indices. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-clearcache.html. -// -type IndicesClearCache func(o ...func(*IndicesClearCacheRequest)) (*Response, error) - -// IndicesClearCacheRequest configures the Indices Clear Cache API request. -// -type IndicesClearCacheRequest struct { - Index []string - - AllowNoIndices *bool - ExpandWildcards string - Fielddata *bool - Fields []string - IgnoreUnavailable *bool - Query *bool - Request *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesClearCacheRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len(strings.Join(r.Index, ",")) + 1 + len("_cache") + 1 + len("clear")) - if len(r.Index) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Index, ",")) - } - path.WriteString("/") - path.WriteString("_cache") - path.WriteString("/") - path.WriteString("clear") - - params = make(map[string]string) - - if r.AllowNoIndices != nil { - params["allow_no_indices"] = strconv.FormatBool(*r.AllowNoIndices) - } - - if r.ExpandWildcards != "" { - params["expand_wildcards"] = r.ExpandWildcards - } - - if r.Fielddata != nil { - params["fielddata"] = strconv.FormatBool(*r.Fielddata) - } - - if len(r.Fields) > 0 { - params["fields"] = strings.Join(r.Fields, ",") - } - - if r.IgnoreUnavailable != nil { - params["ignore_unavailable"] = strconv.FormatBool(*r.IgnoreUnavailable) - } - - if len(r.Index) > 0 { - params["index"] = strings.Join(r.Index, ",") - } - - if r.Query != nil { - params["query"] = strconv.FormatBool(*r.Query) - } - - if r.Request != nil { - params["request"] = strconv.FormatBool(*r.Request) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesClearCache) WithContext(v context.Context) func(*IndicesClearCacheRequest) { - return func(r *IndicesClearCacheRequest) { - r.ctx = v - } -} - -// WithIndex - a list of index name to limit the operation. -// -func (f IndicesClearCache) WithIndex(v ...string) func(*IndicesClearCacheRequest) { - return func(r *IndicesClearCacheRequest) { - r.Index = v - } -} - -// WithAllowNoIndices - whether to ignore if a wildcard indices expression resolves into no concrete indices. (this includes `_all` string or when no indices have been specified). -// -func (f IndicesClearCache) WithAllowNoIndices(v bool) func(*IndicesClearCacheRequest) { - return func(r *IndicesClearCacheRequest) { - r.AllowNoIndices = &v - } -} - -// WithExpandWildcards - whether to expand wildcard expression to concrete indices that are open, closed or both.. -// -func (f IndicesClearCache) WithExpandWildcards(v string) func(*IndicesClearCacheRequest) { - return func(r *IndicesClearCacheRequest) { - r.ExpandWildcards = v - } -} - -// WithFielddata - clear field data. -// -func (f IndicesClearCache) WithFielddata(v bool) func(*IndicesClearCacheRequest) { - return func(r *IndicesClearCacheRequest) { - r.Fielddata = &v - } -} - -// WithFields - a list of fields to clear when using the `fielddata` parameter (default: all). -// -func (f IndicesClearCache) WithFields(v ...string) func(*IndicesClearCacheRequest) { - return func(r *IndicesClearCacheRequest) { - r.Fields = v - } -} - -// WithIgnoreUnavailable - whether specified concrete indices should be ignored when unavailable (missing or closed). -// -func (f IndicesClearCache) WithIgnoreUnavailable(v bool) func(*IndicesClearCacheRequest) { - return func(r *IndicesClearCacheRequest) { - r.IgnoreUnavailable = &v - } -} - -// WithQuery - clear query caches. -// -func (f IndicesClearCache) WithQuery(v bool) func(*IndicesClearCacheRequest) { - return func(r *IndicesClearCacheRequest) { - r.Query = &v - } -} - -// WithRequest - clear request cache. -// -func (f IndicesClearCache) WithRequest(v bool) func(*IndicesClearCacheRequest) { - return func(r *IndicesClearCacheRequest) { - r.Request = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesClearCache) WithPretty() func(*IndicesClearCacheRequest) { - return func(r *IndicesClearCacheRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesClearCache) WithHuman() func(*IndicesClearCacheRequest) { - return func(r *IndicesClearCacheRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesClearCache) WithErrorTrace() func(*IndicesClearCacheRequest) { - return func(r *IndicesClearCacheRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesClearCache) WithFilterPath(v ...string) func(*IndicesClearCacheRequest) { - return func(r *IndicesClearCacheRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesClearCache) WithHeader(h map[string]string) func(*IndicesClearCacheRequest) { - return func(r *IndicesClearCacheRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesClearCache) WithOpaqueID(s string) func(*IndicesClearCacheRequest) { - return func(r *IndicesClearCacheRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.clone.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.clone.go deleted file mode 100644 index 97d0cb16a..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.clone.go +++ /dev/null @@ -1,261 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" - "time" -) - -func newIndicesCloneFunc(t Transport) IndicesClone { - return func(index string, target string, o ...func(*IndicesCloneRequest)) (*Response, error) { - var r = IndicesCloneRequest{Index: index, Target: target} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesClone clones an index -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-clone-index.html. -// -type IndicesClone func(index string, target string, o ...func(*IndicesCloneRequest)) (*Response, error) - -// IndicesCloneRequest configures the Indices Clone API request. -// -type IndicesCloneRequest struct { - Index string - - Body io.Reader - - Target string - - MasterTimeout time.Duration - Timeout time.Duration - WaitForActiveShards string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesCloneRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - path.Grow(1 + len(r.Index) + 1 + len("_clone") + 1 + len(r.Target)) - path.WriteString("/") - path.WriteString(r.Index) - path.WriteString("/") - path.WriteString("_clone") - path.WriteString("/") - path.WriteString(r.Target) - - params = make(map[string]string) - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.WaitForActiveShards != "" { - params["wait_for_active_shards"] = r.WaitForActiveShards - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesClone) WithContext(v context.Context) func(*IndicesCloneRequest) { - return func(r *IndicesCloneRequest) { - r.ctx = v - } -} - -// WithBody - The configuration for the target index (`settings` and `aliases`). -// -func (f IndicesClone) WithBody(v io.Reader) func(*IndicesCloneRequest) { - return func(r *IndicesCloneRequest) { - r.Body = v - } -} - -// WithMasterTimeout - specify timeout for connection to master. -// -func (f IndicesClone) WithMasterTimeout(v time.Duration) func(*IndicesCloneRequest) { - return func(r *IndicesCloneRequest) { - r.MasterTimeout = v - } -} - -// WithTimeout - explicit operation timeout. -// -func (f IndicesClone) WithTimeout(v time.Duration) func(*IndicesCloneRequest) { - return func(r *IndicesCloneRequest) { - r.Timeout = v - } -} - -// WithWaitForActiveShards - set the number of active shards to wait for on the cloned index before the operation returns.. -// -func (f IndicesClone) WithWaitForActiveShards(v string) func(*IndicesCloneRequest) { - return func(r *IndicesCloneRequest) { - r.WaitForActiveShards = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesClone) WithPretty() func(*IndicesCloneRequest) { - return func(r *IndicesCloneRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesClone) WithHuman() func(*IndicesCloneRequest) { - return func(r *IndicesCloneRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesClone) WithErrorTrace() func(*IndicesCloneRequest) { - return func(r *IndicesCloneRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesClone) WithFilterPath(v ...string) func(*IndicesCloneRequest) { - return func(r *IndicesCloneRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesClone) WithHeader(h map[string]string) func(*IndicesCloneRequest) { - return func(r *IndicesCloneRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesClone) WithOpaqueID(s string) func(*IndicesCloneRequest) { - return func(r *IndicesCloneRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.close.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.close.go deleted file mode 100644 index 664aae20f..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.close.go +++ /dev/null @@ -1,282 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" - "time" -) - -func newIndicesCloseFunc(t Transport) IndicesClose { - return func(index []string, o ...func(*IndicesCloseRequest)) (*Response, error) { - var r = IndicesCloseRequest{Index: index} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesClose closes an index. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-open-close.html. -// -type IndicesClose func(index []string, o ...func(*IndicesCloseRequest)) (*Response, error) - -// IndicesCloseRequest configures the Indices Close API request. -// -type IndicesCloseRequest struct { - Index []string - - AllowNoIndices *bool - ExpandWildcards string - IgnoreUnavailable *bool - MasterTimeout time.Duration - Timeout time.Duration - WaitForActiveShards string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesCloseRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len(strings.Join(r.Index, ",")) + 1 + len("_close")) - path.WriteString("/") - path.WriteString(strings.Join(r.Index, ",")) - path.WriteString("/") - path.WriteString("_close") - - params = make(map[string]string) - - if r.AllowNoIndices != nil { - params["allow_no_indices"] = strconv.FormatBool(*r.AllowNoIndices) - } - - if r.ExpandWildcards != "" { - params["expand_wildcards"] = r.ExpandWildcards - } - - if r.IgnoreUnavailable != nil { - params["ignore_unavailable"] = strconv.FormatBool(*r.IgnoreUnavailable) - } - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.WaitForActiveShards != "" { - params["wait_for_active_shards"] = r.WaitForActiveShards - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesClose) WithContext(v context.Context) func(*IndicesCloseRequest) { - return func(r *IndicesCloseRequest) { - r.ctx = v - } -} - -// WithAllowNoIndices - whether to ignore if a wildcard indices expression resolves into no concrete indices. (this includes `_all` string or when no indices have been specified). -// -func (f IndicesClose) WithAllowNoIndices(v bool) func(*IndicesCloseRequest) { - return func(r *IndicesCloseRequest) { - r.AllowNoIndices = &v - } -} - -// WithExpandWildcards - whether to expand wildcard expression to concrete indices that are open, closed or both.. -// -func (f IndicesClose) WithExpandWildcards(v string) func(*IndicesCloseRequest) { - return func(r *IndicesCloseRequest) { - r.ExpandWildcards = v - } -} - -// WithIgnoreUnavailable - whether specified concrete indices should be ignored when unavailable (missing or closed). -// -func (f IndicesClose) WithIgnoreUnavailable(v bool) func(*IndicesCloseRequest) { - return func(r *IndicesCloseRequest) { - r.IgnoreUnavailable = &v - } -} - -// WithMasterTimeout - specify timeout for connection to master. -// -func (f IndicesClose) WithMasterTimeout(v time.Duration) func(*IndicesCloseRequest) { - return func(r *IndicesCloseRequest) { - r.MasterTimeout = v - } -} - -// WithTimeout - explicit operation timeout. -// -func (f IndicesClose) WithTimeout(v time.Duration) func(*IndicesCloseRequest) { - return func(r *IndicesCloseRequest) { - r.Timeout = v - } -} - -// WithWaitForActiveShards - sets the number of active shards to wait for before the operation returns. set to `index-setting` to wait according to the index setting `index.write.wait_for_active_shards`, or `all` to wait for all shards, or an integer. defaults to `0`.. -// -func (f IndicesClose) WithWaitForActiveShards(v string) func(*IndicesCloseRequest) { - return func(r *IndicesCloseRequest) { - r.WaitForActiveShards = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesClose) WithPretty() func(*IndicesCloseRequest) { - return func(r *IndicesCloseRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesClose) WithHuman() func(*IndicesCloseRequest) { - return func(r *IndicesCloseRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesClose) WithErrorTrace() func(*IndicesCloseRequest) { - return func(r *IndicesCloseRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesClose) WithFilterPath(v ...string) func(*IndicesCloseRequest) { - return func(r *IndicesCloseRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesClose) WithHeader(h map[string]string) func(*IndicesCloseRequest) { - return func(r *IndicesCloseRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesClose) WithOpaqueID(s string) func(*IndicesCloseRequest) { - return func(r *IndicesCloseRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.create.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.create.go deleted file mode 100644 index 700944b15..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.create.go +++ /dev/null @@ -1,269 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" - "time" -) - -func newIndicesCreateFunc(t Transport) IndicesCreate { - return func(index string, o ...func(*IndicesCreateRequest)) (*Response, error) { - var r = IndicesCreateRequest{Index: index} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesCreate creates an index with optional settings and mappings. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-create-index.html. -// -type IndicesCreate func(index string, o ...func(*IndicesCreateRequest)) (*Response, error) - -// IndicesCreateRequest configures the Indices Create API request. -// -type IndicesCreateRequest struct { - Index string - - Body io.Reader - - IncludeTypeName *bool - MasterTimeout time.Duration - Timeout time.Duration - WaitForActiveShards string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesCreateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - path.Grow(1 + len(r.Index)) - path.WriteString("/") - path.WriteString(r.Index) - - params = make(map[string]string) - - if r.IncludeTypeName != nil { - params["include_type_name"] = strconv.FormatBool(*r.IncludeTypeName) - } - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.WaitForActiveShards != "" { - params["wait_for_active_shards"] = r.WaitForActiveShards - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesCreate) WithContext(v context.Context) func(*IndicesCreateRequest) { - return func(r *IndicesCreateRequest) { - r.ctx = v - } -} - -// WithBody - The configuration for the index (`settings` and `mappings`). -// -func (f IndicesCreate) WithBody(v io.Reader) func(*IndicesCreateRequest) { - return func(r *IndicesCreateRequest) { - r.Body = v - } -} - -// WithIncludeTypeName - whether a type should be expected in the body of the mappings.. -// -func (f IndicesCreate) WithIncludeTypeName(v bool) func(*IndicesCreateRequest) { - return func(r *IndicesCreateRequest) { - r.IncludeTypeName = &v - } -} - -// WithMasterTimeout - specify timeout for connection to master. -// -func (f IndicesCreate) WithMasterTimeout(v time.Duration) func(*IndicesCreateRequest) { - return func(r *IndicesCreateRequest) { - r.MasterTimeout = v - } -} - -// WithTimeout - explicit operation timeout. -// -func (f IndicesCreate) WithTimeout(v time.Duration) func(*IndicesCreateRequest) { - return func(r *IndicesCreateRequest) { - r.Timeout = v - } -} - -// WithWaitForActiveShards - set the number of active shards to wait for before the operation returns.. -// -func (f IndicesCreate) WithWaitForActiveShards(v string) func(*IndicesCreateRequest) { - return func(r *IndicesCreateRequest) { - r.WaitForActiveShards = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesCreate) WithPretty() func(*IndicesCreateRequest) { - return func(r *IndicesCreateRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesCreate) WithHuman() func(*IndicesCreateRequest) { - return func(r *IndicesCreateRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesCreate) WithErrorTrace() func(*IndicesCreateRequest) { - return func(r *IndicesCreateRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesCreate) WithFilterPath(v ...string) func(*IndicesCreateRequest) { - return func(r *IndicesCreateRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesCreate) WithHeader(h map[string]string) func(*IndicesCreateRequest) { - return func(r *IndicesCreateRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesCreate) WithOpaqueID(s string) func(*IndicesCreateRequest) { - return func(r *IndicesCreateRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.delete.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.delete.go deleted file mode 100644 index 42d1f1808..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.delete.go +++ /dev/null @@ -1,267 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" - "time" -) - -func newIndicesDeleteFunc(t Transport) IndicesDelete { - return func(index []string, o ...func(*IndicesDeleteRequest)) (*Response, error) { - var r = IndicesDeleteRequest{Index: index} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesDelete deletes an index. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-delete-index.html. -// -type IndicesDelete func(index []string, o ...func(*IndicesDeleteRequest)) (*Response, error) - -// IndicesDeleteRequest configures the Indices Delete API request. -// -type IndicesDeleteRequest struct { - Index []string - - AllowNoIndices *bool - ExpandWildcards string - IgnoreUnavailable *bool - MasterTimeout time.Duration - Timeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesDeleteRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "DELETE" - - path.Grow(1 + len(strings.Join(r.Index, ","))) - path.WriteString("/") - path.WriteString(strings.Join(r.Index, ",")) - - params = make(map[string]string) - - if r.AllowNoIndices != nil { - params["allow_no_indices"] = strconv.FormatBool(*r.AllowNoIndices) - } - - if r.ExpandWildcards != "" { - params["expand_wildcards"] = r.ExpandWildcards - } - - if r.IgnoreUnavailable != nil { - params["ignore_unavailable"] = strconv.FormatBool(*r.IgnoreUnavailable) - } - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesDelete) WithContext(v context.Context) func(*IndicesDeleteRequest) { - return func(r *IndicesDeleteRequest) { - r.ctx = v - } -} - -// WithAllowNoIndices - ignore if a wildcard expression resolves to no concrete indices (default: false). -// -func (f IndicesDelete) WithAllowNoIndices(v bool) func(*IndicesDeleteRequest) { - return func(r *IndicesDeleteRequest) { - r.AllowNoIndices = &v - } -} - -// WithExpandWildcards - whether wildcard expressions should get expanded to open or closed indices (default: open). -// -func (f IndicesDelete) WithExpandWildcards(v string) func(*IndicesDeleteRequest) { - return func(r *IndicesDeleteRequest) { - r.ExpandWildcards = v - } -} - -// WithIgnoreUnavailable - ignore unavailable indexes (default: false). -// -func (f IndicesDelete) WithIgnoreUnavailable(v bool) func(*IndicesDeleteRequest) { - return func(r *IndicesDeleteRequest) { - r.IgnoreUnavailable = &v - } -} - -// WithMasterTimeout - specify timeout for connection to master. -// -func (f IndicesDelete) WithMasterTimeout(v time.Duration) func(*IndicesDeleteRequest) { - return func(r *IndicesDeleteRequest) { - r.MasterTimeout = v - } -} - -// WithTimeout - explicit operation timeout. -// -func (f IndicesDelete) WithTimeout(v time.Duration) func(*IndicesDeleteRequest) { - return func(r *IndicesDeleteRequest) { - r.Timeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesDelete) WithPretty() func(*IndicesDeleteRequest) { - return func(r *IndicesDeleteRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesDelete) WithHuman() func(*IndicesDeleteRequest) { - return func(r *IndicesDeleteRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesDelete) WithErrorTrace() func(*IndicesDeleteRequest) { - return func(r *IndicesDeleteRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesDelete) WithFilterPath(v ...string) func(*IndicesDeleteRequest) { - return func(r *IndicesDeleteRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesDelete) WithHeader(h map[string]string) func(*IndicesDeleteRequest) { - return func(r *IndicesDeleteRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesDelete) WithOpaqueID(s string) func(*IndicesDeleteRequest) { - return func(r *IndicesDeleteRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.delete_alias.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.delete_alias.go deleted file mode 100644 index 1f51f2baf..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.delete_alias.go +++ /dev/null @@ -1,233 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" - "time" -) - -func newIndicesDeleteAliasFunc(t Transport) IndicesDeleteAlias { - return func(index []string, name []string, o ...func(*IndicesDeleteAliasRequest)) (*Response, error) { - var r = IndicesDeleteAliasRequest{Index: index, Name: name} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesDeleteAlias deletes an alias. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html. -// -type IndicesDeleteAlias func(index []string, name []string, o ...func(*IndicesDeleteAliasRequest)) (*Response, error) - -// IndicesDeleteAliasRequest configures the Indices Delete Alias API request. -// -type IndicesDeleteAliasRequest struct { - Index []string - - Name []string - - MasterTimeout time.Duration - Timeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesDeleteAliasRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "DELETE" - - path.Grow(1 + len(strings.Join(r.Index, ",")) + 1 + len("_aliases") + 1 + len(strings.Join(r.Name, ","))) - path.WriteString("/") - path.WriteString(strings.Join(r.Index, ",")) - path.WriteString("/") - path.WriteString("_aliases") - path.WriteString("/") - path.WriteString(strings.Join(r.Name, ",")) - - params = make(map[string]string) - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesDeleteAlias) WithContext(v context.Context) func(*IndicesDeleteAliasRequest) { - return func(r *IndicesDeleteAliasRequest) { - r.ctx = v - } -} - -// WithMasterTimeout - specify timeout for connection to master. -// -func (f IndicesDeleteAlias) WithMasterTimeout(v time.Duration) func(*IndicesDeleteAliasRequest) { - return func(r *IndicesDeleteAliasRequest) { - r.MasterTimeout = v - } -} - -// WithTimeout - explicit timestamp for the document. -// -func (f IndicesDeleteAlias) WithTimeout(v time.Duration) func(*IndicesDeleteAliasRequest) { - return func(r *IndicesDeleteAliasRequest) { - r.Timeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesDeleteAlias) WithPretty() func(*IndicesDeleteAliasRequest) { - return func(r *IndicesDeleteAliasRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesDeleteAlias) WithHuman() func(*IndicesDeleteAliasRequest) { - return func(r *IndicesDeleteAliasRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesDeleteAlias) WithErrorTrace() func(*IndicesDeleteAliasRequest) { - return func(r *IndicesDeleteAliasRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesDeleteAlias) WithFilterPath(v ...string) func(*IndicesDeleteAliasRequest) { - return func(r *IndicesDeleteAliasRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesDeleteAlias) WithHeader(h map[string]string) func(*IndicesDeleteAliasRequest) { - return func(r *IndicesDeleteAliasRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesDeleteAlias) WithOpaqueID(s string) func(*IndicesDeleteAliasRequest) { - return func(r *IndicesDeleteAliasRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.delete_index_template.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.delete_index_template.go deleted file mode 100644 index 987ef420f..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.delete_index_template.go +++ /dev/null @@ -1,229 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" - "time" -) - -func newIndicesDeleteIndexTemplateFunc(t Transport) IndicesDeleteIndexTemplate { - return func(name string, o ...func(*IndicesDeleteIndexTemplateRequest)) (*Response, error) { - var r = IndicesDeleteIndexTemplateRequest{Name: name} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesDeleteIndexTemplate deletes an index template. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html. -// -type IndicesDeleteIndexTemplate func(name string, o ...func(*IndicesDeleteIndexTemplateRequest)) (*Response, error) - -// IndicesDeleteIndexTemplateRequest configures the Indices Delete Index Template API request. -// -type IndicesDeleteIndexTemplateRequest struct { - Name string - - MasterTimeout time.Duration - Timeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesDeleteIndexTemplateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "DELETE" - - path.Grow(1 + len("_index_template") + 1 + len(r.Name)) - path.WriteString("/") - path.WriteString("_index_template") - path.WriteString("/") - path.WriteString(r.Name) - - params = make(map[string]string) - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesDeleteIndexTemplate) WithContext(v context.Context) func(*IndicesDeleteIndexTemplateRequest) { - return func(r *IndicesDeleteIndexTemplateRequest) { - r.ctx = v - } -} - -// WithMasterTimeout - specify timeout for connection to master. -// -func (f IndicesDeleteIndexTemplate) WithMasterTimeout(v time.Duration) func(*IndicesDeleteIndexTemplateRequest) { - return func(r *IndicesDeleteIndexTemplateRequest) { - r.MasterTimeout = v - } -} - -// WithTimeout - explicit operation timeout. -// -func (f IndicesDeleteIndexTemplate) WithTimeout(v time.Duration) func(*IndicesDeleteIndexTemplateRequest) { - return func(r *IndicesDeleteIndexTemplateRequest) { - r.Timeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesDeleteIndexTemplate) WithPretty() func(*IndicesDeleteIndexTemplateRequest) { - return func(r *IndicesDeleteIndexTemplateRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesDeleteIndexTemplate) WithHuman() func(*IndicesDeleteIndexTemplateRequest) { - return func(r *IndicesDeleteIndexTemplateRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesDeleteIndexTemplate) WithErrorTrace() func(*IndicesDeleteIndexTemplateRequest) { - return func(r *IndicesDeleteIndexTemplateRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesDeleteIndexTemplate) WithFilterPath(v ...string) func(*IndicesDeleteIndexTemplateRequest) { - return func(r *IndicesDeleteIndexTemplateRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesDeleteIndexTemplate) WithHeader(h map[string]string) func(*IndicesDeleteIndexTemplateRequest) { - return func(r *IndicesDeleteIndexTemplateRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesDeleteIndexTemplate) WithOpaqueID(s string) func(*IndicesDeleteIndexTemplateRequest) { - return func(r *IndicesDeleteIndexTemplateRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.delete_template.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.delete_template.go deleted file mode 100644 index 71ec4836b..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.delete_template.go +++ /dev/null @@ -1,229 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" - "time" -) - -func newIndicesDeleteTemplateFunc(t Transport) IndicesDeleteTemplate { - return func(name string, o ...func(*IndicesDeleteTemplateRequest)) (*Response, error) { - var r = IndicesDeleteTemplateRequest{Name: name} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesDeleteTemplate deletes an index template. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html. -// -type IndicesDeleteTemplate func(name string, o ...func(*IndicesDeleteTemplateRequest)) (*Response, error) - -// IndicesDeleteTemplateRequest configures the Indices Delete Template API request. -// -type IndicesDeleteTemplateRequest struct { - Name string - - MasterTimeout time.Duration - Timeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesDeleteTemplateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "DELETE" - - path.Grow(1 + len("_template") + 1 + len(r.Name)) - path.WriteString("/") - path.WriteString("_template") - path.WriteString("/") - path.WriteString(r.Name) - - params = make(map[string]string) - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesDeleteTemplate) WithContext(v context.Context) func(*IndicesDeleteTemplateRequest) { - return func(r *IndicesDeleteTemplateRequest) { - r.ctx = v - } -} - -// WithMasterTimeout - specify timeout for connection to master. -// -func (f IndicesDeleteTemplate) WithMasterTimeout(v time.Duration) func(*IndicesDeleteTemplateRequest) { - return func(r *IndicesDeleteTemplateRequest) { - r.MasterTimeout = v - } -} - -// WithTimeout - explicit operation timeout. -// -func (f IndicesDeleteTemplate) WithTimeout(v time.Duration) func(*IndicesDeleteTemplateRequest) { - return func(r *IndicesDeleteTemplateRequest) { - r.Timeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesDeleteTemplate) WithPretty() func(*IndicesDeleteTemplateRequest) { - return func(r *IndicesDeleteTemplateRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesDeleteTemplate) WithHuman() func(*IndicesDeleteTemplateRequest) { - return func(r *IndicesDeleteTemplateRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesDeleteTemplate) WithErrorTrace() func(*IndicesDeleteTemplateRequest) { - return func(r *IndicesDeleteTemplateRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesDeleteTemplate) WithFilterPath(v ...string) func(*IndicesDeleteTemplateRequest) { - return func(r *IndicesDeleteTemplateRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesDeleteTemplate) WithHeader(h map[string]string) func(*IndicesDeleteTemplateRequest) { - return func(r *IndicesDeleteTemplateRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesDeleteTemplate) WithOpaqueID(s string) func(*IndicesDeleteTemplateRequest) { - return func(r *IndicesDeleteTemplateRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.exists.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.exists.go deleted file mode 100644 index 8189c453f..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.exists.go +++ /dev/null @@ -1,279 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newIndicesExistsFunc(t Transport) IndicesExists { - return func(index []string, o ...func(*IndicesExistsRequest)) (*Response, error) { - var r = IndicesExistsRequest{Index: index} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesExists returns information about whether a particular index exists. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-exists.html. -// -type IndicesExists func(index []string, o ...func(*IndicesExistsRequest)) (*Response, error) - -// IndicesExistsRequest configures the Indices Exists API request. -// -type IndicesExistsRequest struct { - Index []string - - AllowNoIndices *bool - ExpandWildcards string - FlatSettings *bool - IgnoreUnavailable *bool - IncludeDefaults *bool - Local *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesExistsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "HEAD" - - path.Grow(1 + len(strings.Join(r.Index, ","))) - path.WriteString("/") - path.WriteString(strings.Join(r.Index, ",")) - - params = make(map[string]string) - - if r.AllowNoIndices != nil { - params["allow_no_indices"] = strconv.FormatBool(*r.AllowNoIndices) - } - - if r.ExpandWildcards != "" { - params["expand_wildcards"] = r.ExpandWildcards - } - - if r.FlatSettings != nil { - params["flat_settings"] = strconv.FormatBool(*r.FlatSettings) - } - - if r.IgnoreUnavailable != nil { - params["ignore_unavailable"] = strconv.FormatBool(*r.IgnoreUnavailable) - } - - if r.IncludeDefaults != nil { - params["include_defaults"] = strconv.FormatBool(*r.IncludeDefaults) - } - - if r.Local != nil { - params["local"] = strconv.FormatBool(*r.Local) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesExists) WithContext(v context.Context) func(*IndicesExistsRequest) { - return func(r *IndicesExistsRequest) { - r.ctx = v - } -} - -// WithAllowNoIndices - ignore if a wildcard expression resolves to no concrete indices (default: false). -// -func (f IndicesExists) WithAllowNoIndices(v bool) func(*IndicesExistsRequest) { - return func(r *IndicesExistsRequest) { - r.AllowNoIndices = &v - } -} - -// WithExpandWildcards - whether wildcard expressions should get expanded to open or closed indices (default: open). -// -func (f IndicesExists) WithExpandWildcards(v string) func(*IndicesExistsRequest) { - return func(r *IndicesExistsRequest) { - r.ExpandWildcards = v - } -} - -// WithFlatSettings - return settings in flat format (default: false). -// -func (f IndicesExists) WithFlatSettings(v bool) func(*IndicesExistsRequest) { - return func(r *IndicesExistsRequest) { - r.FlatSettings = &v - } -} - -// WithIgnoreUnavailable - ignore unavailable indexes (default: false). -// -func (f IndicesExists) WithIgnoreUnavailable(v bool) func(*IndicesExistsRequest) { - return func(r *IndicesExistsRequest) { - r.IgnoreUnavailable = &v - } -} - -// WithIncludeDefaults - whether to return all default setting for each of the indices.. -// -func (f IndicesExists) WithIncludeDefaults(v bool) func(*IndicesExistsRequest) { - return func(r *IndicesExistsRequest) { - r.IncludeDefaults = &v - } -} - -// WithLocal - return local information, do not retrieve the state from master node (default: false). -// -func (f IndicesExists) WithLocal(v bool) func(*IndicesExistsRequest) { - return func(r *IndicesExistsRequest) { - r.Local = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesExists) WithPretty() func(*IndicesExistsRequest) { - return func(r *IndicesExistsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesExists) WithHuman() func(*IndicesExistsRequest) { - return func(r *IndicesExistsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesExists) WithErrorTrace() func(*IndicesExistsRequest) { - return func(r *IndicesExistsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesExists) WithFilterPath(v ...string) func(*IndicesExistsRequest) { - return func(r *IndicesExistsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesExists) WithHeader(h map[string]string) func(*IndicesExistsRequest) { - return func(r *IndicesExistsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesExists) WithOpaqueID(s string) func(*IndicesExistsRequest) { - return func(r *IndicesExistsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.exists_alias.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.exists_alias.go deleted file mode 100644 index 622f42150..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.exists_alias.go +++ /dev/null @@ -1,269 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newIndicesExistsAliasFunc(t Transport) IndicesExistsAlias { - return func(name []string, o ...func(*IndicesExistsAliasRequest)) (*Response, error) { - var r = IndicesExistsAliasRequest{Name: name} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesExistsAlias returns information about whether a particular alias exists. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html. -// -type IndicesExistsAlias func(name []string, o ...func(*IndicesExistsAliasRequest)) (*Response, error) - -// IndicesExistsAliasRequest configures the Indices Exists Alias API request. -// -type IndicesExistsAliasRequest struct { - Index []string - - Name []string - - AllowNoIndices *bool - ExpandWildcards string - IgnoreUnavailable *bool - Local *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesExistsAliasRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "HEAD" - - path.Grow(1 + len(strings.Join(r.Index, ",")) + 1 + len("_alias") + 1 + len(strings.Join(r.Name, ","))) - if len(r.Index) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Index, ",")) - } - path.WriteString("/") - path.WriteString("_alias") - path.WriteString("/") - path.WriteString(strings.Join(r.Name, ",")) - - params = make(map[string]string) - - if r.AllowNoIndices != nil { - params["allow_no_indices"] = strconv.FormatBool(*r.AllowNoIndices) - } - - if r.ExpandWildcards != "" { - params["expand_wildcards"] = r.ExpandWildcards - } - - if r.IgnoreUnavailable != nil { - params["ignore_unavailable"] = strconv.FormatBool(*r.IgnoreUnavailable) - } - - if r.Local != nil { - params["local"] = strconv.FormatBool(*r.Local) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesExistsAlias) WithContext(v context.Context) func(*IndicesExistsAliasRequest) { - return func(r *IndicesExistsAliasRequest) { - r.ctx = v - } -} - -// WithIndex - a list of index names to filter aliases. -// -func (f IndicesExistsAlias) WithIndex(v ...string) func(*IndicesExistsAliasRequest) { - return func(r *IndicesExistsAliasRequest) { - r.Index = v - } -} - -// WithAllowNoIndices - whether to ignore if a wildcard indices expression resolves into no concrete indices. (this includes `_all` string or when no indices have been specified). -// -func (f IndicesExistsAlias) WithAllowNoIndices(v bool) func(*IndicesExistsAliasRequest) { - return func(r *IndicesExistsAliasRequest) { - r.AllowNoIndices = &v - } -} - -// WithExpandWildcards - whether to expand wildcard expression to concrete indices that are open, closed or both.. -// -func (f IndicesExistsAlias) WithExpandWildcards(v string) func(*IndicesExistsAliasRequest) { - return func(r *IndicesExistsAliasRequest) { - r.ExpandWildcards = v - } -} - -// WithIgnoreUnavailable - whether specified concrete indices should be ignored when unavailable (missing or closed). -// -func (f IndicesExistsAlias) WithIgnoreUnavailable(v bool) func(*IndicesExistsAliasRequest) { - return func(r *IndicesExistsAliasRequest) { - r.IgnoreUnavailable = &v - } -} - -// WithLocal - return local information, do not retrieve the state from master node (default: false). -// -func (f IndicesExistsAlias) WithLocal(v bool) func(*IndicesExistsAliasRequest) { - return func(r *IndicesExistsAliasRequest) { - r.Local = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesExistsAlias) WithPretty() func(*IndicesExistsAliasRequest) { - return func(r *IndicesExistsAliasRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesExistsAlias) WithHuman() func(*IndicesExistsAliasRequest) { - return func(r *IndicesExistsAliasRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesExistsAlias) WithErrorTrace() func(*IndicesExistsAliasRequest) { - return func(r *IndicesExistsAliasRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesExistsAlias) WithFilterPath(v ...string) func(*IndicesExistsAliasRequest) { - return func(r *IndicesExistsAliasRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesExistsAlias) WithHeader(h map[string]string) func(*IndicesExistsAliasRequest) { - return func(r *IndicesExistsAliasRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesExistsAlias) WithOpaqueID(s string) func(*IndicesExistsAliasRequest) { - return func(r *IndicesExistsAliasRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.exists_index_template.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.exists_index_template.go deleted file mode 100644 index f62900ee1..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.exists_index_template.go +++ /dev/null @@ -1,243 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" - "time" -) - -func newIndicesExistsIndexTemplateFunc(t Transport) IndicesExistsIndexTemplate { - return func(name string, o ...func(*IndicesExistsIndexTemplateRequest)) (*Response, error) { - var r = IndicesExistsIndexTemplateRequest{Name: name} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesExistsIndexTemplate returns information about whether a particular index template exists. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html. -// -type IndicesExistsIndexTemplate func(name string, o ...func(*IndicesExistsIndexTemplateRequest)) (*Response, error) - -// IndicesExistsIndexTemplateRequest configures the Indices Exists Index Template API request. -// -type IndicesExistsIndexTemplateRequest struct { - Name string - - FlatSettings *bool - Local *bool - MasterTimeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesExistsIndexTemplateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "HEAD" - - path.Grow(1 + len("_index_template") + 1 + len(r.Name)) - path.WriteString("/") - path.WriteString("_index_template") - path.WriteString("/") - path.WriteString(r.Name) - - params = make(map[string]string) - - if r.FlatSettings != nil { - params["flat_settings"] = strconv.FormatBool(*r.FlatSettings) - } - - if r.Local != nil { - params["local"] = strconv.FormatBool(*r.Local) - } - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesExistsIndexTemplate) WithContext(v context.Context) func(*IndicesExistsIndexTemplateRequest) { - return func(r *IndicesExistsIndexTemplateRequest) { - r.ctx = v - } -} - -// WithFlatSettings - return settings in flat format (default: false). -// -func (f IndicesExistsIndexTemplate) WithFlatSettings(v bool) func(*IndicesExistsIndexTemplateRequest) { - return func(r *IndicesExistsIndexTemplateRequest) { - r.FlatSettings = &v - } -} - -// WithLocal - return local information, do not retrieve the state from master node (default: false). -// -func (f IndicesExistsIndexTemplate) WithLocal(v bool) func(*IndicesExistsIndexTemplateRequest) { - return func(r *IndicesExistsIndexTemplateRequest) { - r.Local = &v - } -} - -// WithMasterTimeout - explicit operation timeout for connection to master node. -// -func (f IndicesExistsIndexTemplate) WithMasterTimeout(v time.Duration) func(*IndicesExistsIndexTemplateRequest) { - return func(r *IndicesExistsIndexTemplateRequest) { - r.MasterTimeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesExistsIndexTemplate) WithPretty() func(*IndicesExistsIndexTemplateRequest) { - return func(r *IndicesExistsIndexTemplateRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesExistsIndexTemplate) WithHuman() func(*IndicesExistsIndexTemplateRequest) { - return func(r *IndicesExistsIndexTemplateRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesExistsIndexTemplate) WithErrorTrace() func(*IndicesExistsIndexTemplateRequest) { - return func(r *IndicesExistsIndexTemplateRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesExistsIndexTemplate) WithFilterPath(v ...string) func(*IndicesExistsIndexTemplateRequest) { - return func(r *IndicesExistsIndexTemplateRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesExistsIndexTemplate) WithHeader(h map[string]string) func(*IndicesExistsIndexTemplateRequest) { - return func(r *IndicesExistsIndexTemplateRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesExistsIndexTemplate) WithOpaqueID(s string) func(*IndicesExistsIndexTemplateRequest) { - return func(r *IndicesExistsIndexTemplateRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.exists_template.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.exists_template.go deleted file mode 100644 index f1706e026..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.exists_template.go +++ /dev/null @@ -1,243 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" - "time" -) - -func newIndicesExistsTemplateFunc(t Transport) IndicesExistsTemplate { - return func(name []string, o ...func(*IndicesExistsTemplateRequest)) (*Response, error) { - var r = IndicesExistsTemplateRequest{Name: name} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesExistsTemplate returns information about whether a particular index template exists. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html. -// -type IndicesExistsTemplate func(name []string, o ...func(*IndicesExistsTemplateRequest)) (*Response, error) - -// IndicesExistsTemplateRequest configures the Indices Exists Template API request. -// -type IndicesExistsTemplateRequest struct { - Name []string - - FlatSettings *bool - Local *bool - MasterTimeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesExistsTemplateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "HEAD" - - path.Grow(1 + len("_template") + 1 + len(strings.Join(r.Name, ","))) - path.WriteString("/") - path.WriteString("_template") - path.WriteString("/") - path.WriteString(strings.Join(r.Name, ",")) - - params = make(map[string]string) - - if r.FlatSettings != nil { - params["flat_settings"] = strconv.FormatBool(*r.FlatSettings) - } - - if r.Local != nil { - params["local"] = strconv.FormatBool(*r.Local) - } - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesExistsTemplate) WithContext(v context.Context) func(*IndicesExistsTemplateRequest) { - return func(r *IndicesExistsTemplateRequest) { - r.ctx = v - } -} - -// WithFlatSettings - return settings in flat format (default: false). -// -func (f IndicesExistsTemplate) WithFlatSettings(v bool) func(*IndicesExistsTemplateRequest) { - return func(r *IndicesExistsTemplateRequest) { - r.FlatSettings = &v - } -} - -// WithLocal - return local information, do not retrieve the state from master node (default: false). -// -func (f IndicesExistsTemplate) WithLocal(v bool) func(*IndicesExistsTemplateRequest) { - return func(r *IndicesExistsTemplateRequest) { - r.Local = &v - } -} - -// WithMasterTimeout - explicit operation timeout for connection to master node. -// -func (f IndicesExistsTemplate) WithMasterTimeout(v time.Duration) func(*IndicesExistsTemplateRequest) { - return func(r *IndicesExistsTemplateRequest) { - r.MasterTimeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesExistsTemplate) WithPretty() func(*IndicesExistsTemplateRequest) { - return func(r *IndicesExistsTemplateRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesExistsTemplate) WithHuman() func(*IndicesExistsTemplateRequest) { - return func(r *IndicesExistsTemplateRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesExistsTemplate) WithErrorTrace() func(*IndicesExistsTemplateRequest) { - return func(r *IndicesExistsTemplateRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesExistsTemplate) WithFilterPath(v ...string) func(*IndicesExistsTemplateRequest) { - return func(r *IndicesExistsTemplateRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesExistsTemplate) WithHeader(h map[string]string) func(*IndicesExistsTemplateRequest) { - return func(r *IndicesExistsTemplateRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesExistsTemplate) WithOpaqueID(s string) func(*IndicesExistsTemplateRequest) { - return func(r *IndicesExistsTemplateRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.exists_type.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.exists_type.go deleted file mode 100644 index 4762cad92..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.exists_type.go +++ /dev/null @@ -1,266 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newIndicesExistsDocumentTypeFunc(t Transport) IndicesExistsDocumentType { - return func(index []string, o ...func(*IndicesExistsDocumentTypeRequest)) (*Response, error) { - var r = IndicesExistsDocumentTypeRequest{Index: index} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesExistsDocumentType returns information about whether a particular document type exists. (DEPRECATED) -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-types-exists.html. -// -type IndicesExistsDocumentType func(index []string, o ...func(*IndicesExistsDocumentTypeRequest)) (*Response, error) - -// IndicesExistsDocumentTypeRequest configures the Indices Exists Document Type API request. -// -type IndicesExistsDocumentTypeRequest struct { - Index []string - DocumentType []string - - AllowNoIndices *bool - ExpandWildcards string - IgnoreUnavailable *bool - Local *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesExistsDocumentTypeRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "HEAD" - - path.Grow(1 + len(strings.Join(r.Index, ",")) + 1 + len("_mapping") + 1 + len(strings.Join(r.DocumentType, ","))) - path.WriteString("/") - path.WriteString(strings.Join(r.Index, ",")) - path.WriteString("/") - path.WriteString("_mapping") - path.WriteString("/") - path.WriteString(strings.Join(r.DocumentType, ",")) - - params = make(map[string]string) - - if r.AllowNoIndices != nil { - params["allow_no_indices"] = strconv.FormatBool(*r.AllowNoIndices) - } - - if r.ExpandWildcards != "" { - params["expand_wildcards"] = r.ExpandWildcards - } - - if r.IgnoreUnavailable != nil { - params["ignore_unavailable"] = strconv.FormatBool(*r.IgnoreUnavailable) - } - - if r.Local != nil { - params["local"] = strconv.FormatBool(*r.Local) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesExistsDocumentType) WithContext(v context.Context) func(*IndicesExistsDocumentTypeRequest) { - return func(r *IndicesExistsDocumentTypeRequest) { - r.ctx = v - } -} - -// WithDocumentType - a list of document types to check. -// -func (f IndicesExistsDocumentType) WithDocumentType(v ...string) func(*IndicesExistsDocumentTypeRequest) { - return func(r *IndicesExistsDocumentTypeRequest) { - r.DocumentType = v - } -} - -// WithAllowNoIndices - whether to ignore if a wildcard indices expression resolves into no concrete indices. (this includes `_all` string or when no indices have been specified). -// -func (f IndicesExistsDocumentType) WithAllowNoIndices(v bool) func(*IndicesExistsDocumentTypeRequest) { - return func(r *IndicesExistsDocumentTypeRequest) { - r.AllowNoIndices = &v - } -} - -// WithExpandWildcards - whether to expand wildcard expression to concrete indices that are open, closed or both.. -// -func (f IndicesExistsDocumentType) WithExpandWildcards(v string) func(*IndicesExistsDocumentTypeRequest) { - return func(r *IndicesExistsDocumentTypeRequest) { - r.ExpandWildcards = v - } -} - -// WithIgnoreUnavailable - whether specified concrete indices should be ignored when unavailable (missing or closed). -// -func (f IndicesExistsDocumentType) WithIgnoreUnavailable(v bool) func(*IndicesExistsDocumentTypeRequest) { - return func(r *IndicesExistsDocumentTypeRequest) { - r.IgnoreUnavailable = &v - } -} - -// WithLocal - return local information, do not retrieve the state from master node (default: false). -// -func (f IndicesExistsDocumentType) WithLocal(v bool) func(*IndicesExistsDocumentTypeRequest) { - return func(r *IndicesExistsDocumentTypeRequest) { - r.Local = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesExistsDocumentType) WithPretty() func(*IndicesExistsDocumentTypeRequest) { - return func(r *IndicesExistsDocumentTypeRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesExistsDocumentType) WithHuman() func(*IndicesExistsDocumentTypeRequest) { - return func(r *IndicesExistsDocumentTypeRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesExistsDocumentType) WithErrorTrace() func(*IndicesExistsDocumentTypeRequest) { - return func(r *IndicesExistsDocumentTypeRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesExistsDocumentType) WithFilterPath(v ...string) func(*IndicesExistsDocumentTypeRequest) { - return func(r *IndicesExistsDocumentTypeRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesExistsDocumentType) WithHeader(h map[string]string) func(*IndicesExistsDocumentTypeRequest) { - return func(r *IndicesExistsDocumentTypeRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesExistsDocumentType) WithOpaqueID(s string) func(*IndicesExistsDocumentTypeRequest) { - return func(r *IndicesExistsDocumentTypeRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.flush.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.flush.go deleted file mode 100644 index 58728ad91..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.flush.go +++ /dev/null @@ -1,278 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newIndicesFlushFunc(t Transport) IndicesFlush { - return func(o ...func(*IndicesFlushRequest)) (*Response, error) { - var r = IndicesFlushRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesFlush performs the flush operation on one or more indices. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-flush.html. -// -type IndicesFlush func(o ...func(*IndicesFlushRequest)) (*Response, error) - -// IndicesFlushRequest configures the Indices Flush API request. -// -type IndicesFlushRequest struct { - Index []string - - AllowNoIndices *bool - ExpandWildcards string - Force *bool - IgnoreUnavailable *bool - WaitIfOngoing *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesFlushRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len(strings.Join(r.Index, ",")) + 1 + len("_flush")) - if len(r.Index) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Index, ",")) - } - path.WriteString("/") - path.WriteString("_flush") - - params = make(map[string]string) - - if r.AllowNoIndices != nil { - params["allow_no_indices"] = strconv.FormatBool(*r.AllowNoIndices) - } - - if r.ExpandWildcards != "" { - params["expand_wildcards"] = r.ExpandWildcards - } - - if r.Force != nil { - params["force"] = strconv.FormatBool(*r.Force) - } - - if r.IgnoreUnavailable != nil { - params["ignore_unavailable"] = strconv.FormatBool(*r.IgnoreUnavailable) - } - - if r.WaitIfOngoing != nil { - params["wait_if_ongoing"] = strconv.FormatBool(*r.WaitIfOngoing) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesFlush) WithContext(v context.Context) func(*IndicesFlushRequest) { - return func(r *IndicesFlushRequest) { - r.ctx = v - } -} - -// WithIndex - a list of index names; use _all for all indices. -// -func (f IndicesFlush) WithIndex(v ...string) func(*IndicesFlushRequest) { - return func(r *IndicesFlushRequest) { - r.Index = v - } -} - -// WithAllowNoIndices - whether to ignore if a wildcard indices expression resolves into no concrete indices. (this includes `_all` string or when no indices have been specified). -// -func (f IndicesFlush) WithAllowNoIndices(v bool) func(*IndicesFlushRequest) { - return func(r *IndicesFlushRequest) { - r.AllowNoIndices = &v - } -} - -// WithExpandWildcards - whether to expand wildcard expression to concrete indices that are open, closed or both.. -// -func (f IndicesFlush) WithExpandWildcards(v string) func(*IndicesFlushRequest) { - return func(r *IndicesFlushRequest) { - r.ExpandWildcards = v - } -} - -// WithForce - whether a flush should be forced even if it is not necessarily needed ie. if no changes will be committed to the index. this is useful if transaction log ids should be incremented even if no uncommitted changes are present. (this setting can be considered as internal). -// -func (f IndicesFlush) WithForce(v bool) func(*IndicesFlushRequest) { - return func(r *IndicesFlushRequest) { - r.Force = &v - } -} - -// WithIgnoreUnavailable - whether specified concrete indices should be ignored when unavailable (missing or closed). -// -func (f IndicesFlush) WithIgnoreUnavailable(v bool) func(*IndicesFlushRequest) { - return func(r *IndicesFlushRequest) { - r.IgnoreUnavailable = &v - } -} - -// WithWaitIfOngoing - if set to true the flush operation will block until the flush can be executed if another flush operation is already executing. the default is true. if set to false the flush will be skipped iff if another flush operation is already running.. -// -func (f IndicesFlush) WithWaitIfOngoing(v bool) func(*IndicesFlushRequest) { - return func(r *IndicesFlushRequest) { - r.WaitIfOngoing = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesFlush) WithPretty() func(*IndicesFlushRequest) { - return func(r *IndicesFlushRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesFlush) WithHuman() func(*IndicesFlushRequest) { - return func(r *IndicesFlushRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesFlush) WithErrorTrace() func(*IndicesFlushRequest) { - return func(r *IndicesFlushRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesFlush) WithFilterPath(v ...string) func(*IndicesFlushRequest) { - return func(r *IndicesFlushRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesFlush) WithHeader(h map[string]string) func(*IndicesFlushRequest) { - return func(r *IndicesFlushRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesFlush) WithOpaqueID(s string) func(*IndicesFlushRequest) { - return func(r *IndicesFlushRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.flush_synced.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.flush_synced.go deleted file mode 100644 index 77e50bc5c..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.flush_synced.go +++ /dev/null @@ -1,254 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newIndicesFlushSyncedFunc(t Transport) IndicesFlushSynced { - return func(o ...func(*IndicesFlushSyncedRequest)) (*Response, error) { - var r = IndicesFlushSyncedRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesFlushSynced performs a synced flush operation on one or more indices. Synced flush is deprecated and will be removed in 8.0. Use flush instead -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-synced-flush-api.html. -// -type IndicesFlushSynced func(o ...func(*IndicesFlushSyncedRequest)) (*Response, error) - -// IndicesFlushSyncedRequest configures the Indices Flush Synced API request. -// -type IndicesFlushSyncedRequest struct { - Index []string - - AllowNoIndices *bool - ExpandWildcards string - IgnoreUnavailable *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesFlushSyncedRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len(strings.Join(r.Index, ",")) + 1 + len("_flush") + 1 + len("synced")) - if len(r.Index) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Index, ",")) - } - path.WriteString("/") - path.WriteString("_flush") - path.WriteString("/") - path.WriteString("synced") - - params = make(map[string]string) - - if r.AllowNoIndices != nil { - params["allow_no_indices"] = strconv.FormatBool(*r.AllowNoIndices) - } - - if r.ExpandWildcards != "" { - params["expand_wildcards"] = r.ExpandWildcards - } - - if r.IgnoreUnavailable != nil { - params["ignore_unavailable"] = strconv.FormatBool(*r.IgnoreUnavailable) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesFlushSynced) WithContext(v context.Context) func(*IndicesFlushSyncedRequest) { - return func(r *IndicesFlushSyncedRequest) { - r.ctx = v - } -} - -// WithIndex - a list of index names; use _all for all indices. -// -func (f IndicesFlushSynced) WithIndex(v ...string) func(*IndicesFlushSyncedRequest) { - return func(r *IndicesFlushSyncedRequest) { - r.Index = v - } -} - -// WithAllowNoIndices - whether to ignore if a wildcard indices expression resolves into no concrete indices. (this includes `_all` string or when no indices have been specified). -// -func (f IndicesFlushSynced) WithAllowNoIndices(v bool) func(*IndicesFlushSyncedRequest) { - return func(r *IndicesFlushSyncedRequest) { - r.AllowNoIndices = &v - } -} - -// WithExpandWildcards - whether to expand wildcard expression to concrete indices that are open, closed or both.. -// -func (f IndicesFlushSynced) WithExpandWildcards(v string) func(*IndicesFlushSyncedRequest) { - return func(r *IndicesFlushSyncedRequest) { - r.ExpandWildcards = v - } -} - -// WithIgnoreUnavailable - whether specified concrete indices should be ignored when unavailable (missing or closed). -// -func (f IndicesFlushSynced) WithIgnoreUnavailable(v bool) func(*IndicesFlushSyncedRequest) { - return func(r *IndicesFlushSyncedRequest) { - r.IgnoreUnavailable = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesFlushSynced) WithPretty() func(*IndicesFlushSyncedRequest) { - return func(r *IndicesFlushSyncedRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesFlushSynced) WithHuman() func(*IndicesFlushSyncedRequest) { - return func(r *IndicesFlushSyncedRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesFlushSynced) WithErrorTrace() func(*IndicesFlushSyncedRequest) { - return func(r *IndicesFlushSyncedRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesFlushSynced) WithFilterPath(v ...string) func(*IndicesFlushSyncedRequest) { - return func(r *IndicesFlushSyncedRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesFlushSynced) WithHeader(h map[string]string) func(*IndicesFlushSyncedRequest) { - return func(r *IndicesFlushSyncedRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesFlushSynced) WithOpaqueID(s string) func(*IndicesFlushSyncedRequest) { - return func(r *IndicesFlushSyncedRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.forcemerge.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.forcemerge.go deleted file mode 100644 index 458f67c73..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.forcemerge.go +++ /dev/null @@ -1,291 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newIndicesForcemergeFunc(t Transport) IndicesForcemerge { - return func(o ...func(*IndicesForcemergeRequest)) (*Response, error) { - var r = IndicesForcemergeRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesForcemerge performs the force merge operation on one or more indices. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-forcemerge.html. -// -type IndicesForcemerge func(o ...func(*IndicesForcemergeRequest)) (*Response, error) - -// IndicesForcemergeRequest configures the Indices Forcemerge API request. -// -type IndicesForcemergeRequest struct { - Index []string - - AllowNoIndices *bool - ExpandWildcards string - Flush *bool - IgnoreUnavailable *bool - MaxNumSegments *int - OnlyExpungeDeletes *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesForcemergeRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len(strings.Join(r.Index, ",")) + 1 + len("_forcemerge")) - if len(r.Index) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Index, ",")) - } - path.WriteString("/") - path.WriteString("_forcemerge") - - params = make(map[string]string) - - if r.AllowNoIndices != nil { - params["allow_no_indices"] = strconv.FormatBool(*r.AllowNoIndices) - } - - if r.ExpandWildcards != "" { - params["expand_wildcards"] = r.ExpandWildcards - } - - if r.Flush != nil { - params["flush"] = strconv.FormatBool(*r.Flush) - } - - if r.IgnoreUnavailable != nil { - params["ignore_unavailable"] = strconv.FormatBool(*r.IgnoreUnavailable) - } - - if r.MaxNumSegments != nil { - params["max_num_segments"] = strconv.FormatInt(int64(*r.MaxNumSegments), 10) - } - - if r.OnlyExpungeDeletes != nil { - params["only_expunge_deletes"] = strconv.FormatBool(*r.OnlyExpungeDeletes) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesForcemerge) WithContext(v context.Context) func(*IndicesForcemergeRequest) { - return func(r *IndicesForcemergeRequest) { - r.ctx = v - } -} - -// WithIndex - a list of index names; use _all to perform the operation on all indices. -// -func (f IndicesForcemerge) WithIndex(v ...string) func(*IndicesForcemergeRequest) { - return func(r *IndicesForcemergeRequest) { - r.Index = v - } -} - -// WithAllowNoIndices - whether to ignore if a wildcard indices expression resolves into no concrete indices. (this includes `_all` string or when no indices have been specified). -// -func (f IndicesForcemerge) WithAllowNoIndices(v bool) func(*IndicesForcemergeRequest) { - return func(r *IndicesForcemergeRequest) { - r.AllowNoIndices = &v - } -} - -// WithExpandWildcards - whether to expand wildcard expression to concrete indices that are open, closed or both.. -// -func (f IndicesForcemerge) WithExpandWildcards(v string) func(*IndicesForcemergeRequest) { - return func(r *IndicesForcemergeRequest) { - r.ExpandWildcards = v - } -} - -// WithFlush - specify whether the index should be flushed after performing the operation (default: true). -// -func (f IndicesForcemerge) WithFlush(v bool) func(*IndicesForcemergeRequest) { - return func(r *IndicesForcemergeRequest) { - r.Flush = &v - } -} - -// WithIgnoreUnavailable - whether specified concrete indices should be ignored when unavailable (missing or closed). -// -func (f IndicesForcemerge) WithIgnoreUnavailable(v bool) func(*IndicesForcemergeRequest) { - return func(r *IndicesForcemergeRequest) { - r.IgnoreUnavailable = &v - } -} - -// WithMaxNumSegments - the number of segments the index should be merged into (default: dynamic). -// -func (f IndicesForcemerge) WithMaxNumSegments(v int) func(*IndicesForcemergeRequest) { - return func(r *IndicesForcemergeRequest) { - r.MaxNumSegments = &v - } -} - -// WithOnlyExpungeDeletes - specify whether the operation should only expunge deleted documents. -// -func (f IndicesForcemerge) WithOnlyExpungeDeletes(v bool) func(*IndicesForcemergeRequest) { - return func(r *IndicesForcemergeRequest) { - r.OnlyExpungeDeletes = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesForcemerge) WithPretty() func(*IndicesForcemergeRequest) { - return func(r *IndicesForcemergeRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesForcemerge) WithHuman() func(*IndicesForcemergeRequest) { - return func(r *IndicesForcemergeRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesForcemerge) WithErrorTrace() func(*IndicesForcemergeRequest) { - return func(r *IndicesForcemergeRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesForcemerge) WithFilterPath(v ...string) func(*IndicesForcemergeRequest) { - return func(r *IndicesForcemergeRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesForcemerge) WithHeader(h map[string]string) func(*IndicesForcemergeRequest) { - return func(r *IndicesForcemergeRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesForcemerge) WithOpaqueID(s string) func(*IndicesForcemergeRequest) { - return func(r *IndicesForcemergeRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.get.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.get.go deleted file mode 100644 index d723d6de4..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.get.go +++ /dev/null @@ -1,306 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" - "time" -) - -func newIndicesGetFunc(t Transport) IndicesGet { - return func(index []string, o ...func(*IndicesGetRequest)) (*Response, error) { - var r = IndicesGetRequest{Index: index} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesGet returns information about one or more indices. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-index.html. -// -type IndicesGet func(index []string, o ...func(*IndicesGetRequest)) (*Response, error) - -// IndicesGetRequest configures the Indices Get API request. -// -type IndicesGetRequest struct { - Index []string - - AllowNoIndices *bool - ExpandWildcards string - FlatSettings *bool - IgnoreUnavailable *bool - IncludeDefaults *bool - IncludeTypeName *bool - Local *bool - MasterTimeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesGetRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len(strings.Join(r.Index, ","))) - path.WriteString("/") - path.WriteString(strings.Join(r.Index, ",")) - - params = make(map[string]string) - - if r.AllowNoIndices != nil { - params["allow_no_indices"] = strconv.FormatBool(*r.AllowNoIndices) - } - - if r.ExpandWildcards != "" { - params["expand_wildcards"] = r.ExpandWildcards - } - - if r.FlatSettings != nil { - params["flat_settings"] = strconv.FormatBool(*r.FlatSettings) - } - - if r.IgnoreUnavailable != nil { - params["ignore_unavailable"] = strconv.FormatBool(*r.IgnoreUnavailable) - } - - if r.IncludeDefaults != nil { - params["include_defaults"] = strconv.FormatBool(*r.IncludeDefaults) - } - - if r.IncludeTypeName != nil { - params["include_type_name"] = strconv.FormatBool(*r.IncludeTypeName) - } - - if r.Local != nil { - params["local"] = strconv.FormatBool(*r.Local) - } - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesGet) WithContext(v context.Context) func(*IndicesGetRequest) { - return func(r *IndicesGetRequest) { - r.ctx = v - } -} - -// WithAllowNoIndices - ignore if a wildcard expression resolves to no concrete indices (default: false). -// -func (f IndicesGet) WithAllowNoIndices(v bool) func(*IndicesGetRequest) { - return func(r *IndicesGetRequest) { - r.AllowNoIndices = &v - } -} - -// WithExpandWildcards - whether wildcard expressions should get expanded to open or closed indices (default: open). -// -func (f IndicesGet) WithExpandWildcards(v string) func(*IndicesGetRequest) { - return func(r *IndicesGetRequest) { - r.ExpandWildcards = v - } -} - -// WithFlatSettings - return settings in flat format (default: false). -// -func (f IndicesGet) WithFlatSettings(v bool) func(*IndicesGetRequest) { - return func(r *IndicesGetRequest) { - r.FlatSettings = &v - } -} - -// WithIgnoreUnavailable - ignore unavailable indexes (default: false). -// -func (f IndicesGet) WithIgnoreUnavailable(v bool) func(*IndicesGetRequest) { - return func(r *IndicesGetRequest) { - r.IgnoreUnavailable = &v - } -} - -// WithIncludeDefaults - whether to return all default setting for each of the indices.. -// -func (f IndicesGet) WithIncludeDefaults(v bool) func(*IndicesGetRequest) { - return func(r *IndicesGetRequest) { - r.IncludeDefaults = &v - } -} - -// WithIncludeTypeName - whether to add the type name to the response (default: false). -// -func (f IndicesGet) WithIncludeTypeName(v bool) func(*IndicesGetRequest) { - return func(r *IndicesGetRequest) { - r.IncludeTypeName = &v - } -} - -// WithLocal - return local information, do not retrieve the state from master node (default: false). -// -func (f IndicesGet) WithLocal(v bool) func(*IndicesGetRequest) { - return func(r *IndicesGetRequest) { - r.Local = &v - } -} - -// WithMasterTimeout - specify timeout for connection to master. -// -func (f IndicesGet) WithMasterTimeout(v time.Duration) func(*IndicesGetRequest) { - return func(r *IndicesGetRequest) { - r.MasterTimeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesGet) WithPretty() func(*IndicesGetRequest) { - return func(r *IndicesGetRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesGet) WithHuman() func(*IndicesGetRequest) { - return func(r *IndicesGetRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesGet) WithErrorTrace() func(*IndicesGetRequest) { - return func(r *IndicesGetRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesGet) WithFilterPath(v ...string) func(*IndicesGetRequest) { - return func(r *IndicesGetRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesGet) WithHeader(h map[string]string) func(*IndicesGetRequest) { - return func(r *IndicesGetRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesGet) WithOpaqueID(s string) func(*IndicesGetRequest) { - return func(r *IndicesGetRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.get_alias.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.get_alias.go deleted file mode 100644 index 8bf5357a7..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.get_alias.go +++ /dev/null @@ -1,279 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newIndicesGetAliasFunc(t Transport) IndicesGetAlias { - return func(o ...func(*IndicesGetAliasRequest)) (*Response, error) { - var r = IndicesGetAliasRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesGetAlias returns an alias. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html. -// -type IndicesGetAlias func(o ...func(*IndicesGetAliasRequest)) (*Response, error) - -// IndicesGetAliasRequest configures the Indices Get Alias API request. -// -type IndicesGetAliasRequest struct { - Index []string - - Name []string - - AllowNoIndices *bool - ExpandWildcards string - IgnoreUnavailable *bool - Local *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesGetAliasRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len(strings.Join(r.Index, ",")) + 1 + len("_alias") + 1 + len(strings.Join(r.Name, ","))) - if len(r.Index) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Index, ",")) - } - path.WriteString("/") - path.WriteString("_alias") - if len(r.Name) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Name, ",")) - } - - params = make(map[string]string) - - if r.AllowNoIndices != nil { - params["allow_no_indices"] = strconv.FormatBool(*r.AllowNoIndices) - } - - if r.ExpandWildcards != "" { - params["expand_wildcards"] = r.ExpandWildcards - } - - if r.IgnoreUnavailable != nil { - params["ignore_unavailable"] = strconv.FormatBool(*r.IgnoreUnavailable) - } - - if r.Local != nil { - params["local"] = strconv.FormatBool(*r.Local) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesGetAlias) WithContext(v context.Context) func(*IndicesGetAliasRequest) { - return func(r *IndicesGetAliasRequest) { - r.ctx = v - } -} - -// WithIndex - a list of index names to filter aliases. -// -func (f IndicesGetAlias) WithIndex(v ...string) func(*IndicesGetAliasRequest) { - return func(r *IndicesGetAliasRequest) { - r.Index = v - } -} - -// WithName - a list of alias names to return. -// -func (f IndicesGetAlias) WithName(v ...string) func(*IndicesGetAliasRequest) { - return func(r *IndicesGetAliasRequest) { - r.Name = v - } -} - -// WithAllowNoIndices - whether to ignore if a wildcard indices expression resolves into no concrete indices. (this includes `_all` string or when no indices have been specified). -// -func (f IndicesGetAlias) WithAllowNoIndices(v bool) func(*IndicesGetAliasRequest) { - return func(r *IndicesGetAliasRequest) { - r.AllowNoIndices = &v - } -} - -// WithExpandWildcards - whether to expand wildcard expression to concrete indices that are open, closed or both.. -// -func (f IndicesGetAlias) WithExpandWildcards(v string) func(*IndicesGetAliasRequest) { - return func(r *IndicesGetAliasRequest) { - r.ExpandWildcards = v - } -} - -// WithIgnoreUnavailable - whether specified concrete indices should be ignored when unavailable (missing or closed). -// -func (f IndicesGetAlias) WithIgnoreUnavailable(v bool) func(*IndicesGetAliasRequest) { - return func(r *IndicesGetAliasRequest) { - r.IgnoreUnavailable = &v - } -} - -// WithLocal - return local information, do not retrieve the state from master node (default: false). -// -func (f IndicesGetAlias) WithLocal(v bool) func(*IndicesGetAliasRequest) { - return func(r *IndicesGetAliasRequest) { - r.Local = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesGetAlias) WithPretty() func(*IndicesGetAliasRequest) { - return func(r *IndicesGetAliasRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesGetAlias) WithHuman() func(*IndicesGetAliasRequest) { - return func(r *IndicesGetAliasRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesGetAlias) WithErrorTrace() func(*IndicesGetAliasRequest) { - return func(r *IndicesGetAliasRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesGetAlias) WithFilterPath(v ...string) func(*IndicesGetAliasRequest) { - return func(r *IndicesGetAliasRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesGetAlias) WithHeader(h map[string]string) func(*IndicesGetAliasRequest) { - return func(r *IndicesGetAliasRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesGetAlias) WithOpaqueID(s string) func(*IndicesGetAliasRequest) { - return func(r *IndicesGetAliasRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.get_field_mapping.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.get_field_mapping.go deleted file mode 100644 index 2647422ef..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.get_field_mapping.go +++ /dev/null @@ -1,310 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newIndicesGetFieldMappingFunc(t Transport) IndicesGetFieldMapping { - return func(fields []string, o ...func(*IndicesGetFieldMappingRequest)) (*Response, error) { - var r = IndicesGetFieldMappingRequest{Fields: fields} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesGetFieldMapping returns mapping for one or more fields. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-field-mapping.html. -// -type IndicesGetFieldMapping func(fields []string, o ...func(*IndicesGetFieldMappingRequest)) (*Response, error) - -// IndicesGetFieldMappingRequest configures the Indices Get Field Mapping API request. -// -type IndicesGetFieldMappingRequest struct { - Index []string - DocumentType []string - - Fields []string - - AllowNoIndices *bool - ExpandWildcards string - IgnoreUnavailable *bool - IncludeDefaults *bool - IncludeTypeName *bool - Local *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesGetFieldMappingRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len(strings.Join(r.Index, ",")) + 1 + len("_mapping") + 1 + len(strings.Join(r.DocumentType, ",")) + 1 + len("field") + 1 + len(strings.Join(r.Fields, ","))) - if len(r.Index) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Index, ",")) - } - path.WriteString("/") - path.WriteString("_mapping") - if len(r.DocumentType) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.DocumentType, ",")) - } - path.WriteString("/") - path.WriteString("field") - path.WriteString("/") - path.WriteString(strings.Join(r.Fields, ",")) - - params = make(map[string]string) - - if r.AllowNoIndices != nil { - params["allow_no_indices"] = strconv.FormatBool(*r.AllowNoIndices) - } - - if r.ExpandWildcards != "" { - params["expand_wildcards"] = r.ExpandWildcards - } - - if r.IgnoreUnavailable != nil { - params["ignore_unavailable"] = strconv.FormatBool(*r.IgnoreUnavailable) - } - - if r.IncludeDefaults != nil { - params["include_defaults"] = strconv.FormatBool(*r.IncludeDefaults) - } - - if r.IncludeTypeName != nil { - params["include_type_name"] = strconv.FormatBool(*r.IncludeTypeName) - } - - if r.Local != nil { - params["local"] = strconv.FormatBool(*r.Local) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesGetFieldMapping) WithContext(v context.Context) func(*IndicesGetFieldMappingRequest) { - return func(r *IndicesGetFieldMappingRequest) { - r.ctx = v - } -} - -// WithIndex - a list of index names. -// -func (f IndicesGetFieldMapping) WithIndex(v ...string) func(*IndicesGetFieldMappingRequest) { - return func(r *IndicesGetFieldMappingRequest) { - r.Index = v - } -} - -// WithDocumentType - a list of document types. -// -func (f IndicesGetFieldMapping) WithDocumentType(v ...string) func(*IndicesGetFieldMappingRequest) { - return func(r *IndicesGetFieldMappingRequest) { - r.DocumentType = v - } -} - -// WithAllowNoIndices - whether to ignore if a wildcard indices expression resolves into no concrete indices. (this includes `_all` string or when no indices have been specified). -// -func (f IndicesGetFieldMapping) WithAllowNoIndices(v bool) func(*IndicesGetFieldMappingRequest) { - return func(r *IndicesGetFieldMappingRequest) { - r.AllowNoIndices = &v - } -} - -// WithExpandWildcards - whether to expand wildcard expression to concrete indices that are open, closed or both.. -// -func (f IndicesGetFieldMapping) WithExpandWildcards(v string) func(*IndicesGetFieldMappingRequest) { - return func(r *IndicesGetFieldMappingRequest) { - r.ExpandWildcards = v - } -} - -// WithIgnoreUnavailable - whether specified concrete indices should be ignored when unavailable (missing or closed). -// -func (f IndicesGetFieldMapping) WithIgnoreUnavailable(v bool) func(*IndicesGetFieldMappingRequest) { - return func(r *IndicesGetFieldMappingRequest) { - r.IgnoreUnavailable = &v - } -} - -// WithIncludeDefaults - whether the default mapping values should be returned as well. -// -func (f IndicesGetFieldMapping) WithIncludeDefaults(v bool) func(*IndicesGetFieldMappingRequest) { - return func(r *IndicesGetFieldMappingRequest) { - r.IncludeDefaults = &v - } -} - -// WithIncludeTypeName - whether a type should be returned in the body of the mappings.. -// -func (f IndicesGetFieldMapping) WithIncludeTypeName(v bool) func(*IndicesGetFieldMappingRequest) { - return func(r *IndicesGetFieldMappingRequest) { - r.IncludeTypeName = &v - } -} - -// WithLocal - return local information, do not retrieve the state from master node (default: false). -// -func (f IndicesGetFieldMapping) WithLocal(v bool) func(*IndicesGetFieldMappingRequest) { - return func(r *IndicesGetFieldMappingRequest) { - r.Local = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesGetFieldMapping) WithPretty() func(*IndicesGetFieldMappingRequest) { - return func(r *IndicesGetFieldMappingRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesGetFieldMapping) WithHuman() func(*IndicesGetFieldMappingRequest) { - return func(r *IndicesGetFieldMappingRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesGetFieldMapping) WithErrorTrace() func(*IndicesGetFieldMappingRequest) { - return func(r *IndicesGetFieldMappingRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesGetFieldMapping) WithFilterPath(v ...string) func(*IndicesGetFieldMappingRequest) { - return func(r *IndicesGetFieldMappingRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesGetFieldMapping) WithHeader(h map[string]string) func(*IndicesGetFieldMappingRequest) { - return func(r *IndicesGetFieldMappingRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesGetFieldMapping) WithOpaqueID(s string) func(*IndicesGetFieldMappingRequest) { - return func(r *IndicesGetFieldMappingRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.get_index_template.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.get_index_template.go deleted file mode 100644 index d49d26656..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.get_index_template.go +++ /dev/null @@ -1,253 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" - "time" -) - -func newIndicesGetIndexTemplateFunc(t Transport) IndicesGetIndexTemplate { - return func(o ...func(*IndicesGetIndexTemplateRequest)) (*Response, error) { - var r = IndicesGetIndexTemplateRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesGetIndexTemplate returns an index template. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html. -// -type IndicesGetIndexTemplate func(o ...func(*IndicesGetIndexTemplateRequest)) (*Response, error) - -// IndicesGetIndexTemplateRequest configures the Indices Get Index Template API request. -// -type IndicesGetIndexTemplateRequest struct { - Name []string - - FlatSettings *bool - Local *bool - MasterTimeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesGetIndexTemplateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_index_template") + 1 + len(strings.Join(r.Name, ","))) - path.WriteString("/") - path.WriteString("_index_template") - if len(r.Name) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Name, ",")) - } - - params = make(map[string]string) - - if r.FlatSettings != nil { - params["flat_settings"] = strconv.FormatBool(*r.FlatSettings) - } - - if r.Local != nil { - params["local"] = strconv.FormatBool(*r.Local) - } - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesGetIndexTemplate) WithContext(v context.Context) func(*IndicesGetIndexTemplateRequest) { - return func(r *IndicesGetIndexTemplateRequest) { - r.ctx = v - } -} - -// WithName - the comma separated names of the index templates. -// -func (f IndicesGetIndexTemplate) WithName(v ...string) func(*IndicesGetIndexTemplateRequest) { - return func(r *IndicesGetIndexTemplateRequest) { - r.Name = v - } -} - -// WithFlatSettings - return settings in flat format (default: false). -// -func (f IndicesGetIndexTemplate) WithFlatSettings(v bool) func(*IndicesGetIndexTemplateRequest) { - return func(r *IndicesGetIndexTemplateRequest) { - r.FlatSettings = &v - } -} - -// WithLocal - return local information, do not retrieve the state from master node (default: false). -// -func (f IndicesGetIndexTemplate) WithLocal(v bool) func(*IndicesGetIndexTemplateRequest) { - return func(r *IndicesGetIndexTemplateRequest) { - r.Local = &v - } -} - -// WithMasterTimeout - explicit operation timeout for connection to master node. -// -func (f IndicesGetIndexTemplate) WithMasterTimeout(v time.Duration) func(*IndicesGetIndexTemplateRequest) { - return func(r *IndicesGetIndexTemplateRequest) { - r.MasterTimeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesGetIndexTemplate) WithPretty() func(*IndicesGetIndexTemplateRequest) { - return func(r *IndicesGetIndexTemplateRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesGetIndexTemplate) WithHuman() func(*IndicesGetIndexTemplateRequest) { - return func(r *IndicesGetIndexTemplateRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesGetIndexTemplate) WithErrorTrace() func(*IndicesGetIndexTemplateRequest) { - return func(r *IndicesGetIndexTemplateRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesGetIndexTemplate) WithFilterPath(v ...string) func(*IndicesGetIndexTemplateRequest) { - return func(r *IndicesGetIndexTemplateRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesGetIndexTemplate) WithHeader(h map[string]string) func(*IndicesGetIndexTemplateRequest) { - return func(r *IndicesGetIndexTemplateRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesGetIndexTemplate) WithOpaqueID(s string) func(*IndicesGetIndexTemplateRequest) { - return func(r *IndicesGetIndexTemplateRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.get_mapping.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.get_mapping.go deleted file mode 100644 index bc026d227..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.get_mapping.go +++ /dev/null @@ -1,305 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" - "time" -) - -func newIndicesGetMappingFunc(t Transport) IndicesGetMapping { - return func(o ...func(*IndicesGetMappingRequest)) (*Response, error) { - var r = IndicesGetMappingRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesGetMapping returns mappings for one or more indices. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-mapping.html. -// -type IndicesGetMapping func(o ...func(*IndicesGetMappingRequest)) (*Response, error) - -// IndicesGetMappingRequest configures the Indices Get Mapping API request. -// -type IndicesGetMappingRequest struct { - Index []string - DocumentType []string - - AllowNoIndices *bool - ExpandWildcards string - IgnoreUnavailable *bool - IncludeTypeName *bool - Local *bool - MasterTimeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesGetMappingRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len(strings.Join(r.Index, ",")) + 1 + len("_mapping") + 1 + len(strings.Join(r.DocumentType, ","))) - if len(r.Index) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Index, ",")) - } - path.WriteString("/") - path.WriteString("_mapping") - if len(r.DocumentType) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.DocumentType, ",")) - } - - params = make(map[string]string) - - if r.AllowNoIndices != nil { - params["allow_no_indices"] = strconv.FormatBool(*r.AllowNoIndices) - } - - if r.ExpandWildcards != "" { - params["expand_wildcards"] = r.ExpandWildcards - } - - if r.IgnoreUnavailable != nil { - params["ignore_unavailable"] = strconv.FormatBool(*r.IgnoreUnavailable) - } - - if r.IncludeTypeName != nil { - params["include_type_name"] = strconv.FormatBool(*r.IncludeTypeName) - } - - if r.Local != nil { - params["local"] = strconv.FormatBool(*r.Local) - } - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesGetMapping) WithContext(v context.Context) func(*IndicesGetMappingRequest) { - return func(r *IndicesGetMappingRequest) { - r.ctx = v - } -} - -// WithIndex - a list of index names. -// -func (f IndicesGetMapping) WithIndex(v ...string) func(*IndicesGetMappingRequest) { - return func(r *IndicesGetMappingRequest) { - r.Index = v - } -} - -// WithDocumentType - a list of document types. -// -func (f IndicesGetMapping) WithDocumentType(v ...string) func(*IndicesGetMappingRequest) { - return func(r *IndicesGetMappingRequest) { - r.DocumentType = v - } -} - -// WithAllowNoIndices - whether to ignore if a wildcard indices expression resolves into no concrete indices. (this includes `_all` string or when no indices have been specified). -// -func (f IndicesGetMapping) WithAllowNoIndices(v bool) func(*IndicesGetMappingRequest) { - return func(r *IndicesGetMappingRequest) { - r.AllowNoIndices = &v - } -} - -// WithExpandWildcards - whether to expand wildcard expression to concrete indices that are open, closed or both.. -// -func (f IndicesGetMapping) WithExpandWildcards(v string) func(*IndicesGetMappingRequest) { - return func(r *IndicesGetMappingRequest) { - r.ExpandWildcards = v - } -} - -// WithIgnoreUnavailable - whether specified concrete indices should be ignored when unavailable (missing or closed). -// -func (f IndicesGetMapping) WithIgnoreUnavailable(v bool) func(*IndicesGetMappingRequest) { - return func(r *IndicesGetMappingRequest) { - r.IgnoreUnavailable = &v - } -} - -// WithIncludeTypeName - whether to add the type name to the response (default: false). -// -func (f IndicesGetMapping) WithIncludeTypeName(v bool) func(*IndicesGetMappingRequest) { - return func(r *IndicesGetMappingRequest) { - r.IncludeTypeName = &v - } -} - -// WithLocal - return local information, do not retrieve the state from master node (default: false). -// -func (f IndicesGetMapping) WithLocal(v bool) func(*IndicesGetMappingRequest) { - return func(r *IndicesGetMappingRequest) { - r.Local = &v - } -} - -// WithMasterTimeout - specify timeout for connection to master. -// -func (f IndicesGetMapping) WithMasterTimeout(v time.Duration) func(*IndicesGetMappingRequest) { - return func(r *IndicesGetMappingRequest) { - r.MasterTimeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesGetMapping) WithPretty() func(*IndicesGetMappingRequest) { - return func(r *IndicesGetMappingRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesGetMapping) WithHuman() func(*IndicesGetMappingRequest) { - return func(r *IndicesGetMappingRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesGetMapping) WithErrorTrace() func(*IndicesGetMappingRequest) { - return func(r *IndicesGetMappingRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesGetMapping) WithFilterPath(v ...string) func(*IndicesGetMappingRequest) { - return func(r *IndicesGetMappingRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesGetMapping) WithHeader(h map[string]string) func(*IndicesGetMappingRequest) { - return func(r *IndicesGetMappingRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesGetMapping) WithOpaqueID(s string) func(*IndicesGetMappingRequest) { - return func(r *IndicesGetMappingRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.get_settings.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.get_settings.go deleted file mode 100644 index cc39b5eeb..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.get_settings.go +++ /dev/null @@ -1,319 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" - "time" -) - -func newIndicesGetSettingsFunc(t Transport) IndicesGetSettings { - return func(o ...func(*IndicesGetSettingsRequest)) (*Response, error) { - var r = IndicesGetSettingsRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesGetSettings returns settings for one or more indices. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-settings.html. -// -type IndicesGetSettings func(o ...func(*IndicesGetSettingsRequest)) (*Response, error) - -// IndicesGetSettingsRequest configures the Indices Get Settings API request. -// -type IndicesGetSettingsRequest struct { - Index []string - - Name []string - - AllowNoIndices *bool - ExpandWildcards string - FlatSettings *bool - IgnoreUnavailable *bool - IncludeDefaults *bool - Local *bool - MasterTimeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesGetSettingsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len(strings.Join(r.Index, ",")) + 1 + len("_settings") + 1 + len(strings.Join(r.Name, ","))) - if len(r.Index) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Index, ",")) - } - path.WriteString("/") - path.WriteString("_settings") - if len(r.Name) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Name, ",")) - } - - params = make(map[string]string) - - if r.AllowNoIndices != nil { - params["allow_no_indices"] = strconv.FormatBool(*r.AllowNoIndices) - } - - if r.ExpandWildcards != "" { - params["expand_wildcards"] = r.ExpandWildcards - } - - if r.FlatSettings != nil { - params["flat_settings"] = strconv.FormatBool(*r.FlatSettings) - } - - if r.IgnoreUnavailable != nil { - params["ignore_unavailable"] = strconv.FormatBool(*r.IgnoreUnavailable) - } - - if r.IncludeDefaults != nil { - params["include_defaults"] = strconv.FormatBool(*r.IncludeDefaults) - } - - if r.Local != nil { - params["local"] = strconv.FormatBool(*r.Local) - } - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesGetSettings) WithContext(v context.Context) func(*IndicesGetSettingsRequest) { - return func(r *IndicesGetSettingsRequest) { - r.ctx = v - } -} - -// WithIndex - a list of index names; use _all to perform the operation on all indices. -// -func (f IndicesGetSettings) WithIndex(v ...string) func(*IndicesGetSettingsRequest) { - return func(r *IndicesGetSettingsRequest) { - r.Index = v - } -} - -// WithName - the name of the settings that should be included. -// -func (f IndicesGetSettings) WithName(v ...string) func(*IndicesGetSettingsRequest) { - return func(r *IndicesGetSettingsRequest) { - r.Name = v - } -} - -// WithAllowNoIndices - whether to ignore if a wildcard indices expression resolves into no concrete indices. (this includes `_all` string or when no indices have been specified). -// -func (f IndicesGetSettings) WithAllowNoIndices(v bool) func(*IndicesGetSettingsRequest) { - return func(r *IndicesGetSettingsRequest) { - r.AllowNoIndices = &v - } -} - -// WithExpandWildcards - whether to expand wildcard expression to concrete indices that are open, closed or both.. -// -func (f IndicesGetSettings) WithExpandWildcards(v string) func(*IndicesGetSettingsRequest) { - return func(r *IndicesGetSettingsRequest) { - r.ExpandWildcards = v - } -} - -// WithFlatSettings - return settings in flat format (default: false). -// -func (f IndicesGetSettings) WithFlatSettings(v bool) func(*IndicesGetSettingsRequest) { - return func(r *IndicesGetSettingsRequest) { - r.FlatSettings = &v - } -} - -// WithIgnoreUnavailable - whether specified concrete indices should be ignored when unavailable (missing or closed). -// -func (f IndicesGetSettings) WithIgnoreUnavailable(v bool) func(*IndicesGetSettingsRequest) { - return func(r *IndicesGetSettingsRequest) { - r.IgnoreUnavailable = &v - } -} - -// WithIncludeDefaults - whether to return all default setting for each of the indices.. -// -func (f IndicesGetSettings) WithIncludeDefaults(v bool) func(*IndicesGetSettingsRequest) { - return func(r *IndicesGetSettingsRequest) { - r.IncludeDefaults = &v - } -} - -// WithLocal - return local information, do not retrieve the state from master node (default: false). -// -func (f IndicesGetSettings) WithLocal(v bool) func(*IndicesGetSettingsRequest) { - return func(r *IndicesGetSettingsRequest) { - r.Local = &v - } -} - -// WithMasterTimeout - specify timeout for connection to master. -// -func (f IndicesGetSettings) WithMasterTimeout(v time.Duration) func(*IndicesGetSettingsRequest) { - return func(r *IndicesGetSettingsRequest) { - r.MasterTimeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesGetSettings) WithPretty() func(*IndicesGetSettingsRequest) { - return func(r *IndicesGetSettingsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesGetSettings) WithHuman() func(*IndicesGetSettingsRequest) { - return func(r *IndicesGetSettingsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesGetSettings) WithErrorTrace() func(*IndicesGetSettingsRequest) { - return func(r *IndicesGetSettingsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesGetSettings) WithFilterPath(v ...string) func(*IndicesGetSettingsRequest) { - return func(r *IndicesGetSettingsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesGetSettings) WithHeader(h map[string]string) func(*IndicesGetSettingsRequest) { - return func(r *IndicesGetSettingsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesGetSettings) WithOpaqueID(s string) func(*IndicesGetSettingsRequest) { - return func(r *IndicesGetSettingsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.get_template.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.get_template.go deleted file mode 100644 index 63df9e9c4..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.get_template.go +++ /dev/null @@ -1,266 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" - "time" -) - -func newIndicesGetTemplateFunc(t Transport) IndicesGetTemplate { - return func(o ...func(*IndicesGetTemplateRequest)) (*Response, error) { - var r = IndicesGetTemplateRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesGetTemplate returns an index template. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html. -// -type IndicesGetTemplate func(o ...func(*IndicesGetTemplateRequest)) (*Response, error) - -// IndicesGetTemplateRequest configures the Indices Get Template API request. -// -type IndicesGetTemplateRequest struct { - Name []string - - FlatSettings *bool - IncludeTypeName *bool - Local *bool - MasterTimeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesGetTemplateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_template") + 1 + len(strings.Join(r.Name, ","))) - path.WriteString("/") - path.WriteString("_template") - if len(r.Name) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Name, ",")) - } - - params = make(map[string]string) - - if r.FlatSettings != nil { - params["flat_settings"] = strconv.FormatBool(*r.FlatSettings) - } - - if r.IncludeTypeName != nil { - params["include_type_name"] = strconv.FormatBool(*r.IncludeTypeName) - } - - if r.Local != nil { - params["local"] = strconv.FormatBool(*r.Local) - } - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesGetTemplate) WithContext(v context.Context) func(*IndicesGetTemplateRequest) { - return func(r *IndicesGetTemplateRequest) { - r.ctx = v - } -} - -// WithName - the comma separated names of the index templates. -// -func (f IndicesGetTemplate) WithName(v ...string) func(*IndicesGetTemplateRequest) { - return func(r *IndicesGetTemplateRequest) { - r.Name = v - } -} - -// WithFlatSettings - return settings in flat format (default: false). -// -func (f IndicesGetTemplate) WithFlatSettings(v bool) func(*IndicesGetTemplateRequest) { - return func(r *IndicesGetTemplateRequest) { - r.FlatSettings = &v - } -} - -// WithIncludeTypeName - whether a type should be returned in the body of the mappings.. -// -func (f IndicesGetTemplate) WithIncludeTypeName(v bool) func(*IndicesGetTemplateRequest) { - return func(r *IndicesGetTemplateRequest) { - r.IncludeTypeName = &v - } -} - -// WithLocal - return local information, do not retrieve the state from master node (default: false). -// -func (f IndicesGetTemplate) WithLocal(v bool) func(*IndicesGetTemplateRequest) { - return func(r *IndicesGetTemplateRequest) { - r.Local = &v - } -} - -// WithMasterTimeout - explicit operation timeout for connection to master node. -// -func (f IndicesGetTemplate) WithMasterTimeout(v time.Duration) func(*IndicesGetTemplateRequest) { - return func(r *IndicesGetTemplateRequest) { - r.MasterTimeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesGetTemplate) WithPretty() func(*IndicesGetTemplateRequest) { - return func(r *IndicesGetTemplateRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesGetTemplate) WithHuman() func(*IndicesGetTemplateRequest) { - return func(r *IndicesGetTemplateRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesGetTemplate) WithErrorTrace() func(*IndicesGetTemplateRequest) { - return func(r *IndicesGetTemplateRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesGetTemplate) WithFilterPath(v ...string) func(*IndicesGetTemplateRequest) { - return func(r *IndicesGetTemplateRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesGetTemplate) WithHeader(h map[string]string) func(*IndicesGetTemplateRequest) { - return func(r *IndicesGetTemplateRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesGetTemplate) WithOpaqueID(s string) func(*IndicesGetTemplateRequest) { - return func(r *IndicesGetTemplateRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.get_upgrade.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.get_upgrade.go deleted file mode 100644 index 454225eb2..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.get_upgrade.go +++ /dev/null @@ -1,252 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newIndicesGetUpgradeFunc(t Transport) IndicesGetUpgrade { - return func(o ...func(*IndicesGetUpgradeRequest)) (*Response, error) { - var r = IndicesGetUpgradeRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesGetUpgrade deprecated Returns a progress status of current upgrade. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-upgrade.html. -// -type IndicesGetUpgrade func(o ...func(*IndicesGetUpgradeRequest)) (*Response, error) - -// IndicesGetUpgradeRequest configures the Indices Get Upgrade API request. -// -type IndicesGetUpgradeRequest struct { - Index []string - - AllowNoIndices *bool - ExpandWildcards string - IgnoreUnavailable *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesGetUpgradeRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len(strings.Join(r.Index, ",")) + 1 + len("_upgrade")) - if len(r.Index) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Index, ",")) - } - path.WriteString("/") - path.WriteString("_upgrade") - - params = make(map[string]string) - - if r.AllowNoIndices != nil { - params["allow_no_indices"] = strconv.FormatBool(*r.AllowNoIndices) - } - - if r.ExpandWildcards != "" { - params["expand_wildcards"] = r.ExpandWildcards - } - - if r.IgnoreUnavailable != nil { - params["ignore_unavailable"] = strconv.FormatBool(*r.IgnoreUnavailable) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesGetUpgrade) WithContext(v context.Context) func(*IndicesGetUpgradeRequest) { - return func(r *IndicesGetUpgradeRequest) { - r.ctx = v - } -} - -// WithIndex - a list of index names; use _all to perform the operation on all indices. -// -func (f IndicesGetUpgrade) WithIndex(v ...string) func(*IndicesGetUpgradeRequest) { - return func(r *IndicesGetUpgradeRequest) { - r.Index = v - } -} - -// WithAllowNoIndices - whether to ignore if a wildcard indices expression resolves into no concrete indices. (this includes `_all` string or when no indices have been specified). -// -func (f IndicesGetUpgrade) WithAllowNoIndices(v bool) func(*IndicesGetUpgradeRequest) { - return func(r *IndicesGetUpgradeRequest) { - r.AllowNoIndices = &v - } -} - -// WithExpandWildcards - whether to expand wildcard expression to concrete indices that are open, closed or both.. -// -func (f IndicesGetUpgrade) WithExpandWildcards(v string) func(*IndicesGetUpgradeRequest) { - return func(r *IndicesGetUpgradeRequest) { - r.ExpandWildcards = v - } -} - -// WithIgnoreUnavailable - whether specified concrete indices should be ignored when unavailable (missing or closed). -// -func (f IndicesGetUpgrade) WithIgnoreUnavailable(v bool) func(*IndicesGetUpgradeRequest) { - return func(r *IndicesGetUpgradeRequest) { - r.IgnoreUnavailable = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesGetUpgrade) WithPretty() func(*IndicesGetUpgradeRequest) { - return func(r *IndicesGetUpgradeRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesGetUpgrade) WithHuman() func(*IndicesGetUpgradeRequest) { - return func(r *IndicesGetUpgradeRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesGetUpgrade) WithErrorTrace() func(*IndicesGetUpgradeRequest) { - return func(r *IndicesGetUpgradeRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesGetUpgrade) WithFilterPath(v ...string) func(*IndicesGetUpgradeRequest) { - return func(r *IndicesGetUpgradeRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesGetUpgrade) WithHeader(h map[string]string) func(*IndicesGetUpgradeRequest) { - return func(r *IndicesGetUpgradeRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesGetUpgrade) WithOpaqueID(s string) func(*IndicesGetUpgradeRequest) { - return func(r *IndicesGetUpgradeRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.open.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.open.go deleted file mode 100644 index 5f2996e17..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.open.go +++ /dev/null @@ -1,282 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" - "time" -) - -func newIndicesOpenFunc(t Transport) IndicesOpen { - return func(index []string, o ...func(*IndicesOpenRequest)) (*Response, error) { - var r = IndicesOpenRequest{Index: index} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesOpen opens an index. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-open-close.html. -// -type IndicesOpen func(index []string, o ...func(*IndicesOpenRequest)) (*Response, error) - -// IndicesOpenRequest configures the Indices Open API request. -// -type IndicesOpenRequest struct { - Index []string - - AllowNoIndices *bool - ExpandWildcards string - IgnoreUnavailable *bool - MasterTimeout time.Duration - Timeout time.Duration - WaitForActiveShards string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesOpenRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len(strings.Join(r.Index, ",")) + 1 + len("_open")) - path.WriteString("/") - path.WriteString(strings.Join(r.Index, ",")) - path.WriteString("/") - path.WriteString("_open") - - params = make(map[string]string) - - if r.AllowNoIndices != nil { - params["allow_no_indices"] = strconv.FormatBool(*r.AllowNoIndices) - } - - if r.ExpandWildcards != "" { - params["expand_wildcards"] = r.ExpandWildcards - } - - if r.IgnoreUnavailable != nil { - params["ignore_unavailable"] = strconv.FormatBool(*r.IgnoreUnavailable) - } - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.WaitForActiveShards != "" { - params["wait_for_active_shards"] = r.WaitForActiveShards - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesOpen) WithContext(v context.Context) func(*IndicesOpenRequest) { - return func(r *IndicesOpenRequest) { - r.ctx = v - } -} - -// WithAllowNoIndices - whether to ignore if a wildcard indices expression resolves into no concrete indices. (this includes `_all` string or when no indices have been specified). -// -func (f IndicesOpen) WithAllowNoIndices(v bool) func(*IndicesOpenRequest) { - return func(r *IndicesOpenRequest) { - r.AllowNoIndices = &v - } -} - -// WithExpandWildcards - whether to expand wildcard expression to concrete indices that are open, closed or both.. -// -func (f IndicesOpen) WithExpandWildcards(v string) func(*IndicesOpenRequest) { - return func(r *IndicesOpenRequest) { - r.ExpandWildcards = v - } -} - -// WithIgnoreUnavailable - whether specified concrete indices should be ignored when unavailable (missing or closed). -// -func (f IndicesOpen) WithIgnoreUnavailable(v bool) func(*IndicesOpenRequest) { - return func(r *IndicesOpenRequest) { - r.IgnoreUnavailable = &v - } -} - -// WithMasterTimeout - specify timeout for connection to master. -// -func (f IndicesOpen) WithMasterTimeout(v time.Duration) func(*IndicesOpenRequest) { - return func(r *IndicesOpenRequest) { - r.MasterTimeout = v - } -} - -// WithTimeout - explicit operation timeout. -// -func (f IndicesOpen) WithTimeout(v time.Duration) func(*IndicesOpenRequest) { - return func(r *IndicesOpenRequest) { - r.Timeout = v - } -} - -// WithWaitForActiveShards - sets the number of active shards to wait for before the operation returns.. -// -func (f IndicesOpen) WithWaitForActiveShards(v string) func(*IndicesOpenRequest) { - return func(r *IndicesOpenRequest) { - r.WaitForActiveShards = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesOpen) WithPretty() func(*IndicesOpenRequest) { - return func(r *IndicesOpenRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesOpen) WithHuman() func(*IndicesOpenRequest) { - return func(r *IndicesOpenRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesOpen) WithErrorTrace() func(*IndicesOpenRequest) { - return func(r *IndicesOpenRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesOpen) WithFilterPath(v ...string) func(*IndicesOpenRequest) { - return func(r *IndicesOpenRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesOpen) WithHeader(h map[string]string) func(*IndicesOpenRequest) { - return func(r *IndicesOpenRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesOpen) WithOpaqueID(s string) func(*IndicesOpenRequest) { - return func(r *IndicesOpenRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.put_alias.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.put_alias.go deleted file mode 100644 index 32338c012..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.put_alias.go +++ /dev/null @@ -1,248 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" - "time" -) - -func newIndicesPutAliasFunc(t Transport) IndicesPutAlias { - return func(index []string, name string, o ...func(*IndicesPutAliasRequest)) (*Response, error) { - var r = IndicesPutAliasRequest{Index: index, Name: name} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesPutAlias creates or updates an alias. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html. -// -type IndicesPutAlias func(index []string, name string, o ...func(*IndicesPutAliasRequest)) (*Response, error) - -// IndicesPutAliasRequest configures the Indices Put Alias API request. -// -type IndicesPutAliasRequest struct { - Index []string - - Body io.Reader - - Name string - - MasterTimeout time.Duration - Timeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesPutAliasRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - path.Grow(1 + len(strings.Join(r.Index, ",")) + 1 + len("_aliases") + 1 + len(r.Name)) - path.WriteString("/") - path.WriteString(strings.Join(r.Index, ",")) - path.WriteString("/") - path.WriteString("_aliases") - path.WriteString("/") - path.WriteString(r.Name) - - params = make(map[string]string) - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesPutAlias) WithContext(v context.Context) func(*IndicesPutAliasRequest) { - return func(r *IndicesPutAliasRequest) { - r.ctx = v - } -} - -// WithBody - The settings for the alias, such as `routing` or `filter`. -// -func (f IndicesPutAlias) WithBody(v io.Reader) func(*IndicesPutAliasRequest) { - return func(r *IndicesPutAliasRequest) { - r.Body = v - } -} - -// WithMasterTimeout - specify timeout for connection to master. -// -func (f IndicesPutAlias) WithMasterTimeout(v time.Duration) func(*IndicesPutAliasRequest) { - return func(r *IndicesPutAliasRequest) { - r.MasterTimeout = v - } -} - -// WithTimeout - explicit timestamp for the document. -// -func (f IndicesPutAlias) WithTimeout(v time.Duration) func(*IndicesPutAliasRequest) { - return func(r *IndicesPutAliasRequest) { - r.Timeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesPutAlias) WithPretty() func(*IndicesPutAliasRequest) { - return func(r *IndicesPutAliasRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesPutAlias) WithHuman() func(*IndicesPutAliasRequest) { - return func(r *IndicesPutAliasRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesPutAlias) WithErrorTrace() func(*IndicesPutAliasRequest) { - return func(r *IndicesPutAliasRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesPutAlias) WithFilterPath(v ...string) func(*IndicesPutAliasRequest) { - return func(r *IndicesPutAliasRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesPutAlias) WithHeader(h map[string]string) func(*IndicesPutAliasRequest) { - return func(r *IndicesPutAliasRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesPutAlias) WithOpaqueID(s string) func(*IndicesPutAliasRequest) { - return func(r *IndicesPutAliasRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.put_index_template.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.put_index_template.go deleted file mode 100644 index 7a5358678..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.put_index_template.go +++ /dev/null @@ -1,250 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" - "time" -) - -func newIndicesPutIndexTemplateFunc(t Transport) IndicesPutIndexTemplate { - return func(name string, body io.Reader, o ...func(*IndicesPutIndexTemplateRequest)) (*Response, error) { - var r = IndicesPutIndexTemplateRequest{Name: name, Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesPutIndexTemplate creates or updates an index template. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html. -// -type IndicesPutIndexTemplate func(name string, body io.Reader, o ...func(*IndicesPutIndexTemplateRequest)) (*Response, error) - -// IndicesPutIndexTemplateRequest configures the Indices Put Index Template API request. -// -type IndicesPutIndexTemplateRequest struct { - Body io.Reader - - Name string - - Cause string - Create *bool - MasterTimeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesPutIndexTemplateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - path.Grow(1 + len("_index_template") + 1 + len(r.Name)) - path.WriteString("/") - path.WriteString("_index_template") - path.WriteString("/") - path.WriteString(r.Name) - - params = make(map[string]string) - - if r.Cause != "" { - params["cause"] = r.Cause - } - - if r.Create != nil { - params["create"] = strconv.FormatBool(*r.Create) - } - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesPutIndexTemplate) WithContext(v context.Context) func(*IndicesPutIndexTemplateRequest) { - return func(r *IndicesPutIndexTemplateRequest) { - r.ctx = v - } -} - -// WithCause - user defined reason for creating/updating the index template. -// -func (f IndicesPutIndexTemplate) WithCause(v string) func(*IndicesPutIndexTemplateRequest) { - return func(r *IndicesPutIndexTemplateRequest) { - r.Cause = v - } -} - -// WithCreate - whether the index template should only be added if new or can also replace an existing one. -// -func (f IndicesPutIndexTemplate) WithCreate(v bool) func(*IndicesPutIndexTemplateRequest) { - return func(r *IndicesPutIndexTemplateRequest) { - r.Create = &v - } -} - -// WithMasterTimeout - specify timeout for connection to master. -// -func (f IndicesPutIndexTemplate) WithMasterTimeout(v time.Duration) func(*IndicesPutIndexTemplateRequest) { - return func(r *IndicesPutIndexTemplateRequest) { - r.MasterTimeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesPutIndexTemplate) WithPretty() func(*IndicesPutIndexTemplateRequest) { - return func(r *IndicesPutIndexTemplateRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesPutIndexTemplate) WithHuman() func(*IndicesPutIndexTemplateRequest) { - return func(r *IndicesPutIndexTemplateRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesPutIndexTemplate) WithErrorTrace() func(*IndicesPutIndexTemplateRequest) { - return func(r *IndicesPutIndexTemplateRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesPutIndexTemplate) WithFilterPath(v ...string) func(*IndicesPutIndexTemplateRequest) { - return func(r *IndicesPutIndexTemplateRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesPutIndexTemplate) WithHeader(h map[string]string) func(*IndicesPutIndexTemplateRequest) { - return func(r *IndicesPutIndexTemplateRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesPutIndexTemplate) WithOpaqueID(s string) func(*IndicesPutIndexTemplateRequest) { - return func(r *IndicesPutIndexTemplateRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.put_mapping.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.put_mapping.go deleted file mode 100644 index 1a846ff95..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.put_mapping.go +++ /dev/null @@ -1,325 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" - "time" -) - -func newIndicesPutMappingFunc(t Transport) IndicesPutMapping { - return func(body io.Reader, o ...func(*IndicesPutMappingRequest)) (*Response, error) { - var r = IndicesPutMappingRequest{Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesPutMapping updates the index mappings. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-put-mapping.html. -// -type IndicesPutMapping func(body io.Reader, o ...func(*IndicesPutMappingRequest)) (*Response, error) - -// IndicesPutMappingRequest configures the Indices Put Mapping API request. -// -type IndicesPutMappingRequest struct { - Index []string - DocumentType string - - Body io.Reader - - AllowNoIndices *bool - ExpandWildcards string - IgnoreUnavailable *bool - IncludeTypeName *bool - MasterTimeout time.Duration - Timeout time.Duration - WriteIndexOnly *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesPutMappingRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - path.Grow(len(strings.Join(r.Index, ",")) + len("/_mapping") + len(r.DocumentType) + 2) - if len(r.Index) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Index, ",")) - } - path.WriteString("/") - path.WriteString("_mapping") - if r.DocumentType != "" { - path.WriteString("/") - path.WriteString(r.DocumentType) - } - - params = make(map[string]string) - - if r.AllowNoIndices != nil { - params["allow_no_indices"] = strconv.FormatBool(*r.AllowNoIndices) - } - - if r.ExpandWildcards != "" { - params["expand_wildcards"] = r.ExpandWildcards - } - - if r.IgnoreUnavailable != nil { - params["ignore_unavailable"] = strconv.FormatBool(*r.IgnoreUnavailable) - } - - if r.IncludeTypeName != nil { - params["include_type_name"] = strconv.FormatBool(*r.IncludeTypeName) - } - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.WriteIndexOnly != nil { - params["write_index_only"] = strconv.FormatBool(*r.WriteIndexOnly) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesPutMapping) WithContext(v context.Context) func(*IndicesPutMappingRequest) { - return func(r *IndicesPutMappingRequest) { - r.ctx = v - } -} - -// WithIndex - a list of index names the mapping should be added to (supports wildcards); use `_all` or omit to add the mapping on all indices.. -// -func (f IndicesPutMapping) WithIndex(v ...string) func(*IndicesPutMappingRequest) { - return func(r *IndicesPutMappingRequest) { - r.Index = v - } -} - -// WithDocumentType - the name of the document type. -// -func (f IndicesPutMapping) WithDocumentType(v string) func(*IndicesPutMappingRequest) { - return func(r *IndicesPutMappingRequest) { - r.DocumentType = v - } -} - -// WithAllowNoIndices - whether to ignore if a wildcard indices expression resolves into no concrete indices. (this includes `_all` string or when no indices have been specified). -// -func (f IndicesPutMapping) WithAllowNoIndices(v bool) func(*IndicesPutMappingRequest) { - return func(r *IndicesPutMappingRequest) { - r.AllowNoIndices = &v - } -} - -// WithExpandWildcards - whether to expand wildcard expression to concrete indices that are open, closed or both.. -// -func (f IndicesPutMapping) WithExpandWildcards(v string) func(*IndicesPutMappingRequest) { - return func(r *IndicesPutMappingRequest) { - r.ExpandWildcards = v - } -} - -// WithIgnoreUnavailable - whether specified concrete indices should be ignored when unavailable (missing or closed). -// -func (f IndicesPutMapping) WithIgnoreUnavailable(v bool) func(*IndicesPutMappingRequest) { - return func(r *IndicesPutMappingRequest) { - r.IgnoreUnavailable = &v - } -} - -// WithIncludeTypeName - whether a type should be expected in the body of the mappings.. -// -func (f IndicesPutMapping) WithIncludeTypeName(v bool) func(*IndicesPutMappingRequest) { - return func(r *IndicesPutMappingRequest) { - r.IncludeTypeName = &v - } -} - -// WithMasterTimeout - specify timeout for connection to master. -// -func (f IndicesPutMapping) WithMasterTimeout(v time.Duration) func(*IndicesPutMappingRequest) { - return func(r *IndicesPutMappingRequest) { - r.MasterTimeout = v - } -} - -// WithTimeout - explicit operation timeout. -// -func (f IndicesPutMapping) WithTimeout(v time.Duration) func(*IndicesPutMappingRequest) { - return func(r *IndicesPutMappingRequest) { - r.Timeout = v - } -} - -// WithWriteIndexOnly - when true, applies mappings only to the write index of an alias or data stream. -// -func (f IndicesPutMapping) WithWriteIndexOnly(v bool) func(*IndicesPutMappingRequest) { - return func(r *IndicesPutMappingRequest) { - r.WriteIndexOnly = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesPutMapping) WithPretty() func(*IndicesPutMappingRequest) { - return func(r *IndicesPutMappingRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesPutMapping) WithHuman() func(*IndicesPutMappingRequest) { - return func(r *IndicesPutMappingRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesPutMapping) WithErrorTrace() func(*IndicesPutMappingRequest) { - return func(r *IndicesPutMappingRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesPutMapping) WithFilterPath(v ...string) func(*IndicesPutMappingRequest) { - return func(r *IndicesPutMappingRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesPutMapping) WithHeader(h map[string]string) func(*IndicesPutMappingRequest) { - return func(r *IndicesPutMappingRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesPutMapping) WithOpaqueID(s string) func(*IndicesPutMappingRequest) { - return func(r *IndicesPutMappingRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.put_settings.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.put_settings.go deleted file mode 100644 index b13d21af6..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.put_settings.go +++ /dev/null @@ -1,312 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" - "time" -) - -func newIndicesPutSettingsFunc(t Transport) IndicesPutSettings { - return func(body io.Reader, o ...func(*IndicesPutSettingsRequest)) (*Response, error) { - var r = IndicesPutSettingsRequest{Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesPutSettings updates the index settings. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-update-settings.html. -// -type IndicesPutSettings func(body io.Reader, o ...func(*IndicesPutSettingsRequest)) (*Response, error) - -// IndicesPutSettingsRequest configures the Indices Put Settings API request. -// -type IndicesPutSettingsRequest struct { - Index []string - - Body io.Reader - - AllowNoIndices *bool - ExpandWildcards string - FlatSettings *bool - IgnoreUnavailable *bool - MasterTimeout time.Duration - PreserveExisting *bool - Timeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesPutSettingsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - path.Grow(1 + len(strings.Join(r.Index, ",")) + 1 + len("_settings")) - if len(r.Index) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Index, ",")) - } - path.WriteString("/") - path.WriteString("_settings") - - params = make(map[string]string) - - if r.AllowNoIndices != nil { - params["allow_no_indices"] = strconv.FormatBool(*r.AllowNoIndices) - } - - if r.ExpandWildcards != "" { - params["expand_wildcards"] = r.ExpandWildcards - } - - if r.FlatSettings != nil { - params["flat_settings"] = strconv.FormatBool(*r.FlatSettings) - } - - if r.IgnoreUnavailable != nil { - params["ignore_unavailable"] = strconv.FormatBool(*r.IgnoreUnavailable) - } - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.PreserveExisting != nil { - params["preserve_existing"] = strconv.FormatBool(*r.PreserveExisting) - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesPutSettings) WithContext(v context.Context) func(*IndicesPutSettingsRequest) { - return func(r *IndicesPutSettingsRequest) { - r.ctx = v - } -} - -// WithIndex - a list of index names; use _all to perform the operation on all indices. -// -func (f IndicesPutSettings) WithIndex(v ...string) func(*IndicesPutSettingsRequest) { - return func(r *IndicesPutSettingsRequest) { - r.Index = v - } -} - -// WithAllowNoIndices - whether to ignore if a wildcard indices expression resolves into no concrete indices. (this includes `_all` string or when no indices have been specified). -// -func (f IndicesPutSettings) WithAllowNoIndices(v bool) func(*IndicesPutSettingsRequest) { - return func(r *IndicesPutSettingsRequest) { - r.AllowNoIndices = &v - } -} - -// WithExpandWildcards - whether to expand wildcard expression to concrete indices that are open, closed or both.. -// -func (f IndicesPutSettings) WithExpandWildcards(v string) func(*IndicesPutSettingsRequest) { - return func(r *IndicesPutSettingsRequest) { - r.ExpandWildcards = v - } -} - -// WithFlatSettings - return settings in flat format (default: false). -// -func (f IndicesPutSettings) WithFlatSettings(v bool) func(*IndicesPutSettingsRequest) { - return func(r *IndicesPutSettingsRequest) { - r.FlatSettings = &v - } -} - -// WithIgnoreUnavailable - whether specified concrete indices should be ignored when unavailable (missing or closed). -// -func (f IndicesPutSettings) WithIgnoreUnavailable(v bool) func(*IndicesPutSettingsRequest) { - return func(r *IndicesPutSettingsRequest) { - r.IgnoreUnavailable = &v - } -} - -// WithMasterTimeout - specify timeout for connection to master. -// -func (f IndicesPutSettings) WithMasterTimeout(v time.Duration) func(*IndicesPutSettingsRequest) { - return func(r *IndicesPutSettingsRequest) { - r.MasterTimeout = v - } -} - -// WithPreserveExisting - whether to update existing settings. if set to `true` existing settings on an index remain unchanged, the default is `false`. -// -func (f IndicesPutSettings) WithPreserveExisting(v bool) func(*IndicesPutSettingsRequest) { - return func(r *IndicesPutSettingsRequest) { - r.PreserveExisting = &v - } -} - -// WithTimeout - explicit operation timeout. -// -func (f IndicesPutSettings) WithTimeout(v time.Duration) func(*IndicesPutSettingsRequest) { - return func(r *IndicesPutSettingsRequest) { - r.Timeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesPutSettings) WithPretty() func(*IndicesPutSettingsRequest) { - return func(r *IndicesPutSettingsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesPutSettings) WithHuman() func(*IndicesPutSettingsRequest) { - return func(r *IndicesPutSettingsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesPutSettings) WithErrorTrace() func(*IndicesPutSettingsRequest) { - return func(r *IndicesPutSettingsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesPutSettings) WithFilterPath(v ...string) func(*IndicesPutSettingsRequest) { - return func(r *IndicesPutSettingsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesPutSettings) WithHeader(h map[string]string) func(*IndicesPutSettingsRequest) { - return func(r *IndicesPutSettingsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesPutSettings) WithOpaqueID(s string) func(*IndicesPutSettingsRequest) { - return func(r *IndicesPutSettingsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.put_template.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.put_template.go deleted file mode 100644 index 6ce9983a1..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.put_template.go +++ /dev/null @@ -1,263 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" - "time" -) - -func newIndicesPutTemplateFunc(t Transport) IndicesPutTemplate { - return func(name string, body io.Reader, o ...func(*IndicesPutTemplateRequest)) (*Response, error) { - var r = IndicesPutTemplateRequest{Name: name, Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesPutTemplate creates or updates an index template. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html. -// -type IndicesPutTemplate func(name string, body io.Reader, o ...func(*IndicesPutTemplateRequest)) (*Response, error) - -// IndicesPutTemplateRequest configures the Indices Put Template API request. -// -type IndicesPutTemplateRequest struct { - Body io.Reader - - Name string - - Create *bool - IncludeTypeName *bool - MasterTimeout time.Duration - Order *int - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesPutTemplateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - path.Grow(1 + len("_template") + 1 + len(r.Name)) - path.WriteString("/") - path.WriteString("_template") - path.WriteString("/") - path.WriteString(r.Name) - - params = make(map[string]string) - - if r.Create != nil { - params["create"] = strconv.FormatBool(*r.Create) - } - - if r.IncludeTypeName != nil { - params["include_type_name"] = strconv.FormatBool(*r.IncludeTypeName) - } - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Order != nil { - params["order"] = strconv.FormatInt(int64(*r.Order), 10) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesPutTemplate) WithContext(v context.Context) func(*IndicesPutTemplateRequest) { - return func(r *IndicesPutTemplateRequest) { - r.ctx = v - } -} - -// WithCreate - whether the index template should only be added if new or can also replace an existing one. -// -func (f IndicesPutTemplate) WithCreate(v bool) func(*IndicesPutTemplateRequest) { - return func(r *IndicesPutTemplateRequest) { - r.Create = &v - } -} - -// WithIncludeTypeName - whether a type should be returned in the body of the mappings.. -// -func (f IndicesPutTemplate) WithIncludeTypeName(v bool) func(*IndicesPutTemplateRequest) { - return func(r *IndicesPutTemplateRequest) { - r.IncludeTypeName = &v - } -} - -// WithMasterTimeout - specify timeout for connection to master. -// -func (f IndicesPutTemplate) WithMasterTimeout(v time.Duration) func(*IndicesPutTemplateRequest) { - return func(r *IndicesPutTemplateRequest) { - r.MasterTimeout = v - } -} - -// WithOrder - the order for this template when merging multiple matching ones (higher numbers are merged later, overriding the lower numbers). -// -func (f IndicesPutTemplate) WithOrder(v int) func(*IndicesPutTemplateRequest) { - return func(r *IndicesPutTemplateRequest) { - r.Order = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesPutTemplate) WithPretty() func(*IndicesPutTemplateRequest) { - return func(r *IndicesPutTemplateRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesPutTemplate) WithHuman() func(*IndicesPutTemplateRequest) { - return func(r *IndicesPutTemplateRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesPutTemplate) WithErrorTrace() func(*IndicesPutTemplateRequest) { - return func(r *IndicesPutTemplateRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesPutTemplate) WithFilterPath(v ...string) func(*IndicesPutTemplateRequest) { - return func(r *IndicesPutTemplateRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesPutTemplate) WithHeader(h map[string]string) func(*IndicesPutTemplateRequest) { - return func(r *IndicesPutTemplateRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesPutTemplate) WithOpaqueID(s string) func(*IndicesPutTemplateRequest) { - return func(r *IndicesPutTemplateRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.recovery.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.recovery.go deleted file mode 100644 index 2627be56c..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.recovery.go +++ /dev/null @@ -1,239 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newIndicesRecoveryFunc(t Transport) IndicesRecovery { - return func(o ...func(*IndicesRecoveryRequest)) (*Response, error) { - var r = IndicesRecoveryRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesRecovery returns information about ongoing index shard recoveries. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-recovery.html. -// -type IndicesRecovery func(o ...func(*IndicesRecoveryRequest)) (*Response, error) - -// IndicesRecoveryRequest configures the Indices Recovery API request. -// -type IndicesRecoveryRequest struct { - Index []string - - ActiveOnly *bool - Detailed *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesRecoveryRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len(strings.Join(r.Index, ",")) + 1 + len("_recovery")) - if len(r.Index) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Index, ",")) - } - path.WriteString("/") - path.WriteString("_recovery") - - params = make(map[string]string) - - if r.ActiveOnly != nil { - params["active_only"] = strconv.FormatBool(*r.ActiveOnly) - } - - if r.Detailed != nil { - params["detailed"] = strconv.FormatBool(*r.Detailed) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesRecovery) WithContext(v context.Context) func(*IndicesRecoveryRequest) { - return func(r *IndicesRecoveryRequest) { - r.ctx = v - } -} - -// WithIndex - a list of index names; use _all to perform the operation on all indices. -// -func (f IndicesRecovery) WithIndex(v ...string) func(*IndicesRecoveryRequest) { - return func(r *IndicesRecoveryRequest) { - r.Index = v - } -} - -// WithActiveOnly - display only those recoveries that are currently on-going. -// -func (f IndicesRecovery) WithActiveOnly(v bool) func(*IndicesRecoveryRequest) { - return func(r *IndicesRecoveryRequest) { - r.ActiveOnly = &v - } -} - -// WithDetailed - whether to display detailed information about shard recovery. -// -func (f IndicesRecovery) WithDetailed(v bool) func(*IndicesRecoveryRequest) { - return func(r *IndicesRecoveryRequest) { - r.Detailed = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesRecovery) WithPretty() func(*IndicesRecoveryRequest) { - return func(r *IndicesRecoveryRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesRecovery) WithHuman() func(*IndicesRecoveryRequest) { - return func(r *IndicesRecoveryRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesRecovery) WithErrorTrace() func(*IndicesRecoveryRequest) { - return func(r *IndicesRecoveryRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesRecovery) WithFilterPath(v ...string) func(*IndicesRecoveryRequest) { - return func(r *IndicesRecoveryRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesRecovery) WithHeader(h map[string]string) func(*IndicesRecoveryRequest) { - return func(r *IndicesRecoveryRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesRecovery) WithOpaqueID(s string) func(*IndicesRecoveryRequest) { - return func(r *IndicesRecoveryRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.refresh.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.refresh.go deleted file mode 100644 index 913d7b2f6..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.refresh.go +++ /dev/null @@ -1,252 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newIndicesRefreshFunc(t Transport) IndicesRefresh { - return func(o ...func(*IndicesRefreshRequest)) (*Response, error) { - var r = IndicesRefreshRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesRefresh performs the refresh operation in one or more indices. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-refresh.html. -// -type IndicesRefresh func(o ...func(*IndicesRefreshRequest)) (*Response, error) - -// IndicesRefreshRequest configures the Indices Refresh API request. -// -type IndicesRefreshRequest struct { - Index []string - - AllowNoIndices *bool - ExpandWildcards string - IgnoreUnavailable *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesRefreshRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len(strings.Join(r.Index, ",")) + 1 + len("_refresh")) - if len(r.Index) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Index, ",")) - } - path.WriteString("/") - path.WriteString("_refresh") - - params = make(map[string]string) - - if r.AllowNoIndices != nil { - params["allow_no_indices"] = strconv.FormatBool(*r.AllowNoIndices) - } - - if r.ExpandWildcards != "" { - params["expand_wildcards"] = r.ExpandWildcards - } - - if r.IgnoreUnavailable != nil { - params["ignore_unavailable"] = strconv.FormatBool(*r.IgnoreUnavailable) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesRefresh) WithContext(v context.Context) func(*IndicesRefreshRequest) { - return func(r *IndicesRefreshRequest) { - r.ctx = v - } -} - -// WithIndex - a list of index names; use _all to perform the operation on all indices. -// -func (f IndicesRefresh) WithIndex(v ...string) func(*IndicesRefreshRequest) { - return func(r *IndicesRefreshRequest) { - r.Index = v - } -} - -// WithAllowNoIndices - whether to ignore if a wildcard indices expression resolves into no concrete indices. (this includes `_all` string or when no indices have been specified). -// -func (f IndicesRefresh) WithAllowNoIndices(v bool) func(*IndicesRefreshRequest) { - return func(r *IndicesRefreshRequest) { - r.AllowNoIndices = &v - } -} - -// WithExpandWildcards - whether to expand wildcard expression to concrete indices that are open, closed or both.. -// -func (f IndicesRefresh) WithExpandWildcards(v string) func(*IndicesRefreshRequest) { - return func(r *IndicesRefreshRequest) { - r.ExpandWildcards = v - } -} - -// WithIgnoreUnavailable - whether specified concrete indices should be ignored when unavailable (missing or closed). -// -func (f IndicesRefresh) WithIgnoreUnavailable(v bool) func(*IndicesRefreshRequest) { - return func(r *IndicesRefreshRequest) { - r.IgnoreUnavailable = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesRefresh) WithPretty() func(*IndicesRefreshRequest) { - return func(r *IndicesRefreshRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesRefresh) WithHuman() func(*IndicesRefreshRequest) { - return func(r *IndicesRefreshRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesRefresh) WithErrorTrace() func(*IndicesRefreshRequest) { - return func(r *IndicesRefreshRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesRefresh) WithFilterPath(v ...string) func(*IndicesRefreshRequest) { - return func(r *IndicesRefreshRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesRefresh) WithHeader(h map[string]string) func(*IndicesRefreshRequest) { - return func(r *IndicesRefreshRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesRefresh) WithOpaqueID(s string) func(*IndicesRefreshRequest) { - return func(r *IndicesRefreshRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.resolve_index.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.resolve_index.go deleted file mode 100644 index 9dde605f8..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.resolve_index.go +++ /dev/null @@ -1,219 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newIndicesResolveIndexFunc(t Transport) IndicesResolveIndex { - return func(name []string, o ...func(*IndicesResolveIndexRequest)) (*Response, error) { - var r = IndicesResolveIndexRequest{Name: name} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesResolveIndex returns information about any matching indices, aliases, and data streams -// -// This API is experimental. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-resolve-index-api.html. -// -type IndicesResolveIndex func(name []string, o ...func(*IndicesResolveIndexRequest)) (*Response, error) - -// IndicesResolveIndexRequest configures the Indices Resolve Index API request. -// -type IndicesResolveIndexRequest struct { - Name []string - - ExpandWildcards string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesResolveIndexRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_resolve") + 1 + len("index") + 1 + len(strings.Join(r.Name, ","))) - path.WriteString("/") - path.WriteString("_resolve") - path.WriteString("/") - path.WriteString("index") - path.WriteString("/") - path.WriteString(strings.Join(r.Name, ",")) - - params = make(map[string]string) - - if r.ExpandWildcards != "" { - params["expand_wildcards"] = r.ExpandWildcards - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesResolveIndex) WithContext(v context.Context) func(*IndicesResolveIndexRequest) { - return func(r *IndicesResolveIndexRequest) { - r.ctx = v - } -} - -// WithExpandWildcards - whether wildcard expressions should get expanded to open or closed indices (default: open). -// -func (f IndicesResolveIndex) WithExpandWildcards(v string) func(*IndicesResolveIndexRequest) { - return func(r *IndicesResolveIndexRequest) { - r.ExpandWildcards = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesResolveIndex) WithPretty() func(*IndicesResolveIndexRequest) { - return func(r *IndicesResolveIndexRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesResolveIndex) WithHuman() func(*IndicesResolveIndexRequest) { - return func(r *IndicesResolveIndexRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesResolveIndex) WithErrorTrace() func(*IndicesResolveIndexRequest) { - return func(r *IndicesResolveIndexRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesResolveIndex) WithFilterPath(v ...string) func(*IndicesResolveIndexRequest) { - return func(r *IndicesResolveIndexRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesResolveIndex) WithHeader(h map[string]string) func(*IndicesResolveIndexRequest) { - return func(r *IndicesResolveIndexRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesResolveIndex) WithOpaqueID(s string) func(*IndicesResolveIndexRequest) { - return func(r *IndicesResolveIndexRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.rollover.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.rollover.go deleted file mode 100644 index 07c1a3bc5..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.rollover.go +++ /dev/null @@ -1,298 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" - "time" -) - -func newIndicesRolloverFunc(t Transport) IndicesRollover { - return func(alias string, o ...func(*IndicesRolloverRequest)) (*Response, error) { - var r = IndicesRolloverRequest{Alias: alias} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesRollover updates an alias to point to a new index when the existing index -// is considered to be too large or too old. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-rollover-index.html. -// -type IndicesRollover func(alias string, o ...func(*IndicesRolloverRequest)) (*Response, error) - -// IndicesRolloverRequest configures the Indices Rollover API request. -// -type IndicesRolloverRequest struct { - Body io.Reader - - Alias string - NewIndex string - - DryRun *bool - IncludeTypeName *bool - MasterTimeout time.Duration - Timeout time.Duration - WaitForActiveShards string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesRolloverRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len(r.Alias) + 1 + len("_rollover") + 1 + len(r.NewIndex)) - path.WriteString("/") - path.WriteString(r.Alias) - path.WriteString("/") - path.WriteString("_rollover") - if r.NewIndex != "" { - path.WriteString("/") - path.WriteString(r.NewIndex) - } - - params = make(map[string]string) - - if r.DryRun != nil { - params["dry_run"] = strconv.FormatBool(*r.DryRun) - } - - if r.IncludeTypeName != nil { - params["include_type_name"] = strconv.FormatBool(*r.IncludeTypeName) - } - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.WaitForActiveShards != "" { - params["wait_for_active_shards"] = r.WaitForActiveShards - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesRollover) WithContext(v context.Context) func(*IndicesRolloverRequest) { - return func(r *IndicesRolloverRequest) { - r.ctx = v - } -} - -// WithBody - The conditions that needs to be met for executing rollover. -// -func (f IndicesRollover) WithBody(v io.Reader) func(*IndicesRolloverRequest) { - return func(r *IndicesRolloverRequest) { - r.Body = v - } -} - -// WithNewIndex - the name of the rollover index. -// -func (f IndicesRollover) WithNewIndex(v string) func(*IndicesRolloverRequest) { - return func(r *IndicesRolloverRequest) { - r.NewIndex = v - } -} - -// WithDryRun - if set to true the rollover action will only be validated but not actually performed even if a condition matches. the default is false. -// -func (f IndicesRollover) WithDryRun(v bool) func(*IndicesRolloverRequest) { - return func(r *IndicesRolloverRequest) { - r.DryRun = &v - } -} - -// WithIncludeTypeName - whether a type should be included in the body of the mappings.. -// -func (f IndicesRollover) WithIncludeTypeName(v bool) func(*IndicesRolloverRequest) { - return func(r *IndicesRolloverRequest) { - r.IncludeTypeName = &v - } -} - -// WithMasterTimeout - specify timeout for connection to master. -// -func (f IndicesRollover) WithMasterTimeout(v time.Duration) func(*IndicesRolloverRequest) { - return func(r *IndicesRolloverRequest) { - r.MasterTimeout = v - } -} - -// WithTimeout - explicit operation timeout. -// -func (f IndicesRollover) WithTimeout(v time.Duration) func(*IndicesRolloverRequest) { - return func(r *IndicesRolloverRequest) { - r.Timeout = v - } -} - -// WithWaitForActiveShards - set the number of active shards to wait for on the newly created rollover index before the operation returns.. -// -func (f IndicesRollover) WithWaitForActiveShards(v string) func(*IndicesRolloverRequest) { - return func(r *IndicesRolloverRequest) { - r.WaitForActiveShards = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesRollover) WithPretty() func(*IndicesRolloverRequest) { - return func(r *IndicesRolloverRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesRollover) WithHuman() func(*IndicesRolloverRequest) { - return func(r *IndicesRolloverRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesRollover) WithErrorTrace() func(*IndicesRolloverRequest) { - return func(r *IndicesRolloverRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesRollover) WithFilterPath(v ...string) func(*IndicesRolloverRequest) { - return func(r *IndicesRolloverRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesRollover) WithHeader(h map[string]string) func(*IndicesRolloverRequest) { - return func(r *IndicesRolloverRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesRollover) WithOpaqueID(s string) func(*IndicesRolloverRequest) { - return func(r *IndicesRolloverRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.segments.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.segments.go deleted file mode 100644 index 9e1cbdd4d..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.segments.go +++ /dev/null @@ -1,265 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newIndicesSegmentsFunc(t Transport) IndicesSegments { - return func(o ...func(*IndicesSegmentsRequest)) (*Response, error) { - var r = IndicesSegmentsRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesSegments provides low-level information about segments in a Lucene index. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-segments.html. -// -type IndicesSegments func(o ...func(*IndicesSegmentsRequest)) (*Response, error) - -// IndicesSegmentsRequest configures the Indices Segments API request. -// -type IndicesSegmentsRequest struct { - Index []string - - AllowNoIndices *bool - ExpandWildcards string - IgnoreUnavailable *bool - Verbose *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesSegmentsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len(strings.Join(r.Index, ",")) + 1 + len("_segments")) - if len(r.Index) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Index, ",")) - } - path.WriteString("/") - path.WriteString("_segments") - - params = make(map[string]string) - - if r.AllowNoIndices != nil { - params["allow_no_indices"] = strconv.FormatBool(*r.AllowNoIndices) - } - - if r.ExpandWildcards != "" { - params["expand_wildcards"] = r.ExpandWildcards - } - - if r.IgnoreUnavailable != nil { - params["ignore_unavailable"] = strconv.FormatBool(*r.IgnoreUnavailable) - } - - if r.Verbose != nil { - params["verbose"] = strconv.FormatBool(*r.Verbose) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesSegments) WithContext(v context.Context) func(*IndicesSegmentsRequest) { - return func(r *IndicesSegmentsRequest) { - r.ctx = v - } -} - -// WithIndex - a list of index names; use _all to perform the operation on all indices. -// -func (f IndicesSegments) WithIndex(v ...string) func(*IndicesSegmentsRequest) { - return func(r *IndicesSegmentsRequest) { - r.Index = v - } -} - -// WithAllowNoIndices - whether to ignore if a wildcard indices expression resolves into no concrete indices. (this includes `_all` string or when no indices have been specified). -// -func (f IndicesSegments) WithAllowNoIndices(v bool) func(*IndicesSegmentsRequest) { - return func(r *IndicesSegmentsRequest) { - r.AllowNoIndices = &v - } -} - -// WithExpandWildcards - whether to expand wildcard expression to concrete indices that are open, closed or both.. -// -func (f IndicesSegments) WithExpandWildcards(v string) func(*IndicesSegmentsRequest) { - return func(r *IndicesSegmentsRequest) { - r.ExpandWildcards = v - } -} - -// WithIgnoreUnavailable - whether specified concrete indices should be ignored when unavailable (missing or closed). -// -func (f IndicesSegments) WithIgnoreUnavailable(v bool) func(*IndicesSegmentsRequest) { - return func(r *IndicesSegmentsRequest) { - r.IgnoreUnavailable = &v - } -} - -// WithVerbose - includes detailed memory usage by lucene.. -// -func (f IndicesSegments) WithVerbose(v bool) func(*IndicesSegmentsRequest) { - return func(r *IndicesSegmentsRequest) { - r.Verbose = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesSegments) WithPretty() func(*IndicesSegmentsRequest) { - return func(r *IndicesSegmentsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesSegments) WithHuman() func(*IndicesSegmentsRequest) { - return func(r *IndicesSegmentsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesSegments) WithErrorTrace() func(*IndicesSegmentsRequest) { - return func(r *IndicesSegmentsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesSegments) WithFilterPath(v ...string) func(*IndicesSegmentsRequest) { - return func(r *IndicesSegmentsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesSegments) WithHeader(h map[string]string) func(*IndicesSegmentsRequest) { - return func(r *IndicesSegmentsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesSegments) WithOpaqueID(s string) func(*IndicesSegmentsRequest) { - return func(r *IndicesSegmentsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.shard_stores.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.shard_stores.go deleted file mode 100644 index b409a966a..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.shard_stores.go +++ /dev/null @@ -1,265 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newIndicesShardStoresFunc(t Transport) IndicesShardStores { - return func(o ...func(*IndicesShardStoresRequest)) (*Response, error) { - var r = IndicesShardStoresRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesShardStores provides store information for shard copies of indices. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-shards-stores.html. -// -type IndicesShardStores func(o ...func(*IndicesShardStoresRequest)) (*Response, error) - -// IndicesShardStoresRequest configures the Indices Shard Stores API request. -// -type IndicesShardStoresRequest struct { - Index []string - - AllowNoIndices *bool - ExpandWildcards string - IgnoreUnavailable *bool - Status []string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesShardStoresRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len(strings.Join(r.Index, ",")) + 1 + len("_shard_stores")) - if len(r.Index) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Index, ",")) - } - path.WriteString("/") - path.WriteString("_shard_stores") - - params = make(map[string]string) - - if r.AllowNoIndices != nil { - params["allow_no_indices"] = strconv.FormatBool(*r.AllowNoIndices) - } - - if r.ExpandWildcards != "" { - params["expand_wildcards"] = r.ExpandWildcards - } - - if r.IgnoreUnavailable != nil { - params["ignore_unavailable"] = strconv.FormatBool(*r.IgnoreUnavailable) - } - - if len(r.Status) > 0 { - params["status"] = strings.Join(r.Status, ",") - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesShardStores) WithContext(v context.Context) func(*IndicesShardStoresRequest) { - return func(r *IndicesShardStoresRequest) { - r.ctx = v - } -} - -// WithIndex - a list of index names; use _all to perform the operation on all indices. -// -func (f IndicesShardStores) WithIndex(v ...string) func(*IndicesShardStoresRequest) { - return func(r *IndicesShardStoresRequest) { - r.Index = v - } -} - -// WithAllowNoIndices - whether to ignore if a wildcard indices expression resolves into no concrete indices. (this includes `_all` string or when no indices have been specified). -// -func (f IndicesShardStores) WithAllowNoIndices(v bool) func(*IndicesShardStoresRequest) { - return func(r *IndicesShardStoresRequest) { - r.AllowNoIndices = &v - } -} - -// WithExpandWildcards - whether to expand wildcard expression to concrete indices that are open, closed or both.. -// -func (f IndicesShardStores) WithExpandWildcards(v string) func(*IndicesShardStoresRequest) { - return func(r *IndicesShardStoresRequest) { - r.ExpandWildcards = v - } -} - -// WithIgnoreUnavailable - whether specified concrete indices should be ignored when unavailable (missing or closed). -// -func (f IndicesShardStores) WithIgnoreUnavailable(v bool) func(*IndicesShardStoresRequest) { - return func(r *IndicesShardStoresRequest) { - r.IgnoreUnavailable = &v - } -} - -// WithStatus - a list of statuses used to filter on shards to get store information for. -// -func (f IndicesShardStores) WithStatus(v ...string) func(*IndicesShardStoresRequest) { - return func(r *IndicesShardStoresRequest) { - r.Status = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesShardStores) WithPretty() func(*IndicesShardStoresRequest) { - return func(r *IndicesShardStoresRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesShardStores) WithHuman() func(*IndicesShardStoresRequest) { - return func(r *IndicesShardStoresRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesShardStores) WithErrorTrace() func(*IndicesShardStoresRequest) { - return func(r *IndicesShardStoresRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesShardStores) WithFilterPath(v ...string) func(*IndicesShardStoresRequest) { - return func(r *IndicesShardStoresRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesShardStores) WithHeader(h map[string]string) func(*IndicesShardStoresRequest) { - return func(r *IndicesShardStoresRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesShardStores) WithOpaqueID(s string) func(*IndicesShardStoresRequest) { - return func(r *IndicesShardStoresRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.shrink.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.shrink.go deleted file mode 100644 index 6fd1036ad..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.shrink.go +++ /dev/null @@ -1,275 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" - "time" -) - -func newIndicesShrinkFunc(t Transport) IndicesShrink { - return func(index string, target string, o ...func(*IndicesShrinkRequest)) (*Response, error) { - var r = IndicesShrinkRequest{Index: index, Target: target} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesShrink allow to shrink an existing index into a new index with fewer primary shards. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-shrink-index.html. -// -type IndicesShrink func(index string, target string, o ...func(*IndicesShrinkRequest)) (*Response, error) - -// IndicesShrinkRequest configures the Indices Shrink API request. -// -type IndicesShrinkRequest struct { - Index string - - Body io.Reader - - Target string - - CopySettings *bool - MasterTimeout time.Duration - Timeout time.Duration - WaitForActiveShards string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesShrinkRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - path.Grow(1 + len(r.Index) + 1 + len("_shrink") + 1 + len(r.Target)) - path.WriteString("/") - path.WriteString(r.Index) - path.WriteString("/") - path.WriteString("_shrink") - path.WriteString("/") - path.WriteString(r.Target) - - params = make(map[string]string) - - if r.CopySettings != nil { - params["copy_settings"] = strconv.FormatBool(*r.CopySettings) - } - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.WaitForActiveShards != "" { - params["wait_for_active_shards"] = r.WaitForActiveShards - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesShrink) WithContext(v context.Context) func(*IndicesShrinkRequest) { - return func(r *IndicesShrinkRequest) { - r.ctx = v - } -} - -// WithBody - The configuration for the target index (`settings` and `aliases`). -// -func (f IndicesShrink) WithBody(v io.Reader) func(*IndicesShrinkRequest) { - return func(r *IndicesShrinkRequest) { - r.Body = v - } -} - -// WithCopySettings - whether or not to copy settings from the source index (defaults to false). -// -func (f IndicesShrink) WithCopySettings(v bool) func(*IndicesShrinkRequest) { - return func(r *IndicesShrinkRequest) { - r.CopySettings = &v - } -} - -// WithMasterTimeout - specify timeout for connection to master. -// -func (f IndicesShrink) WithMasterTimeout(v time.Duration) func(*IndicesShrinkRequest) { - return func(r *IndicesShrinkRequest) { - r.MasterTimeout = v - } -} - -// WithTimeout - explicit operation timeout. -// -func (f IndicesShrink) WithTimeout(v time.Duration) func(*IndicesShrinkRequest) { - return func(r *IndicesShrinkRequest) { - r.Timeout = v - } -} - -// WithWaitForActiveShards - set the number of active shards to wait for on the shrunken index before the operation returns.. -// -func (f IndicesShrink) WithWaitForActiveShards(v string) func(*IndicesShrinkRequest) { - return func(r *IndicesShrinkRequest) { - r.WaitForActiveShards = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesShrink) WithPretty() func(*IndicesShrinkRequest) { - return func(r *IndicesShrinkRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesShrink) WithHuman() func(*IndicesShrinkRequest) { - return func(r *IndicesShrinkRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesShrink) WithErrorTrace() func(*IndicesShrinkRequest) { - return func(r *IndicesShrinkRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesShrink) WithFilterPath(v ...string) func(*IndicesShrinkRequest) { - return func(r *IndicesShrinkRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesShrink) WithHeader(h map[string]string) func(*IndicesShrinkRequest) { - return func(r *IndicesShrinkRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesShrink) WithOpaqueID(s string) func(*IndicesShrinkRequest) { - return func(r *IndicesShrinkRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.simulate_index_template.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.simulate_index_template.go deleted file mode 100644 index 9992948d2..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.simulate_index_template.go +++ /dev/null @@ -1,260 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" - "time" -) - -func newIndicesSimulateIndexTemplateFunc(t Transport) IndicesSimulateIndexTemplate { - return func(name string, o ...func(*IndicesSimulateIndexTemplateRequest)) (*Response, error) { - var r = IndicesSimulateIndexTemplateRequest{Name: name} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesSimulateIndexTemplate simulate matching the given index name against the index templates in the system -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html. -// -type IndicesSimulateIndexTemplate func(name string, o ...func(*IndicesSimulateIndexTemplateRequest)) (*Response, error) - -// IndicesSimulateIndexTemplateRequest configures the Indices Simulate Index Template API request. -// -type IndicesSimulateIndexTemplateRequest struct { - Body io.Reader - - Name string - - Cause string - Create *bool - MasterTimeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesSimulateIndexTemplateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_index_template") + 1 + len("_simulate_index") + 1 + len(r.Name)) - path.WriteString("/") - path.WriteString("_index_template") - path.WriteString("/") - path.WriteString("_simulate_index") - path.WriteString("/") - path.WriteString(r.Name) - - params = make(map[string]string) - - if r.Cause != "" { - params["cause"] = r.Cause - } - - if r.Create != nil { - params["create"] = strconv.FormatBool(*r.Create) - } - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesSimulateIndexTemplate) WithContext(v context.Context) func(*IndicesSimulateIndexTemplateRequest) { - return func(r *IndicesSimulateIndexTemplateRequest) { - r.ctx = v - } -} - -// WithBody - New index template definition, which will be included in the simulation, as if it already exists in the system. -// -func (f IndicesSimulateIndexTemplate) WithBody(v io.Reader) func(*IndicesSimulateIndexTemplateRequest) { - return func(r *IndicesSimulateIndexTemplateRequest) { - r.Body = v - } -} - -// WithCause - user defined reason for dry-run creating the new template for simulation purposes. -// -func (f IndicesSimulateIndexTemplate) WithCause(v string) func(*IndicesSimulateIndexTemplateRequest) { - return func(r *IndicesSimulateIndexTemplateRequest) { - r.Cause = v - } -} - -// WithCreate - whether the index template we optionally defined in the body should only be dry-run added if new or can also replace an existing one. -// -func (f IndicesSimulateIndexTemplate) WithCreate(v bool) func(*IndicesSimulateIndexTemplateRequest) { - return func(r *IndicesSimulateIndexTemplateRequest) { - r.Create = &v - } -} - -// WithMasterTimeout - specify timeout for connection to master. -// -func (f IndicesSimulateIndexTemplate) WithMasterTimeout(v time.Duration) func(*IndicesSimulateIndexTemplateRequest) { - return func(r *IndicesSimulateIndexTemplateRequest) { - r.MasterTimeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesSimulateIndexTemplate) WithPretty() func(*IndicesSimulateIndexTemplateRequest) { - return func(r *IndicesSimulateIndexTemplateRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesSimulateIndexTemplate) WithHuman() func(*IndicesSimulateIndexTemplateRequest) { - return func(r *IndicesSimulateIndexTemplateRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesSimulateIndexTemplate) WithErrorTrace() func(*IndicesSimulateIndexTemplateRequest) { - return func(r *IndicesSimulateIndexTemplateRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesSimulateIndexTemplate) WithFilterPath(v ...string) func(*IndicesSimulateIndexTemplateRequest) { - return func(r *IndicesSimulateIndexTemplateRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesSimulateIndexTemplate) WithHeader(h map[string]string) func(*IndicesSimulateIndexTemplateRequest) { - return func(r *IndicesSimulateIndexTemplateRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesSimulateIndexTemplate) WithOpaqueID(s string) func(*IndicesSimulateIndexTemplateRequest) { - return func(r *IndicesSimulateIndexTemplateRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.simulate_template.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.simulate_template.go deleted file mode 100644 index 041697c41..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.simulate_template.go +++ /dev/null @@ -1,270 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" - "time" -) - -func newIndicesSimulateTemplateFunc(t Transport) IndicesSimulateTemplate { - return func(o ...func(*IndicesSimulateTemplateRequest)) (*Response, error) { - var r = IndicesSimulateTemplateRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesSimulateTemplate simulate resolving the given template name or body -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html. -// -type IndicesSimulateTemplate func(o ...func(*IndicesSimulateTemplateRequest)) (*Response, error) - -// IndicesSimulateTemplateRequest configures the Indices Simulate Template API request. -// -type IndicesSimulateTemplateRequest struct { - Body io.Reader - - Name string - - Cause string - Create *bool - MasterTimeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesSimulateTemplateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_index_template") + 1 + len("_simulate") + 1 + len(r.Name)) - path.WriteString("/") - path.WriteString("_index_template") - path.WriteString("/") - path.WriteString("_simulate") - if r.Name != "" { - path.WriteString("/") - path.WriteString(r.Name) - } - - params = make(map[string]string) - - if r.Cause != "" { - params["cause"] = r.Cause - } - - if r.Create != nil { - params["create"] = strconv.FormatBool(*r.Create) - } - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesSimulateTemplate) WithContext(v context.Context) func(*IndicesSimulateTemplateRequest) { - return func(r *IndicesSimulateTemplateRequest) { - r.ctx = v - } -} - -// WithBody - New index template definition to be simulated, if no index template name is specified. -// -func (f IndicesSimulateTemplate) WithBody(v io.Reader) func(*IndicesSimulateTemplateRequest) { - return func(r *IndicesSimulateTemplateRequest) { - r.Body = v - } -} - -// WithName - the name of the index template. -// -func (f IndicesSimulateTemplate) WithName(v string) func(*IndicesSimulateTemplateRequest) { - return func(r *IndicesSimulateTemplateRequest) { - r.Name = v - } -} - -// WithCause - user defined reason for dry-run creating the new template for simulation purposes. -// -func (f IndicesSimulateTemplate) WithCause(v string) func(*IndicesSimulateTemplateRequest) { - return func(r *IndicesSimulateTemplateRequest) { - r.Cause = v - } -} - -// WithCreate - whether the index template we optionally defined in the body should only be dry-run added if new or can also replace an existing one. -// -func (f IndicesSimulateTemplate) WithCreate(v bool) func(*IndicesSimulateTemplateRequest) { - return func(r *IndicesSimulateTemplateRequest) { - r.Create = &v - } -} - -// WithMasterTimeout - specify timeout for connection to master. -// -func (f IndicesSimulateTemplate) WithMasterTimeout(v time.Duration) func(*IndicesSimulateTemplateRequest) { - return func(r *IndicesSimulateTemplateRequest) { - r.MasterTimeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesSimulateTemplate) WithPretty() func(*IndicesSimulateTemplateRequest) { - return func(r *IndicesSimulateTemplateRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesSimulateTemplate) WithHuman() func(*IndicesSimulateTemplateRequest) { - return func(r *IndicesSimulateTemplateRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesSimulateTemplate) WithErrorTrace() func(*IndicesSimulateTemplateRequest) { - return func(r *IndicesSimulateTemplateRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesSimulateTemplate) WithFilterPath(v ...string) func(*IndicesSimulateTemplateRequest) { - return func(r *IndicesSimulateTemplateRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesSimulateTemplate) WithHeader(h map[string]string) func(*IndicesSimulateTemplateRequest) { - return func(r *IndicesSimulateTemplateRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesSimulateTemplate) WithOpaqueID(s string) func(*IndicesSimulateTemplateRequest) { - return func(r *IndicesSimulateTemplateRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.split.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.split.go deleted file mode 100644 index cda5cae4a..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.split.go +++ /dev/null @@ -1,275 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" - "time" -) - -func newIndicesSplitFunc(t Transport) IndicesSplit { - return func(index string, target string, o ...func(*IndicesSplitRequest)) (*Response, error) { - var r = IndicesSplitRequest{Index: index, Target: target} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesSplit allows you to split an existing index into a new index with more primary shards. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-split-index.html. -// -type IndicesSplit func(index string, target string, o ...func(*IndicesSplitRequest)) (*Response, error) - -// IndicesSplitRequest configures the Indices Split API request. -// -type IndicesSplitRequest struct { - Index string - - Body io.Reader - - Target string - - CopySettings *bool - MasterTimeout time.Duration - Timeout time.Duration - WaitForActiveShards string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesSplitRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - path.Grow(1 + len(r.Index) + 1 + len("_split") + 1 + len(r.Target)) - path.WriteString("/") - path.WriteString(r.Index) - path.WriteString("/") - path.WriteString("_split") - path.WriteString("/") - path.WriteString(r.Target) - - params = make(map[string]string) - - if r.CopySettings != nil { - params["copy_settings"] = strconv.FormatBool(*r.CopySettings) - } - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.WaitForActiveShards != "" { - params["wait_for_active_shards"] = r.WaitForActiveShards - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesSplit) WithContext(v context.Context) func(*IndicesSplitRequest) { - return func(r *IndicesSplitRequest) { - r.ctx = v - } -} - -// WithBody - The configuration for the target index (`settings` and `aliases`). -// -func (f IndicesSplit) WithBody(v io.Reader) func(*IndicesSplitRequest) { - return func(r *IndicesSplitRequest) { - r.Body = v - } -} - -// WithCopySettings - whether or not to copy settings from the source index (defaults to false). -// -func (f IndicesSplit) WithCopySettings(v bool) func(*IndicesSplitRequest) { - return func(r *IndicesSplitRequest) { - r.CopySettings = &v - } -} - -// WithMasterTimeout - specify timeout for connection to master. -// -func (f IndicesSplit) WithMasterTimeout(v time.Duration) func(*IndicesSplitRequest) { - return func(r *IndicesSplitRequest) { - r.MasterTimeout = v - } -} - -// WithTimeout - explicit operation timeout. -// -func (f IndicesSplit) WithTimeout(v time.Duration) func(*IndicesSplitRequest) { - return func(r *IndicesSplitRequest) { - r.Timeout = v - } -} - -// WithWaitForActiveShards - set the number of active shards to wait for on the shrunken index before the operation returns.. -// -func (f IndicesSplit) WithWaitForActiveShards(v string) func(*IndicesSplitRequest) { - return func(r *IndicesSplitRequest) { - r.WaitForActiveShards = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesSplit) WithPretty() func(*IndicesSplitRequest) { - return func(r *IndicesSplitRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesSplit) WithHuman() func(*IndicesSplitRequest) { - return func(r *IndicesSplitRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesSplit) WithErrorTrace() func(*IndicesSplitRequest) { - return func(r *IndicesSplitRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesSplit) WithFilterPath(v ...string) func(*IndicesSplitRequest) { - return func(r *IndicesSplitRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesSplit) WithHeader(h map[string]string) func(*IndicesSplitRequest) { - return func(r *IndicesSplitRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesSplit) WithOpaqueID(s string) func(*IndicesSplitRequest) { - return func(r *IndicesSplitRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.stats.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.stats.go deleted file mode 100644 index c0c98211b..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.stats.go +++ /dev/null @@ -1,357 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newIndicesStatsFunc(t Transport) IndicesStats { - return func(o ...func(*IndicesStatsRequest)) (*Response, error) { - var r = IndicesStatsRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesStats provides statistics on operations happening in an index. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-stats.html. -// -type IndicesStats func(o ...func(*IndicesStatsRequest)) (*Response, error) - -// IndicesStatsRequest configures the Indices Stats API request. -// -type IndicesStatsRequest struct { - Index []string - - Metric []string - - CompletionFields []string - ExpandWildcards string - FielddataFields []string - Fields []string - ForbidClosedIndices *bool - Groups []string - IncludeSegmentFileSizes *bool - IncludeUnloadedSegments *bool - Level string - Types []string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesStatsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len(strings.Join(r.Index, ",")) + 1 + len("_stats") + 1 + len(strings.Join(r.Metric, ","))) - if len(r.Index) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Index, ",")) - } - path.WriteString("/") - path.WriteString("_stats") - if len(r.Metric) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Metric, ",")) - } - - params = make(map[string]string) - - if len(r.CompletionFields) > 0 { - params["completion_fields"] = strings.Join(r.CompletionFields, ",") - } - - if r.ExpandWildcards != "" { - params["expand_wildcards"] = r.ExpandWildcards - } - - if len(r.FielddataFields) > 0 { - params["fielddata_fields"] = strings.Join(r.FielddataFields, ",") - } - - if len(r.Fields) > 0 { - params["fields"] = strings.Join(r.Fields, ",") - } - - if r.ForbidClosedIndices != nil { - params["forbid_closed_indices"] = strconv.FormatBool(*r.ForbidClosedIndices) - } - - if len(r.Groups) > 0 { - params["groups"] = strings.Join(r.Groups, ",") - } - - if r.IncludeSegmentFileSizes != nil { - params["include_segment_file_sizes"] = strconv.FormatBool(*r.IncludeSegmentFileSizes) - } - - if r.IncludeUnloadedSegments != nil { - params["include_unloaded_segments"] = strconv.FormatBool(*r.IncludeUnloadedSegments) - } - - if r.Level != "" { - params["level"] = r.Level - } - - if len(r.Types) > 0 { - params["types"] = strings.Join(r.Types, ",") - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesStats) WithContext(v context.Context) func(*IndicesStatsRequest) { - return func(r *IndicesStatsRequest) { - r.ctx = v - } -} - -// WithIndex - a list of index names; use _all to perform the operation on all indices. -// -func (f IndicesStats) WithIndex(v ...string) func(*IndicesStatsRequest) { - return func(r *IndicesStatsRequest) { - r.Index = v - } -} - -// WithMetric - limit the information returned the specific metrics.. -// -func (f IndicesStats) WithMetric(v ...string) func(*IndicesStatsRequest) { - return func(r *IndicesStatsRequest) { - r.Metric = v - } -} - -// WithCompletionFields - a list of fields for `fielddata` and `suggest` index metric (supports wildcards). -// -func (f IndicesStats) WithCompletionFields(v ...string) func(*IndicesStatsRequest) { - return func(r *IndicesStatsRequest) { - r.CompletionFields = v - } -} - -// WithExpandWildcards - whether to expand wildcard expression to concrete indices that are open, closed or both.. -// -func (f IndicesStats) WithExpandWildcards(v string) func(*IndicesStatsRequest) { - return func(r *IndicesStatsRequest) { - r.ExpandWildcards = v - } -} - -// WithFielddataFields - a list of fields for `fielddata` index metric (supports wildcards). -// -func (f IndicesStats) WithFielddataFields(v ...string) func(*IndicesStatsRequest) { - return func(r *IndicesStatsRequest) { - r.FielddataFields = v - } -} - -// WithFields - a list of fields for `fielddata` and `completion` index metric (supports wildcards). -// -func (f IndicesStats) WithFields(v ...string) func(*IndicesStatsRequest) { - return func(r *IndicesStatsRequest) { - r.Fields = v - } -} - -// WithForbidClosedIndices - if set to false stats will also collected from closed indices if explicitly specified or if expand_wildcards expands to closed indices. -// -func (f IndicesStats) WithForbidClosedIndices(v bool) func(*IndicesStatsRequest) { - return func(r *IndicesStatsRequest) { - r.ForbidClosedIndices = &v - } -} - -// WithGroups - a list of search groups for `search` index metric. -// -func (f IndicesStats) WithGroups(v ...string) func(*IndicesStatsRequest) { - return func(r *IndicesStatsRequest) { - r.Groups = v - } -} - -// WithIncludeSegmentFileSizes - whether to report the aggregated disk usage of each one of the lucene index files (only applies if segment stats are requested). -// -func (f IndicesStats) WithIncludeSegmentFileSizes(v bool) func(*IndicesStatsRequest) { - return func(r *IndicesStatsRequest) { - r.IncludeSegmentFileSizes = &v - } -} - -// WithIncludeUnloadedSegments - if set to true segment stats will include stats for segments that are not currently loaded into memory. -// -func (f IndicesStats) WithIncludeUnloadedSegments(v bool) func(*IndicesStatsRequest) { - return func(r *IndicesStatsRequest) { - r.IncludeUnloadedSegments = &v - } -} - -// WithLevel - return stats aggregated at cluster, index or shard level. -// -func (f IndicesStats) WithLevel(v string) func(*IndicesStatsRequest) { - return func(r *IndicesStatsRequest) { - r.Level = v - } -} - -// WithTypes - a list of document types for the `indexing` index metric. -// -func (f IndicesStats) WithTypes(v ...string) func(*IndicesStatsRequest) { - return func(r *IndicesStatsRequest) { - r.Types = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesStats) WithPretty() func(*IndicesStatsRequest) { - return func(r *IndicesStatsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesStats) WithHuman() func(*IndicesStatsRequest) { - return func(r *IndicesStatsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesStats) WithErrorTrace() func(*IndicesStatsRequest) { - return func(r *IndicesStatsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesStats) WithFilterPath(v ...string) func(*IndicesStatsRequest) { - return func(r *IndicesStatsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesStats) WithHeader(h map[string]string) func(*IndicesStatsRequest) { - return func(r *IndicesStatsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesStats) WithOpaqueID(s string) func(*IndicesStatsRequest) { - return func(r *IndicesStatsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.update_aliases.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.update_aliases.go deleted file mode 100644 index f4e568533..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.update_aliases.go +++ /dev/null @@ -1,231 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" - "time" -) - -func newIndicesUpdateAliasesFunc(t Transport) IndicesUpdateAliases { - return func(body io.Reader, o ...func(*IndicesUpdateAliasesRequest)) (*Response, error) { - var r = IndicesUpdateAliasesRequest{Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesUpdateAliases updates index aliases. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html. -// -type IndicesUpdateAliases func(body io.Reader, o ...func(*IndicesUpdateAliasesRequest)) (*Response, error) - -// IndicesUpdateAliasesRequest configures the Indices Update Aliases API request. -// -type IndicesUpdateAliasesRequest struct { - Body io.Reader - - MasterTimeout time.Duration - Timeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesUpdateAliasesRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(len("/_aliases")) - path.WriteString("/_aliases") - - params = make(map[string]string) - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesUpdateAliases) WithContext(v context.Context) func(*IndicesUpdateAliasesRequest) { - return func(r *IndicesUpdateAliasesRequest) { - r.ctx = v - } -} - -// WithMasterTimeout - specify timeout for connection to master. -// -func (f IndicesUpdateAliases) WithMasterTimeout(v time.Duration) func(*IndicesUpdateAliasesRequest) { - return func(r *IndicesUpdateAliasesRequest) { - r.MasterTimeout = v - } -} - -// WithTimeout - request timeout. -// -func (f IndicesUpdateAliases) WithTimeout(v time.Duration) func(*IndicesUpdateAliasesRequest) { - return func(r *IndicesUpdateAliasesRequest) { - r.Timeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesUpdateAliases) WithPretty() func(*IndicesUpdateAliasesRequest) { - return func(r *IndicesUpdateAliasesRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesUpdateAliases) WithHuman() func(*IndicesUpdateAliasesRequest) { - return func(r *IndicesUpdateAliasesRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesUpdateAliases) WithErrorTrace() func(*IndicesUpdateAliasesRequest) { - return func(r *IndicesUpdateAliasesRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesUpdateAliases) WithFilterPath(v ...string) func(*IndicesUpdateAliasesRequest) { - return func(r *IndicesUpdateAliasesRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesUpdateAliases) WithHeader(h map[string]string) func(*IndicesUpdateAliasesRequest) { - return func(r *IndicesUpdateAliasesRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesUpdateAliases) WithOpaqueID(s string) func(*IndicesUpdateAliasesRequest) { - return func(r *IndicesUpdateAliasesRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.upgrade.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.upgrade.go deleted file mode 100644 index 513eaf6bb..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.upgrade.go +++ /dev/null @@ -1,278 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newIndicesUpgradeFunc(t Transport) IndicesUpgrade { - return func(o ...func(*IndicesUpgradeRequest)) (*Response, error) { - var r = IndicesUpgradeRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesUpgrade deprecated Upgrades to the current version of Lucene. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-upgrade.html. -// -type IndicesUpgrade func(o ...func(*IndicesUpgradeRequest)) (*Response, error) - -// IndicesUpgradeRequest configures the Indices Upgrade API request. -// -type IndicesUpgradeRequest struct { - Index []string - - AllowNoIndices *bool - ExpandWildcards string - IgnoreUnavailable *bool - OnlyAncientSegments *bool - WaitForCompletion *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesUpgradeRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len(strings.Join(r.Index, ",")) + 1 + len("_upgrade")) - if len(r.Index) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Index, ",")) - } - path.WriteString("/") - path.WriteString("_upgrade") - - params = make(map[string]string) - - if r.AllowNoIndices != nil { - params["allow_no_indices"] = strconv.FormatBool(*r.AllowNoIndices) - } - - if r.ExpandWildcards != "" { - params["expand_wildcards"] = r.ExpandWildcards - } - - if r.IgnoreUnavailable != nil { - params["ignore_unavailable"] = strconv.FormatBool(*r.IgnoreUnavailable) - } - - if r.OnlyAncientSegments != nil { - params["only_ancient_segments"] = strconv.FormatBool(*r.OnlyAncientSegments) - } - - if r.WaitForCompletion != nil { - params["wait_for_completion"] = strconv.FormatBool(*r.WaitForCompletion) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesUpgrade) WithContext(v context.Context) func(*IndicesUpgradeRequest) { - return func(r *IndicesUpgradeRequest) { - r.ctx = v - } -} - -// WithIndex - a list of index names; use _all to perform the operation on all indices. -// -func (f IndicesUpgrade) WithIndex(v ...string) func(*IndicesUpgradeRequest) { - return func(r *IndicesUpgradeRequest) { - r.Index = v - } -} - -// WithAllowNoIndices - whether to ignore if a wildcard indices expression resolves into no concrete indices. (this includes `_all` string or when no indices have been specified). -// -func (f IndicesUpgrade) WithAllowNoIndices(v bool) func(*IndicesUpgradeRequest) { - return func(r *IndicesUpgradeRequest) { - r.AllowNoIndices = &v - } -} - -// WithExpandWildcards - whether to expand wildcard expression to concrete indices that are open, closed or both.. -// -func (f IndicesUpgrade) WithExpandWildcards(v string) func(*IndicesUpgradeRequest) { - return func(r *IndicesUpgradeRequest) { - r.ExpandWildcards = v - } -} - -// WithIgnoreUnavailable - whether specified concrete indices should be ignored when unavailable (missing or closed). -// -func (f IndicesUpgrade) WithIgnoreUnavailable(v bool) func(*IndicesUpgradeRequest) { - return func(r *IndicesUpgradeRequest) { - r.IgnoreUnavailable = &v - } -} - -// WithOnlyAncientSegments - if true, only ancient (an older lucene major release) segments will be upgraded. -// -func (f IndicesUpgrade) WithOnlyAncientSegments(v bool) func(*IndicesUpgradeRequest) { - return func(r *IndicesUpgradeRequest) { - r.OnlyAncientSegments = &v - } -} - -// WithWaitForCompletion - specify whether the request should block until the all segments are upgraded (default: false). -// -func (f IndicesUpgrade) WithWaitForCompletion(v bool) func(*IndicesUpgradeRequest) { - return func(r *IndicesUpgradeRequest) { - r.WaitForCompletion = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesUpgrade) WithPretty() func(*IndicesUpgradeRequest) { - return func(r *IndicesUpgradeRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesUpgrade) WithHuman() func(*IndicesUpgradeRequest) { - return func(r *IndicesUpgradeRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesUpgrade) WithErrorTrace() func(*IndicesUpgradeRequest) { - return func(r *IndicesUpgradeRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesUpgrade) WithFilterPath(v ...string) func(*IndicesUpgradeRequest) { - return func(r *IndicesUpgradeRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesUpgrade) WithHeader(h map[string]string) func(*IndicesUpgradeRequest) { - return func(r *IndicesUpgradeRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesUpgrade) WithOpaqueID(s string) func(*IndicesUpgradeRequest) { - return func(r *IndicesUpgradeRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.validate_query.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.validate_query.go deleted file mode 100644 index 15a333405..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.indices.validate_query.go +++ /dev/null @@ -1,399 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" -) - -func newIndicesValidateQueryFunc(t Transport) IndicesValidateQuery { - return func(o ...func(*IndicesValidateQueryRequest)) (*Response, error) { - var r = IndicesValidateQueryRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesValidateQuery allows a user to validate a potentially expensive query without executing it. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/search-validate.html. -// -type IndicesValidateQuery func(o ...func(*IndicesValidateQueryRequest)) (*Response, error) - -// IndicesValidateQueryRequest configures the Indices Validate Query API request. -// -type IndicesValidateQueryRequest struct { - Index []string - DocumentType []string - - Body io.Reader - - AllowNoIndices *bool - AllShards *bool - Analyzer string - AnalyzeWildcard *bool - DefaultOperator string - Df string - ExpandWildcards string - Explain *bool - IgnoreUnavailable *bool - Lenient *bool - Query string - Rewrite *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesValidateQueryRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len(strings.Join(r.Index, ",")) + 1 + len(strings.Join(r.DocumentType, ",")) + 1 + len("_validate") + 1 + len("query")) - if len(r.Index) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Index, ",")) - } - if len(r.DocumentType) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.DocumentType, ",")) - } - path.WriteString("/") - path.WriteString("_validate") - path.WriteString("/") - path.WriteString("query") - - params = make(map[string]string) - - if r.AllowNoIndices != nil { - params["allow_no_indices"] = strconv.FormatBool(*r.AllowNoIndices) - } - - if r.AllShards != nil { - params["all_shards"] = strconv.FormatBool(*r.AllShards) - } - - if r.Analyzer != "" { - params["analyzer"] = r.Analyzer - } - - if r.AnalyzeWildcard != nil { - params["analyze_wildcard"] = strconv.FormatBool(*r.AnalyzeWildcard) - } - - if r.DefaultOperator != "" { - params["default_operator"] = r.DefaultOperator - } - - if r.Df != "" { - params["df"] = r.Df - } - - if r.ExpandWildcards != "" { - params["expand_wildcards"] = r.ExpandWildcards - } - - if r.Explain != nil { - params["explain"] = strconv.FormatBool(*r.Explain) - } - - if r.IgnoreUnavailable != nil { - params["ignore_unavailable"] = strconv.FormatBool(*r.IgnoreUnavailable) - } - - if r.Lenient != nil { - params["lenient"] = strconv.FormatBool(*r.Lenient) - } - - if r.Query != "" { - params["q"] = r.Query - } - - if r.Rewrite != nil { - params["rewrite"] = strconv.FormatBool(*r.Rewrite) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesValidateQuery) WithContext(v context.Context) func(*IndicesValidateQueryRequest) { - return func(r *IndicesValidateQueryRequest) { - r.ctx = v - } -} - -// WithBody - The query definition specified with the Query DSL. -// -func (f IndicesValidateQuery) WithBody(v io.Reader) func(*IndicesValidateQueryRequest) { - return func(r *IndicesValidateQueryRequest) { - r.Body = v - } -} - -// WithIndex - a list of index names to restrict the operation; use _all to perform the operation on all indices. -// -func (f IndicesValidateQuery) WithIndex(v ...string) func(*IndicesValidateQueryRequest) { - return func(r *IndicesValidateQueryRequest) { - r.Index = v - } -} - -// WithDocumentType - a list of document types to restrict the operation; leave empty to perform the operation on all types. -// -func (f IndicesValidateQuery) WithDocumentType(v ...string) func(*IndicesValidateQueryRequest) { - return func(r *IndicesValidateQueryRequest) { - r.DocumentType = v - } -} - -// WithAllowNoIndices - whether to ignore if a wildcard indices expression resolves into no concrete indices. (this includes `_all` string or when no indices have been specified). -// -func (f IndicesValidateQuery) WithAllowNoIndices(v bool) func(*IndicesValidateQueryRequest) { - return func(r *IndicesValidateQueryRequest) { - r.AllowNoIndices = &v - } -} - -// WithAllShards - execute validation on all shards instead of one random shard per index. -// -func (f IndicesValidateQuery) WithAllShards(v bool) func(*IndicesValidateQueryRequest) { - return func(r *IndicesValidateQueryRequest) { - r.AllShards = &v - } -} - -// WithAnalyzer - the analyzer to use for the query string. -// -func (f IndicesValidateQuery) WithAnalyzer(v string) func(*IndicesValidateQueryRequest) { - return func(r *IndicesValidateQueryRequest) { - r.Analyzer = v - } -} - -// WithAnalyzeWildcard - specify whether wildcard and prefix queries should be analyzed (default: false). -// -func (f IndicesValidateQuery) WithAnalyzeWildcard(v bool) func(*IndicesValidateQueryRequest) { - return func(r *IndicesValidateQueryRequest) { - r.AnalyzeWildcard = &v - } -} - -// WithDefaultOperator - the default operator for query string query (and or or). -// -func (f IndicesValidateQuery) WithDefaultOperator(v string) func(*IndicesValidateQueryRequest) { - return func(r *IndicesValidateQueryRequest) { - r.DefaultOperator = v - } -} - -// WithDf - the field to use as default where no field prefix is given in the query string. -// -func (f IndicesValidateQuery) WithDf(v string) func(*IndicesValidateQueryRequest) { - return func(r *IndicesValidateQueryRequest) { - r.Df = v - } -} - -// WithExpandWildcards - whether to expand wildcard expression to concrete indices that are open, closed or both.. -// -func (f IndicesValidateQuery) WithExpandWildcards(v string) func(*IndicesValidateQueryRequest) { - return func(r *IndicesValidateQueryRequest) { - r.ExpandWildcards = v - } -} - -// WithExplain - return detailed information about the error. -// -func (f IndicesValidateQuery) WithExplain(v bool) func(*IndicesValidateQueryRequest) { - return func(r *IndicesValidateQueryRequest) { - r.Explain = &v - } -} - -// WithIgnoreUnavailable - whether specified concrete indices should be ignored when unavailable (missing or closed). -// -func (f IndicesValidateQuery) WithIgnoreUnavailable(v bool) func(*IndicesValidateQueryRequest) { - return func(r *IndicesValidateQueryRequest) { - r.IgnoreUnavailable = &v - } -} - -// WithLenient - specify whether format-based query failures (such as providing text to a numeric field) should be ignored. -// -func (f IndicesValidateQuery) WithLenient(v bool) func(*IndicesValidateQueryRequest) { - return func(r *IndicesValidateQueryRequest) { - r.Lenient = &v - } -} - -// WithQuery - query in the lucene query string syntax. -// -func (f IndicesValidateQuery) WithQuery(v string) func(*IndicesValidateQueryRequest) { - return func(r *IndicesValidateQueryRequest) { - r.Query = v - } -} - -// WithRewrite - provide a more detailed explanation showing the actual lucene query that will be executed.. -// -func (f IndicesValidateQuery) WithRewrite(v bool) func(*IndicesValidateQueryRequest) { - return func(r *IndicesValidateQueryRequest) { - r.Rewrite = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesValidateQuery) WithPretty() func(*IndicesValidateQueryRequest) { - return func(r *IndicesValidateQueryRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesValidateQuery) WithHuman() func(*IndicesValidateQueryRequest) { - return func(r *IndicesValidateQueryRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesValidateQuery) WithErrorTrace() func(*IndicesValidateQueryRequest) { - return func(r *IndicesValidateQueryRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesValidateQuery) WithFilterPath(v ...string) func(*IndicesValidateQueryRequest) { - return func(r *IndicesValidateQueryRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesValidateQuery) WithHeader(h map[string]string) func(*IndicesValidateQueryRequest) { - return func(r *IndicesValidateQueryRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesValidateQuery) WithOpaqueID(s string) func(*IndicesValidateQueryRequest) { - return func(r *IndicesValidateQueryRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.info.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.info.go deleted file mode 100644 index 00549a2c0..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.info.go +++ /dev/null @@ -1,188 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newInfoFunc(t Transport) Info { - return func(o ...func(*InfoRequest)) (*Response, error) { - var r = InfoRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// Info returns basic information about the cluster. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html. -// -type Info func(o ...func(*InfoRequest)) (*Response, error) - -// InfoRequest configures the Info API request. -// -type InfoRequest struct { - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r InfoRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(len("/")) - path.WriteString("/") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f Info) WithContext(v context.Context) func(*InfoRequest) { - return func(r *InfoRequest) { - r.ctx = v - } -} - -// WithHuman makes statistical values human-readable. -// -func (f Info) WithHuman() func(*InfoRequest) { - return func(r *InfoRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f Info) WithErrorTrace() func(*InfoRequest) { - return func(r *InfoRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f Info) WithFilterPath(v ...string) func(*InfoRequest) { - return func(r *InfoRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f Info) WithHeader(h map[string]string) func(*InfoRequest) { - return func(r *InfoRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f Info) WithOpaqueID(s string) func(*InfoRequest) { - return func(r *InfoRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.ingest.delete_pipeline.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.ingest.delete_pipeline.go deleted file mode 100644 index 237dd87f2..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.ingest.delete_pipeline.go +++ /dev/null @@ -1,231 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" - "time" -) - -func newIngestDeletePipelineFunc(t Transport) IngestDeletePipeline { - return func(id string, o ...func(*IngestDeletePipelineRequest)) (*Response, error) { - var r = IngestDeletePipelineRequest{PipelineID: id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IngestDeletePipeline deletes a pipeline. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-pipeline-api.html. -// -type IngestDeletePipeline func(id string, o ...func(*IngestDeletePipelineRequest)) (*Response, error) - -// IngestDeletePipelineRequest configures the Ingest Delete Pipeline API request. -// -type IngestDeletePipelineRequest struct { - PipelineID string - - MasterTimeout time.Duration - Timeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IngestDeletePipelineRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "DELETE" - - path.Grow(1 + len("_ingest") + 1 + len("pipeline") + 1 + len(r.PipelineID)) - path.WriteString("/") - path.WriteString("_ingest") - path.WriteString("/") - path.WriteString("pipeline") - path.WriteString("/") - path.WriteString(r.PipelineID) - - params = make(map[string]string) - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IngestDeletePipeline) WithContext(v context.Context) func(*IngestDeletePipelineRequest) { - return func(r *IngestDeletePipelineRequest) { - r.ctx = v - } -} - -// WithMasterTimeout - explicit operation timeout for connection to master node. -// -func (f IngestDeletePipeline) WithMasterTimeout(v time.Duration) func(*IngestDeletePipelineRequest) { - return func(r *IngestDeletePipelineRequest) { - r.MasterTimeout = v - } -} - -// WithTimeout - explicit operation timeout. -// -func (f IngestDeletePipeline) WithTimeout(v time.Duration) func(*IngestDeletePipelineRequest) { - return func(r *IngestDeletePipelineRequest) { - r.Timeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IngestDeletePipeline) WithPretty() func(*IngestDeletePipelineRequest) { - return func(r *IngestDeletePipelineRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IngestDeletePipeline) WithHuman() func(*IngestDeletePipelineRequest) { - return func(r *IngestDeletePipelineRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IngestDeletePipeline) WithErrorTrace() func(*IngestDeletePipelineRequest) { - return func(r *IngestDeletePipelineRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IngestDeletePipeline) WithFilterPath(v ...string) func(*IngestDeletePipelineRequest) { - return func(r *IngestDeletePipelineRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IngestDeletePipeline) WithHeader(h map[string]string) func(*IngestDeletePipelineRequest) { - return func(r *IngestDeletePipelineRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IngestDeletePipeline) WithOpaqueID(s string) func(*IngestDeletePipelineRequest) { - return func(r *IngestDeletePipelineRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.ingest.geo_ip_stats.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.ingest.geo_ip_stats.go deleted file mode 100644 index 4ccce1120..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.ingest.geo_ip_stats.go +++ /dev/null @@ -1,196 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newIngestGeoIPStatsFunc(t Transport) IngestGeoIPStats { - return func(o ...func(*IngestGeoIPStatsRequest)) (*Response, error) { - var r = IngestGeoIPStatsRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IngestGeoIPStats returns statistical information about geoip databases -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/geoip-stats-api.html. -// -type IngestGeoIPStats func(o ...func(*IngestGeoIPStatsRequest)) (*Response, error) - -// IngestGeoIPStatsRequest configures the Ingest GeoIP Stats API request. -// -type IngestGeoIPStatsRequest struct { - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IngestGeoIPStatsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(len("/_ingest/geoip/stats")) - path.WriteString("/_ingest/geoip/stats") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IngestGeoIPStats) WithContext(v context.Context) func(*IngestGeoIPStatsRequest) { - return func(r *IngestGeoIPStatsRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IngestGeoIPStats) WithPretty() func(*IngestGeoIPStatsRequest) { - return func(r *IngestGeoIPStatsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IngestGeoIPStats) WithHuman() func(*IngestGeoIPStatsRequest) { - return func(r *IngestGeoIPStatsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IngestGeoIPStats) WithErrorTrace() func(*IngestGeoIPStatsRequest) { - return func(r *IngestGeoIPStatsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IngestGeoIPStats) WithFilterPath(v ...string) func(*IngestGeoIPStatsRequest) { - return func(r *IngestGeoIPStatsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IngestGeoIPStats) WithHeader(h map[string]string) func(*IngestGeoIPStatsRequest) { - return func(r *IngestGeoIPStatsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IngestGeoIPStats) WithOpaqueID(s string) func(*IngestGeoIPStatsRequest) { - return func(r *IngestGeoIPStatsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.ingest.get_pipeline.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.ingest.get_pipeline.go deleted file mode 100644 index d8315c425..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.ingest.get_pipeline.go +++ /dev/null @@ -1,242 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" - "time" -) - -func newIngestGetPipelineFunc(t Transport) IngestGetPipeline { - return func(o ...func(*IngestGetPipelineRequest)) (*Response, error) { - var r = IngestGetPipelineRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IngestGetPipeline returns a pipeline. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/get-pipeline-api.html. -// -type IngestGetPipeline func(o ...func(*IngestGetPipelineRequest)) (*Response, error) - -// IngestGetPipelineRequest configures the Ingest Get Pipeline API request. -// -type IngestGetPipelineRequest struct { - PipelineID string - - MasterTimeout time.Duration - Summary *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IngestGetPipelineRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_ingest") + 1 + len("pipeline") + 1 + len(r.PipelineID)) - path.WriteString("/") - path.WriteString("_ingest") - path.WriteString("/") - path.WriteString("pipeline") - if r.PipelineID != "" { - path.WriteString("/") - path.WriteString(r.PipelineID) - } - - params = make(map[string]string) - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Summary != nil { - params["summary"] = strconv.FormatBool(*r.Summary) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IngestGetPipeline) WithContext(v context.Context) func(*IngestGetPipelineRequest) { - return func(r *IngestGetPipelineRequest) { - r.ctx = v - } -} - -// WithPipelineID - comma separated list of pipeline ids. wildcards supported. -// -func (f IngestGetPipeline) WithPipelineID(v string) func(*IngestGetPipelineRequest) { - return func(r *IngestGetPipelineRequest) { - r.PipelineID = v - } -} - -// WithMasterTimeout - explicit operation timeout for connection to master node. -// -func (f IngestGetPipeline) WithMasterTimeout(v time.Duration) func(*IngestGetPipelineRequest) { - return func(r *IngestGetPipelineRequest) { - r.MasterTimeout = v - } -} - -// WithSummary - return pipelines without their definitions (default: false). -// -func (f IngestGetPipeline) WithSummary(v bool) func(*IngestGetPipelineRequest) { - return func(r *IngestGetPipelineRequest) { - r.Summary = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IngestGetPipeline) WithPretty() func(*IngestGetPipelineRequest) { - return func(r *IngestGetPipelineRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IngestGetPipeline) WithHuman() func(*IngestGetPipelineRequest) { - return func(r *IngestGetPipelineRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IngestGetPipeline) WithErrorTrace() func(*IngestGetPipelineRequest) { - return func(r *IngestGetPipelineRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IngestGetPipeline) WithFilterPath(v ...string) func(*IngestGetPipelineRequest) { - return func(r *IngestGetPipelineRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IngestGetPipeline) WithHeader(h map[string]string) func(*IngestGetPipelineRequest) { - return func(r *IngestGetPipelineRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IngestGetPipeline) WithOpaqueID(s string) func(*IngestGetPipelineRequest) { - return func(r *IngestGetPipelineRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.ingest.processor_grok.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.ingest.processor_grok.go deleted file mode 100644 index 1fe794975..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.ingest.processor_grok.go +++ /dev/null @@ -1,196 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newIngestProcessorGrokFunc(t Transport) IngestProcessorGrok { - return func(o ...func(*IngestProcessorGrokRequest)) (*Response, error) { - var r = IngestProcessorGrokRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IngestProcessorGrok returns a list of the built-in patterns. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/grok-processor.html#grok-processor-rest-get. -// -type IngestProcessorGrok func(o ...func(*IngestProcessorGrokRequest)) (*Response, error) - -// IngestProcessorGrokRequest configures the Ingest Processor Grok API request. -// -type IngestProcessorGrokRequest struct { - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IngestProcessorGrokRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(len("/_ingest/processor/grok")) - path.WriteString("/_ingest/processor/grok") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IngestProcessorGrok) WithContext(v context.Context) func(*IngestProcessorGrokRequest) { - return func(r *IngestProcessorGrokRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IngestProcessorGrok) WithPretty() func(*IngestProcessorGrokRequest) { - return func(r *IngestProcessorGrokRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IngestProcessorGrok) WithHuman() func(*IngestProcessorGrokRequest) { - return func(r *IngestProcessorGrokRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IngestProcessorGrok) WithErrorTrace() func(*IngestProcessorGrokRequest) { - return func(r *IngestProcessorGrokRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IngestProcessorGrok) WithFilterPath(v ...string) func(*IngestProcessorGrokRequest) { - return func(r *IngestProcessorGrokRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IngestProcessorGrok) WithHeader(h map[string]string) func(*IngestProcessorGrokRequest) { - return func(r *IngestProcessorGrokRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IngestProcessorGrok) WithOpaqueID(s string) func(*IngestProcessorGrokRequest) { - return func(r *IngestProcessorGrokRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.ingest.put_pipeline.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.ingest.put_pipeline.go deleted file mode 100644 index d27f169a1..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.ingest.put_pipeline.go +++ /dev/null @@ -1,238 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" - "time" -) - -func newIngestPutPipelineFunc(t Transport) IngestPutPipeline { - return func(id string, body io.Reader, o ...func(*IngestPutPipelineRequest)) (*Response, error) { - var r = IngestPutPipelineRequest{PipelineID: id, Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IngestPutPipeline creates or updates a pipeline. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/put-pipeline-api.html. -// -type IngestPutPipeline func(id string, body io.Reader, o ...func(*IngestPutPipelineRequest)) (*Response, error) - -// IngestPutPipelineRequest configures the Ingest Put Pipeline API request. -// -type IngestPutPipelineRequest struct { - PipelineID string - - Body io.Reader - - MasterTimeout time.Duration - Timeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IngestPutPipelineRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - path.Grow(1 + len("_ingest") + 1 + len("pipeline") + 1 + len(r.PipelineID)) - path.WriteString("/") - path.WriteString("_ingest") - path.WriteString("/") - path.WriteString("pipeline") - path.WriteString("/") - path.WriteString(r.PipelineID) - - params = make(map[string]string) - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IngestPutPipeline) WithContext(v context.Context) func(*IngestPutPipelineRequest) { - return func(r *IngestPutPipelineRequest) { - r.ctx = v - } -} - -// WithMasterTimeout - explicit operation timeout for connection to master node. -// -func (f IngestPutPipeline) WithMasterTimeout(v time.Duration) func(*IngestPutPipelineRequest) { - return func(r *IngestPutPipelineRequest) { - r.MasterTimeout = v - } -} - -// WithTimeout - explicit operation timeout. -// -func (f IngestPutPipeline) WithTimeout(v time.Duration) func(*IngestPutPipelineRequest) { - return func(r *IngestPutPipelineRequest) { - r.Timeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IngestPutPipeline) WithPretty() func(*IngestPutPipelineRequest) { - return func(r *IngestPutPipelineRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IngestPutPipeline) WithHuman() func(*IngestPutPipelineRequest) { - return func(r *IngestPutPipelineRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IngestPutPipeline) WithErrorTrace() func(*IngestPutPipelineRequest) { - return func(r *IngestPutPipelineRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IngestPutPipeline) WithFilterPath(v ...string) func(*IngestPutPipelineRequest) { - return func(r *IngestPutPipelineRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IngestPutPipeline) WithHeader(h map[string]string) func(*IngestPutPipelineRequest) { - return func(r *IngestPutPipelineRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IngestPutPipeline) WithOpaqueID(s string) func(*IngestPutPipelineRequest) { - return func(r *IngestPutPipelineRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.ingest.simulate.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.ingest.simulate.go deleted file mode 100644 index dfb4740d8..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.ingest.simulate.go +++ /dev/null @@ -1,237 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" -) - -func newIngestSimulateFunc(t Transport) IngestSimulate { - return func(body io.Reader, o ...func(*IngestSimulateRequest)) (*Response, error) { - var r = IngestSimulateRequest{Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IngestSimulate allows to simulate a pipeline with example documents. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/simulate-pipeline-api.html. -// -type IngestSimulate func(body io.Reader, o ...func(*IngestSimulateRequest)) (*Response, error) - -// IngestSimulateRequest configures the Ingest Simulate API request. -// -type IngestSimulateRequest struct { - PipelineID string - - Body io.Reader - - Verbose *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IngestSimulateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_ingest") + 1 + len("pipeline") + 1 + len(r.PipelineID) + 1 + len("_simulate")) - path.WriteString("/") - path.WriteString("_ingest") - path.WriteString("/") - path.WriteString("pipeline") - if r.PipelineID != "" { - path.WriteString("/") - path.WriteString(r.PipelineID) - } - path.WriteString("/") - path.WriteString("_simulate") - - params = make(map[string]string) - - if r.Verbose != nil { - params["verbose"] = strconv.FormatBool(*r.Verbose) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IngestSimulate) WithContext(v context.Context) func(*IngestSimulateRequest) { - return func(r *IngestSimulateRequest) { - r.ctx = v - } -} - -// WithPipelineID - pipeline ID. -// -func (f IngestSimulate) WithPipelineID(v string) func(*IngestSimulateRequest) { - return func(r *IngestSimulateRequest) { - r.PipelineID = v - } -} - -// WithVerbose - verbose mode. display data output for each processor in executed pipeline. -// -func (f IngestSimulate) WithVerbose(v bool) func(*IngestSimulateRequest) { - return func(r *IngestSimulateRequest) { - r.Verbose = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IngestSimulate) WithPretty() func(*IngestSimulateRequest) { - return func(r *IngestSimulateRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IngestSimulate) WithHuman() func(*IngestSimulateRequest) { - return func(r *IngestSimulateRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IngestSimulate) WithErrorTrace() func(*IngestSimulateRequest) { - return func(r *IngestSimulateRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IngestSimulate) WithFilterPath(v ...string) func(*IngestSimulateRequest) { - return func(r *IngestSimulateRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IngestSimulate) WithHeader(h map[string]string) func(*IngestSimulateRequest) { - return func(r *IngestSimulateRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IngestSimulate) WithOpaqueID(s string) func(*IngestSimulateRequest) { - return func(r *IngestSimulateRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.mget.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.mget.go deleted file mode 100644 index e88aa783d..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.mget.go +++ /dev/null @@ -1,337 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" -) - -func newMgetFunc(t Transport) Mget { - return func(body io.Reader, o ...func(*MgetRequest)) (*Response, error) { - var r = MgetRequest{Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// Mget allows to get multiple documents in one request. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-multi-get.html. -// -type Mget func(body io.Reader, o ...func(*MgetRequest)) (*Response, error) - -// MgetRequest configures the Mget API request. -// -type MgetRequest struct { - Index string - DocumentType string - - Body io.Reader - - Preference string - Realtime *bool - Refresh *bool - Routing string - Source []string - SourceExcludes []string - SourceIncludes []string - StoredFields []string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MgetRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len(r.Index) + 1 + len(r.DocumentType) + 1 + len("_mget")) - if r.Index != "" { - path.WriteString("/") - path.WriteString(r.Index) - } - if r.DocumentType != "" { - path.WriteString("/") - path.WriteString(r.DocumentType) - } - path.WriteString("/") - path.WriteString("_mget") - - params = make(map[string]string) - - if r.Preference != "" { - params["preference"] = r.Preference - } - - if r.Realtime != nil { - params["realtime"] = strconv.FormatBool(*r.Realtime) - } - - if r.Refresh != nil { - params["refresh"] = strconv.FormatBool(*r.Refresh) - } - - if r.Routing != "" { - params["routing"] = r.Routing - } - - if len(r.Source) > 0 { - params["_source"] = strings.Join(r.Source, ",") - } - - if len(r.SourceExcludes) > 0 { - params["_source_excludes"] = strings.Join(r.SourceExcludes, ",") - } - - if len(r.SourceIncludes) > 0 { - params["_source_includes"] = strings.Join(r.SourceIncludes, ",") - } - - if len(r.StoredFields) > 0 { - params["stored_fields"] = strings.Join(r.StoredFields, ",") - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f Mget) WithContext(v context.Context) func(*MgetRequest) { - return func(r *MgetRequest) { - r.ctx = v - } -} - -// WithIndex - the name of the index. -// -func (f Mget) WithIndex(v string) func(*MgetRequest) { - return func(r *MgetRequest) { - r.Index = v - } -} - -// WithDocumentType - the type of the document. -// -func (f Mget) WithDocumentType(v string) func(*MgetRequest) { - return func(r *MgetRequest) { - r.DocumentType = v - } -} - -// WithPreference - specify the node or shard the operation should be performed on (default: random). -// -func (f Mget) WithPreference(v string) func(*MgetRequest) { - return func(r *MgetRequest) { - r.Preference = v - } -} - -// WithRealtime - specify whether to perform the operation in realtime or search mode. -// -func (f Mget) WithRealtime(v bool) func(*MgetRequest) { - return func(r *MgetRequest) { - r.Realtime = &v - } -} - -// WithRefresh - refresh the shard containing the document before performing the operation. -// -func (f Mget) WithRefresh(v bool) func(*MgetRequest) { - return func(r *MgetRequest) { - r.Refresh = &v - } -} - -// WithRouting - specific routing value. -// -func (f Mget) WithRouting(v string) func(*MgetRequest) { - return func(r *MgetRequest) { - r.Routing = v - } -} - -// WithSource - true or false to return the _source field or not, or a list of fields to return. -// -func (f Mget) WithSource(v ...string) func(*MgetRequest) { - return func(r *MgetRequest) { - r.Source = v - } -} - -// WithSourceExcludes - a list of fields to exclude from the returned _source field. -// -func (f Mget) WithSourceExcludes(v ...string) func(*MgetRequest) { - return func(r *MgetRequest) { - r.SourceExcludes = v - } -} - -// WithSourceIncludes - a list of fields to extract and return from the _source field. -// -func (f Mget) WithSourceIncludes(v ...string) func(*MgetRequest) { - return func(r *MgetRequest) { - r.SourceIncludes = v - } -} - -// WithStoredFields - a list of stored fields to return in the response. -// -func (f Mget) WithStoredFields(v ...string) func(*MgetRequest) { - return func(r *MgetRequest) { - r.StoredFields = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f Mget) WithPretty() func(*MgetRequest) { - return func(r *MgetRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f Mget) WithHuman() func(*MgetRequest) { - return func(r *MgetRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f Mget) WithErrorTrace() func(*MgetRequest) { - return func(r *MgetRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f Mget) WithFilterPath(v ...string) func(*MgetRequest) { - return func(r *MgetRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f Mget) WithHeader(h map[string]string) func(*MgetRequest) { - return func(r *MgetRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f Mget) WithOpaqueID(s string) func(*MgetRequest) { - return func(r *MgetRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.msearch.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.msearch.go deleted file mode 100644 index 1d108abf7..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.msearch.go +++ /dev/null @@ -1,324 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" -) - -func newMsearchFunc(t Transport) Msearch { - return func(body io.Reader, o ...func(*MsearchRequest)) (*Response, error) { - var r = MsearchRequest{Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// Msearch allows to execute several search operations in one request. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/search-multi-search.html. -// -type Msearch func(body io.Reader, o ...func(*MsearchRequest)) (*Response, error) - -// MsearchRequest configures the Msearch API request. -// -type MsearchRequest struct { - Index []string - DocumentType []string - - Body io.Reader - - CcsMinimizeRoundtrips *bool - MaxConcurrentSearches *int - MaxConcurrentShardRequests *int - PreFilterShardSize *int - RestTotalHitsAsInt *bool - SearchType string - TypedKeys *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MsearchRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len(strings.Join(r.Index, ",")) + 1 + len(strings.Join(r.DocumentType, ",")) + 1 + len("_msearch")) - if len(r.Index) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Index, ",")) - } - if len(r.DocumentType) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.DocumentType, ",")) - } - path.WriteString("/") - path.WriteString("_msearch") - - params = make(map[string]string) - - if r.CcsMinimizeRoundtrips != nil { - params["ccs_minimize_roundtrips"] = strconv.FormatBool(*r.CcsMinimizeRoundtrips) - } - - if r.MaxConcurrentSearches != nil { - params["max_concurrent_searches"] = strconv.FormatInt(int64(*r.MaxConcurrentSearches), 10) - } - - if r.MaxConcurrentShardRequests != nil { - params["max_concurrent_shard_requests"] = strconv.FormatInt(int64(*r.MaxConcurrentShardRequests), 10) - } - - if r.PreFilterShardSize != nil { - params["pre_filter_shard_size"] = strconv.FormatInt(int64(*r.PreFilterShardSize), 10) - } - - if r.RestTotalHitsAsInt != nil { - params["rest_total_hits_as_int"] = strconv.FormatBool(*r.RestTotalHitsAsInt) - } - - if r.SearchType != "" { - params["search_type"] = r.SearchType - } - - if r.TypedKeys != nil { - params["typed_keys"] = strconv.FormatBool(*r.TypedKeys) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f Msearch) WithContext(v context.Context) func(*MsearchRequest) { - return func(r *MsearchRequest) { - r.ctx = v - } -} - -// WithIndex - a list of index names to use as default. -// -func (f Msearch) WithIndex(v ...string) func(*MsearchRequest) { - return func(r *MsearchRequest) { - r.Index = v - } -} - -// WithDocumentType - a list of document types to use as default. -// -func (f Msearch) WithDocumentType(v ...string) func(*MsearchRequest) { - return func(r *MsearchRequest) { - r.DocumentType = v - } -} - -// WithCcsMinimizeRoundtrips - indicates whether network round-trips should be minimized as part of cross-cluster search requests execution. -// -func (f Msearch) WithCcsMinimizeRoundtrips(v bool) func(*MsearchRequest) { - return func(r *MsearchRequest) { - r.CcsMinimizeRoundtrips = &v - } -} - -// WithMaxConcurrentSearches - controls the maximum number of concurrent searches the multi search api will execute. -// -func (f Msearch) WithMaxConcurrentSearches(v int) func(*MsearchRequest) { - return func(r *MsearchRequest) { - r.MaxConcurrentSearches = &v - } -} - -// WithMaxConcurrentShardRequests - the number of concurrent shard requests each sub search executes concurrently per node. this value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests. -// -func (f Msearch) WithMaxConcurrentShardRequests(v int) func(*MsearchRequest) { - return func(r *MsearchRequest) { - r.MaxConcurrentShardRequests = &v - } -} - -// WithPreFilterShardSize - a threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. this filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method ie. if date filters are mandatory to match but the shard bounds and the query are disjoint.. -// -func (f Msearch) WithPreFilterShardSize(v int) func(*MsearchRequest) { - return func(r *MsearchRequest) { - r.PreFilterShardSize = &v - } -} - -// WithRestTotalHitsAsInt - indicates whether hits.total should be rendered as an integer or an object in the rest search response. -// -func (f Msearch) WithRestTotalHitsAsInt(v bool) func(*MsearchRequest) { - return func(r *MsearchRequest) { - r.RestTotalHitsAsInt = &v - } -} - -// WithSearchType - search operation type. -// -func (f Msearch) WithSearchType(v string) func(*MsearchRequest) { - return func(r *MsearchRequest) { - r.SearchType = v - } -} - -// WithTypedKeys - specify whether aggregation and suggester names should be prefixed by their respective types in the response. -// -func (f Msearch) WithTypedKeys(v bool) func(*MsearchRequest) { - return func(r *MsearchRequest) { - r.TypedKeys = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f Msearch) WithPretty() func(*MsearchRequest) { - return func(r *MsearchRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f Msearch) WithHuman() func(*MsearchRequest) { - return func(r *MsearchRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f Msearch) WithErrorTrace() func(*MsearchRequest) { - return func(r *MsearchRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f Msearch) WithFilterPath(v ...string) func(*MsearchRequest) { - return func(r *MsearchRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f Msearch) WithHeader(h map[string]string) func(*MsearchRequest) { - return func(r *MsearchRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f Msearch) WithOpaqueID(s string) func(*MsearchRequest) { - return func(r *MsearchRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.msearch_template.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.msearch_template.go deleted file mode 100644 index bba07ae28..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.msearch_template.go +++ /dev/null @@ -1,300 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" -) - -func newMsearchTemplateFunc(t Transport) MsearchTemplate { - return func(body io.Reader, o ...func(*MsearchTemplateRequest)) (*Response, error) { - var r = MsearchTemplateRequest{Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MsearchTemplate allows to execute several search template operations in one request. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html. -// -type MsearchTemplate func(body io.Reader, o ...func(*MsearchTemplateRequest)) (*Response, error) - -// MsearchTemplateRequest configures the Msearch Template API request. -// -type MsearchTemplateRequest struct { - Index []string - DocumentType []string - - Body io.Reader - - CcsMinimizeRoundtrips *bool - MaxConcurrentSearches *int - RestTotalHitsAsInt *bool - SearchType string - TypedKeys *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MsearchTemplateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len(strings.Join(r.Index, ",")) + 1 + len(strings.Join(r.DocumentType, ",")) + 1 + len("_msearch") + 1 + len("template")) - if len(r.Index) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Index, ",")) - } - if len(r.DocumentType) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.DocumentType, ",")) - } - path.WriteString("/") - path.WriteString("_msearch") - path.WriteString("/") - path.WriteString("template") - - params = make(map[string]string) - - if r.CcsMinimizeRoundtrips != nil { - params["ccs_minimize_roundtrips"] = strconv.FormatBool(*r.CcsMinimizeRoundtrips) - } - - if r.MaxConcurrentSearches != nil { - params["max_concurrent_searches"] = strconv.FormatInt(int64(*r.MaxConcurrentSearches), 10) - } - - if r.RestTotalHitsAsInt != nil { - params["rest_total_hits_as_int"] = strconv.FormatBool(*r.RestTotalHitsAsInt) - } - - if r.SearchType != "" { - params["search_type"] = r.SearchType - } - - if r.TypedKeys != nil { - params["typed_keys"] = strconv.FormatBool(*r.TypedKeys) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MsearchTemplate) WithContext(v context.Context) func(*MsearchTemplateRequest) { - return func(r *MsearchTemplateRequest) { - r.ctx = v - } -} - -// WithIndex - a list of index names to use as default. -// -func (f MsearchTemplate) WithIndex(v ...string) func(*MsearchTemplateRequest) { - return func(r *MsearchTemplateRequest) { - r.Index = v - } -} - -// WithDocumentType - a list of document types to use as default. -// -func (f MsearchTemplate) WithDocumentType(v ...string) func(*MsearchTemplateRequest) { - return func(r *MsearchTemplateRequest) { - r.DocumentType = v - } -} - -// WithCcsMinimizeRoundtrips - indicates whether network round-trips should be minimized as part of cross-cluster search requests execution. -// -func (f MsearchTemplate) WithCcsMinimizeRoundtrips(v bool) func(*MsearchTemplateRequest) { - return func(r *MsearchTemplateRequest) { - r.CcsMinimizeRoundtrips = &v - } -} - -// WithMaxConcurrentSearches - controls the maximum number of concurrent searches the multi search api will execute. -// -func (f MsearchTemplate) WithMaxConcurrentSearches(v int) func(*MsearchTemplateRequest) { - return func(r *MsearchTemplateRequest) { - r.MaxConcurrentSearches = &v - } -} - -// WithRestTotalHitsAsInt - indicates whether hits.total should be rendered as an integer or an object in the rest search response. -// -func (f MsearchTemplate) WithRestTotalHitsAsInt(v bool) func(*MsearchTemplateRequest) { - return func(r *MsearchTemplateRequest) { - r.RestTotalHitsAsInt = &v - } -} - -// WithSearchType - search operation type. -// -func (f MsearchTemplate) WithSearchType(v string) func(*MsearchTemplateRequest) { - return func(r *MsearchTemplateRequest) { - r.SearchType = v - } -} - -// WithTypedKeys - specify whether aggregation and suggester names should be prefixed by their respective types in the response. -// -func (f MsearchTemplate) WithTypedKeys(v bool) func(*MsearchTemplateRequest) { - return func(r *MsearchTemplateRequest) { - r.TypedKeys = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MsearchTemplate) WithPretty() func(*MsearchTemplateRequest) { - return func(r *MsearchTemplateRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MsearchTemplate) WithHuman() func(*MsearchTemplateRequest) { - return func(r *MsearchTemplateRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MsearchTemplate) WithErrorTrace() func(*MsearchTemplateRequest) { - return func(r *MsearchTemplateRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MsearchTemplate) WithFilterPath(v ...string) func(*MsearchTemplateRequest) { - return func(r *MsearchTemplateRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MsearchTemplate) WithHeader(h map[string]string) func(*MsearchTemplateRequest) { - return func(r *MsearchTemplateRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MsearchTemplate) WithOpaqueID(s string) func(*MsearchTemplateRequest) { - return func(r *MsearchTemplateRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.mtermvectors.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.mtermvectors.go deleted file mode 100644 index 7e3e4654c..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.mtermvectors.go +++ /dev/null @@ -1,397 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" -) - -func newMtermvectorsFunc(t Transport) Mtermvectors { - return func(o ...func(*MtermvectorsRequest)) (*Response, error) { - var r = MtermvectorsRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// Mtermvectors returns multiple termvectors in one request. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-multi-termvectors.html. -// -type Mtermvectors func(o ...func(*MtermvectorsRequest)) (*Response, error) - -// MtermvectorsRequest configures the Mtermvectors API request. -// -type MtermvectorsRequest struct { - Index string - DocumentType string - - Body io.Reader - - Fields []string - FieldStatistics *bool - Ids []string - Offsets *bool - Payloads *bool - Positions *bool - Preference string - Realtime *bool - Routing string - TermStatistics *bool - Version *int - VersionType string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MtermvectorsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len(r.Index) + 1 + len(r.DocumentType) + 1 + len("_mtermvectors")) - if r.Index != "" { - path.WriteString("/") - path.WriteString(r.Index) - } - if r.DocumentType != "" { - path.WriteString("/") - path.WriteString(r.DocumentType) - } - path.WriteString("/") - path.WriteString("_mtermvectors") - - params = make(map[string]string) - - if len(r.Fields) > 0 { - params["fields"] = strings.Join(r.Fields, ",") - } - - if r.FieldStatistics != nil { - params["field_statistics"] = strconv.FormatBool(*r.FieldStatistics) - } - - if len(r.Ids) > 0 { - params["ids"] = strings.Join(r.Ids, ",") - } - - if r.Offsets != nil { - params["offsets"] = strconv.FormatBool(*r.Offsets) - } - - if r.Payloads != nil { - params["payloads"] = strconv.FormatBool(*r.Payloads) - } - - if r.Positions != nil { - params["positions"] = strconv.FormatBool(*r.Positions) - } - - if r.Preference != "" { - params["preference"] = r.Preference - } - - if r.Realtime != nil { - params["realtime"] = strconv.FormatBool(*r.Realtime) - } - - if r.Routing != "" { - params["routing"] = r.Routing - } - - if r.TermStatistics != nil { - params["term_statistics"] = strconv.FormatBool(*r.TermStatistics) - } - - if r.Version != nil { - params["version"] = strconv.FormatInt(int64(*r.Version), 10) - } - - if r.VersionType != "" { - params["version_type"] = r.VersionType - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f Mtermvectors) WithContext(v context.Context) func(*MtermvectorsRequest) { - return func(r *MtermvectorsRequest) { - r.ctx = v - } -} - -// WithBody - Define ids, documents, parameters or a list of parameters per document here. You must at least provide a list of document ids. See documentation.. -// -func (f Mtermvectors) WithBody(v io.Reader) func(*MtermvectorsRequest) { - return func(r *MtermvectorsRequest) { - r.Body = v - } -} - -// WithIndex - the index in which the document resides.. -// -func (f Mtermvectors) WithIndex(v string) func(*MtermvectorsRequest) { - return func(r *MtermvectorsRequest) { - r.Index = v - } -} - -// WithDocumentType - the type of the document.. -// -func (f Mtermvectors) WithDocumentType(v string) func(*MtermvectorsRequest) { - return func(r *MtermvectorsRequest) { - r.DocumentType = v - } -} - -// WithFields - a list of fields to return. applies to all returned documents unless otherwise specified in body "params" or "docs".. -// -func (f Mtermvectors) WithFields(v ...string) func(*MtermvectorsRequest) { - return func(r *MtermvectorsRequest) { - r.Fields = v - } -} - -// WithFieldStatistics - specifies if document count, sum of document frequencies and sum of total term frequencies should be returned. applies to all returned documents unless otherwise specified in body "params" or "docs".. -// -func (f Mtermvectors) WithFieldStatistics(v bool) func(*MtermvectorsRequest) { - return func(r *MtermvectorsRequest) { - r.FieldStatistics = &v - } -} - -// WithIds - a list of documents ids. you must define ids as parameter or set "ids" or "docs" in the request body. -// -func (f Mtermvectors) WithIds(v ...string) func(*MtermvectorsRequest) { - return func(r *MtermvectorsRequest) { - r.Ids = v - } -} - -// WithOffsets - specifies if term offsets should be returned. applies to all returned documents unless otherwise specified in body "params" or "docs".. -// -func (f Mtermvectors) WithOffsets(v bool) func(*MtermvectorsRequest) { - return func(r *MtermvectorsRequest) { - r.Offsets = &v - } -} - -// WithPayloads - specifies if term payloads should be returned. applies to all returned documents unless otherwise specified in body "params" or "docs".. -// -func (f Mtermvectors) WithPayloads(v bool) func(*MtermvectorsRequest) { - return func(r *MtermvectorsRequest) { - r.Payloads = &v - } -} - -// WithPositions - specifies if term positions should be returned. applies to all returned documents unless otherwise specified in body "params" or "docs".. -// -func (f Mtermvectors) WithPositions(v bool) func(*MtermvectorsRequest) { - return func(r *MtermvectorsRequest) { - r.Positions = &v - } -} - -// WithPreference - specify the node or shard the operation should be performed on (default: random) .applies to all returned documents unless otherwise specified in body "params" or "docs".. -// -func (f Mtermvectors) WithPreference(v string) func(*MtermvectorsRequest) { - return func(r *MtermvectorsRequest) { - r.Preference = v - } -} - -// WithRealtime - specifies if requests are real-time as opposed to near-real-time (default: true).. -// -func (f Mtermvectors) WithRealtime(v bool) func(*MtermvectorsRequest) { - return func(r *MtermvectorsRequest) { - r.Realtime = &v - } -} - -// WithRouting - specific routing value. applies to all returned documents unless otherwise specified in body "params" or "docs".. -// -func (f Mtermvectors) WithRouting(v string) func(*MtermvectorsRequest) { - return func(r *MtermvectorsRequest) { - r.Routing = v - } -} - -// WithTermStatistics - specifies if total term frequency and document frequency should be returned. applies to all returned documents unless otherwise specified in body "params" or "docs".. -// -func (f Mtermvectors) WithTermStatistics(v bool) func(*MtermvectorsRequest) { - return func(r *MtermvectorsRequest) { - r.TermStatistics = &v - } -} - -// WithVersion - explicit version number for concurrency control. -// -func (f Mtermvectors) WithVersion(v int) func(*MtermvectorsRequest) { - return func(r *MtermvectorsRequest) { - r.Version = &v - } -} - -// WithVersionType - specific version type. -// -func (f Mtermvectors) WithVersionType(v string) func(*MtermvectorsRequest) { - return func(r *MtermvectorsRequest) { - r.VersionType = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f Mtermvectors) WithPretty() func(*MtermvectorsRequest) { - return func(r *MtermvectorsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f Mtermvectors) WithHuman() func(*MtermvectorsRequest) { - return func(r *MtermvectorsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f Mtermvectors) WithErrorTrace() func(*MtermvectorsRequest) { - return func(r *MtermvectorsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f Mtermvectors) WithFilterPath(v ...string) func(*MtermvectorsRequest) { - return func(r *MtermvectorsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f Mtermvectors) WithHeader(h map[string]string) func(*MtermvectorsRequest) { - return func(r *MtermvectorsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f Mtermvectors) WithOpaqueID(s string) func(*MtermvectorsRequest) { - return func(r *MtermvectorsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.nodes.hot_threads.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.nodes.hot_threads.go deleted file mode 100644 index c52738a51..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.nodes.hot_threads.go +++ /dev/null @@ -1,296 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" - "time" -) - -func newNodesHotThreadsFunc(t Transport) NodesHotThreads { - return func(o ...func(*NodesHotThreadsRequest)) (*Response, error) { - var r = NodesHotThreadsRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// NodesHotThreads returns information about hot threads on each node in the cluster. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-hot-threads.html. -// -type NodesHotThreads func(o ...func(*NodesHotThreadsRequest)) (*Response, error) - -// NodesHotThreadsRequest configures the Nodes Hot Threads API request. -// -type NodesHotThreadsRequest struct { - NodeID []string - - IgnoreIdleThreads *bool - Interval time.Duration - Snapshots *int - Threads *int - Timeout time.Duration - DocumentType string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r NodesHotThreadsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_cluster") + 1 + len("nodes") + 1 + len(strings.Join(r.NodeID, ",")) + 1 + len("hot_threads")) - path.WriteString("/") - path.WriteString("_cluster") - path.WriteString("/") - path.WriteString("nodes") - if len(r.NodeID) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.NodeID, ",")) - } - path.WriteString("/") - path.WriteString("hot_threads") - - params = make(map[string]string) - - if r.IgnoreIdleThreads != nil { - params["ignore_idle_threads"] = strconv.FormatBool(*r.IgnoreIdleThreads) - } - - if r.Interval != 0 { - params["interval"] = formatDuration(r.Interval) - } - - if r.Snapshots != nil { - params["snapshots"] = strconv.FormatInt(int64(*r.Snapshots), 10) - } - - if r.Threads != nil { - params["threads"] = strconv.FormatInt(int64(*r.Threads), 10) - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.DocumentType != "" { - params["type"] = r.DocumentType - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f NodesHotThreads) WithContext(v context.Context) func(*NodesHotThreadsRequest) { - return func(r *NodesHotThreadsRequest) { - r.ctx = v - } -} - -// WithNodeID - a list of node ids or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes. -// -func (f NodesHotThreads) WithNodeID(v ...string) func(*NodesHotThreadsRequest) { - return func(r *NodesHotThreadsRequest) { - r.NodeID = v - } -} - -// WithIgnoreIdleThreads - don't show threads that are in known-idle places, such as waiting on a socket select or pulling from an empty task queue (default: true). -// -func (f NodesHotThreads) WithIgnoreIdleThreads(v bool) func(*NodesHotThreadsRequest) { - return func(r *NodesHotThreadsRequest) { - r.IgnoreIdleThreads = &v - } -} - -// WithInterval - the interval for the second sampling of threads. -// -func (f NodesHotThreads) WithInterval(v time.Duration) func(*NodesHotThreadsRequest) { - return func(r *NodesHotThreadsRequest) { - r.Interval = v - } -} - -// WithSnapshots - number of samples of thread stacktrace (default: 10). -// -func (f NodesHotThreads) WithSnapshots(v int) func(*NodesHotThreadsRequest) { - return func(r *NodesHotThreadsRequest) { - r.Snapshots = &v - } -} - -// WithThreads - specify the number of threads to provide information for (default: 3). -// -func (f NodesHotThreads) WithThreads(v int) func(*NodesHotThreadsRequest) { - return func(r *NodesHotThreadsRequest) { - r.Threads = &v - } -} - -// WithTimeout - explicit operation timeout. -// -func (f NodesHotThreads) WithTimeout(v time.Duration) func(*NodesHotThreadsRequest) { - return func(r *NodesHotThreadsRequest) { - r.Timeout = v - } -} - -// WithDocumentType - the type to sample (default: cpu). -// -func (f NodesHotThreads) WithDocumentType(v string) func(*NodesHotThreadsRequest) { - return func(r *NodesHotThreadsRequest) { - r.DocumentType = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f NodesHotThreads) WithPretty() func(*NodesHotThreadsRequest) { - return func(r *NodesHotThreadsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f NodesHotThreads) WithHuman() func(*NodesHotThreadsRequest) { - return func(r *NodesHotThreadsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f NodesHotThreads) WithErrorTrace() func(*NodesHotThreadsRequest) { - return func(r *NodesHotThreadsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f NodesHotThreads) WithFilterPath(v ...string) func(*NodesHotThreadsRequest) { - return func(r *NodesHotThreadsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f NodesHotThreads) WithHeader(h map[string]string) func(*NodesHotThreadsRequest) { - return func(r *NodesHotThreadsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f NodesHotThreads) WithOpaqueID(s string) func(*NodesHotThreadsRequest) { - return func(r *NodesHotThreadsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.nodes.info.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.nodes.info.go deleted file mode 100644 index 3e095c60d..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.nodes.info.go +++ /dev/null @@ -1,253 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" - "time" -) - -func newNodesInfoFunc(t Transport) NodesInfo { - return func(o ...func(*NodesInfoRequest)) (*Response, error) { - var r = NodesInfoRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// NodesInfo returns information about nodes in the cluster. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-info.html. -// -type NodesInfo func(o ...func(*NodesInfoRequest)) (*Response, error) - -// NodesInfoRequest configures the Nodes Info API request. -// -type NodesInfoRequest struct { - Metric []string - NodeID []string - - FlatSettings *bool - Timeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r NodesInfoRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_nodes") + 1 + len(strings.Join(r.NodeID, ",")) + 1 + len(strings.Join(r.Metric, ","))) - path.WriteString("/") - path.WriteString("_nodes") - if len(r.NodeID) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.NodeID, ",")) - } - if len(r.Metric) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Metric, ",")) - } - - params = make(map[string]string) - - if r.FlatSettings != nil { - params["flat_settings"] = strconv.FormatBool(*r.FlatSettings) - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f NodesInfo) WithContext(v context.Context) func(*NodesInfoRequest) { - return func(r *NodesInfoRequest) { - r.ctx = v - } -} - -// WithMetric - a list of metrics you wish returned. leave empty to return all.. -// -func (f NodesInfo) WithMetric(v ...string) func(*NodesInfoRequest) { - return func(r *NodesInfoRequest) { - r.Metric = v - } -} - -// WithNodeID - a list of node ids or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes. -// -func (f NodesInfo) WithNodeID(v ...string) func(*NodesInfoRequest) { - return func(r *NodesInfoRequest) { - r.NodeID = v - } -} - -// WithFlatSettings - return settings in flat format (default: false). -// -func (f NodesInfo) WithFlatSettings(v bool) func(*NodesInfoRequest) { - return func(r *NodesInfoRequest) { - r.FlatSettings = &v - } -} - -// WithTimeout - explicit operation timeout. -// -func (f NodesInfo) WithTimeout(v time.Duration) func(*NodesInfoRequest) { - return func(r *NodesInfoRequest) { - r.Timeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f NodesInfo) WithPretty() func(*NodesInfoRequest) { - return func(r *NodesInfoRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f NodesInfo) WithHuman() func(*NodesInfoRequest) { - return func(r *NodesInfoRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f NodesInfo) WithErrorTrace() func(*NodesInfoRequest) { - return func(r *NodesInfoRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f NodesInfo) WithFilterPath(v ...string) func(*NodesInfoRequest) { - return func(r *NodesInfoRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f NodesInfo) WithHeader(h map[string]string) func(*NodesInfoRequest) { - return func(r *NodesInfoRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f NodesInfo) WithOpaqueID(s string) func(*NodesInfoRequest) { - return func(r *NodesInfoRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.nodes.reload_secure_settings.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.nodes.reload_secure_settings.go deleted file mode 100644 index 41ee20f56..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.nodes.reload_secure_settings.go +++ /dev/null @@ -1,243 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" - "time" -) - -func newNodesReloadSecureSettingsFunc(t Transport) NodesReloadSecureSettings { - return func(o ...func(*NodesReloadSecureSettingsRequest)) (*Response, error) { - var r = NodesReloadSecureSettingsRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// NodesReloadSecureSettings reloads secure settings. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/secure-settings.html#reloadable-secure-settings. -// -type NodesReloadSecureSettings func(o ...func(*NodesReloadSecureSettingsRequest)) (*Response, error) - -// NodesReloadSecureSettingsRequest configures the Nodes Reload Secure Settings API request. -// -type NodesReloadSecureSettingsRequest struct { - Body io.Reader - - NodeID []string - - Timeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r NodesReloadSecureSettingsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_nodes") + 1 + len(strings.Join(r.NodeID, ",")) + 1 + len("reload_secure_settings")) - path.WriteString("/") - path.WriteString("_nodes") - if len(r.NodeID) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.NodeID, ",")) - } - path.WriteString("/") - path.WriteString("reload_secure_settings") - - params = make(map[string]string) - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f NodesReloadSecureSettings) WithContext(v context.Context) func(*NodesReloadSecureSettingsRequest) { - return func(r *NodesReloadSecureSettingsRequest) { - r.ctx = v - } -} - -// WithBody - An object containing the password for the elasticsearch keystore. -// -func (f NodesReloadSecureSettings) WithBody(v io.Reader) func(*NodesReloadSecureSettingsRequest) { - return func(r *NodesReloadSecureSettingsRequest) { - r.Body = v - } -} - -// WithNodeID - a list of node ids to span the reload/reinit call. should stay empty because reloading usually involves all cluster nodes.. -// -func (f NodesReloadSecureSettings) WithNodeID(v ...string) func(*NodesReloadSecureSettingsRequest) { - return func(r *NodesReloadSecureSettingsRequest) { - r.NodeID = v - } -} - -// WithTimeout - explicit operation timeout. -// -func (f NodesReloadSecureSettings) WithTimeout(v time.Duration) func(*NodesReloadSecureSettingsRequest) { - return func(r *NodesReloadSecureSettingsRequest) { - r.Timeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f NodesReloadSecureSettings) WithPretty() func(*NodesReloadSecureSettingsRequest) { - return func(r *NodesReloadSecureSettingsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f NodesReloadSecureSettings) WithHuman() func(*NodesReloadSecureSettingsRequest) { - return func(r *NodesReloadSecureSettingsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f NodesReloadSecureSettings) WithErrorTrace() func(*NodesReloadSecureSettingsRequest) { - return func(r *NodesReloadSecureSettingsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f NodesReloadSecureSettings) WithFilterPath(v ...string) func(*NodesReloadSecureSettingsRequest) { - return func(r *NodesReloadSecureSettingsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f NodesReloadSecureSettings) WithHeader(h map[string]string) func(*NodesReloadSecureSettingsRequest) { - return func(r *NodesReloadSecureSettingsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f NodesReloadSecureSettings) WithOpaqueID(s string) func(*NodesReloadSecureSettingsRequest) { - return func(r *NodesReloadSecureSettingsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.nodes.stats.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.nodes.stats.go deleted file mode 100644 index 8c7cc0db7..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.nodes.stats.go +++ /dev/null @@ -1,359 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" - "time" -) - -func newNodesStatsFunc(t Transport) NodesStats { - return func(o ...func(*NodesStatsRequest)) (*Response, error) { - var r = NodesStatsRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// NodesStats returns statistical information about nodes in the cluster. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-stats.html. -// -type NodesStats func(o ...func(*NodesStatsRequest)) (*Response, error) - -// NodesStatsRequest configures the Nodes Stats API request. -// -type NodesStatsRequest struct { - IndexMetric []string - Metric []string - NodeID []string - - CompletionFields []string - FielddataFields []string - Fields []string - Groups *bool - IncludeSegmentFileSizes *bool - IncludeUnloadedSegments *bool - Level string - Timeout time.Duration - Types []string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r NodesStatsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_nodes") + 1 + len(strings.Join(r.NodeID, ",")) + 1 + len("stats") + 1 + len(strings.Join(r.Metric, ",")) + 1 + len(strings.Join(r.IndexMetric, ","))) - path.WriteString("/") - path.WriteString("_nodes") - if len(r.NodeID) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.NodeID, ",")) - } - path.WriteString("/") - path.WriteString("stats") - if len(r.Metric) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Metric, ",")) - } - if len(r.IndexMetric) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.IndexMetric, ",")) - } - - params = make(map[string]string) - - if len(r.CompletionFields) > 0 { - params["completion_fields"] = strings.Join(r.CompletionFields, ",") - } - - if len(r.FielddataFields) > 0 { - params["fielddata_fields"] = strings.Join(r.FielddataFields, ",") - } - - if len(r.Fields) > 0 { - params["fields"] = strings.Join(r.Fields, ",") - } - - if r.Groups != nil { - params["groups"] = strconv.FormatBool(*r.Groups) - } - - if r.IncludeSegmentFileSizes != nil { - params["include_segment_file_sizes"] = strconv.FormatBool(*r.IncludeSegmentFileSizes) - } - - if r.IncludeUnloadedSegments != nil { - params["include_unloaded_segments"] = strconv.FormatBool(*r.IncludeUnloadedSegments) - } - - if r.Level != "" { - params["level"] = r.Level - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if len(r.Types) > 0 { - params["types"] = strings.Join(r.Types, ",") - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f NodesStats) WithContext(v context.Context) func(*NodesStatsRequest) { - return func(r *NodesStatsRequest) { - r.ctx = v - } -} - -// WithIndexMetric - limit the information returned for `indices` metric to the specific index metrics. isn't used if `indices` (or `all`) metric isn't specified.. -// -func (f NodesStats) WithIndexMetric(v ...string) func(*NodesStatsRequest) { - return func(r *NodesStatsRequest) { - r.IndexMetric = v - } -} - -// WithMetric - limit the information returned to the specified metrics. -// -func (f NodesStats) WithMetric(v ...string) func(*NodesStatsRequest) { - return func(r *NodesStatsRequest) { - r.Metric = v - } -} - -// WithNodeID - a list of node ids or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes. -// -func (f NodesStats) WithNodeID(v ...string) func(*NodesStatsRequest) { - return func(r *NodesStatsRequest) { - r.NodeID = v - } -} - -// WithCompletionFields - a list of fields for `fielddata` and `suggest` index metric (supports wildcards). -// -func (f NodesStats) WithCompletionFields(v ...string) func(*NodesStatsRequest) { - return func(r *NodesStatsRequest) { - r.CompletionFields = v - } -} - -// WithFielddataFields - a list of fields for `fielddata` index metric (supports wildcards). -// -func (f NodesStats) WithFielddataFields(v ...string) func(*NodesStatsRequest) { - return func(r *NodesStatsRequest) { - r.FielddataFields = v - } -} - -// WithFields - a list of fields for `fielddata` and `completion` index metric (supports wildcards). -// -func (f NodesStats) WithFields(v ...string) func(*NodesStatsRequest) { - return func(r *NodesStatsRequest) { - r.Fields = v - } -} - -// WithGroups - a list of search groups for `search` index metric. -// -func (f NodesStats) WithGroups(v bool) func(*NodesStatsRequest) { - return func(r *NodesStatsRequest) { - r.Groups = &v - } -} - -// WithIncludeSegmentFileSizes - whether to report the aggregated disk usage of each one of the lucene index files (only applies if segment stats are requested). -// -func (f NodesStats) WithIncludeSegmentFileSizes(v bool) func(*NodesStatsRequest) { - return func(r *NodesStatsRequest) { - r.IncludeSegmentFileSizes = &v - } -} - -// WithIncludeUnloadedSegments - if set to true segment stats will include stats for segments that are not currently loaded into memory. -// -func (f NodesStats) WithIncludeUnloadedSegments(v bool) func(*NodesStatsRequest) { - return func(r *NodesStatsRequest) { - r.IncludeUnloadedSegments = &v - } -} - -// WithLevel - return indices stats aggregated at index, node or shard level. -// -func (f NodesStats) WithLevel(v string) func(*NodesStatsRequest) { - return func(r *NodesStatsRequest) { - r.Level = v - } -} - -// WithTimeout - explicit operation timeout. -// -func (f NodesStats) WithTimeout(v time.Duration) func(*NodesStatsRequest) { - return func(r *NodesStatsRequest) { - r.Timeout = v - } -} - -// WithTypes - a list of document types for the `indexing` index metric. -// -func (f NodesStats) WithTypes(v ...string) func(*NodesStatsRequest) { - return func(r *NodesStatsRequest) { - r.Types = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f NodesStats) WithPretty() func(*NodesStatsRequest) { - return func(r *NodesStatsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f NodesStats) WithHuman() func(*NodesStatsRequest) { - return func(r *NodesStatsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f NodesStats) WithErrorTrace() func(*NodesStatsRequest) { - return func(r *NodesStatsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f NodesStats) WithFilterPath(v ...string) func(*NodesStatsRequest) { - return func(r *NodesStatsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f NodesStats) WithHeader(h map[string]string) func(*NodesStatsRequest) { - return func(r *NodesStatsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f NodesStats) WithOpaqueID(s string) func(*NodesStatsRequest) { - return func(r *NodesStatsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.nodes.usage.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.nodes.usage.go deleted file mode 100644 index e3159ae69..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.nodes.usage.go +++ /dev/null @@ -1,241 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" - "time" -) - -func newNodesUsageFunc(t Transport) NodesUsage { - return func(o ...func(*NodesUsageRequest)) (*Response, error) { - var r = NodesUsageRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// NodesUsage returns low-level information about REST actions usage on nodes. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-usage.html. -// -type NodesUsage func(o ...func(*NodesUsageRequest)) (*Response, error) - -// NodesUsageRequest configures the Nodes Usage API request. -// -type NodesUsageRequest struct { - Metric []string - NodeID []string - - Timeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r NodesUsageRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_nodes") + 1 + len(strings.Join(r.NodeID, ",")) + 1 + len("usage") + 1 + len(strings.Join(r.Metric, ","))) - path.WriteString("/") - path.WriteString("_nodes") - if len(r.NodeID) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.NodeID, ",")) - } - path.WriteString("/") - path.WriteString("usage") - if len(r.Metric) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Metric, ",")) - } - - params = make(map[string]string) - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f NodesUsage) WithContext(v context.Context) func(*NodesUsageRequest) { - return func(r *NodesUsageRequest) { - r.ctx = v - } -} - -// WithMetric - limit the information returned to the specified metrics. -// -func (f NodesUsage) WithMetric(v ...string) func(*NodesUsageRequest) { - return func(r *NodesUsageRequest) { - r.Metric = v - } -} - -// WithNodeID - a list of node ids or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes. -// -func (f NodesUsage) WithNodeID(v ...string) func(*NodesUsageRequest) { - return func(r *NodesUsageRequest) { - r.NodeID = v - } -} - -// WithTimeout - explicit operation timeout. -// -func (f NodesUsage) WithTimeout(v time.Duration) func(*NodesUsageRequest) { - return func(r *NodesUsageRequest) { - r.Timeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f NodesUsage) WithPretty() func(*NodesUsageRequest) { - return func(r *NodesUsageRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f NodesUsage) WithHuman() func(*NodesUsageRequest) { - return func(r *NodesUsageRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f NodesUsage) WithErrorTrace() func(*NodesUsageRequest) { - return func(r *NodesUsageRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f NodesUsage) WithFilterPath(v ...string) func(*NodesUsageRequest) { - return func(r *NodesUsageRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f NodesUsage) WithHeader(h map[string]string) func(*NodesUsageRequest) { - return func(r *NodesUsageRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f NodesUsage) WithOpaqueID(s string) func(*NodesUsageRequest) { - return func(r *NodesUsageRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.ping.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.ping.go deleted file mode 100644 index 427f7c6ab..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.ping.go +++ /dev/null @@ -1,196 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newPingFunc(t Transport) Ping { - return func(o ...func(*PingRequest)) (*Response, error) { - var r = PingRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// Ping returns whether the cluster is running. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html. -// -type Ping func(o ...func(*PingRequest)) (*Response, error) - -// PingRequest configures the Ping API request. -// -type PingRequest struct { - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r PingRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "HEAD" - - path.Grow(len("/")) - path.WriteString("/") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f Ping) WithContext(v context.Context) func(*PingRequest) { - return func(r *PingRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f Ping) WithPretty() func(*PingRequest) { - return func(r *PingRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f Ping) WithHuman() func(*PingRequest) { - return func(r *PingRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f Ping) WithErrorTrace() func(*PingRequest) { - return func(r *PingRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f Ping) WithFilterPath(v ...string) func(*PingRequest) { - return func(r *PingRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f Ping) WithHeader(h map[string]string) func(*PingRequest) { - return func(r *PingRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f Ping) WithOpaqueID(s string) func(*PingRequest) { - return func(r *PingRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.put_script.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.put_script.go deleted file mode 100644 index ad5d5163b..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.put_script.go +++ /dev/null @@ -1,254 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" - "time" -) - -func newPutScriptFunc(t Transport) PutScript { - return func(id string, body io.Reader, o ...func(*PutScriptRequest)) (*Response, error) { - var r = PutScriptRequest{ScriptID: id, Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// PutScript creates or updates a script. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html. -// -type PutScript func(id string, body io.Reader, o ...func(*PutScriptRequest)) (*Response, error) - -// PutScriptRequest configures the Put Script API request. -// -type PutScriptRequest struct { - ScriptID string - - Body io.Reader - - ScriptContext string - - MasterTimeout time.Duration - Timeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r PutScriptRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - path.Grow(1 + len("_scripts") + 1 + len(r.ScriptID) + 1 + len(r.ScriptContext)) - path.WriteString("/") - path.WriteString("_scripts") - path.WriteString("/") - path.WriteString(r.ScriptID) - if r.ScriptContext != "" { - path.WriteString("/") - path.WriteString(r.ScriptContext) - } - - params = make(map[string]string) - - if r.ScriptContext != "" { - params["context"] = r.ScriptContext - } - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f PutScript) WithContext(v context.Context) func(*PutScriptRequest) { - return func(r *PutScriptRequest) { - r.ctx = v - } -} - -// WithScriptContext - script context. -// -func (f PutScript) WithScriptContext(v string) func(*PutScriptRequest) { - return func(r *PutScriptRequest) { - r.ScriptContext = v - } -} - -// WithMasterTimeout - specify timeout for connection to master. -// -func (f PutScript) WithMasterTimeout(v time.Duration) func(*PutScriptRequest) { - return func(r *PutScriptRequest) { - r.MasterTimeout = v - } -} - -// WithTimeout - explicit operation timeout. -// -func (f PutScript) WithTimeout(v time.Duration) func(*PutScriptRequest) { - return func(r *PutScriptRequest) { - r.Timeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f PutScript) WithPretty() func(*PutScriptRequest) { - return func(r *PutScriptRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f PutScript) WithHuman() func(*PutScriptRequest) { - return func(r *PutScriptRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f PutScript) WithErrorTrace() func(*PutScriptRequest) { - return func(r *PutScriptRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f PutScript) WithFilterPath(v ...string) func(*PutScriptRequest) { - return func(r *PutScriptRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f PutScript) WithHeader(h map[string]string) func(*PutScriptRequest) { - return func(r *PutScriptRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f PutScript) WithOpaqueID(s string) func(*PutScriptRequest) { - return func(r *PutScriptRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.rank_eval.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.rank_eval.go deleted file mode 100644 index 96f324755..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.rank_eval.go +++ /dev/null @@ -1,274 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" -) - -func newRankEvalFunc(t Transport) RankEval { - return func(body io.Reader, o ...func(*RankEvalRequest)) (*Response, error) { - var r = RankEvalRequest{Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// RankEval allows to evaluate the quality of ranked search results over a set of typical search queries -// -// This API is experimental. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/search-rank-eval.html. -// -type RankEval func(body io.Reader, o ...func(*RankEvalRequest)) (*Response, error) - -// RankEvalRequest configures the Rank Eval API request. -// -type RankEvalRequest struct { - Index []string - - Body io.Reader - - AllowNoIndices *bool - ExpandWildcards string - IgnoreUnavailable *bool - SearchType string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r RankEvalRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len(strings.Join(r.Index, ",")) + 1 + len("_rank_eval")) - if len(r.Index) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Index, ",")) - } - path.WriteString("/") - path.WriteString("_rank_eval") - - params = make(map[string]string) - - if r.AllowNoIndices != nil { - params["allow_no_indices"] = strconv.FormatBool(*r.AllowNoIndices) - } - - if r.ExpandWildcards != "" { - params["expand_wildcards"] = r.ExpandWildcards - } - - if r.IgnoreUnavailable != nil { - params["ignore_unavailable"] = strconv.FormatBool(*r.IgnoreUnavailable) - } - - if r.SearchType != "" { - params["search_type"] = r.SearchType - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f RankEval) WithContext(v context.Context) func(*RankEvalRequest) { - return func(r *RankEvalRequest) { - r.ctx = v - } -} - -// WithIndex - a list of index names to search; use _all to perform the operation on all indices. -// -func (f RankEval) WithIndex(v ...string) func(*RankEvalRequest) { - return func(r *RankEvalRequest) { - r.Index = v - } -} - -// WithAllowNoIndices - whether to ignore if a wildcard indices expression resolves into no concrete indices. (this includes `_all` string or when no indices have been specified). -// -func (f RankEval) WithAllowNoIndices(v bool) func(*RankEvalRequest) { - return func(r *RankEvalRequest) { - r.AllowNoIndices = &v - } -} - -// WithExpandWildcards - whether to expand wildcard expression to concrete indices that are open, closed or both.. -// -func (f RankEval) WithExpandWildcards(v string) func(*RankEvalRequest) { - return func(r *RankEvalRequest) { - r.ExpandWildcards = v - } -} - -// WithIgnoreUnavailable - whether specified concrete indices should be ignored when unavailable (missing or closed). -// -func (f RankEval) WithIgnoreUnavailable(v bool) func(*RankEvalRequest) { - return func(r *RankEvalRequest) { - r.IgnoreUnavailable = &v - } -} - -// WithSearchType - search operation type. -// -func (f RankEval) WithSearchType(v string) func(*RankEvalRequest) { - return func(r *RankEvalRequest) { - r.SearchType = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f RankEval) WithPretty() func(*RankEvalRequest) { - return func(r *RankEvalRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f RankEval) WithHuman() func(*RankEvalRequest) { - return func(r *RankEvalRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f RankEval) WithErrorTrace() func(*RankEvalRequest) { - return func(r *RankEvalRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f RankEval) WithFilterPath(v ...string) func(*RankEvalRequest) { - return func(r *RankEvalRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f RankEval) WithHeader(h map[string]string) func(*RankEvalRequest) { - return func(r *RankEvalRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f RankEval) WithOpaqueID(s string) func(*RankEvalRequest) { - return func(r *RankEvalRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.reindex.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.reindex.go deleted file mode 100644 index a9ec023b3..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.reindex.go +++ /dev/null @@ -1,313 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "fmt" - "io" - "net/http" - "strconv" - "strings" - "time" -) - -func newReindexFunc(t Transport) Reindex { - return func(body io.Reader, o ...func(*ReindexRequest)) (*Response, error) { - var r = ReindexRequest{Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// Reindex allows to copy documents from one index to another, optionally filtering the source -// documents by a query, changing the destination index settings, or fetching the -// documents from a remote cluster. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-reindex.html. -// -type Reindex func(body io.Reader, o ...func(*ReindexRequest)) (*Response, error) - -// ReindexRequest configures the Reindex API request. -// -type ReindexRequest struct { - Body io.Reader - - MaxDocs *int - Refresh *bool - RequestsPerSecond *int - Scroll time.Duration - Slices interface{} - Timeout time.Duration - WaitForActiveShards string - WaitForCompletion *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r ReindexRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(len("/_reindex")) - path.WriteString("/_reindex") - - params = make(map[string]string) - - if r.MaxDocs != nil { - params["max_docs"] = strconv.FormatInt(int64(*r.MaxDocs), 10) - } - - if r.Refresh != nil { - params["refresh"] = strconv.FormatBool(*r.Refresh) - } - - if r.RequestsPerSecond != nil { - params["requests_per_second"] = strconv.FormatInt(int64(*r.RequestsPerSecond), 10) - } - - if r.Scroll != 0 { - params["scroll"] = formatDuration(r.Scroll) - } - - if r.Slices != nil { - params["slices"] = fmt.Sprintf("%v", r.Slices) - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.WaitForActiveShards != "" { - params["wait_for_active_shards"] = r.WaitForActiveShards - } - - if r.WaitForCompletion != nil { - params["wait_for_completion"] = strconv.FormatBool(*r.WaitForCompletion) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f Reindex) WithContext(v context.Context) func(*ReindexRequest) { - return func(r *ReindexRequest) { - r.ctx = v - } -} - -// WithMaxDocs - maximum number of documents to process (default: all documents). -// -func (f Reindex) WithMaxDocs(v int) func(*ReindexRequest) { - return func(r *ReindexRequest) { - r.MaxDocs = &v - } -} - -// WithRefresh - should the affected indexes be refreshed?. -// -func (f Reindex) WithRefresh(v bool) func(*ReindexRequest) { - return func(r *ReindexRequest) { - r.Refresh = &v - } -} - -// WithRequestsPerSecond - the throttle to set on this request in sub-requests per second. -1 means no throttle.. -// -func (f Reindex) WithRequestsPerSecond(v int) func(*ReindexRequest) { - return func(r *ReindexRequest) { - r.RequestsPerSecond = &v - } -} - -// WithScroll - control how long to keep the search context alive. -// -func (f Reindex) WithScroll(v time.Duration) func(*ReindexRequest) { - return func(r *ReindexRequest) { - r.Scroll = v - } -} - -// WithSlices - the number of slices this task should be divided into. defaults to 1, meaning the task isn't sliced into subtasks. can be set to `auto`.. -// -func (f Reindex) WithSlices(v interface{}) func(*ReindexRequest) { - return func(r *ReindexRequest) { - r.Slices = v - } -} - -// WithTimeout - time each individual bulk request should wait for shards that are unavailable.. -// -func (f Reindex) WithTimeout(v time.Duration) func(*ReindexRequest) { - return func(r *ReindexRequest) { - r.Timeout = v - } -} - -// WithWaitForActiveShards - sets the number of shard copies that must be active before proceeding with the reindex operation. defaults to 1, meaning the primary shard only. set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1). -// -func (f Reindex) WithWaitForActiveShards(v string) func(*ReindexRequest) { - return func(r *ReindexRequest) { - r.WaitForActiveShards = v - } -} - -// WithWaitForCompletion - should the request should block until the reindex is complete.. -// -func (f Reindex) WithWaitForCompletion(v bool) func(*ReindexRequest) { - return func(r *ReindexRequest) { - r.WaitForCompletion = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f Reindex) WithPretty() func(*ReindexRequest) { - return func(r *ReindexRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f Reindex) WithHuman() func(*ReindexRequest) { - return func(r *ReindexRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f Reindex) WithErrorTrace() func(*ReindexRequest) { - return func(r *ReindexRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f Reindex) WithFilterPath(v ...string) func(*ReindexRequest) { - return func(r *ReindexRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f Reindex) WithHeader(h map[string]string) func(*ReindexRequest) { - return func(r *ReindexRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f Reindex) WithOpaqueID(s string) func(*ReindexRequest) { - return func(r *ReindexRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.reindex_rethrottle.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.reindex_rethrottle.go deleted file mode 100644 index 19bd43735..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.reindex_rethrottle.go +++ /dev/null @@ -1,218 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newReindexRethrottleFunc(t Transport) ReindexRethrottle { - return func(task_id string, requests_per_second *int, o ...func(*ReindexRethrottleRequest)) (*Response, error) { - var r = ReindexRethrottleRequest{TaskID: task_id, RequestsPerSecond: requests_per_second} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// ReindexRethrottle changes the number of requests per second for a particular Reindex operation. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-reindex.html. -// -type ReindexRethrottle func(task_id string, requests_per_second *int, o ...func(*ReindexRethrottleRequest)) (*Response, error) - -// ReindexRethrottleRequest configures the Reindex Rethrottle API request. -// -type ReindexRethrottleRequest struct { - TaskID string - - RequestsPerSecond *int - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r ReindexRethrottleRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_reindex") + 1 + len(r.TaskID) + 1 + len("_rethrottle")) - path.WriteString("/") - path.WriteString("_reindex") - path.WriteString("/") - path.WriteString(r.TaskID) - path.WriteString("/") - path.WriteString("_rethrottle") - - params = make(map[string]string) - - if r.RequestsPerSecond != nil { - params["requests_per_second"] = strconv.FormatInt(int64(*r.RequestsPerSecond), 10) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f ReindexRethrottle) WithContext(v context.Context) func(*ReindexRethrottleRequest) { - return func(r *ReindexRethrottleRequest) { - r.ctx = v - } -} - -// WithRequestsPerSecond - the throttle to set on this request in floating sub-requests per second. -1 means set no throttle.. -// -func (f ReindexRethrottle) WithRequestsPerSecond(v int) func(*ReindexRethrottleRequest) { - return func(r *ReindexRethrottleRequest) { - r.RequestsPerSecond = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f ReindexRethrottle) WithPretty() func(*ReindexRethrottleRequest) { - return func(r *ReindexRethrottleRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f ReindexRethrottle) WithHuman() func(*ReindexRethrottleRequest) { - return func(r *ReindexRethrottleRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f ReindexRethrottle) WithErrorTrace() func(*ReindexRethrottleRequest) { - return func(r *ReindexRethrottleRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f ReindexRethrottle) WithFilterPath(v ...string) func(*ReindexRethrottleRequest) { - return func(r *ReindexRethrottleRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f ReindexRethrottle) WithHeader(h map[string]string) func(*ReindexRethrottleRequest) { - return func(r *ReindexRethrottleRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f ReindexRethrottle) WithOpaqueID(s string) func(*ReindexRethrottleRequest) { - return func(r *ReindexRethrottleRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.render_search_template.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.render_search_template.go deleted file mode 100644 index d0eb00c0b..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.render_search_template.go +++ /dev/null @@ -1,228 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" -) - -func newRenderSearchTemplateFunc(t Transport) RenderSearchTemplate { - return func(o ...func(*RenderSearchTemplateRequest)) (*Response, error) { - var r = RenderSearchTemplateRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// RenderSearchTemplate allows to use the Mustache language to pre-render a search definition. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html#_validating_templates. -// -type RenderSearchTemplate func(o ...func(*RenderSearchTemplateRequest)) (*Response, error) - -// RenderSearchTemplateRequest configures the Render Search Template API request. -// -type RenderSearchTemplateRequest struct { - TemplateID string - - Body io.Reader - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r RenderSearchTemplateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_render") + 1 + len("template") + 1 + len(r.TemplateID)) - path.WriteString("/") - path.WriteString("_render") - path.WriteString("/") - path.WriteString("template") - if r.TemplateID != "" { - path.WriteString("/") - path.WriteString(r.TemplateID) - } - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f RenderSearchTemplate) WithContext(v context.Context) func(*RenderSearchTemplateRequest) { - return func(r *RenderSearchTemplateRequest) { - r.ctx = v - } -} - -// WithBody - The search definition template and its params. -// -func (f RenderSearchTemplate) WithBody(v io.Reader) func(*RenderSearchTemplateRequest) { - return func(r *RenderSearchTemplateRequest) { - r.Body = v - } -} - -// WithTemplateID - the ID of the stored search template. -// -func (f RenderSearchTemplate) WithTemplateID(v string) func(*RenderSearchTemplateRequest) { - return func(r *RenderSearchTemplateRequest) { - r.TemplateID = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f RenderSearchTemplate) WithPretty() func(*RenderSearchTemplateRequest) { - return func(r *RenderSearchTemplateRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f RenderSearchTemplate) WithHuman() func(*RenderSearchTemplateRequest) { - return func(r *RenderSearchTemplateRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f RenderSearchTemplate) WithErrorTrace() func(*RenderSearchTemplateRequest) { - return func(r *RenderSearchTemplateRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f RenderSearchTemplate) WithFilterPath(v ...string) func(*RenderSearchTemplateRequest) { - return func(r *RenderSearchTemplateRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f RenderSearchTemplate) WithHeader(h map[string]string) func(*RenderSearchTemplateRequest) { - return func(r *RenderSearchTemplateRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f RenderSearchTemplate) WithOpaqueID(s string) func(*RenderSearchTemplateRequest) { - return func(r *RenderSearchTemplateRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.scripts_painless_execute.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.scripts_painless_execute.go deleted file mode 100644 index 3e1c920ba..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.scripts_painless_execute.go +++ /dev/null @@ -1,213 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" -) - -func newScriptsPainlessExecuteFunc(t Transport) ScriptsPainlessExecute { - return func(o ...func(*ScriptsPainlessExecuteRequest)) (*Response, error) { - var r = ScriptsPainlessExecuteRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// ScriptsPainlessExecute allows an arbitrary script to be executed and a result to be returned -// -// This API is experimental. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/painless/master/painless-execute-api.html. -// -type ScriptsPainlessExecute func(o ...func(*ScriptsPainlessExecuteRequest)) (*Response, error) - -// ScriptsPainlessExecuteRequest configures the Scripts Painless Execute API request. -// -type ScriptsPainlessExecuteRequest struct { - Body io.Reader - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r ScriptsPainlessExecuteRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(len("/_scripts/painless/_execute")) - path.WriteString("/_scripts/painless/_execute") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f ScriptsPainlessExecute) WithContext(v context.Context) func(*ScriptsPainlessExecuteRequest) { - return func(r *ScriptsPainlessExecuteRequest) { - r.ctx = v - } -} - -// WithBody - The script to execute. -// -func (f ScriptsPainlessExecute) WithBody(v io.Reader) func(*ScriptsPainlessExecuteRequest) { - return func(r *ScriptsPainlessExecuteRequest) { - r.Body = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f ScriptsPainlessExecute) WithPretty() func(*ScriptsPainlessExecuteRequest) { - return func(r *ScriptsPainlessExecuteRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f ScriptsPainlessExecute) WithHuman() func(*ScriptsPainlessExecuteRequest) { - return func(r *ScriptsPainlessExecuteRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f ScriptsPainlessExecute) WithErrorTrace() func(*ScriptsPainlessExecuteRequest) { - return func(r *ScriptsPainlessExecuteRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f ScriptsPainlessExecute) WithFilterPath(v ...string) func(*ScriptsPainlessExecuteRequest) { - return func(r *ScriptsPainlessExecuteRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f ScriptsPainlessExecute) WithHeader(h map[string]string) func(*ScriptsPainlessExecuteRequest) { - return func(r *ScriptsPainlessExecuteRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f ScriptsPainlessExecute) WithOpaqueID(s string) func(*ScriptsPainlessExecuteRequest) { - return func(r *ScriptsPainlessExecuteRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.scroll.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.scroll.go deleted file mode 100644 index 79f439aa3..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.scroll.go +++ /dev/null @@ -1,254 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" - "time" -) - -func newScrollFunc(t Transport) Scroll { - return func(o ...func(*ScrollRequest)) (*Response, error) { - var r = ScrollRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// Scroll allows to retrieve a large numbers of results from a single search request. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/search-request-body.html#request-body-search-scroll. -// -type Scroll func(o ...func(*ScrollRequest)) (*Response, error) - -// ScrollRequest configures the Scroll API request. -// -type ScrollRequest struct { - Body io.Reader - - ScrollID string - - RestTotalHitsAsInt *bool - Scroll time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r ScrollRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(len("/_search/scroll")) - path.WriteString("/_search/scroll") - - params = make(map[string]string) - - if r.RestTotalHitsAsInt != nil { - params["rest_total_hits_as_int"] = strconv.FormatBool(*r.RestTotalHitsAsInt) - } - - if r.Scroll != 0 { - params["scroll"] = formatDuration(r.Scroll) - } - - if r.ScrollID != "" { - params["scroll_id"] = r.ScrollID - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f Scroll) WithContext(v context.Context) func(*ScrollRequest) { - return func(r *ScrollRequest) { - r.ctx = v - } -} - -// WithBody - The scroll ID if not passed by URL or query parameter.. -// -func (f Scroll) WithBody(v io.Reader) func(*ScrollRequest) { - return func(r *ScrollRequest) { - r.Body = v - } -} - -// WithScrollID - the scroll ID. -// -func (f Scroll) WithScrollID(v string) func(*ScrollRequest) { - return func(r *ScrollRequest) { - r.ScrollID = v - } -} - -// WithRestTotalHitsAsInt - indicates whether hits.total should be rendered as an integer or an object in the rest search response. -// -func (f Scroll) WithRestTotalHitsAsInt(v bool) func(*ScrollRequest) { - return func(r *ScrollRequest) { - r.RestTotalHitsAsInt = &v - } -} - -// WithScroll - specify how long a consistent view of the index should be maintained for scrolled search. -// -func (f Scroll) WithScroll(v time.Duration) func(*ScrollRequest) { - return func(r *ScrollRequest) { - r.Scroll = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f Scroll) WithPretty() func(*ScrollRequest) { - return func(r *ScrollRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f Scroll) WithHuman() func(*ScrollRequest) { - return func(r *ScrollRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f Scroll) WithErrorTrace() func(*ScrollRequest) { - return func(r *ScrollRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f Scroll) WithFilterPath(v ...string) func(*ScrollRequest) { - return func(r *ScrollRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f Scroll) WithHeader(h map[string]string) func(*ScrollRequest) { - return func(r *ScrollRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f Scroll) WithOpaqueID(s string) func(*ScrollRequest) { - return func(r *ScrollRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.search.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.search.go deleted file mode 100644 index 858c2ccb6..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.search.go +++ /dev/null @@ -1,802 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "fmt" - "io" - "net/http" - "strconv" - "strings" - "time" -) - -func newSearchFunc(t Transport) Search { - return func(o ...func(*SearchRequest)) (*Response, error) { - var r = SearchRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// Search returns results matching a query. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/search-search.html. -// -type Search func(o ...func(*SearchRequest)) (*Response, error) - -// SearchRequest configures the Search API request. -// -type SearchRequest struct { - Index []string - DocumentType []string - - Body io.Reader - - AllowNoIndices *bool - AllowPartialSearchResults *bool - Analyzer string - AnalyzeWildcard *bool - BatchedReduceSize *int - CcsMinimizeRoundtrips *bool - DefaultOperator string - Df string - DocvalueFields []string - ExpandWildcards string - Explain *bool - From *int - IgnoreThrottled *bool - IgnoreUnavailable *bool - Lenient *bool - MaxConcurrentShardRequests *int - MinCompatibleShardNode string - Preference string - PreFilterShardSize *int - Query string - RequestCache *bool - RestTotalHitsAsInt *bool - Routing []string - Scroll time.Duration - SearchType string - SeqNoPrimaryTerm *bool - Size *int - Sort []string - Source []string - SourceExcludes []string - SourceIncludes []string - Stats []string - StoredFields []string - SuggestField string - SuggestMode string - SuggestSize *int - SuggestText string - TerminateAfter *int - Timeout time.Duration - TrackScores *bool - TrackTotalHits interface{} - TypedKeys *bool - Version *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SearchRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len(strings.Join(r.Index, ",")) + 1 + len(strings.Join(r.DocumentType, ",")) + 1 + len("_search")) - if len(r.Index) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Index, ",")) - } - if len(r.DocumentType) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.DocumentType, ",")) - } - path.WriteString("/") - path.WriteString("_search") - - params = make(map[string]string) - - if r.AllowNoIndices != nil { - params["allow_no_indices"] = strconv.FormatBool(*r.AllowNoIndices) - } - - if r.AllowPartialSearchResults != nil { - params["allow_partial_search_results"] = strconv.FormatBool(*r.AllowPartialSearchResults) - } - - if r.Analyzer != "" { - params["analyzer"] = r.Analyzer - } - - if r.AnalyzeWildcard != nil { - params["analyze_wildcard"] = strconv.FormatBool(*r.AnalyzeWildcard) - } - - if r.BatchedReduceSize != nil { - params["batched_reduce_size"] = strconv.FormatInt(int64(*r.BatchedReduceSize), 10) - } - - if r.CcsMinimizeRoundtrips != nil { - params["ccs_minimize_roundtrips"] = strconv.FormatBool(*r.CcsMinimizeRoundtrips) - } - - if r.DefaultOperator != "" { - params["default_operator"] = r.DefaultOperator - } - - if r.Df != "" { - params["df"] = r.Df - } - - if len(r.DocvalueFields) > 0 { - params["docvalue_fields"] = strings.Join(r.DocvalueFields, ",") - } - - if r.ExpandWildcards != "" { - params["expand_wildcards"] = r.ExpandWildcards - } - - if r.Explain != nil { - params["explain"] = strconv.FormatBool(*r.Explain) - } - - if r.From != nil { - params["from"] = strconv.FormatInt(int64(*r.From), 10) - } - - if r.IgnoreThrottled != nil { - params["ignore_throttled"] = strconv.FormatBool(*r.IgnoreThrottled) - } - - if r.IgnoreUnavailable != nil { - params["ignore_unavailable"] = strconv.FormatBool(*r.IgnoreUnavailable) - } - - if r.Lenient != nil { - params["lenient"] = strconv.FormatBool(*r.Lenient) - } - - if r.MaxConcurrentShardRequests != nil { - params["max_concurrent_shard_requests"] = strconv.FormatInt(int64(*r.MaxConcurrentShardRequests), 10) - } - - if r.MinCompatibleShardNode != "" { - params["min_compatible_shard_node"] = r.MinCompatibleShardNode - } - - if r.Preference != "" { - params["preference"] = r.Preference - } - - if r.PreFilterShardSize != nil { - params["pre_filter_shard_size"] = strconv.FormatInt(int64(*r.PreFilterShardSize), 10) - } - - if r.Query != "" { - params["q"] = r.Query - } - - if r.RequestCache != nil { - params["request_cache"] = strconv.FormatBool(*r.RequestCache) - } - - if r.RestTotalHitsAsInt != nil { - params["rest_total_hits_as_int"] = strconv.FormatBool(*r.RestTotalHitsAsInt) - } - - if len(r.Routing) > 0 { - params["routing"] = strings.Join(r.Routing, ",") - } - - if r.Scroll != 0 { - params["scroll"] = formatDuration(r.Scroll) - } - - if r.SearchType != "" { - params["search_type"] = r.SearchType - } - - if r.SeqNoPrimaryTerm != nil { - params["seq_no_primary_term"] = strconv.FormatBool(*r.SeqNoPrimaryTerm) - } - - if r.Size != nil { - params["size"] = strconv.FormatInt(int64(*r.Size), 10) - } - - if len(r.Sort) > 0 { - params["sort"] = strings.Join(r.Sort, ",") - } - - if len(r.Source) > 0 { - params["_source"] = strings.Join(r.Source, ",") - } - - if len(r.SourceExcludes) > 0 { - params["_source_excludes"] = strings.Join(r.SourceExcludes, ",") - } - - if len(r.SourceIncludes) > 0 { - params["_source_includes"] = strings.Join(r.SourceIncludes, ",") - } - - if len(r.Stats) > 0 { - params["stats"] = strings.Join(r.Stats, ",") - } - - if len(r.StoredFields) > 0 { - params["stored_fields"] = strings.Join(r.StoredFields, ",") - } - - if r.SuggestField != "" { - params["suggest_field"] = r.SuggestField - } - - if r.SuggestMode != "" { - params["suggest_mode"] = r.SuggestMode - } - - if r.SuggestSize != nil { - params["suggest_size"] = strconv.FormatInt(int64(*r.SuggestSize), 10) - } - - if r.SuggestText != "" { - params["suggest_text"] = r.SuggestText - } - - if r.TerminateAfter != nil { - params["terminate_after"] = strconv.FormatInt(int64(*r.TerminateAfter), 10) - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.TrackScores != nil { - params["track_scores"] = strconv.FormatBool(*r.TrackScores) - } - - if r.TrackTotalHits != nil { - params["track_total_hits"] = fmt.Sprintf("%v", r.TrackTotalHits) - } - - if r.TypedKeys != nil { - params["typed_keys"] = strconv.FormatBool(*r.TypedKeys) - } - - if r.Version != nil { - params["version"] = strconv.FormatBool(*r.Version) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f Search) WithContext(v context.Context) func(*SearchRequest) { - return func(r *SearchRequest) { - r.ctx = v - } -} - -// WithBody - The search definition using the Query DSL. -// -func (f Search) WithBody(v io.Reader) func(*SearchRequest) { - return func(r *SearchRequest) { - r.Body = v - } -} - -// WithIndex - a list of index names to search; use _all to perform the operation on all indices. -// -func (f Search) WithIndex(v ...string) func(*SearchRequest) { - return func(r *SearchRequest) { - r.Index = v - } -} - -// WithDocumentType - a list of document types to search; leave empty to perform the operation on all types. -// -func (f Search) WithDocumentType(v ...string) func(*SearchRequest) { - return func(r *SearchRequest) { - r.DocumentType = v - } -} - -// WithAllowNoIndices - whether to ignore if a wildcard indices expression resolves into no concrete indices. (this includes `_all` string or when no indices have been specified). -// -func (f Search) WithAllowNoIndices(v bool) func(*SearchRequest) { - return func(r *SearchRequest) { - r.AllowNoIndices = &v - } -} - -// WithAllowPartialSearchResults - indicate if an error should be returned if there is a partial search failure or timeout. -// -func (f Search) WithAllowPartialSearchResults(v bool) func(*SearchRequest) { - return func(r *SearchRequest) { - r.AllowPartialSearchResults = &v - } -} - -// WithAnalyzer - the analyzer to use for the query string. -// -func (f Search) WithAnalyzer(v string) func(*SearchRequest) { - return func(r *SearchRequest) { - r.Analyzer = v - } -} - -// WithAnalyzeWildcard - specify whether wildcard and prefix queries should be analyzed (default: false). -// -func (f Search) WithAnalyzeWildcard(v bool) func(*SearchRequest) { - return func(r *SearchRequest) { - r.AnalyzeWildcard = &v - } -} - -// WithBatchedReduceSize - the number of shard results that should be reduced at once on the coordinating node. this value should be used as a protection mechanism to reduce the memory overhead per search request if the potential number of shards in the request can be large.. -// -func (f Search) WithBatchedReduceSize(v int) func(*SearchRequest) { - return func(r *SearchRequest) { - r.BatchedReduceSize = &v - } -} - -// WithCcsMinimizeRoundtrips - indicates whether network round-trips should be minimized as part of cross-cluster search requests execution. -// -func (f Search) WithCcsMinimizeRoundtrips(v bool) func(*SearchRequest) { - return func(r *SearchRequest) { - r.CcsMinimizeRoundtrips = &v - } -} - -// WithDefaultOperator - the default operator for query string query (and or or). -// -func (f Search) WithDefaultOperator(v string) func(*SearchRequest) { - return func(r *SearchRequest) { - r.DefaultOperator = v - } -} - -// WithDf - the field to use as default where no field prefix is given in the query string. -// -func (f Search) WithDf(v string) func(*SearchRequest) { - return func(r *SearchRequest) { - r.Df = v - } -} - -// WithDocvalueFields - a list of fields to return as the docvalue representation of a field for each hit. -// -func (f Search) WithDocvalueFields(v ...string) func(*SearchRequest) { - return func(r *SearchRequest) { - r.DocvalueFields = v - } -} - -// WithExpandWildcards - whether to expand wildcard expression to concrete indices that are open, closed or both.. -// -func (f Search) WithExpandWildcards(v string) func(*SearchRequest) { - return func(r *SearchRequest) { - r.ExpandWildcards = v - } -} - -// WithExplain - specify whether to return detailed information about score computation as part of a hit. -// -func (f Search) WithExplain(v bool) func(*SearchRequest) { - return func(r *SearchRequest) { - r.Explain = &v - } -} - -// WithFrom - starting offset (default: 0). -// -func (f Search) WithFrom(v int) func(*SearchRequest) { - return func(r *SearchRequest) { - r.From = &v - } -} - -// WithIgnoreThrottled - whether specified concrete, expanded or aliased indices should be ignored when throttled. -// -func (f Search) WithIgnoreThrottled(v bool) func(*SearchRequest) { - return func(r *SearchRequest) { - r.IgnoreThrottled = &v - } -} - -// WithIgnoreUnavailable - whether specified concrete indices should be ignored when unavailable (missing or closed). -// -func (f Search) WithIgnoreUnavailable(v bool) func(*SearchRequest) { - return func(r *SearchRequest) { - r.IgnoreUnavailable = &v - } -} - -// WithLenient - specify whether format-based query failures (such as providing text to a numeric field) should be ignored. -// -func (f Search) WithLenient(v bool) func(*SearchRequest) { - return func(r *SearchRequest) { - r.Lenient = &v - } -} - -// WithMaxConcurrentShardRequests - the number of concurrent shard requests per node this search executes concurrently. this value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests. -// -func (f Search) WithMaxConcurrentShardRequests(v int) func(*SearchRequest) { - return func(r *SearchRequest) { - r.MaxConcurrentShardRequests = &v - } -} - -// WithMinCompatibleShardNode - the minimum compatible version that all shards involved in search should have for this request to be successful. -// -func (f Search) WithMinCompatibleShardNode(v string) func(*SearchRequest) { - return func(r *SearchRequest) { - r.MinCompatibleShardNode = v - } -} - -// WithPreference - specify the node or shard the operation should be performed on (default: random). -// -func (f Search) WithPreference(v string) func(*SearchRequest) { - return func(r *SearchRequest) { - r.Preference = v - } -} - -// WithPreFilterShardSize - a threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. this filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method ie. if date filters are mandatory to match but the shard bounds and the query are disjoint.. -// -func (f Search) WithPreFilterShardSize(v int) func(*SearchRequest) { - return func(r *SearchRequest) { - r.PreFilterShardSize = &v - } -} - -// WithQuery - query in the lucene query string syntax. -// -func (f Search) WithQuery(v string) func(*SearchRequest) { - return func(r *SearchRequest) { - r.Query = v - } -} - -// WithRequestCache - specify if request cache should be used for this request or not, defaults to index level setting. -// -func (f Search) WithRequestCache(v bool) func(*SearchRequest) { - return func(r *SearchRequest) { - r.RequestCache = &v - } -} - -// WithRestTotalHitsAsInt - indicates whether hits.total should be rendered as an integer or an object in the rest search response. -// -func (f Search) WithRestTotalHitsAsInt(v bool) func(*SearchRequest) { - return func(r *SearchRequest) { - r.RestTotalHitsAsInt = &v - } -} - -// WithRouting - a list of specific routing values. -// -func (f Search) WithRouting(v ...string) func(*SearchRequest) { - return func(r *SearchRequest) { - r.Routing = v - } -} - -// WithScroll - specify how long a consistent view of the index should be maintained for scrolled search. -// -func (f Search) WithScroll(v time.Duration) func(*SearchRequest) { - return func(r *SearchRequest) { - r.Scroll = v - } -} - -// WithSearchType - search operation type. -// -func (f Search) WithSearchType(v string) func(*SearchRequest) { - return func(r *SearchRequest) { - r.SearchType = v - } -} - -// WithSeqNoPrimaryTerm - specify whether to return sequence number and primary term of the last modification of each hit. -// -func (f Search) WithSeqNoPrimaryTerm(v bool) func(*SearchRequest) { - return func(r *SearchRequest) { - r.SeqNoPrimaryTerm = &v - } -} - -// WithSize - number of hits to return (default: 10). -// -func (f Search) WithSize(v int) func(*SearchRequest) { - return func(r *SearchRequest) { - r.Size = &v - } -} - -// WithSort - a list of : pairs. -// -func (f Search) WithSort(v ...string) func(*SearchRequest) { - return func(r *SearchRequest) { - r.Sort = v - } -} - -// WithSource - true or false to return the _source field or not, or a list of fields to return. -// -func (f Search) WithSource(v ...string) func(*SearchRequest) { - return func(r *SearchRequest) { - r.Source = v - } -} - -// WithSourceExcludes - a list of fields to exclude from the returned _source field. -// -func (f Search) WithSourceExcludes(v ...string) func(*SearchRequest) { - return func(r *SearchRequest) { - r.SourceExcludes = v - } -} - -// WithSourceIncludes - a list of fields to extract and return from the _source field. -// -func (f Search) WithSourceIncludes(v ...string) func(*SearchRequest) { - return func(r *SearchRequest) { - r.SourceIncludes = v - } -} - -// WithStats - specific 'tag' of the request for logging and statistical purposes. -// -func (f Search) WithStats(v ...string) func(*SearchRequest) { - return func(r *SearchRequest) { - r.Stats = v - } -} - -// WithStoredFields - a list of stored fields to return as part of a hit. -// -func (f Search) WithStoredFields(v ...string) func(*SearchRequest) { - return func(r *SearchRequest) { - r.StoredFields = v - } -} - -// WithSuggestField - specify which field to use for suggestions. -// -func (f Search) WithSuggestField(v string) func(*SearchRequest) { - return func(r *SearchRequest) { - r.SuggestField = v - } -} - -// WithSuggestMode - specify suggest mode. -// -func (f Search) WithSuggestMode(v string) func(*SearchRequest) { - return func(r *SearchRequest) { - r.SuggestMode = v - } -} - -// WithSuggestSize - how many suggestions to return in response. -// -func (f Search) WithSuggestSize(v int) func(*SearchRequest) { - return func(r *SearchRequest) { - r.SuggestSize = &v - } -} - -// WithSuggestText - the source text for which the suggestions should be returned. -// -func (f Search) WithSuggestText(v string) func(*SearchRequest) { - return func(r *SearchRequest) { - r.SuggestText = v - } -} - -// WithTerminateAfter - the maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early.. -// -func (f Search) WithTerminateAfter(v int) func(*SearchRequest) { - return func(r *SearchRequest) { - r.TerminateAfter = &v - } -} - -// WithTimeout - explicit operation timeout. -// -func (f Search) WithTimeout(v time.Duration) func(*SearchRequest) { - return func(r *SearchRequest) { - r.Timeout = v - } -} - -// WithTrackScores - whether to calculate and return scores even if they are not used for sorting. -// -func (f Search) WithTrackScores(v bool) func(*SearchRequest) { - return func(r *SearchRequest) { - r.TrackScores = &v - } -} - -// WithTrackTotalHits - indicate if the number of documents that match the query should be tracked. -// -func (f Search) WithTrackTotalHits(v interface{}) func(*SearchRequest) { - return func(r *SearchRequest) { - r.TrackTotalHits = v - } -} - -// WithTypedKeys - specify whether aggregation and suggester names should be prefixed by their respective types in the response. -// -func (f Search) WithTypedKeys(v bool) func(*SearchRequest) { - return func(r *SearchRequest) { - r.TypedKeys = &v - } -} - -// WithVersion - specify whether to return document version as part of a hit. -// -func (f Search) WithVersion(v bool) func(*SearchRequest) { - return func(r *SearchRequest) { - r.Version = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f Search) WithPretty() func(*SearchRequest) { - return func(r *SearchRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f Search) WithHuman() func(*SearchRequest) { - return func(r *SearchRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f Search) WithErrorTrace() func(*SearchRequest) { - return func(r *SearchRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f Search) WithFilterPath(v ...string) func(*SearchRequest) { - return func(r *SearchRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f Search) WithHeader(h map[string]string) func(*SearchRequest) { - return func(r *SearchRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f Search) WithOpaqueID(s string) func(*SearchRequest) { - return func(r *SearchRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.search_shards.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.search_shards.go deleted file mode 100644 index b6139c2ab..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.search_shards.go +++ /dev/null @@ -1,291 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newSearchShardsFunc(t Transport) SearchShards { - return func(o ...func(*SearchShardsRequest)) (*Response, error) { - var r = SearchShardsRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SearchShards returns information about the indices and shards that a search request would be executed against. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/search-shards.html. -// -type SearchShards func(o ...func(*SearchShardsRequest)) (*Response, error) - -// SearchShardsRequest configures the Search Shards API request. -// -type SearchShardsRequest struct { - Index []string - - AllowNoIndices *bool - ExpandWildcards string - IgnoreUnavailable *bool - Local *bool - Preference string - Routing string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SearchShardsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len(strings.Join(r.Index, ",")) + 1 + len("_search_shards")) - if len(r.Index) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Index, ",")) - } - path.WriteString("/") - path.WriteString("_search_shards") - - params = make(map[string]string) - - if r.AllowNoIndices != nil { - params["allow_no_indices"] = strconv.FormatBool(*r.AllowNoIndices) - } - - if r.ExpandWildcards != "" { - params["expand_wildcards"] = r.ExpandWildcards - } - - if r.IgnoreUnavailable != nil { - params["ignore_unavailable"] = strconv.FormatBool(*r.IgnoreUnavailable) - } - - if r.Local != nil { - params["local"] = strconv.FormatBool(*r.Local) - } - - if r.Preference != "" { - params["preference"] = r.Preference - } - - if r.Routing != "" { - params["routing"] = r.Routing - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SearchShards) WithContext(v context.Context) func(*SearchShardsRequest) { - return func(r *SearchShardsRequest) { - r.ctx = v - } -} - -// WithIndex - a list of index names to search; use _all to perform the operation on all indices. -// -func (f SearchShards) WithIndex(v ...string) func(*SearchShardsRequest) { - return func(r *SearchShardsRequest) { - r.Index = v - } -} - -// WithAllowNoIndices - whether to ignore if a wildcard indices expression resolves into no concrete indices. (this includes `_all` string or when no indices have been specified). -// -func (f SearchShards) WithAllowNoIndices(v bool) func(*SearchShardsRequest) { - return func(r *SearchShardsRequest) { - r.AllowNoIndices = &v - } -} - -// WithExpandWildcards - whether to expand wildcard expression to concrete indices that are open, closed or both.. -// -func (f SearchShards) WithExpandWildcards(v string) func(*SearchShardsRequest) { - return func(r *SearchShardsRequest) { - r.ExpandWildcards = v - } -} - -// WithIgnoreUnavailable - whether specified concrete indices should be ignored when unavailable (missing or closed). -// -func (f SearchShards) WithIgnoreUnavailable(v bool) func(*SearchShardsRequest) { - return func(r *SearchShardsRequest) { - r.IgnoreUnavailable = &v - } -} - -// WithLocal - return local information, do not retrieve the state from master node (default: false). -// -func (f SearchShards) WithLocal(v bool) func(*SearchShardsRequest) { - return func(r *SearchShardsRequest) { - r.Local = &v - } -} - -// WithPreference - specify the node or shard the operation should be performed on (default: random). -// -func (f SearchShards) WithPreference(v string) func(*SearchShardsRequest) { - return func(r *SearchShardsRequest) { - r.Preference = v - } -} - -// WithRouting - specific routing value. -// -func (f SearchShards) WithRouting(v string) func(*SearchShardsRequest) { - return func(r *SearchShardsRequest) { - r.Routing = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SearchShards) WithPretty() func(*SearchShardsRequest) { - return func(r *SearchShardsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SearchShards) WithHuman() func(*SearchShardsRequest) { - return func(r *SearchShardsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SearchShards) WithErrorTrace() func(*SearchShardsRequest) { - return func(r *SearchShardsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SearchShards) WithFilterPath(v ...string) func(*SearchShardsRequest) { - return func(r *SearchShardsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SearchShards) WithHeader(h map[string]string) func(*SearchShardsRequest) { - return func(r *SearchShardsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SearchShards) WithOpaqueID(s string) func(*SearchShardsRequest) { - return func(r *SearchShardsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.search_template.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.search_template.go deleted file mode 100644 index e3781030c..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.search_template.go +++ /dev/null @@ -1,405 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" - "time" -) - -func newSearchTemplateFunc(t Transport) SearchTemplate { - return func(body io.Reader, o ...func(*SearchTemplateRequest)) (*Response, error) { - var r = SearchTemplateRequest{Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SearchTemplate allows to use the Mustache language to pre-render a search definition. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html. -// -type SearchTemplate func(body io.Reader, o ...func(*SearchTemplateRequest)) (*Response, error) - -// SearchTemplateRequest configures the Search Template API request. -// -type SearchTemplateRequest struct { - Index []string - DocumentType []string - - Body io.Reader - - AllowNoIndices *bool - CcsMinimizeRoundtrips *bool - ExpandWildcards string - Explain *bool - IgnoreThrottled *bool - IgnoreUnavailable *bool - Preference string - Profile *bool - RestTotalHitsAsInt *bool - Routing []string - Scroll time.Duration - SearchType string - TypedKeys *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SearchTemplateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len(strings.Join(r.Index, ",")) + 1 + len(strings.Join(r.DocumentType, ",")) + 1 + len("_search") + 1 + len("template")) - if len(r.Index) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Index, ",")) - } - if len(r.DocumentType) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.DocumentType, ",")) - } - path.WriteString("/") - path.WriteString("_search") - path.WriteString("/") - path.WriteString("template") - - params = make(map[string]string) - - if r.AllowNoIndices != nil { - params["allow_no_indices"] = strconv.FormatBool(*r.AllowNoIndices) - } - - if r.CcsMinimizeRoundtrips != nil { - params["ccs_minimize_roundtrips"] = strconv.FormatBool(*r.CcsMinimizeRoundtrips) - } - - if r.ExpandWildcards != "" { - params["expand_wildcards"] = r.ExpandWildcards - } - - if r.Explain != nil { - params["explain"] = strconv.FormatBool(*r.Explain) - } - - if r.IgnoreThrottled != nil { - params["ignore_throttled"] = strconv.FormatBool(*r.IgnoreThrottled) - } - - if r.IgnoreUnavailable != nil { - params["ignore_unavailable"] = strconv.FormatBool(*r.IgnoreUnavailable) - } - - if r.Preference != "" { - params["preference"] = r.Preference - } - - if r.Profile != nil { - params["profile"] = strconv.FormatBool(*r.Profile) - } - - if r.RestTotalHitsAsInt != nil { - params["rest_total_hits_as_int"] = strconv.FormatBool(*r.RestTotalHitsAsInt) - } - - if len(r.Routing) > 0 { - params["routing"] = strings.Join(r.Routing, ",") - } - - if r.Scroll != 0 { - params["scroll"] = formatDuration(r.Scroll) - } - - if r.SearchType != "" { - params["search_type"] = r.SearchType - } - - if r.TypedKeys != nil { - params["typed_keys"] = strconv.FormatBool(*r.TypedKeys) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SearchTemplate) WithContext(v context.Context) func(*SearchTemplateRequest) { - return func(r *SearchTemplateRequest) { - r.ctx = v - } -} - -// WithIndex - a list of index names to search; use _all to perform the operation on all indices. -// -func (f SearchTemplate) WithIndex(v ...string) func(*SearchTemplateRequest) { - return func(r *SearchTemplateRequest) { - r.Index = v - } -} - -// WithDocumentType - a list of document types to search; leave empty to perform the operation on all types. -// -func (f SearchTemplate) WithDocumentType(v ...string) func(*SearchTemplateRequest) { - return func(r *SearchTemplateRequest) { - r.DocumentType = v - } -} - -// WithAllowNoIndices - whether to ignore if a wildcard indices expression resolves into no concrete indices. (this includes `_all` string or when no indices have been specified). -// -func (f SearchTemplate) WithAllowNoIndices(v bool) func(*SearchTemplateRequest) { - return func(r *SearchTemplateRequest) { - r.AllowNoIndices = &v - } -} - -// WithCcsMinimizeRoundtrips - indicates whether network round-trips should be minimized as part of cross-cluster search requests execution. -// -func (f SearchTemplate) WithCcsMinimizeRoundtrips(v bool) func(*SearchTemplateRequest) { - return func(r *SearchTemplateRequest) { - r.CcsMinimizeRoundtrips = &v - } -} - -// WithExpandWildcards - whether to expand wildcard expression to concrete indices that are open, closed or both.. -// -func (f SearchTemplate) WithExpandWildcards(v string) func(*SearchTemplateRequest) { - return func(r *SearchTemplateRequest) { - r.ExpandWildcards = v - } -} - -// WithExplain - specify whether to return detailed information about score computation as part of a hit. -// -func (f SearchTemplate) WithExplain(v bool) func(*SearchTemplateRequest) { - return func(r *SearchTemplateRequest) { - r.Explain = &v - } -} - -// WithIgnoreThrottled - whether specified concrete, expanded or aliased indices should be ignored when throttled. -// -func (f SearchTemplate) WithIgnoreThrottled(v bool) func(*SearchTemplateRequest) { - return func(r *SearchTemplateRequest) { - r.IgnoreThrottled = &v - } -} - -// WithIgnoreUnavailable - whether specified concrete indices should be ignored when unavailable (missing or closed). -// -func (f SearchTemplate) WithIgnoreUnavailable(v bool) func(*SearchTemplateRequest) { - return func(r *SearchTemplateRequest) { - r.IgnoreUnavailable = &v - } -} - -// WithPreference - specify the node or shard the operation should be performed on (default: random). -// -func (f SearchTemplate) WithPreference(v string) func(*SearchTemplateRequest) { - return func(r *SearchTemplateRequest) { - r.Preference = v - } -} - -// WithProfile - specify whether to profile the query execution. -// -func (f SearchTemplate) WithProfile(v bool) func(*SearchTemplateRequest) { - return func(r *SearchTemplateRequest) { - r.Profile = &v - } -} - -// WithRestTotalHitsAsInt - indicates whether hits.total should be rendered as an integer or an object in the rest search response. -// -func (f SearchTemplate) WithRestTotalHitsAsInt(v bool) func(*SearchTemplateRequest) { - return func(r *SearchTemplateRequest) { - r.RestTotalHitsAsInt = &v - } -} - -// WithRouting - a list of specific routing values. -// -func (f SearchTemplate) WithRouting(v ...string) func(*SearchTemplateRequest) { - return func(r *SearchTemplateRequest) { - r.Routing = v - } -} - -// WithScroll - specify how long a consistent view of the index should be maintained for scrolled search. -// -func (f SearchTemplate) WithScroll(v time.Duration) func(*SearchTemplateRequest) { - return func(r *SearchTemplateRequest) { - r.Scroll = v - } -} - -// WithSearchType - search operation type. -// -func (f SearchTemplate) WithSearchType(v string) func(*SearchTemplateRequest) { - return func(r *SearchTemplateRequest) { - r.SearchType = v - } -} - -// WithTypedKeys - specify whether aggregation and suggester names should be prefixed by their respective types in the response. -// -func (f SearchTemplate) WithTypedKeys(v bool) func(*SearchTemplateRequest) { - return func(r *SearchTemplateRequest) { - r.TypedKeys = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SearchTemplate) WithPretty() func(*SearchTemplateRequest) { - return func(r *SearchTemplateRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SearchTemplate) WithHuman() func(*SearchTemplateRequest) { - return func(r *SearchTemplateRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SearchTemplate) WithErrorTrace() func(*SearchTemplateRequest) { - return func(r *SearchTemplateRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SearchTemplate) WithFilterPath(v ...string) func(*SearchTemplateRequest) { - return func(r *SearchTemplateRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SearchTemplate) WithHeader(h map[string]string) func(*SearchTemplateRequest) { - return func(r *SearchTemplateRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SearchTemplate) WithOpaqueID(s string) func(*SearchTemplateRequest) { - return func(r *SearchTemplateRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.shutdown.delete_node.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.shutdown.delete_node.go deleted file mode 100644 index 1c7909b1c..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.shutdown.delete_node.go +++ /dev/null @@ -1,205 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newShutdownDeleteNodeFunc(t Transport) ShutdownDeleteNode { - return func(node_id string, o ...func(*ShutdownDeleteNodeRequest)) (*Response, error) { - var r = ShutdownDeleteNodeRequest{NodeID: node_id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// ShutdownDeleteNode removes a node from the shutdown list -// -// This API is experimental. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current. -// -type ShutdownDeleteNode func(node_id string, o ...func(*ShutdownDeleteNodeRequest)) (*Response, error) - -// ShutdownDeleteNodeRequest configures the Shutdown Delete Node API request. -// -type ShutdownDeleteNodeRequest struct { - NodeID string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r ShutdownDeleteNodeRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "DELETE" - - path.Grow(1 + len("_nodes") + 1 + len(r.NodeID) + 1 + len("shutdown")) - path.WriteString("/") - path.WriteString("_nodes") - path.WriteString("/") - path.WriteString(r.NodeID) - path.WriteString("/") - path.WriteString("shutdown") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f ShutdownDeleteNode) WithContext(v context.Context) func(*ShutdownDeleteNodeRequest) { - return func(r *ShutdownDeleteNodeRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f ShutdownDeleteNode) WithPretty() func(*ShutdownDeleteNodeRequest) { - return func(r *ShutdownDeleteNodeRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f ShutdownDeleteNode) WithHuman() func(*ShutdownDeleteNodeRequest) { - return func(r *ShutdownDeleteNodeRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f ShutdownDeleteNode) WithErrorTrace() func(*ShutdownDeleteNodeRequest) { - return func(r *ShutdownDeleteNodeRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f ShutdownDeleteNode) WithFilterPath(v ...string) func(*ShutdownDeleteNodeRequest) { - return func(r *ShutdownDeleteNodeRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f ShutdownDeleteNode) WithHeader(h map[string]string) func(*ShutdownDeleteNodeRequest) { - return func(r *ShutdownDeleteNodeRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f ShutdownDeleteNode) WithOpaqueID(s string) func(*ShutdownDeleteNodeRequest) { - return func(r *ShutdownDeleteNodeRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.shutdown.get_node.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.shutdown.get_node.go deleted file mode 100644 index aaa0a1c7c..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.shutdown.get_node.go +++ /dev/null @@ -1,215 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newShutdownGetNodeFunc(t Transport) ShutdownGetNode { - return func(o ...func(*ShutdownGetNodeRequest)) (*Response, error) { - var r = ShutdownGetNodeRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// ShutdownGetNode retrieve status of a node or nodes that are currently marked as shutting down -// -// This API is experimental. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current. -// -type ShutdownGetNode func(o ...func(*ShutdownGetNodeRequest)) (*Response, error) - -// ShutdownGetNodeRequest configures the Shutdown Get Node API request. -// -type ShutdownGetNodeRequest struct { - NodeID string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r ShutdownGetNodeRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_nodes") + 1 + len(r.NodeID) + 1 + len("shutdown")) - path.WriteString("/") - path.WriteString("_nodes") - if r.NodeID != "" { - path.WriteString("/") - path.WriteString(r.NodeID) - } - path.WriteString("/") - path.WriteString("shutdown") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f ShutdownGetNode) WithContext(v context.Context) func(*ShutdownGetNodeRequest) { - return func(r *ShutdownGetNodeRequest) { - r.ctx = v - } -} - -// WithNodeID - which node for which to retrieve the shutdown status. -// -func (f ShutdownGetNode) WithNodeID(v string) func(*ShutdownGetNodeRequest) { - return func(r *ShutdownGetNodeRequest) { - r.NodeID = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f ShutdownGetNode) WithPretty() func(*ShutdownGetNodeRequest) { - return func(r *ShutdownGetNodeRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f ShutdownGetNode) WithHuman() func(*ShutdownGetNodeRequest) { - return func(r *ShutdownGetNodeRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f ShutdownGetNode) WithErrorTrace() func(*ShutdownGetNodeRequest) { - return func(r *ShutdownGetNodeRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f ShutdownGetNode) WithFilterPath(v ...string) func(*ShutdownGetNodeRequest) { - return func(r *ShutdownGetNodeRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f ShutdownGetNode) WithHeader(h map[string]string) func(*ShutdownGetNodeRequest) { - return func(r *ShutdownGetNodeRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f ShutdownGetNode) WithOpaqueID(s string) func(*ShutdownGetNodeRequest) { - return func(r *ShutdownGetNodeRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.shutdown.put_node.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.shutdown.put_node.go deleted file mode 100644 index bc5b0cb4c..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.shutdown.put_node.go +++ /dev/null @@ -1,212 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" -) - -func newShutdownPutNodeFunc(t Transport) ShutdownPutNode { - return func(body io.Reader, node_id string, o ...func(*ShutdownPutNodeRequest)) (*Response, error) { - var r = ShutdownPutNodeRequest{Body: body, NodeID: node_id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// ShutdownPutNode adds a node to be shut down -// -// This API is experimental. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current. -// -type ShutdownPutNode func(body io.Reader, node_id string, o ...func(*ShutdownPutNodeRequest)) (*Response, error) - -// ShutdownPutNodeRequest configures the Shutdown Put Node API request. -// -type ShutdownPutNodeRequest struct { - Body io.Reader - - NodeID string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r ShutdownPutNodeRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - path.Grow(1 + len("_nodes") + 1 + len(r.NodeID) + 1 + len("shutdown")) - path.WriteString("/") - path.WriteString("_nodes") - path.WriteString("/") - path.WriteString(r.NodeID) - path.WriteString("/") - path.WriteString("shutdown") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f ShutdownPutNode) WithContext(v context.Context) func(*ShutdownPutNodeRequest) { - return func(r *ShutdownPutNodeRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f ShutdownPutNode) WithPretty() func(*ShutdownPutNodeRequest) { - return func(r *ShutdownPutNodeRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f ShutdownPutNode) WithHuman() func(*ShutdownPutNodeRequest) { - return func(r *ShutdownPutNodeRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f ShutdownPutNode) WithErrorTrace() func(*ShutdownPutNodeRequest) { - return func(r *ShutdownPutNodeRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f ShutdownPutNode) WithFilterPath(v ...string) func(*ShutdownPutNodeRequest) { - return func(r *ShutdownPutNodeRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f ShutdownPutNode) WithHeader(h map[string]string) func(*ShutdownPutNodeRequest) { - return func(r *ShutdownPutNodeRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f ShutdownPutNode) WithOpaqueID(s string) func(*ShutdownPutNodeRequest) { - return func(r *ShutdownPutNodeRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.snapshot.cleanup_repository.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.snapshot.cleanup_repository.go deleted file mode 100644 index cdfad33de..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.snapshot.cleanup_repository.go +++ /dev/null @@ -1,231 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" - "time" -) - -func newSnapshotCleanupRepositoryFunc(t Transport) SnapshotCleanupRepository { - return func(repository string, o ...func(*SnapshotCleanupRepositoryRequest)) (*Response, error) { - var r = SnapshotCleanupRepositoryRequest{Repository: repository} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SnapshotCleanupRepository removes stale data from repository. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/clean-up-snapshot-repo-api.html. -// -type SnapshotCleanupRepository func(repository string, o ...func(*SnapshotCleanupRepositoryRequest)) (*Response, error) - -// SnapshotCleanupRepositoryRequest configures the Snapshot Cleanup Repository API request. -// -type SnapshotCleanupRepositoryRequest struct { - Repository string - - MasterTimeout time.Duration - Timeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SnapshotCleanupRepositoryRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_snapshot") + 1 + len(r.Repository) + 1 + len("_cleanup")) - path.WriteString("/") - path.WriteString("_snapshot") - path.WriteString("/") - path.WriteString(r.Repository) - path.WriteString("/") - path.WriteString("_cleanup") - - params = make(map[string]string) - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SnapshotCleanupRepository) WithContext(v context.Context) func(*SnapshotCleanupRepositoryRequest) { - return func(r *SnapshotCleanupRepositoryRequest) { - r.ctx = v - } -} - -// WithMasterTimeout - explicit operation timeout for connection to master node. -// -func (f SnapshotCleanupRepository) WithMasterTimeout(v time.Duration) func(*SnapshotCleanupRepositoryRequest) { - return func(r *SnapshotCleanupRepositoryRequest) { - r.MasterTimeout = v - } -} - -// WithTimeout - explicit operation timeout. -// -func (f SnapshotCleanupRepository) WithTimeout(v time.Duration) func(*SnapshotCleanupRepositoryRequest) { - return func(r *SnapshotCleanupRepositoryRequest) { - r.Timeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SnapshotCleanupRepository) WithPretty() func(*SnapshotCleanupRepositoryRequest) { - return func(r *SnapshotCleanupRepositoryRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SnapshotCleanupRepository) WithHuman() func(*SnapshotCleanupRepositoryRequest) { - return func(r *SnapshotCleanupRepositoryRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SnapshotCleanupRepository) WithErrorTrace() func(*SnapshotCleanupRepositoryRequest) { - return func(r *SnapshotCleanupRepositoryRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SnapshotCleanupRepository) WithFilterPath(v ...string) func(*SnapshotCleanupRepositoryRequest) { - return func(r *SnapshotCleanupRepositoryRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SnapshotCleanupRepository) WithHeader(h map[string]string) func(*SnapshotCleanupRepositoryRequest) { - return func(r *SnapshotCleanupRepositoryRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SnapshotCleanupRepository) WithOpaqueID(s string) func(*SnapshotCleanupRepositoryRequest) { - return func(r *SnapshotCleanupRepositoryRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.snapshot.clone.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.snapshot.clone.go deleted file mode 100644 index 5fd509430..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.snapshot.clone.go +++ /dev/null @@ -1,231 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" - "time" -) - -func newSnapshotCloneFunc(t Transport) SnapshotClone { - return func(repository string, snapshot string, body io.Reader, target_snapshot string, o ...func(*SnapshotCloneRequest)) (*Response, error) { - var r = SnapshotCloneRequest{Repository: repository, Snapshot: snapshot, Body: body, TargetSnapshot: target_snapshot} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SnapshotClone clones indices from one snapshot into another snapshot in the same repository. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html. -// -type SnapshotClone func(repository string, snapshot string, body io.Reader, target_snapshot string, o ...func(*SnapshotCloneRequest)) (*Response, error) - -// SnapshotCloneRequest configures the Snapshot Clone API request. -// -type SnapshotCloneRequest struct { - Body io.Reader - - Repository string - Snapshot string - TargetSnapshot string - - MasterTimeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SnapshotCloneRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - path.Grow(1 + len("_snapshot") + 1 + len(r.Repository) + 1 + len(r.Snapshot) + 1 + len("_clone") + 1 + len(r.TargetSnapshot)) - path.WriteString("/") - path.WriteString("_snapshot") - path.WriteString("/") - path.WriteString(r.Repository) - path.WriteString("/") - path.WriteString(r.Snapshot) - path.WriteString("/") - path.WriteString("_clone") - path.WriteString("/") - path.WriteString(r.TargetSnapshot) - - params = make(map[string]string) - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SnapshotClone) WithContext(v context.Context) func(*SnapshotCloneRequest) { - return func(r *SnapshotCloneRequest) { - r.ctx = v - } -} - -// WithMasterTimeout - explicit operation timeout for connection to master node. -// -func (f SnapshotClone) WithMasterTimeout(v time.Duration) func(*SnapshotCloneRequest) { - return func(r *SnapshotCloneRequest) { - r.MasterTimeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SnapshotClone) WithPretty() func(*SnapshotCloneRequest) { - return func(r *SnapshotCloneRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SnapshotClone) WithHuman() func(*SnapshotCloneRequest) { - return func(r *SnapshotCloneRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SnapshotClone) WithErrorTrace() func(*SnapshotCloneRequest) { - return func(r *SnapshotCloneRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SnapshotClone) WithFilterPath(v ...string) func(*SnapshotCloneRequest) { - return func(r *SnapshotCloneRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SnapshotClone) WithHeader(h map[string]string) func(*SnapshotCloneRequest) { - return func(r *SnapshotCloneRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SnapshotClone) WithOpaqueID(s string) func(*SnapshotCloneRequest) { - return func(r *SnapshotCloneRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.snapshot.create.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.snapshot.create.go deleted file mode 100644 index e89ddffb6..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.snapshot.create.go +++ /dev/null @@ -1,248 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" - "time" -) - -func newSnapshotCreateFunc(t Transport) SnapshotCreate { - return func(repository string, snapshot string, o ...func(*SnapshotCreateRequest)) (*Response, error) { - var r = SnapshotCreateRequest{Repository: repository, Snapshot: snapshot} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SnapshotCreate creates a snapshot in a repository. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html. -// -type SnapshotCreate func(repository string, snapshot string, o ...func(*SnapshotCreateRequest)) (*Response, error) - -// SnapshotCreateRequest configures the Snapshot Create API request. -// -type SnapshotCreateRequest struct { - Body io.Reader - - Repository string - Snapshot string - - MasterTimeout time.Duration - WaitForCompletion *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SnapshotCreateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - path.Grow(1 + len("_snapshot") + 1 + len(r.Repository) + 1 + len(r.Snapshot)) - path.WriteString("/") - path.WriteString("_snapshot") - path.WriteString("/") - path.WriteString(r.Repository) - path.WriteString("/") - path.WriteString(r.Snapshot) - - params = make(map[string]string) - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.WaitForCompletion != nil { - params["wait_for_completion"] = strconv.FormatBool(*r.WaitForCompletion) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SnapshotCreate) WithContext(v context.Context) func(*SnapshotCreateRequest) { - return func(r *SnapshotCreateRequest) { - r.ctx = v - } -} - -// WithBody - The snapshot definition. -// -func (f SnapshotCreate) WithBody(v io.Reader) func(*SnapshotCreateRequest) { - return func(r *SnapshotCreateRequest) { - r.Body = v - } -} - -// WithMasterTimeout - explicit operation timeout for connection to master node. -// -func (f SnapshotCreate) WithMasterTimeout(v time.Duration) func(*SnapshotCreateRequest) { - return func(r *SnapshotCreateRequest) { - r.MasterTimeout = v - } -} - -// WithWaitForCompletion - should this request wait until the operation has completed before returning. -// -func (f SnapshotCreate) WithWaitForCompletion(v bool) func(*SnapshotCreateRequest) { - return func(r *SnapshotCreateRequest) { - r.WaitForCompletion = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SnapshotCreate) WithPretty() func(*SnapshotCreateRequest) { - return func(r *SnapshotCreateRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SnapshotCreate) WithHuman() func(*SnapshotCreateRequest) { - return func(r *SnapshotCreateRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SnapshotCreate) WithErrorTrace() func(*SnapshotCreateRequest) { - return func(r *SnapshotCreateRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SnapshotCreate) WithFilterPath(v ...string) func(*SnapshotCreateRequest) { - return func(r *SnapshotCreateRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SnapshotCreate) WithHeader(h map[string]string) func(*SnapshotCreateRequest) { - return func(r *SnapshotCreateRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SnapshotCreate) WithOpaqueID(s string) func(*SnapshotCreateRequest) { - return func(r *SnapshotCreateRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.snapshot.create_repository.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.snapshot.create_repository.go deleted file mode 100644 index 50463e8ab..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.snapshot.create_repository.go +++ /dev/null @@ -1,250 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" - "time" -) - -func newSnapshotCreateRepositoryFunc(t Transport) SnapshotCreateRepository { - return func(repository string, body io.Reader, o ...func(*SnapshotCreateRepositoryRequest)) (*Response, error) { - var r = SnapshotCreateRepositoryRequest{Repository: repository, Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SnapshotCreateRepository creates a repository. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html. -// -type SnapshotCreateRepository func(repository string, body io.Reader, o ...func(*SnapshotCreateRepositoryRequest)) (*Response, error) - -// SnapshotCreateRepositoryRequest configures the Snapshot Create Repository API request. -// -type SnapshotCreateRepositoryRequest struct { - Body io.Reader - - Repository string - - MasterTimeout time.Duration - Timeout time.Duration - Verify *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SnapshotCreateRepositoryRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - path.Grow(1 + len("_snapshot") + 1 + len(r.Repository)) - path.WriteString("/") - path.WriteString("_snapshot") - path.WriteString("/") - path.WriteString(r.Repository) - - params = make(map[string]string) - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.Verify != nil { - params["verify"] = strconv.FormatBool(*r.Verify) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SnapshotCreateRepository) WithContext(v context.Context) func(*SnapshotCreateRepositoryRequest) { - return func(r *SnapshotCreateRepositoryRequest) { - r.ctx = v - } -} - -// WithMasterTimeout - explicit operation timeout for connection to master node. -// -func (f SnapshotCreateRepository) WithMasterTimeout(v time.Duration) func(*SnapshotCreateRepositoryRequest) { - return func(r *SnapshotCreateRepositoryRequest) { - r.MasterTimeout = v - } -} - -// WithTimeout - explicit operation timeout. -// -func (f SnapshotCreateRepository) WithTimeout(v time.Duration) func(*SnapshotCreateRepositoryRequest) { - return func(r *SnapshotCreateRepositoryRequest) { - r.Timeout = v - } -} - -// WithVerify - whether to verify the repository after creation. -// -func (f SnapshotCreateRepository) WithVerify(v bool) func(*SnapshotCreateRepositoryRequest) { - return func(r *SnapshotCreateRepositoryRequest) { - r.Verify = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SnapshotCreateRepository) WithPretty() func(*SnapshotCreateRepositoryRequest) { - return func(r *SnapshotCreateRepositoryRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SnapshotCreateRepository) WithHuman() func(*SnapshotCreateRepositoryRequest) { - return func(r *SnapshotCreateRepositoryRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SnapshotCreateRepository) WithErrorTrace() func(*SnapshotCreateRepositoryRequest) { - return func(r *SnapshotCreateRepositoryRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SnapshotCreateRepository) WithFilterPath(v ...string) func(*SnapshotCreateRepositoryRequest) { - return func(r *SnapshotCreateRepositoryRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SnapshotCreateRepository) WithHeader(h map[string]string) func(*SnapshotCreateRepositoryRequest) { - return func(r *SnapshotCreateRepositoryRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SnapshotCreateRepository) WithOpaqueID(s string) func(*SnapshotCreateRepositoryRequest) { - return func(r *SnapshotCreateRepositoryRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.snapshot.delete.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.snapshot.delete.go deleted file mode 100644 index 30605dc66..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.snapshot.delete.go +++ /dev/null @@ -1,219 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" - "time" -) - -func newSnapshotDeleteFunc(t Transport) SnapshotDelete { - return func(repository string, snapshot string, o ...func(*SnapshotDeleteRequest)) (*Response, error) { - var r = SnapshotDeleteRequest{Repository: repository, Snapshot: snapshot} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SnapshotDelete deletes a snapshot. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html. -// -type SnapshotDelete func(repository string, snapshot string, o ...func(*SnapshotDeleteRequest)) (*Response, error) - -// SnapshotDeleteRequest configures the Snapshot Delete API request. -// -type SnapshotDeleteRequest struct { - Repository string - Snapshot string - - MasterTimeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SnapshotDeleteRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "DELETE" - - path.Grow(1 + len("_snapshot") + 1 + len(r.Repository) + 1 + len(r.Snapshot)) - path.WriteString("/") - path.WriteString("_snapshot") - path.WriteString("/") - path.WriteString(r.Repository) - path.WriteString("/") - path.WriteString(r.Snapshot) - - params = make(map[string]string) - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SnapshotDelete) WithContext(v context.Context) func(*SnapshotDeleteRequest) { - return func(r *SnapshotDeleteRequest) { - r.ctx = v - } -} - -// WithMasterTimeout - explicit operation timeout for connection to master node. -// -func (f SnapshotDelete) WithMasterTimeout(v time.Duration) func(*SnapshotDeleteRequest) { - return func(r *SnapshotDeleteRequest) { - r.MasterTimeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SnapshotDelete) WithPretty() func(*SnapshotDeleteRequest) { - return func(r *SnapshotDeleteRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SnapshotDelete) WithHuman() func(*SnapshotDeleteRequest) { - return func(r *SnapshotDeleteRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SnapshotDelete) WithErrorTrace() func(*SnapshotDeleteRequest) { - return func(r *SnapshotDeleteRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SnapshotDelete) WithFilterPath(v ...string) func(*SnapshotDeleteRequest) { - return func(r *SnapshotDeleteRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SnapshotDelete) WithHeader(h map[string]string) func(*SnapshotDeleteRequest) { - return func(r *SnapshotDeleteRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SnapshotDelete) WithOpaqueID(s string) func(*SnapshotDeleteRequest) { - return func(r *SnapshotDeleteRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.snapshot.delete_repository.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.snapshot.delete_repository.go deleted file mode 100644 index ec6e2edca..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.snapshot.delete_repository.go +++ /dev/null @@ -1,229 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" - "time" -) - -func newSnapshotDeleteRepositoryFunc(t Transport) SnapshotDeleteRepository { - return func(repository []string, o ...func(*SnapshotDeleteRepositoryRequest)) (*Response, error) { - var r = SnapshotDeleteRepositoryRequest{Repository: repository} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SnapshotDeleteRepository deletes a repository. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html. -// -type SnapshotDeleteRepository func(repository []string, o ...func(*SnapshotDeleteRepositoryRequest)) (*Response, error) - -// SnapshotDeleteRepositoryRequest configures the Snapshot Delete Repository API request. -// -type SnapshotDeleteRepositoryRequest struct { - Repository []string - - MasterTimeout time.Duration - Timeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SnapshotDeleteRepositoryRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "DELETE" - - path.Grow(1 + len("_snapshot") + 1 + len(strings.Join(r.Repository, ","))) - path.WriteString("/") - path.WriteString("_snapshot") - path.WriteString("/") - path.WriteString(strings.Join(r.Repository, ",")) - - params = make(map[string]string) - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SnapshotDeleteRepository) WithContext(v context.Context) func(*SnapshotDeleteRepositoryRequest) { - return func(r *SnapshotDeleteRepositoryRequest) { - r.ctx = v - } -} - -// WithMasterTimeout - explicit operation timeout for connection to master node. -// -func (f SnapshotDeleteRepository) WithMasterTimeout(v time.Duration) func(*SnapshotDeleteRepositoryRequest) { - return func(r *SnapshotDeleteRepositoryRequest) { - r.MasterTimeout = v - } -} - -// WithTimeout - explicit operation timeout. -// -func (f SnapshotDeleteRepository) WithTimeout(v time.Duration) func(*SnapshotDeleteRepositoryRequest) { - return func(r *SnapshotDeleteRepositoryRequest) { - r.Timeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SnapshotDeleteRepository) WithPretty() func(*SnapshotDeleteRepositoryRequest) { - return func(r *SnapshotDeleteRepositoryRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SnapshotDeleteRepository) WithHuman() func(*SnapshotDeleteRepositoryRequest) { - return func(r *SnapshotDeleteRepositoryRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SnapshotDeleteRepository) WithErrorTrace() func(*SnapshotDeleteRepositoryRequest) { - return func(r *SnapshotDeleteRepositoryRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SnapshotDeleteRepository) WithFilterPath(v ...string) func(*SnapshotDeleteRepositoryRequest) { - return func(r *SnapshotDeleteRepositoryRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SnapshotDeleteRepository) WithHeader(h map[string]string) func(*SnapshotDeleteRepositoryRequest) { - return func(r *SnapshotDeleteRepositoryRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SnapshotDeleteRepository) WithOpaqueID(s string) func(*SnapshotDeleteRepositoryRequest) { - return func(r *SnapshotDeleteRepositoryRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.snapshot.get.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.snapshot.get.go deleted file mode 100644 index 6d748d175..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.snapshot.get.go +++ /dev/null @@ -1,259 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" - "time" -) - -func newSnapshotGetFunc(t Transport) SnapshotGet { - return func(repository string, snapshot []string, o ...func(*SnapshotGetRequest)) (*Response, error) { - var r = SnapshotGetRequest{Repository: repository, Snapshot: snapshot} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SnapshotGet returns information about a snapshot. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html. -// -type SnapshotGet func(repository string, snapshot []string, o ...func(*SnapshotGetRequest)) (*Response, error) - -// SnapshotGetRequest configures the Snapshot Get API request. -// -type SnapshotGetRequest struct { - Repository string - Snapshot []string - - IgnoreUnavailable *bool - IndexDetails *bool - MasterTimeout time.Duration - Verbose *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SnapshotGetRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_snapshot") + 1 + len(r.Repository) + 1 + len(strings.Join(r.Snapshot, ","))) - path.WriteString("/") - path.WriteString("_snapshot") - path.WriteString("/") - path.WriteString(r.Repository) - path.WriteString("/") - path.WriteString(strings.Join(r.Snapshot, ",")) - - params = make(map[string]string) - - if r.IgnoreUnavailable != nil { - params["ignore_unavailable"] = strconv.FormatBool(*r.IgnoreUnavailable) - } - - if r.IndexDetails != nil { - params["index_details"] = strconv.FormatBool(*r.IndexDetails) - } - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Verbose != nil { - params["verbose"] = strconv.FormatBool(*r.Verbose) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SnapshotGet) WithContext(v context.Context) func(*SnapshotGetRequest) { - return func(r *SnapshotGetRequest) { - r.ctx = v - } -} - -// WithIgnoreUnavailable - whether to ignore unavailable snapshots, defaults to false which means a snapshotmissingexception is thrown. -// -func (f SnapshotGet) WithIgnoreUnavailable(v bool) func(*SnapshotGetRequest) { - return func(r *SnapshotGetRequest) { - r.IgnoreUnavailable = &v - } -} - -// WithIndexDetails - whether to include details of each index in the snapshot, if those details are available. defaults to false.. -// -func (f SnapshotGet) WithIndexDetails(v bool) func(*SnapshotGetRequest) { - return func(r *SnapshotGetRequest) { - r.IndexDetails = &v - } -} - -// WithMasterTimeout - explicit operation timeout for connection to master node. -// -func (f SnapshotGet) WithMasterTimeout(v time.Duration) func(*SnapshotGetRequest) { - return func(r *SnapshotGetRequest) { - r.MasterTimeout = v - } -} - -// WithVerbose - whether to show verbose snapshot info or only show the basic info found in the repository index blob. -// -func (f SnapshotGet) WithVerbose(v bool) func(*SnapshotGetRequest) { - return func(r *SnapshotGetRequest) { - r.Verbose = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SnapshotGet) WithPretty() func(*SnapshotGetRequest) { - return func(r *SnapshotGetRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SnapshotGet) WithHuman() func(*SnapshotGetRequest) { - return func(r *SnapshotGetRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SnapshotGet) WithErrorTrace() func(*SnapshotGetRequest) { - return func(r *SnapshotGetRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SnapshotGet) WithFilterPath(v ...string) func(*SnapshotGetRequest) { - return func(r *SnapshotGetRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SnapshotGet) WithHeader(h map[string]string) func(*SnapshotGetRequest) { - return func(r *SnapshotGetRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SnapshotGet) WithOpaqueID(s string) func(*SnapshotGetRequest) { - return func(r *SnapshotGetRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.snapshot.get_repository.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.snapshot.get_repository.go deleted file mode 100644 index d2d524961..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.snapshot.get_repository.go +++ /dev/null @@ -1,240 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" - "time" -) - -func newSnapshotGetRepositoryFunc(t Transport) SnapshotGetRepository { - return func(o ...func(*SnapshotGetRepositoryRequest)) (*Response, error) { - var r = SnapshotGetRepositoryRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SnapshotGetRepository returns information about a repository. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html. -// -type SnapshotGetRepository func(o ...func(*SnapshotGetRepositoryRequest)) (*Response, error) - -// SnapshotGetRepositoryRequest configures the Snapshot Get Repository API request. -// -type SnapshotGetRepositoryRequest struct { - Repository []string - - Local *bool - MasterTimeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SnapshotGetRepositoryRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_snapshot") + 1 + len(strings.Join(r.Repository, ","))) - path.WriteString("/") - path.WriteString("_snapshot") - if len(r.Repository) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Repository, ",")) - } - - params = make(map[string]string) - - if r.Local != nil { - params["local"] = strconv.FormatBool(*r.Local) - } - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SnapshotGetRepository) WithContext(v context.Context) func(*SnapshotGetRepositoryRequest) { - return func(r *SnapshotGetRepositoryRequest) { - r.ctx = v - } -} - -// WithRepository - a list of repository names. -// -func (f SnapshotGetRepository) WithRepository(v ...string) func(*SnapshotGetRepositoryRequest) { - return func(r *SnapshotGetRepositoryRequest) { - r.Repository = v - } -} - -// WithLocal - return local information, do not retrieve the state from master node (default: false). -// -func (f SnapshotGetRepository) WithLocal(v bool) func(*SnapshotGetRepositoryRequest) { - return func(r *SnapshotGetRepositoryRequest) { - r.Local = &v - } -} - -// WithMasterTimeout - explicit operation timeout for connection to master node. -// -func (f SnapshotGetRepository) WithMasterTimeout(v time.Duration) func(*SnapshotGetRepositoryRequest) { - return func(r *SnapshotGetRepositoryRequest) { - r.MasterTimeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SnapshotGetRepository) WithPretty() func(*SnapshotGetRepositoryRequest) { - return func(r *SnapshotGetRepositoryRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SnapshotGetRepository) WithHuman() func(*SnapshotGetRepositoryRequest) { - return func(r *SnapshotGetRepositoryRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SnapshotGetRepository) WithErrorTrace() func(*SnapshotGetRepositoryRequest) { - return func(r *SnapshotGetRepositoryRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SnapshotGetRepository) WithFilterPath(v ...string) func(*SnapshotGetRepositoryRequest) { - return func(r *SnapshotGetRepositoryRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SnapshotGetRepository) WithHeader(h map[string]string) func(*SnapshotGetRepositoryRequest) { - return func(r *SnapshotGetRepositoryRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SnapshotGetRepository) WithOpaqueID(s string) func(*SnapshotGetRepositoryRequest) { - return func(r *SnapshotGetRepositoryRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.snapshot.repository_analyze.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.snapshot.repository_analyze.go deleted file mode 100644 index ccc3d8fea..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.snapshot.repository_analyze.go +++ /dev/null @@ -1,336 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" - "time" -) - -func newSnapshotRepositoryAnalyzeFunc(t Transport) SnapshotRepositoryAnalyze { - return func(repository string, o ...func(*SnapshotRepositoryAnalyzeRequest)) (*Response, error) { - var r = SnapshotRepositoryAnalyzeRequest{Repository: repository} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SnapshotRepositoryAnalyze analyzes a repository for correctness and performance -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html. -// -type SnapshotRepositoryAnalyze func(repository string, o ...func(*SnapshotRepositoryAnalyzeRequest)) (*Response, error) - -// SnapshotRepositoryAnalyzeRequest configures the Snapshot Repository Analyze API request. -// -type SnapshotRepositoryAnalyzeRequest struct { - Repository string - - BlobCount *int - Concurrency *int - Detailed *bool - EarlyReadNodeCount *int - MaxBlobSize string - MaxTotalDataSize string - RareActionProbability *int - ReadNodeCount *int - Seed *int - Timeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SnapshotRepositoryAnalyzeRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_snapshot") + 1 + len(r.Repository) + 1 + len("_analyze")) - path.WriteString("/") - path.WriteString("_snapshot") - path.WriteString("/") - path.WriteString(r.Repository) - path.WriteString("/") - path.WriteString("_analyze") - - params = make(map[string]string) - - if r.BlobCount != nil { - params["blob_count"] = strconv.FormatInt(int64(*r.BlobCount), 10) - } - - if r.Concurrency != nil { - params["concurrency"] = strconv.FormatInt(int64(*r.Concurrency), 10) - } - - if r.Detailed != nil { - params["detailed"] = strconv.FormatBool(*r.Detailed) - } - - if r.EarlyReadNodeCount != nil { - params["early_read_node_count"] = strconv.FormatInt(int64(*r.EarlyReadNodeCount), 10) - } - - if r.MaxBlobSize != "" { - params["max_blob_size"] = r.MaxBlobSize - } - - if r.MaxTotalDataSize != "" { - params["max_total_data_size"] = r.MaxTotalDataSize - } - - if r.RareActionProbability != nil { - params["rare_action_probability"] = strconv.FormatInt(int64(*r.RareActionProbability), 10) - } - - if r.ReadNodeCount != nil { - params["read_node_count"] = strconv.FormatInt(int64(*r.ReadNodeCount), 10) - } - - if r.Seed != nil { - params["seed"] = strconv.FormatInt(int64(*r.Seed), 10) - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SnapshotRepositoryAnalyze) WithContext(v context.Context) func(*SnapshotRepositoryAnalyzeRequest) { - return func(r *SnapshotRepositoryAnalyzeRequest) { - r.ctx = v - } -} - -// WithBlobCount - number of blobs to create during the test. defaults to 100.. -// -func (f SnapshotRepositoryAnalyze) WithBlobCount(v int) func(*SnapshotRepositoryAnalyzeRequest) { - return func(r *SnapshotRepositoryAnalyzeRequest) { - r.BlobCount = &v - } -} - -// WithConcurrency - number of operations to run concurrently during the test. defaults to 10.. -// -func (f SnapshotRepositoryAnalyze) WithConcurrency(v int) func(*SnapshotRepositoryAnalyzeRequest) { - return func(r *SnapshotRepositoryAnalyzeRequest) { - r.Concurrency = &v - } -} - -// WithDetailed - whether to return detailed results or a summary. defaults to 'false' so that only the summary is returned.. -// -func (f SnapshotRepositoryAnalyze) WithDetailed(v bool) func(*SnapshotRepositoryAnalyzeRequest) { - return func(r *SnapshotRepositoryAnalyzeRequest) { - r.Detailed = &v - } -} - -// WithEarlyReadNodeCount - number of nodes on which to perform an early read on a blob, i.e. before writing has completed. early reads are rare actions so the 'rare_action_probability' parameter is also relevant. defaults to 2.. -// -func (f SnapshotRepositoryAnalyze) WithEarlyReadNodeCount(v int) func(*SnapshotRepositoryAnalyzeRequest) { - return func(r *SnapshotRepositoryAnalyzeRequest) { - r.EarlyReadNodeCount = &v - } -} - -// WithMaxBlobSize - maximum size of a blob to create during the test, e.g '1gb' or '100mb'. defaults to '10mb'.. -// -func (f SnapshotRepositoryAnalyze) WithMaxBlobSize(v string) func(*SnapshotRepositoryAnalyzeRequest) { - return func(r *SnapshotRepositoryAnalyzeRequest) { - r.MaxBlobSize = v - } -} - -// WithMaxTotalDataSize - maximum total size of all blobs to create during the test, e.g '1tb' or '100gb'. defaults to '1gb'.. -// -func (f SnapshotRepositoryAnalyze) WithMaxTotalDataSize(v string) func(*SnapshotRepositoryAnalyzeRequest) { - return func(r *SnapshotRepositoryAnalyzeRequest) { - r.MaxTotalDataSize = v - } -} - -// WithRareActionProbability - probability of taking a rare action such as an early read or an overwrite. defaults to 0.02.. -// -func (f SnapshotRepositoryAnalyze) WithRareActionProbability(v int) func(*SnapshotRepositoryAnalyzeRequest) { - return func(r *SnapshotRepositoryAnalyzeRequest) { - r.RareActionProbability = &v - } -} - -// WithReadNodeCount - number of nodes on which to read a blob after writing. defaults to 10.. -// -func (f SnapshotRepositoryAnalyze) WithReadNodeCount(v int) func(*SnapshotRepositoryAnalyzeRequest) { - return func(r *SnapshotRepositoryAnalyzeRequest) { - r.ReadNodeCount = &v - } -} - -// WithSeed - seed for the random number generator used to create the test workload. defaults to a random value.. -// -func (f SnapshotRepositoryAnalyze) WithSeed(v int) func(*SnapshotRepositoryAnalyzeRequest) { - return func(r *SnapshotRepositoryAnalyzeRequest) { - r.Seed = &v - } -} - -// WithTimeout - explicit operation timeout. defaults to '30s'.. -// -func (f SnapshotRepositoryAnalyze) WithTimeout(v time.Duration) func(*SnapshotRepositoryAnalyzeRequest) { - return func(r *SnapshotRepositoryAnalyzeRequest) { - r.Timeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SnapshotRepositoryAnalyze) WithPretty() func(*SnapshotRepositoryAnalyzeRequest) { - return func(r *SnapshotRepositoryAnalyzeRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SnapshotRepositoryAnalyze) WithHuman() func(*SnapshotRepositoryAnalyzeRequest) { - return func(r *SnapshotRepositoryAnalyzeRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SnapshotRepositoryAnalyze) WithErrorTrace() func(*SnapshotRepositoryAnalyzeRequest) { - return func(r *SnapshotRepositoryAnalyzeRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SnapshotRepositoryAnalyze) WithFilterPath(v ...string) func(*SnapshotRepositoryAnalyzeRequest) { - return func(r *SnapshotRepositoryAnalyzeRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SnapshotRepositoryAnalyze) WithHeader(h map[string]string) func(*SnapshotRepositoryAnalyzeRequest) { - return func(r *SnapshotRepositoryAnalyzeRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SnapshotRepositoryAnalyze) WithOpaqueID(s string) func(*SnapshotRepositoryAnalyzeRequest) { - return func(r *SnapshotRepositoryAnalyzeRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.snapshot.restore.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.snapshot.restore.go deleted file mode 100644 index ddfdc5249..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.snapshot.restore.go +++ /dev/null @@ -1,250 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" - "time" -) - -func newSnapshotRestoreFunc(t Transport) SnapshotRestore { - return func(repository string, snapshot string, o ...func(*SnapshotRestoreRequest)) (*Response, error) { - var r = SnapshotRestoreRequest{Repository: repository, Snapshot: snapshot} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SnapshotRestore restores a snapshot. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html. -// -type SnapshotRestore func(repository string, snapshot string, o ...func(*SnapshotRestoreRequest)) (*Response, error) - -// SnapshotRestoreRequest configures the Snapshot Restore API request. -// -type SnapshotRestoreRequest struct { - Body io.Reader - - Repository string - Snapshot string - - MasterTimeout time.Duration - WaitForCompletion *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SnapshotRestoreRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_snapshot") + 1 + len(r.Repository) + 1 + len(r.Snapshot) + 1 + len("_restore")) - path.WriteString("/") - path.WriteString("_snapshot") - path.WriteString("/") - path.WriteString(r.Repository) - path.WriteString("/") - path.WriteString(r.Snapshot) - path.WriteString("/") - path.WriteString("_restore") - - params = make(map[string]string) - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.WaitForCompletion != nil { - params["wait_for_completion"] = strconv.FormatBool(*r.WaitForCompletion) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SnapshotRestore) WithContext(v context.Context) func(*SnapshotRestoreRequest) { - return func(r *SnapshotRestoreRequest) { - r.ctx = v - } -} - -// WithBody - Details of what to restore. -// -func (f SnapshotRestore) WithBody(v io.Reader) func(*SnapshotRestoreRequest) { - return func(r *SnapshotRestoreRequest) { - r.Body = v - } -} - -// WithMasterTimeout - explicit operation timeout for connection to master node. -// -func (f SnapshotRestore) WithMasterTimeout(v time.Duration) func(*SnapshotRestoreRequest) { - return func(r *SnapshotRestoreRequest) { - r.MasterTimeout = v - } -} - -// WithWaitForCompletion - should this request wait until the operation has completed before returning. -// -func (f SnapshotRestore) WithWaitForCompletion(v bool) func(*SnapshotRestoreRequest) { - return func(r *SnapshotRestoreRequest) { - r.WaitForCompletion = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SnapshotRestore) WithPretty() func(*SnapshotRestoreRequest) { - return func(r *SnapshotRestoreRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SnapshotRestore) WithHuman() func(*SnapshotRestoreRequest) { - return func(r *SnapshotRestoreRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SnapshotRestore) WithErrorTrace() func(*SnapshotRestoreRequest) { - return func(r *SnapshotRestoreRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SnapshotRestore) WithFilterPath(v ...string) func(*SnapshotRestoreRequest) { - return func(r *SnapshotRestoreRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SnapshotRestore) WithHeader(h map[string]string) func(*SnapshotRestoreRequest) { - return func(r *SnapshotRestoreRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SnapshotRestore) WithOpaqueID(s string) func(*SnapshotRestoreRequest) { - return func(r *SnapshotRestoreRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.snapshot.status.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.snapshot.status.go deleted file mode 100644 index 18b027da0..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.snapshot.status.go +++ /dev/null @@ -1,255 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" - "time" -) - -func newSnapshotStatusFunc(t Transport) SnapshotStatus { - return func(o ...func(*SnapshotStatusRequest)) (*Response, error) { - var r = SnapshotStatusRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SnapshotStatus returns information about the status of a snapshot. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html. -// -type SnapshotStatus func(o ...func(*SnapshotStatusRequest)) (*Response, error) - -// SnapshotStatusRequest configures the Snapshot Status API request. -// -type SnapshotStatusRequest struct { - Repository string - Snapshot []string - - IgnoreUnavailable *bool - MasterTimeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SnapshotStatusRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_snapshot") + 1 + len(r.Repository) + 1 + len(strings.Join(r.Snapshot, ",")) + 1 + len("_status")) - path.WriteString("/") - path.WriteString("_snapshot") - if r.Repository != "" { - path.WriteString("/") - path.WriteString(r.Repository) - } - if len(r.Snapshot) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Snapshot, ",")) - } - path.WriteString("/") - path.WriteString("_status") - - params = make(map[string]string) - - if r.IgnoreUnavailable != nil { - params["ignore_unavailable"] = strconv.FormatBool(*r.IgnoreUnavailable) - } - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SnapshotStatus) WithContext(v context.Context) func(*SnapshotStatusRequest) { - return func(r *SnapshotStatusRequest) { - r.ctx = v - } -} - -// WithRepository - a repository name. -// -func (f SnapshotStatus) WithRepository(v string) func(*SnapshotStatusRequest) { - return func(r *SnapshotStatusRequest) { - r.Repository = v - } -} - -// WithSnapshot - a list of snapshot names. -// -func (f SnapshotStatus) WithSnapshot(v ...string) func(*SnapshotStatusRequest) { - return func(r *SnapshotStatusRequest) { - r.Snapshot = v - } -} - -// WithIgnoreUnavailable - whether to ignore unavailable snapshots, defaults to false which means a snapshotmissingexception is thrown. -// -func (f SnapshotStatus) WithIgnoreUnavailable(v bool) func(*SnapshotStatusRequest) { - return func(r *SnapshotStatusRequest) { - r.IgnoreUnavailable = &v - } -} - -// WithMasterTimeout - explicit operation timeout for connection to master node. -// -func (f SnapshotStatus) WithMasterTimeout(v time.Duration) func(*SnapshotStatusRequest) { - return func(r *SnapshotStatusRequest) { - r.MasterTimeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SnapshotStatus) WithPretty() func(*SnapshotStatusRequest) { - return func(r *SnapshotStatusRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SnapshotStatus) WithHuman() func(*SnapshotStatusRequest) { - return func(r *SnapshotStatusRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SnapshotStatus) WithErrorTrace() func(*SnapshotStatusRequest) { - return func(r *SnapshotStatusRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SnapshotStatus) WithFilterPath(v ...string) func(*SnapshotStatusRequest) { - return func(r *SnapshotStatusRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SnapshotStatus) WithHeader(h map[string]string) func(*SnapshotStatusRequest) { - return func(r *SnapshotStatusRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SnapshotStatus) WithOpaqueID(s string) func(*SnapshotStatusRequest) { - return func(r *SnapshotStatusRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.snapshot.verify_repository.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.snapshot.verify_repository.go deleted file mode 100644 index 217fbe3cc..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.snapshot.verify_repository.go +++ /dev/null @@ -1,231 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" - "time" -) - -func newSnapshotVerifyRepositoryFunc(t Transport) SnapshotVerifyRepository { - return func(repository string, o ...func(*SnapshotVerifyRepositoryRequest)) (*Response, error) { - var r = SnapshotVerifyRepositoryRequest{Repository: repository} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SnapshotVerifyRepository verifies a repository. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html. -// -type SnapshotVerifyRepository func(repository string, o ...func(*SnapshotVerifyRepositoryRequest)) (*Response, error) - -// SnapshotVerifyRepositoryRequest configures the Snapshot Verify Repository API request. -// -type SnapshotVerifyRepositoryRequest struct { - Repository string - - MasterTimeout time.Duration - Timeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SnapshotVerifyRepositoryRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_snapshot") + 1 + len(r.Repository) + 1 + len("_verify")) - path.WriteString("/") - path.WriteString("_snapshot") - path.WriteString("/") - path.WriteString(r.Repository) - path.WriteString("/") - path.WriteString("_verify") - - params = make(map[string]string) - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SnapshotVerifyRepository) WithContext(v context.Context) func(*SnapshotVerifyRepositoryRequest) { - return func(r *SnapshotVerifyRepositoryRequest) { - r.ctx = v - } -} - -// WithMasterTimeout - explicit operation timeout for connection to master node. -// -func (f SnapshotVerifyRepository) WithMasterTimeout(v time.Duration) func(*SnapshotVerifyRepositoryRequest) { - return func(r *SnapshotVerifyRepositoryRequest) { - r.MasterTimeout = v - } -} - -// WithTimeout - explicit operation timeout. -// -func (f SnapshotVerifyRepository) WithTimeout(v time.Duration) func(*SnapshotVerifyRepositoryRequest) { - return func(r *SnapshotVerifyRepositoryRequest) { - r.Timeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SnapshotVerifyRepository) WithPretty() func(*SnapshotVerifyRepositoryRequest) { - return func(r *SnapshotVerifyRepositoryRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SnapshotVerifyRepository) WithHuman() func(*SnapshotVerifyRepositoryRequest) { - return func(r *SnapshotVerifyRepositoryRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SnapshotVerifyRepository) WithErrorTrace() func(*SnapshotVerifyRepositoryRequest) { - return func(r *SnapshotVerifyRepositoryRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SnapshotVerifyRepository) WithFilterPath(v ...string) func(*SnapshotVerifyRepositoryRequest) { - return func(r *SnapshotVerifyRepositoryRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SnapshotVerifyRepository) WithHeader(h map[string]string) func(*SnapshotVerifyRepositoryRequest) { - return func(r *SnapshotVerifyRepositoryRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SnapshotVerifyRepository) WithOpaqueID(s string) func(*SnapshotVerifyRepositoryRequest) { - return func(r *SnapshotVerifyRepositoryRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.tasks.cancel.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.tasks.cancel.go deleted file mode 100644 index 45d834ea9..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.tasks.cancel.go +++ /dev/null @@ -1,269 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newTasksCancelFunc(t Transport) TasksCancel { - return func(o ...func(*TasksCancelRequest)) (*Response, error) { - var r = TasksCancelRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// TasksCancel cancels a task, if it can be cancelled through an API. -// -// This API is experimental. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html. -// -type TasksCancel func(o ...func(*TasksCancelRequest)) (*Response, error) - -// TasksCancelRequest configures the Tasks Cancel API request. -// -type TasksCancelRequest struct { - TaskID string - - Actions []string - Nodes []string - ParentTaskID string - WaitForCompletion *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r TasksCancelRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_tasks") + 1 + len(r.TaskID) + 1 + len("_cancel")) - path.WriteString("/") - path.WriteString("_tasks") - if r.TaskID != "" { - path.WriteString("/") - path.WriteString(r.TaskID) - } - path.WriteString("/") - path.WriteString("_cancel") - - params = make(map[string]string) - - if len(r.Actions) > 0 { - params["actions"] = strings.Join(r.Actions, ",") - } - - if len(r.Nodes) > 0 { - params["nodes"] = strings.Join(r.Nodes, ",") - } - - if r.ParentTaskID != "" { - params["parent_task_id"] = r.ParentTaskID - } - - if r.WaitForCompletion != nil { - params["wait_for_completion"] = strconv.FormatBool(*r.WaitForCompletion) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f TasksCancel) WithContext(v context.Context) func(*TasksCancelRequest) { - return func(r *TasksCancelRequest) { - r.ctx = v - } -} - -// WithTaskID - cancel the task with specified task ID (node_id:task_number). -// -func (f TasksCancel) WithTaskID(v string) func(*TasksCancelRequest) { - return func(r *TasksCancelRequest) { - r.TaskID = v - } -} - -// WithActions - a list of actions that should be cancelled. leave empty to cancel all.. -// -func (f TasksCancel) WithActions(v ...string) func(*TasksCancelRequest) { - return func(r *TasksCancelRequest) { - r.Actions = v - } -} - -// WithNodes - a list of node ids or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes. -// -func (f TasksCancel) WithNodes(v ...string) func(*TasksCancelRequest) { - return func(r *TasksCancelRequest) { - r.Nodes = v - } -} - -// WithParentTaskID - cancel tasks with specified parent task ID (node_id:task_number). set to -1 to cancel all.. -// -func (f TasksCancel) WithParentTaskID(v string) func(*TasksCancelRequest) { - return func(r *TasksCancelRequest) { - r.ParentTaskID = v - } -} - -// WithWaitForCompletion - should the request block until the cancellation of the task and its descendant tasks is completed. defaults to false. -// -func (f TasksCancel) WithWaitForCompletion(v bool) func(*TasksCancelRequest) { - return func(r *TasksCancelRequest) { - r.WaitForCompletion = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f TasksCancel) WithPretty() func(*TasksCancelRequest) { - return func(r *TasksCancelRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f TasksCancel) WithHuman() func(*TasksCancelRequest) { - return func(r *TasksCancelRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f TasksCancel) WithErrorTrace() func(*TasksCancelRequest) { - return func(r *TasksCancelRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f TasksCancel) WithFilterPath(v ...string) func(*TasksCancelRequest) { - return func(r *TasksCancelRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f TasksCancel) WithHeader(h map[string]string) func(*TasksCancelRequest) { - return func(r *TasksCancelRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f TasksCancel) WithOpaqueID(s string) func(*TasksCancelRequest) { - return func(r *TasksCancelRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.tasks.get.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.tasks.get.go deleted file mode 100644 index 1d3199e4d..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.tasks.get.go +++ /dev/null @@ -1,232 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" - "time" -) - -func newTasksGetFunc(t Transport) TasksGet { - return func(task_id string, o ...func(*TasksGetRequest)) (*Response, error) { - var r = TasksGetRequest{TaskID: task_id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// TasksGet returns information about a task. -// -// This API is experimental. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html. -// -type TasksGet func(task_id string, o ...func(*TasksGetRequest)) (*Response, error) - -// TasksGetRequest configures the Tasks Get API request. -// -type TasksGetRequest struct { - TaskID string - - Timeout time.Duration - WaitForCompletion *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r TasksGetRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_tasks") + 1 + len(r.TaskID)) - path.WriteString("/") - path.WriteString("_tasks") - path.WriteString("/") - path.WriteString(r.TaskID) - - params = make(map[string]string) - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.WaitForCompletion != nil { - params["wait_for_completion"] = strconv.FormatBool(*r.WaitForCompletion) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f TasksGet) WithContext(v context.Context) func(*TasksGetRequest) { - return func(r *TasksGetRequest) { - r.ctx = v - } -} - -// WithTimeout - explicit operation timeout. -// -func (f TasksGet) WithTimeout(v time.Duration) func(*TasksGetRequest) { - return func(r *TasksGetRequest) { - r.Timeout = v - } -} - -// WithWaitForCompletion - wait for the matching tasks to complete (default: false). -// -func (f TasksGet) WithWaitForCompletion(v bool) func(*TasksGetRequest) { - return func(r *TasksGetRequest) { - r.WaitForCompletion = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f TasksGet) WithPretty() func(*TasksGetRequest) { - return func(r *TasksGetRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f TasksGet) WithHuman() func(*TasksGetRequest) { - return func(r *TasksGetRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f TasksGet) WithErrorTrace() func(*TasksGetRequest) { - return func(r *TasksGetRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f TasksGet) WithFilterPath(v ...string) func(*TasksGetRequest) { - return func(r *TasksGetRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f TasksGet) WithHeader(h map[string]string) func(*TasksGetRequest) { - return func(r *TasksGetRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f TasksGet) WithOpaqueID(s string) func(*TasksGetRequest) { - return func(r *TasksGetRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.tasks.list.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.tasks.list.go deleted file mode 100644 index 134c2ba0f..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.tasks.list.go +++ /dev/null @@ -1,292 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" - "time" -) - -func newTasksListFunc(t Transport) TasksList { - return func(o ...func(*TasksListRequest)) (*Response, error) { - var r = TasksListRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// TasksList returns a list of tasks. -// -// This API is experimental. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html. -// -type TasksList func(o ...func(*TasksListRequest)) (*Response, error) - -// TasksListRequest configures the Tasks List API request. -// -type TasksListRequest struct { - Actions []string - Detailed *bool - GroupBy string - Nodes []string - ParentTaskID string - Timeout time.Duration - WaitForCompletion *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r TasksListRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(len("/_tasks")) - path.WriteString("/_tasks") - - params = make(map[string]string) - - if len(r.Actions) > 0 { - params["actions"] = strings.Join(r.Actions, ",") - } - - if r.Detailed != nil { - params["detailed"] = strconv.FormatBool(*r.Detailed) - } - - if r.GroupBy != "" { - params["group_by"] = r.GroupBy - } - - if len(r.Nodes) > 0 { - params["nodes"] = strings.Join(r.Nodes, ",") - } - - if r.ParentTaskID != "" { - params["parent_task_id"] = r.ParentTaskID - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.WaitForCompletion != nil { - params["wait_for_completion"] = strconv.FormatBool(*r.WaitForCompletion) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f TasksList) WithContext(v context.Context) func(*TasksListRequest) { - return func(r *TasksListRequest) { - r.ctx = v - } -} - -// WithActions - a list of actions that should be returned. leave empty to return all.. -// -func (f TasksList) WithActions(v ...string) func(*TasksListRequest) { - return func(r *TasksListRequest) { - r.Actions = v - } -} - -// WithDetailed - return detailed task information (default: false). -// -func (f TasksList) WithDetailed(v bool) func(*TasksListRequest) { - return func(r *TasksListRequest) { - r.Detailed = &v - } -} - -// WithGroupBy - group tasks by nodes or parent/child relationships. -// -func (f TasksList) WithGroupBy(v string) func(*TasksListRequest) { - return func(r *TasksListRequest) { - r.GroupBy = v - } -} - -// WithNodes - a list of node ids or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes. -// -func (f TasksList) WithNodes(v ...string) func(*TasksListRequest) { - return func(r *TasksListRequest) { - r.Nodes = v - } -} - -// WithParentTaskID - return tasks with specified parent task ID (node_id:task_number). set to -1 to return all.. -// -func (f TasksList) WithParentTaskID(v string) func(*TasksListRequest) { - return func(r *TasksListRequest) { - r.ParentTaskID = v - } -} - -// WithTimeout - explicit operation timeout. -// -func (f TasksList) WithTimeout(v time.Duration) func(*TasksListRequest) { - return func(r *TasksListRequest) { - r.Timeout = v - } -} - -// WithWaitForCompletion - wait for the matching tasks to complete (default: false). -// -func (f TasksList) WithWaitForCompletion(v bool) func(*TasksListRequest) { - return func(r *TasksListRequest) { - r.WaitForCompletion = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f TasksList) WithPretty() func(*TasksListRequest) { - return func(r *TasksListRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f TasksList) WithHuman() func(*TasksListRequest) { - return func(r *TasksListRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f TasksList) WithErrorTrace() func(*TasksListRequest) { - return func(r *TasksListRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f TasksList) WithFilterPath(v ...string) func(*TasksListRequest) { - return func(r *TasksListRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f TasksList) WithHeader(h map[string]string) func(*TasksListRequest) { - return func(r *TasksListRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f TasksList) WithOpaqueID(s string) func(*TasksListRequest) { - return func(r *TasksListRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.termvectors.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.termvectors.go deleted file mode 100644 index b7f6fe5f7..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.termvectors.go +++ /dev/null @@ -1,391 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" -) - -func newTermvectorsFunc(t Transport) Termvectors { - return func(index string, o ...func(*TermvectorsRequest)) (*Response, error) { - var r = TermvectorsRequest{Index: index} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// Termvectors returns information and statistics about terms in the fields of a particular document. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-termvectors.html. -// -type Termvectors func(index string, o ...func(*TermvectorsRequest)) (*Response, error) - -// TermvectorsRequest configures the Termvectors API request. -// -type TermvectorsRequest struct { - Index string - DocumentType string - DocumentID string - - Body io.Reader - - Fields []string - FieldStatistics *bool - Offsets *bool - Payloads *bool - Positions *bool - Preference string - Realtime *bool - Routing string - TermStatistics *bool - Version *int - VersionType string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r TermvectorsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - if r.DocumentType == "" { - r.DocumentType = "_doc" - } - - path.Grow(1 + len(r.Index) + 1 + len(r.DocumentType) + 1 + len(r.DocumentID) + 1 + len("_termvectors")) - path.WriteString("/") - path.WriteString(r.Index) - if r.DocumentType != "" { - path.WriteString("/") - path.WriteString(r.DocumentType) - } - if r.DocumentID != "" { - path.WriteString("/") - path.WriteString(r.DocumentID) - } - path.WriteString("/") - path.WriteString("_termvectors") - - params = make(map[string]string) - - if len(r.Fields) > 0 { - params["fields"] = strings.Join(r.Fields, ",") - } - - if r.FieldStatistics != nil { - params["field_statistics"] = strconv.FormatBool(*r.FieldStatistics) - } - - if r.Offsets != nil { - params["offsets"] = strconv.FormatBool(*r.Offsets) - } - - if r.Payloads != nil { - params["payloads"] = strconv.FormatBool(*r.Payloads) - } - - if r.Positions != nil { - params["positions"] = strconv.FormatBool(*r.Positions) - } - - if r.Preference != "" { - params["preference"] = r.Preference - } - - if r.Realtime != nil { - params["realtime"] = strconv.FormatBool(*r.Realtime) - } - - if r.Routing != "" { - params["routing"] = r.Routing - } - - if r.TermStatistics != nil { - params["term_statistics"] = strconv.FormatBool(*r.TermStatistics) - } - - if r.Version != nil { - params["version"] = strconv.FormatInt(int64(*r.Version), 10) - } - - if r.VersionType != "" { - params["version_type"] = r.VersionType - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f Termvectors) WithContext(v context.Context) func(*TermvectorsRequest) { - return func(r *TermvectorsRequest) { - r.ctx = v - } -} - -// WithBody - Define parameters and or supply a document to get termvectors for. See documentation.. -// -func (f Termvectors) WithBody(v io.Reader) func(*TermvectorsRequest) { - return func(r *TermvectorsRequest) { - r.Body = v - } -} - -// WithDocumentID - the ID of the document, when not specified a doc param should be supplied.. -// -func (f Termvectors) WithDocumentID(v string) func(*TermvectorsRequest) { - return func(r *TermvectorsRequest) { - r.DocumentID = v - } -} - -// WithDocumentType - the type of the document.. -// -func (f Termvectors) WithDocumentType(v string) func(*TermvectorsRequest) { - return func(r *TermvectorsRequest) { - r.DocumentType = v - } -} - -// WithFields - a list of fields to return.. -// -func (f Termvectors) WithFields(v ...string) func(*TermvectorsRequest) { - return func(r *TermvectorsRequest) { - r.Fields = v - } -} - -// WithFieldStatistics - specifies if document count, sum of document frequencies and sum of total term frequencies should be returned.. -// -func (f Termvectors) WithFieldStatistics(v bool) func(*TermvectorsRequest) { - return func(r *TermvectorsRequest) { - r.FieldStatistics = &v - } -} - -// WithOffsets - specifies if term offsets should be returned.. -// -func (f Termvectors) WithOffsets(v bool) func(*TermvectorsRequest) { - return func(r *TermvectorsRequest) { - r.Offsets = &v - } -} - -// WithPayloads - specifies if term payloads should be returned.. -// -func (f Termvectors) WithPayloads(v bool) func(*TermvectorsRequest) { - return func(r *TermvectorsRequest) { - r.Payloads = &v - } -} - -// WithPositions - specifies if term positions should be returned.. -// -func (f Termvectors) WithPositions(v bool) func(*TermvectorsRequest) { - return func(r *TermvectorsRequest) { - r.Positions = &v - } -} - -// WithPreference - specify the node or shard the operation should be performed on (default: random).. -// -func (f Termvectors) WithPreference(v string) func(*TermvectorsRequest) { - return func(r *TermvectorsRequest) { - r.Preference = v - } -} - -// WithRealtime - specifies if request is real-time as opposed to near-real-time (default: true).. -// -func (f Termvectors) WithRealtime(v bool) func(*TermvectorsRequest) { - return func(r *TermvectorsRequest) { - r.Realtime = &v - } -} - -// WithRouting - specific routing value.. -// -func (f Termvectors) WithRouting(v string) func(*TermvectorsRequest) { - return func(r *TermvectorsRequest) { - r.Routing = v - } -} - -// WithTermStatistics - specifies if total term frequency and document frequency should be returned.. -// -func (f Termvectors) WithTermStatistics(v bool) func(*TermvectorsRequest) { - return func(r *TermvectorsRequest) { - r.TermStatistics = &v - } -} - -// WithVersion - explicit version number for concurrency control. -// -func (f Termvectors) WithVersion(v int) func(*TermvectorsRequest) { - return func(r *TermvectorsRequest) { - r.Version = &v - } -} - -// WithVersionType - specific version type. -// -func (f Termvectors) WithVersionType(v string) func(*TermvectorsRequest) { - return func(r *TermvectorsRequest) { - r.VersionType = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f Termvectors) WithPretty() func(*TermvectorsRequest) { - return func(r *TermvectorsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f Termvectors) WithHuman() func(*TermvectorsRequest) { - return func(r *TermvectorsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f Termvectors) WithErrorTrace() func(*TermvectorsRequest) { - return func(r *TermvectorsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f Termvectors) WithFilterPath(v ...string) func(*TermvectorsRequest) { - return func(r *TermvectorsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f Termvectors) WithHeader(h map[string]string) func(*TermvectorsRequest) { - return func(r *TermvectorsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f Termvectors) WithOpaqueID(s string) func(*TermvectorsRequest) { - return func(r *TermvectorsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.update.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.update.go deleted file mode 100644 index eba94c45b..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.update.go +++ /dev/null @@ -1,387 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" - "time" -) - -func newUpdateFunc(t Transport) Update { - return func(index string, id string, body io.Reader, o ...func(*UpdateRequest)) (*Response, error) { - var r = UpdateRequest{Index: index, DocumentID: id, Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// Update updates a document with a script or partial document. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-update.html. -// -type Update func(index string, id string, body io.Reader, o ...func(*UpdateRequest)) (*Response, error) - -// UpdateRequest configures the Update API request. -// -type UpdateRequest struct { - Index string - DocumentType string - DocumentID string - - Body io.Reader - - IfPrimaryTerm *int - IfSeqNo *int - Lang string - Refresh string - RequireAlias *bool - RetryOnConflict *int - Routing string - Source []string - SourceExcludes []string - SourceIncludes []string - Timeout time.Duration - WaitForActiveShards string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r UpdateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - if r.DocumentType == "" { - r.DocumentType = "_doc" - } - - path.Grow(1 + len(r.Index) + 1 + len(r.DocumentType) + 1 + len(r.DocumentID) + 1 + len("_update")) - path.WriteString("/") - path.WriteString(r.Index) - if r.DocumentType != "" { - path.WriteString("/") - path.WriteString(r.DocumentType) - } - path.WriteString("/") - path.WriteString(r.DocumentID) - path.WriteString("/") - path.WriteString("_update") - - params = make(map[string]string) - - if r.IfPrimaryTerm != nil { - params["if_primary_term"] = strconv.FormatInt(int64(*r.IfPrimaryTerm), 10) - } - - if r.IfSeqNo != nil { - params["if_seq_no"] = strconv.FormatInt(int64(*r.IfSeqNo), 10) - } - - if r.Lang != "" { - params["lang"] = r.Lang - } - - if r.Refresh != "" { - params["refresh"] = r.Refresh - } - - if r.RequireAlias != nil { - params["require_alias"] = strconv.FormatBool(*r.RequireAlias) - } - - if r.RetryOnConflict != nil { - params["retry_on_conflict"] = strconv.FormatInt(int64(*r.RetryOnConflict), 10) - } - - if r.Routing != "" { - params["routing"] = r.Routing - } - - if len(r.Source) > 0 { - params["_source"] = strings.Join(r.Source, ",") - } - - if len(r.SourceExcludes) > 0 { - params["_source_excludes"] = strings.Join(r.SourceExcludes, ",") - } - - if len(r.SourceIncludes) > 0 { - params["_source_includes"] = strings.Join(r.SourceIncludes, ",") - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.WaitForActiveShards != "" { - params["wait_for_active_shards"] = r.WaitForActiveShards - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f Update) WithContext(v context.Context) func(*UpdateRequest) { - return func(r *UpdateRequest) { - r.ctx = v - } -} - -// WithDocumentType - the type of the document. -// -func (f Update) WithDocumentType(v string) func(*UpdateRequest) { - return func(r *UpdateRequest) { - r.DocumentType = v - } -} - -// WithIfPrimaryTerm - only perform the update operation if the last operation that has changed the document has the specified primary term. -// -func (f Update) WithIfPrimaryTerm(v int) func(*UpdateRequest) { - return func(r *UpdateRequest) { - r.IfPrimaryTerm = &v - } -} - -// WithIfSeqNo - only perform the update operation if the last operation that has changed the document has the specified sequence number. -// -func (f Update) WithIfSeqNo(v int) func(*UpdateRequest) { - return func(r *UpdateRequest) { - r.IfSeqNo = &v - } -} - -// WithLang - the script language (default: painless). -// -func (f Update) WithLang(v string) func(*UpdateRequest) { - return func(r *UpdateRequest) { - r.Lang = v - } -} - -// WithRefresh - if `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes.. -// -func (f Update) WithRefresh(v string) func(*UpdateRequest) { - return func(r *UpdateRequest) { - r.Refresh = v - } -} - -// WithRequireAlias - when true, requires destination is an alias. default is false. -// -func (f Update) WithRequireAlias(v bool) func(*UpdateRequest) { - return func(r *UpdateRequest) { - r.RequireAlias = &v - } -} - -// WithRetryOnConflict - specify how many times should the operation be retried when a conflict occurs (default: 0). -// -func (f Update) WithRetryOnConflict(v int) func(*UpdateRequest) { - return func(r *UpdateRequest) { - r.RetryOnConflict = &v - } -} - -// WithRouting - specific routing value. -// -func (f Update) WithRouting(v string) func(*UpdateRequest) { - return func(r *UpdateRequest) { - r.Routing = v - } -} - -// WithSource - true or false to return the _source field or not, or a list of fields to return. -// -func (f Update) WithSource(v ...string) func(*UpdateRequest) { - return func(r *UpdateRequest) { - r.Source = v - } -} - -// WithSourceExcludes - a list of fields to exclude from the returned _source field. -// -func (f Update) WithSourceExcludes(v ...string) func(*UpdateRequest) { - return func(r *UpdateRequest) { - r.SourceExcludes = v - } -} - -// WithSourceIncludes - a list of fields to extract and return from the _source field. -// -func (f Update) WithSourceIncludes(v ...string) func(*UpdateRequest) { - return func(r *UpdateRequest) { - r.SourceIncludes = v - } -} - -// WithTimeout - explicit operation timeout. -// -func (f Update) WithTimeout(v time.Duration) func(*UpdateRequest) { - return func(r *UpdateRequest) { - r.Timeout = v - } -} - -// WithWaitForActiveShards - sets the number of shard copies that must be active before proceeding with the update operation. defaults to 1, meaning the primary shard only. set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1). -// -func (f Update) WithWaitForActiveShards(v string) func(*UpdateRequest) { - return func(r *UpdateRequest) { - r.WaitForActiveShards = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f Update) WithPretty() func(*UpdateRequest) { - return func(r *UpdateRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f Update) WithHuman() func(*UpdateRequest) { - return func(r *UpdateRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f Update) WithErrorTrace() func(*UpdateRequest) { - return func(r *UpdateRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f Update) WithFilterPath(v ...string) func(*UpdateRequest) { - return func(r *UpdateRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f Update) WithHeader(h map[string]string) func(*UpdateRequest) { - return func(r *UpdateRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f Update) WithOpaqueID(s string) func(*UpdateRequest) { - return func(r *UpdateRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.update_by_query.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.update_by_query.go deleted file mode 100644 index f96d03113..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.update_by_query.go +++ /dev/null @@ -1,689 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "fmt" - "io" - "net/http" - "strconv" - "strings" - "time" -) - -func newUpdateByQueryFunc(t Transport) UpdateByQuery { - return func(index []string, o ...func(*UpdateByQueryRequest)) (*Response, error) { - var r = UpdateByQueryRequest{Index: index} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// UpdateByQuery performs an update on every document in the index without changing the source, -// for example to pick up a mapping change. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-update-by-query.html. -// -type UpdateByQuery func(index []string, o ...func(*UpdateByQueryRequest)) (*Response, error) - -// UpdateByQueryRequest configures the Update By Query API request. -// -type UpdateByQueryRequest struct { - Index []string - DocumentType []string - - Body io.Reader - - AllowNoIndices *bool - Analyzer string - AnalyzeWildcard *bool - Conflicts string - DefaultOperator string - Df string - ExpandWildcards string - From *int - IgnoreUnavailable *bool - Lenient *bool - MaxDocs *int - Pipeline string - Preference string - Query string - Refresh *bool - RequestCache *bool - RequestsPerSecond *int - Routing []string - Scroll time.Duration - ScrollSize *int - SearchTimeout time.Duration - SearchType string - Size *int - Slices interface{} - Sort []string - Source []string - SourceExcludes []string - SourceIncludes []string - Stats []string - TerminateAfter *int - Timeout time.Duration - Version *bool - VersionType *bool - WaitForActiveShards string - WaitForCompletion *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r UpdateByQueryRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len(strings.Join(r.Index, ",")) + 1 + len(strings.Join(r.DocumentType, ",")) + 1 + len("_update_by_query")) - path.WriteString("/") - path.WriteString(strings.Join(r.Index, ",")) - if len(r.DocumentType) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.DocumentType, ",")) - } - path.WriteString("/") - path.WriteString("_update_by_query") - - params = make(map[string]string) - - if r.AllowNoIndices != nil { - params["allow_no_indices"] = strconv.FormatBool(*r.AllowNoIndices) - } - - if r.Analyzer != "" { - params["analyzer"] = r.Analyzer - } - - if r.AnalyzeWildcard != nil { - params["analyze_wildcard"] = strconv.FormatBool(*r.AnalyzeWildcard) - } - - if r.Conflicts != "" { - params["conflicts"] = r.Conflicts - } - - if r.DefaultOperator != "" { - params["default_operator"] = r.DefaultOperator - } - - if r.Df != "" { - params["df"] = r.Df - } - - if r.ExpandWildcards != "" { - params["expand_wildcards"] = r.ExpandWildcards - } - - if r.From != nil { - params["from"] = strconv.FormatInt(int64(*r.From), 10) - } - - if r.IgnoreUnavailable != nil { - params["ignore_unavailable"] = strconv.FormatBool(*r.IgnoreUnavailable) - } - - if r.Lenient != nil { - params["lenient"] = strconv.FormatBool(*r.Lenient) - } - - if r.MaxDocs != nil { - params["max_docs"] = strconv.FormatInt(int64(*r.MaxDocs), 10) - } - - if r.Pipeline != "" { - params["pipeline"] = r.Pipeline - } - - if r.Preference != "" { - params["preference"] = r.Preference - } - - if r.Query != "" { - params["q"] = r.Query - } - - if r.Refresh != nil { - params["refresh"] = strconv.FormatBool(*r.Refresh) - } - - if r.RequestCache != nil { - params["request_cache"] = strconv.FormatBool(*r.RequestCache) - } - - if r.RequestsPerSecond != nil { - params["requests_per_second"] = strconv.FormatInt(int64(*r.RequestsPerSecond), 10) - } - - if len(r.Routing) > 0 { - params["routing"] = strings.Join(r.Routing, ",") - } - - if r.Scroll != 0 { - params["scroll"] = formatDuration(r.Scroll) - } - - if r.ScrollSize != nil { - params["scroll_size"] = strconv.FormatInt(int64(*r.ScrollSize), 10) - } - - if r.SearchTimeout != 0 { - params["search_timeout"] = formatDuration(r.SearchTimeout) - } - - if r.SearchType != "" { - params["search_type"] = r.SearchType - } - - if r.Size != nil { - params["size"] = strconv.FormatInt(int64(*r.Size), 10) - } - - if r.Slices != nil { - params["slices"] = fmt.Sprintf("%v", r.Slices) - } - - if len(r.Sort) > 0 { - params["sort"] = strings.Join(r.Sort, ",") - } - - if len(r.Source) > 0 { - params["_source"] = strings.Join(r.Source, ",") - } - - if len(r.SourceExcludes) > 0 { - params["_source_excludes"] = strings.Join(r.SourceExcludes, ",") - } - - if len(r.SourceIncludes) > 0 { - params["_source_includes"] = strings.Join(r.SourceIncludes, ",") - } - - if len(r.Stats) > 0 { - params["stats"] = strings.Join(r.Stats, ",") - } - - if r.TerminateAfter != nil { - params["terminate_after"] = strconv.FormatInt(int64(*r.TerminateAfter), 10) - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.Version != nil { - params["version"] = strconv.FormatBool(*r.Version) - } - - if r.VersionType != nil { - params["version_type"] = strconv.FormatBool(*r.VersionType) - } - - if r.WaitForActiveShards != "" { - params["wait_for_active_shards"] = r.WaitForActiveShards - } - - if r.WaitForCompletion != nil { - params["wait_for_completion"] = strconv.FormatBool(*r.WaitForCompletion) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f UpdateByQuery) WithContext(v context.Context) func(*UpdateByQueryRequest) { - return func(r *UpdateByQueryRequest) { - r.ctx = v - } -} - -// WithBody - The search definition using the Query DSL. -// -func (f UpdateByQuery) WithBody(v io.Reader) func(*UpdateByQueryRequest) { - return func(r *UpdateByQueryRequest) { - r.Body = v - } -} - -// WithDocumentType - a list of document types to search; leave empty to perform the operation on all types. -// -func (f UpdateByQuery) WithDocumentType(v ...string) func(*UpdateByQueryRequest) { - return func(r *UpdateByQueryRequest) { - r.DocumentType = v - } -} - -// WithAllowNoIndices - whether to ignore if a wildcard indices expression resolves into no concrete indices. (this includes `_all` string or when no indices have been specified). -// -func (f UpdateByQuery) WithAllowNoIndices(v bool) func(*UpdateByQueryRequest) { - return func(r *UpdateByQueryRequest) { - r.AllowNoIndices = &v - } -} - -// WithAnalyzer - the analyzer to use for the query string. -// -func (f UpdateByQuery) WithAnalyzer(v string) func(*UpdateByQueryRequest) { - return func(r *UpdateByQueryRequest) { - r.Analyzer = v - } -} - -// WithAnalyzeWildcard - specify whether wildcard and prefix queries should be analyzed (default: false). -// -func (f UpdateByQuery) WithAnalyzeWildcard(v bool) func(*UpdateByQueryRequest) { - return func(r *UpdateByQueryRequest) { - r.AnalyzeWildcard = &v - } -} - -// WithConflicts - what to do when the update by query hits version conflicts?. -// -func (f UpdateByQuery) WithConflicts(v string) func(*UpdateByQueryRequest) { - return func(r *UpdateByQueryRequest) { - r.Conflicts = v - } -} - -// WithDefaultOperator - the default operator for query string query (and or or). -// -func (f UpdateByQuery) WithDefaultOperator(v string) func(*UpdateByQueryRequest) { - return func(r *UpdateByQueryRequest) { - r.DefaultOperator = v - } -} - -// WithDf - the field to use as default where no field prefix is given in the query string. -// -func (f UpdateByQuery) WithDf(v string) func(*UpdateByQueryRequest) { - return func(r *UpdateByQueryRequest) { - r.Df = v - } -} - -// WithExpandWildcards - whether to expand wildcard expression to concrete indices that are open, closed or both.. -// -func (f UpdateByQuery) WithExpandWildcards(v string) func(*UpdateByQueryRequest) { - return func(r *UpdateByQueryRequest) { - r.ExpandWildcards = v - } -} - -// WithFrom - starting offset (default: 0). -// -func (f UpdateByQuery) WithFrom(v int) func(*UpdateByQueryRequest) { - return func(r *UpdateByQueryRequest) { - r.From = &v - } -} - -// WithIgnoreUnavailable - whether specified concrete indices should be ignored when unavailable (missing or closed). -// -func (f UpdateByQuery) WithIgnoreUnavailable(v bool) func(*UpdateByQueryRequest) { - return func(r *UpdateByQueryRequest) { - r.IgnoreUnavailable = &v - } -} - -// WithLenient - specify whether format-based query failures (such as providing text to a numeric field) should be ignored. -// -func (f UpdateByQuery) WithLenient(v bool) func(*UpdateByQueryRequest) { - return func(r *UpdateByQueryRequest) { - r.Lenient = &v - } -} - -// WithMaxDocs - maximum number of documents to process (default: all documents). -// -func (f UpdateByQuery) WithMaxDocs(v int) func(*UpdateByQueryRequest) { - return func(r *UpdateByQueryRequest) { - r.MaxDocs = &v - } -} - -// WithPipeline - ingest pipeline to set on index requests made by this action. (default: none). -// -func (f UpdateByQuery) WithPipeline(v string) func(*UpdateByQueryRequest) { - return func(r *UpdateByQueryRequest) { - r.Pipeline = v - } -} - -// WithPreference - specify the node or shard the operation should be performed on (default: random). -// -func (f UpdateByQuery) WithPreference(v string) func(*UpdateByQueryRequest) { - return func(r *UpdateByQueryRequest) { - r.Preference = v - } -} - -// WithQuery - query in the lucene query string syntax. -// -func (f UpdateByQuery) WithQuery(v string) func(*UpdateByQueryRequest) { - return func(r *UpdateByQueryRequest) { - r.Query = v - } -} - -// WithRefresh - should the affected indexes be refreshed?. -// -func (f UpdateByQuery) WithRefresh(v bool) func(*UpdateByQueryRequest) { - return func(r *UpdateByQueryRequest) { - r.Refresh = &v - } -} - -// WithRequestCache - specify if request cache should be used for this request or not, defaults to index level setting. -// -func (f UpdateByQuery) WithRequestCache(v bool) func(*UpdateByQueryRequest) { - return func(r *UpdateByQueryRequest) { - r.RequestCache = &v - } -} - -// WithRequestsPerSecond - the throttle to set on this request in sub-requests per second. -1 means no throttle.. -// -func (f UpdateByQuery) WithRequestsPerSecond(v int) func(*UpdateByQueryRequest) { - return func(r *UpdateByQueryRequest) { - r.RequestsPerSecond = &v - } -} - -// WithRouting - a list of specific routing values. -// -func (f UpdateByQuery) WithRouting(v ...string) func(*UpdateByQueryRequest) { - return func(r *UpdateByQueryRequest) { - r.Routing = v - } -} - -// WithScroll - specify how long a consistent view of the index should be maintained for scrolled search. -// -func (f UpdateByQuery) WithScroll(v time.Duration) func(*UpdateByQueryRequest) { - return func(r *UpdateByQueryRequest) { - r.Scroll = v - } -} - -// WithScrollSize - size on the scroll request powering the update by query. -// -func (f UpdateByQuery) WithScrollSize(v int) func(*UpdateByQueryRequest) { - return func(r *UpdateByQueryRequest) { - r.ScrollSize = &v - } -} - -// WithSearchTimeout - explicit timeout for each search request. defaults to no timeout.. -// -func (f UpdateByQuery) WithSearchTimeout(v time.Duration) func(*UpdateByQueryRequest) { - return func(r *UpdateByQueryRequest) { - r.SearchTimeout = v - } -} - -// WithSearchType - search operation type. -// -func (f UpdateByQuery) WithSearchType(v string) func(*UpdateByQueryRequest) { - return func(r *UpdateByQueryRequest) { - r.SearchType = v - } -} - -// WithSize - deprecated, please use `max_docs` instead. -// -func (f UpdateByQuery) WithSize(v int) func(*UpdateByQueryRequest) { - return func(r *UpdateByQueryRequest) { - r.Size = &v - } -} - -// WithSlices - the number of slices this task should be divided into. defaults to 1, meaning the task isn't sliced into subtasks. can be set to `auto`.. -// -func (f UpdateByQuery) WithSlices(v interface{}) func(*UpdateByQueryRequest) { - return func(r *UpdateByQueryRequest) { - r.Slices = v - } -} - -// WithSort - a list of : pairs. -// -func (f UpdateByQuery) WithSort(v ...string) func(*UpdateByQueryRequest) { - return func(r *UpdateByQueryRequest) { - r.Sort = v - } -} - -// WithSource - true or false to return the _source field or not, or a list of fields to return. -// -func (f UpdateByQuery) WithSource(v ...string) func(*UpdateByQueryRequest) { - return func(r *UpdateByQueryRequest) { - r.Source = v - } -} - -// WithSourceExcludes - a list of fields to exclude from the returned _source field. -// -func (f UpdateByQuery) WithSourceExcludes(v ...string) func(*UpdateByQueryRequest) { - return func(r *UpdateByQueryRequest) { - r.SourceExcludes = v - } -} - -// WithSourceIncludes - a list of fields to extract and return from the _source field. -// -func (f UpdateByQuery) WithSourceIncludes(v ...string) func(*UpdateByQueryRequest) { - return func(r *UpdateByQueryRequest) { - r.SourceIncludes = v - } -} - -// WithStats - specific 'tag' of the request for logging and statistical purposes. -// -func (f UpdateByQuery) WithStats(v ...string) func(*UpdateByQueryRequest) { - return func(r *UpdateByQueryRequest) { - r.Stats = v - } -} - -// WithTerminateAfter - the maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early.. -// -func (f UpdateByQuery) WithTerminateAfter(v int) func(*UpdateByQueryRequest) { - return func(r *UpdateByQueryRequest) { - r.TerminateAfter = &v - } -} - -// WithTimeout - time each individual bulk request should wait for shards that are unavailable.. -// -func (f UpdateByQuery) WithTimeout(v time.Duration) func(*UpdateByQueryRequest) { - return func(r *UpdateByQueryRequest) { - r.Timeout = v - } -} - -// WithVersion - specify whether to return document version as part of a hit. -// -func (f UpdateByQuery) WithVersion(v bool) func(*UpdateByQueryRequest) { - return func(r *UpdateByQueryRequest) { - r.Version = &v - } -} - -// WithVersionType - should the document increment the version number (internal) on hit or not (reindex). -// -func (f UpdateByQuery) WithVersionType(v bool) func(*UpdateByQueryRequest) { - return func(r *UpdateByQueryRequest) { - r.VersionType = &v - } -} - -// WithWaitForActiveShards - sets the number of shard copies that must be active before proceeding with the update by query operation. defaults to 1, meaning the primary shard only. set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1). -// -func (f UpdateByQuery) WithWaitForActiveShards(v string) func(*UpdateByQueryRequest) { - return func(r *UpdateByQueryRequest) { - r.WaitForActiveShards = v - } -} - -// WithWaitForCompletion - should the request should block until the update by query operation is complete.. -// -func (f UpdateByQuery) WithWaitForCompletion(v bool) func(*UpdateByQueryRequest) { - return func(r *UpdateByQueryRequest) { - r.WaitForCompletion = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f UpdateByQuery) WithPretty() func(*UpdateByQueryRequest) { - return func(r *UpdateByQueryRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f UpdateByQuery) WithHuman() func(*UpdateByQueryRequest) { - return func(r *UpdateByQueryRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f UpdateByQuery) WithErrorTrace() func(*UpdateByQueryRequest) { - return func(r *UpdateByQueryRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f UpdateByQuery) WithFilterPath(v ...string) func(*UpdateByQueryRequest) { - return func(r *UpdateByQueryRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f UpdateByQuery) WithHeader(h map[string]string) func(*UpdateByQueryRequest) { - return func(r *UpdateByQueryRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f UpdateByQuery) WithOpaqueID(s string) func(*UpdateByQueryRequest) { - return func(r *UpdateByQueryRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.update_by_query_rethrottle.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.update_by_query_rethrottle.go deleted file mode 100644 index 094a0febd..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.update_by_query_rethrottle.go +++ /dev/null @@ -1,218 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newUpdateByQueryRethrottleFunc(t Transport) UpdateByQueryRethrottle { - return func(task_id string, requests_per_second *int, o ...func(*UpdateByQueryRethrottleRequest)) (*Response, error) { - var r = UpdateByQueryRethrottleRequest{TaskID: task_id, RequestsPerSecond: requests_per_second} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// UpdateByQueryRethrottle changes the number of requests per second for a particular Update By Query operation. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update-by-query.html. -// -type UpdateByQueryRethrottle func(task_id string, requests_per_second *int, o ...func(*UpdateByQueryRethrottleRequest)) (*Response, error) - -// UpdateByQueryRethrottleRequest configures the Update By Query Rethrottle API request. -// -type UpdateByQueryRethrottleRequest struct { - TaskID string - - RequestsPerSecond *int - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r UpdateByQueryRethrottleRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_update_by_query") + 1 + len(r.TaskID) + 1 + len("_rethrottle")) - path.WriteString("/") - path.WriteString("_update_by_query") - path.WriteString("/") - path.WriteString(r.TaskID) - path.WriteString("/") - path.WriteString("_rethrottle") - - params = make(map[string]string) - - if r.RequestsPerSecond != nil { - params["requests_per_second"] = strconv.FormatInt(int64(*r.RequestsPerSecond), 10) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f UpdateByQueryRethrottle) WithContext(v context.Context) func(*UpdateByQueryRethrottleRequest) { - return func(r *UpdateByQueryRethrottleRequest) { - r.ctx = v - } -} - -// WithRequestsPerSecond - the throttle to set on this request in floating sub-requests per second. -1 means set no throttle.. -// -func (f UpdateByQueryRethrottle) WithRequestsPerSecond(v int) func(*UpdateByQueryRethrottleRequest) { - return func(r *UpdateByQueryRethrottleRequest) { - r.RequestsPerSecond = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f UpdateByQueryRethrottle) WithPretty() func(*UpdateByQueryRethrottleRequest) { - return func(r *UpdateByQueryRethrottleRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f UpdateByQueryRethrottle) WithHuman() func(*UpdateByQueryRethrottleRequest) { - return func(r *UpdateByQueryRethrottleRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f UpdateByQueryRethrottle) WithErrorTrace() func(*UpdateByQueryRethrottleRequest) { - return func(r *UpdateByQueryRethrottleRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f UpdateByQueryRethrottle) WithFilterPath(v ...string) func(*UpdateByQueryRethrottleRequest) { - return func(r *UpdateByQueryRethrottleRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f UpdateByQueryRethrottle) WithHeader(h map[string]string) func(*UpdateByQueryRethrottleRequest) { - return func(r *UpdateByQueryRethrottleRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f UpdateByQueryRethrottle) WithOpaqueID(s string) func(*UpdateByQueryRethrottleRequest) { - return func(r *UpdateByQueryRethrottleRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.async_search.delete.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.async_search.delete.go deleted file mode 100644 index e9c97c52a..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.async_search.delete.go +++ /dev/null @@ -1,201 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newAsyncSearchDeleteFunc(t Transport) AsyncSearchDelete { - return func(id string, o ...func(*AsyncSearchDeleteRequest)) (*Response, error) { - var r = AsyncSearchDeleteRequest{DocumentID: id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// AsyncSearchDelete - Deletes an async search by ID. If the search is still running, the search request will be cancelled. Otherwise, the saved search results are deleted. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html. -// -type AsyncSearchDelete func(id string, o ...func(*AsyncSearchDeleteRequest)) (*Response, error) - -// AsyncSearchDeleteRequest configures the Async Search Delete API request. -// -type AsyncSearchDeleteRequest struct { - DocumentID string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r AsyncSearchDeleteRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "DELETE" - - path.Grow(1 + len("_async_search") + 1 + len(r.DocumentID)) - path.WriteString("/") - path.WriteString("_async_search") - path.WriteString("/") - path.WriteString(r.DocumentID) - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f AsyncSearchDelete) WithContext(v context.Context) func(*AsyncSearchDeleteRequest) { - return func(r *AsyncSearchDeleteRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f AsyncSearchDelete) WithPretty() func(*AsyncSearchDeleteRequest) { - return func(r *AsyncSearchDeleteRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f AsyncSearchDelete) WithHuman() func(*AsyncSearchDeleteRequest) { - return func(r *AsyncSearchDeleteRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f AsyncSearchDelete) WithErrorTrace() func(*AsyncSearchDeleteRequest) { - return func(r *AsyncSearchDeleteRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f AsyncSearchDelete) WithFilterPath(v ...string) func(*AsyncSearchDeleteRequest) { - return func(r *AsyncSearchDeleteRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f AsyncSearchDelete) WithHeader(h map[string]string) func(*AsyncSearchDeleteRequest) { - return func(r *AsyncSearchDeleteRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f AsyncSearchDelete) WithOpaqueID(s string) func(*AsyncSearchDeleteRequest) { - return func(r *AsyncSearchDeleteRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.async_search.get.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.async_search.get.go deleted file mode 100644 index cf8c61982..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.async_search.get.go +++ /dev/null @@ -1,243 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" - "time" -) - -func newAsyncSearchGetFunc(t Transport) AsyncSearchGet { - return func(id string, o ...func(*AsyncSearchGetRequest)) (*Response, error) { - var r = AsyncSearchGetRequest{DocumentID: id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// AsyncSearchGet - Retrieves the results of a previously submitted async search request given its ID. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html. -// -type AsyncSearchGet func(id string, o ...func(*AsyncSearchGetRequest)) (*Response, error) - -// AsyncSearchGetRequest configures the Async Search Get API request. -// -type AsyncSearchGetRequest struct { - DocumentID string - - KeepAlive time.Duration - TypedKeys *bool - WaitForCompletionTimeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r AsyncSearchGetRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_async_search") + 1 + len(r.DocumentID)) - path.WriteString("/") - path.WriteString("_async_search") - path.WriteString("/") - path.WriteString(r.DocumentID) - - params = make(map[string]string) - - if r.KeepAlive != 0 { - params["keep_alive"] = formatDuration(r.KeepAlive) - } - - if r.TypedKeys != nil { - params["typed_keys"] = strconv.FormatBool(*r.TypedKeys) - } - - if r.WaitForCompletionTimeout != 0 { - params["wait_for_completion_timeout"] = formatDuration(r.WaitForCompletionTimeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f AsyncSearchGet) WithContext(v context.Context) func(*AsyncSearchGetRequest) { - return func(r *AsyncSearchGetRequest) { - r.ctx = v - } -} - -// WithKeepAlive - specify the time interval in which the results (partial or final) for this search will be available. -// -func (f AsyncSearchGet) WithKeepAlive(v time.Duration) func(*AsyncSearchGetRequest) { - return func(r *AsyncSearchGetRequest) { - r.KeepAlive = v - } -} - -// WithTypedKeys - specify whether aggregation and suggester names should be prefixed by their respective types in the response. -// -func (f AsyncSearchGet) WithTypedKeys(v bool) func(*AsyncSearchGetRequest) { - return func(r *AsyncSearchGetRequest) { - r.TypedKeys = &v - } -} - -// WithWaitForCompletionTimeout - specify the time that the request should block waiting for the final response. -// -func (f AsyncSearchGet) WithWaitForCompletionTimeout(v time.Duration) func(*AsyncSearchGetRequest) { - return func(r *AsyncSearchGetRequest) { - r.WaitForCompletionTimeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f AsyncSearchGet) WithPretty() func(*AsyncSearchGetRequest) { - return func(r *AsyncSearchGetRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f AsyncSearchGet) WithHuman() func(*AsyncSearchGetRequest) { - return func(r *AsyncSearchGetRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f AsyncSearchGet) WithErrorTrace() func(*AsyncSearchGetRequest) { - return func(r *AsyncSearchGetRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f AsyncSearchGet) WithFilterPath(v ...string) func(*AsyncSearchGetRequest) { - return func(r *AsyncSearchGetRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f AsyncSearchGet) WithHeader(h map[string]string) func(*AsyncSearchGetRequest) { - return func(r *AsyncSearchGetRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f AsyncSearchGet) WithOpaqueID(s string) func(*AsyncSearchGetRequest) { - return func(r *AsyncSearchGetRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.async_search.status.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.async_search.status.go deleted file mode 100644 index 7ea3ab3b0..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.async_search.status.go +++ /dev/null @@ -1,203 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newAsyncSearchStatusFunc(t Transport) AsyncSearchStatus { - return func(id string, o ...func(*AsyncSearchStatusRequest)) (*Response, error) { - var r = AsyncSearchStatusRequest{DocumentID: id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// AsyncSearchStatus - Retrieves the status of a previously submitted async search request given its ID. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html. -// -type AsyncSearchStatus func(id string, o ...func(*AsyncSearchStatusRequest)) (*Response, error) - -// AsyncSearchStatusRequest configures the Async Search Status API request. -// -type AsyncSearchStatusRequest struct { - DocumentID string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r AsyncSearchStatusRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_async_search") + 1 + len("status") + 1 + len(r.DocumentID)) - path.WriteString("/") - path.WriteString("_async_search") - path.WriteString("/") - path.WriteString("status") - path.WriteString("/") - path.WriteString(r.DocumentID) - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f AsyncSearchStatus) WithContext(v context.Context) func(*AsyncSearchStatusRequest) { - return func(r *AsyncSearchStatusRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f AsyncSearchStatus) WithPretty() func(*AsyncSearchStatusRequest) { - return func(r *AsyncSearchStatusRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f AsyncSearchStatus) WithHuman() func(*AsyncSearchStatusRequest) { - return func(r *AsyncSearchStatusRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f AsyncSearchStatus) WithErrorTrace() func(*AsyncSearchStatusRequest) { - return func(r *AsyncSearchStatusRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f AsyncSearchStatus) WithFilterPath(v ...string) func(*AsyncSearchStatusRequest) { - return func(r *AsyncSearchStatusRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f AsyncSearchStatus) WithHeader(h map[string]string) func(*AsyncSearchStatusRequest) { - return func(r *AsyncSearchStatusRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f AsyncSearchStatus) WithOpaqueID(s string) func(*AsyncSearchStatusRequest) { - return func(r *AsyncSearchStatusRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.async_search.submit.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.async_search.submit.go deleted file mode 100644 index 9899f2c08..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.async_search.submit.go +++ /dev/null @@ -1,762 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" - "time" -) - -func newAsyncSearchSubmitFunc(t Transport) AsyncSearchSubmit { - return func(o ...func(*AsyncSearchSubmitRequest)) (*Response, error) { - var r = AsyncSearchSubmitRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// AsyncSearchSubmit - Executes a search request asynchronously. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html. -// -type AsyncSearchSubmit func(o ...func(*AsyncSearchSubmitRequest)) (*Response, error) - -// AsyncSearchSubmitRequest configures the Async Search Submit API request. -// -type AsyncSearchSubmitRequest struct { - Index []string - - Body io.Reader - - AllowNoIndices *bool - AllowPartialSearchResults *bool - Analyzer string - AnalyzeWildcard *bool - BatchedReduceSize *int - DefaultOperator string - Df string - DocvalueFields []string - ExpandWildcards string - Explain *bool - From *int - IgnoreThrottled *bool - IgnoreUnavailable *bool - KeepAlive time.Duration - KeepOnCompletion *bool - Lenient *bool - MaxConcurrentShardRequests *int - Preference string - Query string - RequestCache *bool - Routing []string - SearchType string - SeqNoPrimaryTerm *bool - Size *int - Sort []string - Source []string - SourceExcludes []string - SourceIncludes []string - Stats []string - StoredFields []string - SuggestField string - SuggestMode string - SuggestSize *int - SuggestText string - TerminateAfter *int - Timeout time.Duration - TrackScores *bool - TrackTotalHits *bool - TypedKeys *bool - Version *bool - WaitForCompletionTimeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r AsyncSearchSubmitRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len(strings.Join(r.Index, ",")) + 1 + len("_async_search")) - if len(r.Index) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Index, ",")) - } - path.WriteString("/") - path.WriteString("_async_search") - - params = make(map[string]string) - - if r.AllowNoIndices != nil { - params["allow_no_indices"] = strconv.FormatBool(*r.AllowNoIndices) - } - - if r.AllowPartialSearchResults != nil { - params["allow_partial_search_results"] = strconv.FormatBool(*r.AllowPartialSearchResults) - } - - if r.Analyzer != "" { - params["analyzer"] = r.Analyzer - } - - if r.AnalyzeWildcard != nil { - params["analyze_wildcard"] = strconv.FormatBool(*r.AnalyzeWildcard) - } - - if r.BatchedReduceSize != nil { - params["batched_reduce_size"] = strconv.FormatInt(int64(*r.BatchedReduceSize), 10) - } - - if r.DefaultOperator != "" { - params["default_operator"] = r.DefaultOperator - } - - if r.Df != "" { - params["df"] = r.Df - } - - if len(r.DocvalueFields) > 0 { - params["docvalue_fields"] = strings.Join(r.DocvalueFields, ",") - } - - if r.ExpandWildcards != "" { - params["expand_wildcards"] = r.ExpandWildcards - } - - if r.Explain != nil { - params["explain"] = strconv.FormatBool(*r.Explain) - } - - if r.From != nil { - params["from"] = strconv.FormatInt(int64(*r.From), 10) - } - - if r.IgnoreThrottled != nil { - params["ignore_throttled"] = strconv.FormatBool(*r.IgnoreThrottled) - } - - if r.IgnoreUnavailable != nil { - params["ignore_unavailable"] = strconv.FormatBool(*r.IgnoreUnavailable) - } - - if r.KeepAlive != 0 { - params["keep_alive"] = formatDuration(r.KeepAlive) - } - - if r.KeepOnCompletion != nil { - params["keep_on_completion"] = strconv.FormatBool(*r.KeepOnCompletion) - } - - if r.Lenient != nil { - params["lenient"] = strconv.FormatBool(*r.Lenient) - } - - if r.MaxConcurrentShardRequests != nil { - params["max_concurrent_shard_requests"] = strconv.FormatInt(int64(*r.MaxConcurrentShardRequests), 10) - } - - if r.Preference != "" { - params["preference"] = r.Preference - } - - if r.Query != "" { - params["q"] = r.Query - } - - if r.RequestCache != nil { - params["request_cache"] = strconv.FormatBool(*r.RequestCache) - } - - if len(r.Routing) > 0 { - params["routing"] = strings.Join(r.Routing, ",") - } - - if r.SearchType != "" { - params["search_type"] = r.SearchType - } - - if r.SeqNoPrimaryTerm != nil { - params["seq_no_primary_term"] = strconv.FormatBool(*r.SeqNoPrimaryTerm) - } - - if r.Size != nil { - params["size"] = strconv.FormatInt(int64(*r.Size), 10) - } - - if len(r.Sort) > 0 { - params["sort"] = strings.Join(r.Sort, ",") - } - - if len(r.Source) > 0 { - params["_source"] = strings.Join(r.Source, ",") - } - - if len(r.SourceExcludes) > 0 { - params["_source_excludes"] = strings.Join(r.SourceExcludes, ",") - } - - if len(r.SourceIncludes) > 0 { - params["_source_includes"] = strings.Join(r.SourceIncludes, ",") - } - - if len(r.Stats) > 0 { - params["stats"] = strings.Join(r.Stats, ",") - } - - if len(r.StoredFields) > 0 { - params["stored_fields"] = strings.Join(r.StoredFields, ",") - } - - if r.SuggestField != "" { - params["suggest_field"] = r.SuggestField - } - - if r.SuggestMode != "" { - params["suggest_mode"] = r.SuggestMode - } - - if r.SuggestSize != nil { - params["suggest_size"] = strconv.FormatInt(int64(*r.SuggestSize), 10) - } - - if r.SuggestText != "" { - params["suggest_text"] = r.SuggestText - } - - if r.TerminateAfter != nil { - params["terminate_after"] = strconv.FormatInt(int64(*r.TerminateAfter), 10) - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.TrackScores != nil { - params["track_scores"] = strconv.FormatBool(*r.TrackScores) - } - - if r.TrackTotalHits != nil { - params["track_total_hits"] = strconv.FormatBool(*r.TrackTotalHits) - } - - if r.TypedKeys != nil { - params["typed_keys"] = strconv.FormatBool(*r.TypedKeys) - } - - if r.Version != nil { - params["version"] = strconv.FormatBool(*r.Version) - } - - if r.WaitForCompletionTimeout != 0 { - params["wait_for_completion_timeout"] = formatDuration(r.WaitForCompletionTimeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f AsyncSearchSubmit) WithContext(v context.Context) func(*AsyncSearchSubmitRequest) { - return func(r *AsyncSearchSubmitRequest) { - r.ctx = v - } -} - -// WithBody - The search definition using the Query DSL. -// -func (f AsyncSearchSubmit) WithBody(v io.Reader) func(*AsyncSearchSubmitRequest) { - return func(r *AsyncSearchSubmitRequest) { - r.Body = v - } -} - -// WithIndex - a list of index names to search; use _all to perform the operation on all indices. -// -func (f AsyncSearchSubmit) WithIndex(v ...string) func(*AsyncSearchSubmitRequest) { - return func(r *AsyncSearchSubmitRequest) { - r.Index = v - } -} - -// WithAllowNoIndices - whether to ignore if a wildcard indices expression resolves into no concrete indices. (this includes `_all` string or when no indices have been specified). -// -func (f AsyncSearchSubmit) WithAllowNoIndices(v bool) func(*AsyncSearchSubmitRequest) { - return func(r *AsyncSearchSubmitRequest) { - r.AllowNoIndices = &v - } -} - -// WithAllowPartialSearchResults - indicate if an error should be returned if there is a partial search failure or timeout. -// -func (f AsyncSearchSubmit) WithAllowPartialSearchResults(v bool) func(*AsyncSearchSubmitRequest) { - return func(r *AsyncSearchSubmitRequest) { - r.AllowPartialSearchResults = &v - } -} - -// WithAnalyzer - the analyzer to use for the query string. -// -func (f AsyncSearchSubmit) WithAnalyzer(v string) func(*AsyncSearchSubmitRequest) { - return func(r *AsyncSearchSubmitRequest) { - r.Analyzer = v - } -} - -// WithAnalyzeWildcard - specify whether wildcard and prefix queries should be analyzed (default: false). -// -func (f AsyncSearchSubmit) WithAnalyzeWildcard(v bool) func(*AsyncSearchSubmitRequest) { - return func(r *AsyncSearchSubmitRequest) { - r.AnalyzeWildcard = &v - } -} - -// WithBatchedReduceSize - the number of shard results that should be reduced at once on the coordinating node. this value should be used as the granularity at which progress results will be made available.. -// -func (f AsyncSearchSubmit) WithBatchedReduceSize(v int) func(*AsyncSearchSubmitRequest) { - return func(r *AsyncSearchSubmitRequest) { - r.BatchedReduceSize = &v - } -} - -// WithDefaultOperator - the default operator for query string query (and or or). -// -func (f AsyncSearchSubmit) WithDefaultOperator(v string) func(*AsyncSearchSubmitRequest) { - return func(r *AsyncSearchSubmitRequest) { - r.DefaultOperator = v - } -} - -// WithDf - the field to use as default where no field prefix is given in the query string. -// -func (f AsyncSearchSubmit) WithDf(v string) func(*AsyncSearchSubmitRequest) { - return func(r *AsyncSearchSubmitRequest) { - r.Df = v - } -} - -// WithDocvalueFields - a list of fields to return as the docvalue representation of a field for each hit. -// -func (f AsyncSearchSubmit) WithDocvalueFields(v ...string) func(*AsyncSearchSubmitRequest) { - return func(r *AsyncSearchSubmitRequest) { - r.DocvalueFields = v - } -} - -// WithExpandWildcards - whether to expand wildcard expression to concrete indices that are open, closed or both.. -// -func (f AsyncSearchSubmit) WithExpandWildcards(v string) func(*AsyncSearchSubmitRequest) { - return func(r *AsyncSearchSubmitRequest) { - r.ExpandWildcards = v - } -} - -// WithExplain - specify whether to return detailed information about score computation as part of a hit. -// -func (f AsyncSearchSubmit) WithExplain(v bool) func(*AsyncSearchSubmitRequest) { - return func(r *AsyncSearchSubmitRequest) { - r.Explain = &v - } -} - -// WithFrom - starting offset (default: 0). -// -func (f AsyncSearchSubmit) WithFrom(v int) func(*AsyncSearchSubmitRequest) { - return func(r *AsyncSearchSubmitRequest) { - r.From = &v - } -} - -// WithIgnoreThrottled - whether specified concrete, expanded or aliased indices should be ignored when throttled. -// -func (f AsyncSearchSubmit) WithIgnoreThrottled(v bool) func(*AsyncSearchSubmitRequest) { - return func(r *AsyncSearchSubmitRequest) { - r.IgnoreThrottled = &v - } -} - -// WithIgnoreUnavailable - whether specified concrete indices should be ignored when unavailable (missing or closed). -// -func (f AsyncSearchSubmit) WithIgnoreUnavailable(v bool) func(*AsyncSearchSubmitRequest) { - return func(r *AsyncSearchSubmitRequest) { - r.IgnoreUnavailable = &v - } -} - -// WithKeepAlive - update the time interval in which the results (partial or final) for this search will be available. -// -func (f AsyncSearchSubmit) WithKeepAlive(v time.Duration) func(*AsyncSearchSubmitRequest) { - return func(r *AsyncSearchSubmitRequest) { - r.KeepAlive = v - } -} - -// WithKeepOnCompletion - control whether the response should be stored in the cluster if it completed within the provided [wait_for_completion] time (default: false). -// -func (f AsyncSearchSubmit) WithKeepOnCompletion(v bool) func(*AsyncSearchSubmitRequest) { - return func(r *AsyncSearchSubmitRequest) { - r.KeepOnCompletion = &v - } -} - -// WithLenient - specify whether format-based query failures (such as providing text to a numeric field) should be ignored. -// -func (f AsyncSearchSubmit) WithLenient(v bool) func(*AsyncSearchSubmitRequest) { - return func(r *AsyncSearchSubmitRequest) { - r.Lenient = &v - } -} - -// WithMaxConcurrentShardRequests - the number of concurrent shard requests per node this search executes concurrently. this value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests. -// -func (f AsyncSearchSubmit) WithMaxConcurrentShardRequests(v int) func(*AsyncSearchSubmitRequest) { - return func(r *AsyncSearchSubmitRequest) { - r.MaxConcurrentShardRequests = &v - } -} - -// WithPreference - specify the node or shard the operation should be performed on (default: random). -// -func (f AsyncSearchSubmit) WithPreference(v string) func(*AsyncSearchSubmitRequest) { - return func(r *AsyncSearchSubmitRequest) { - r.Preference = v - } -} - -// WithQuery - query in the lucene query string syntax. -// -func (f AsyncSearchSubmit) WithQuery(v string) func(*AsyncSearchSubmitRequest) { - return func(r *AsyncSearchSubmitRequest) { - r.Query = v - } -} - -// WithRequestCache - specify if request cache should be used for this request or not, defaults to true. -// -func (f AsyncSearchSubmit) WithRequestCache(v bool) func(*AsyncSearchSubmitRequest) { - return func(r *AsyncSearchSubmitRequest) { - r.RequestCache = &v - } -} - -// WithRouting - a list of specific routing values. -// -func (f AsyncSearchSubmit) WithRouting(v ...string) func(*AsyncSearchSubmitRequest) { - return func(r *AsyncSearchSubmitRequest) { - r.Routing = v - } -} - -// WithSearchType - search operation type. -// -func (f AsyncSearchSubmit) WithSearchType(v string) func(*AsyncSearchSubmitRequest) { - return func(r *AsyncSearchSubmitRequest) { - r.SearchType = v - } -} - -// WithSeqNoPrimaryTerm - specify whether to return sequence number and primary term of the last modification of each hit. -// -func (f AsyncSearchSubmit) WithSeqNoPrimaryTerm(v bool) func(*AsyncSearchSubmitRequest) { - return func(r *AsyncSearchSubmitRequest) { - r.SeqNoPrimaryTerm = &v - } -} - -// WithSize - number of hits to return (default: 10). -// -func (f AsyncSearchSubmit) WithSize(v int) func(*AsyncSearchSubmitRequest) { - return func(r *AsyncSearchSubmitRequest) { - r.Size = &v - } -} - -// WithSort - a list of : pairs. -// -func (f AsyncSearchSubmit) WithSort(v ...string) func(*AsyncSearchSubmitRequest) { - return func(r *AsyncSearchSubmitRequest) { - r.Sort = v - } -} - -// WithSource - true or false to return the _source field or not, or a list of fields to return. -// -func (f AsyncSearchSubmit) WithSource(v ...string) func(*AsyncSearchSubmitRequest) { - return func(r *AsyncSearchSubmitRequest) { - r.Source = v - } -} - -// WithSourceExcludes - a list of fields to exclude from the returned _source field. -// -func (f AsyncSearchSubmit) WithSourceExcludes(v ...string) func(*AsyncSearchSubmitRequest) { - return func(r *AsyncSearchSubmitRequest) { - r.SourceExcludes = v - } -} - -// WithSourceIncludes - a list of fields to extract and return from the _source field. -// -func (f AsyncSearchSubmit) WithSourceIncludes(v ...string) func(*AsyncSearchSubmitRequest) { - return func(r *AsyncSearchSubmitRequest) { - r.SourceIncludes = v - } -} - -// WithStats - specific 'tag' of the request for logging and statistical purposes. -// -func (f AsyncSearchSubmit) WithStats(v ...string) func(*AsyncSearchSubmitRequest) { - return func(r *AsyncSearchSubmitRequest) { - r.Stats = v - } -} - -// WithStoredFields - a list of stored fields to return as part of a hit. -// -func (f AsyncSearchSubmit) WithStoredFields(v ...string) func(*AsyncSearchSubmitRequest) { - return func(r *AsyncSearchSubmitRequest) { - r.StoredFields = v - } -} - -// WithSuggestField - specify which field to use for suggestions. -// -func (f AsyncSearchSubmit) WithSuggestField(v string) func(*AsyncSearchSubmitRequest) { - return func(r *AsyncSearchSubmitRequest) { - r.SuggestField = v - } -} - -// WithSuggestMode - specify suggest mode. -// -func (f AsyncSearchSubmit) WithSuggestMode(v string) func(*AsyncSearchSubmitRequest) { - return func(r *AsyncSearchSubmitRequest) { - r.SuggestMode = v - } -} - -// WithSuggestSize - how many suggestions to return in response. -// -func (f AsyncSearchSubmit) WithSuggestSize(v int) func(*AsyncSearchSubmitRequest) { - return func(r *AsyncSearchSubmitRequest) { - r.SuggestSize = &v - } -} - -// WithSuggestText - the source text for which the suggestions should be returned. -// -func (f AsyncSearchSubmit) WithSuggestText(v string) func(*AsyncSearchSubmitRequest) { - return func(r *AsyncSearchSubmitRequest) { - r.SuggestText = v - } -} - -// WithTerminateAfter - the maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early.. -// -func (f AsyncSearchSubmit) WithTerminateAfter(v int) func(*AsyncSearchSubmitRequest) { - return func(r *AsyncSearchSubmitRequest) { - r.TerminateAfter = &v - } -} - -// WithTimeout - explicit operation timeout. -// -func (f AsyncSearchSubmit) WithTimeout(v time.Duration) func(*AsyncSearchSubmitRequest) { - return func(r *AsyncSearchSubmitRequest) { - r.Timeout = v - } -} - -// WithTrackScores - whether to calculate and return scores even if they are not used for sorting. -// -func (f AsyncSearchSubmit) WithTrackScores(v bool) func(*AsyncSearchSubmitRequest) { - return func(r *AsyncSearchSubmitRequest) { - r.TrackScores = &v - } -} - -// WithTrackTotalHits - indicate if the number of documents that match the query should be tracked. -// -func (f AsyncSearchSubmit) WithTrackTotalHits(v bool) func(*AsyncSearchSubmitRequest) { - return func(r *AsyncSearchSubmitRequest) { - r.TrackTotalHits = &v - } -} - -// WithTypedKeys - specify whether aggregation and suggester names should be prefixed by their respective types in the response. -// -func (f AsyncSearchSubmit) WithTypedKeys(v bool) func(*AsyncSearchSubmitRequest) { - return func(r *AsyncSearchSubmitRequest) { - r.TypedKeys = &v - } -} - -// WithVersion - specify whether to return document version as part of a hit. -// -func (f AsyncSearchSubmit) WithVersion(v bool) func(*AsyncSearchSubmitRequest) { - return func(r *AsyncSearchSubmitRequest) { - r.Version = &v - } -} - -// WithWaitForCompletionTimeout - specify the time that the request should block waiting for the final response. -// -func (f AsyncSearchSubmit) WithWaitForCompletionTimeout(v time.Duration) func(*AsyncSearchSubmitRequest) { - return func(r *AsyncSearchSubmitRequest) { - r.WaitForCompletionTimeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f AsyncSearchSubmit) WithPretty() func(*AsyncSearchSubmitRequest) { - return func(r *AsyncSearchSubmitRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f AsyncSearchSubmit) WithHuman() func(*AsyncSearchSubmitRequest) { - return func(r *AsyncSearchSubmitRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f AsyncSearchSubmit) WithErrorTrace() func(*AsyncSearchSubmitRequest) { - return func(r *AsyncSearchSubmitRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f AsyncSearchSubmit) WithFilterPath(v ...string) func(*AsyncSearchSubmitRequest) { - return func(r *AsyncSearchSubmitRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f AsyncSearchSubmit) WithHeader(h map[string]string) func(*AsyncSearchSubmitRequest) { - return func(r *AsyncSearchSubmitRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f AsyncSearchSubmit) WithOpaqueID(s string) func(*AsyncSearchSubmitRequest) { - return func(r *AsyncSearchSubmitRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.autoscaling.delete_autoscaling_policy.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.autoscaling.delete_autoscaling_policy.go deleted file mode 100644 index 00fd7f897..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.autoscaling.delete_autoscaling_policy.go +++ /dev/null @@ -1,203 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newAutoscalingDeleteAutoscalingPolicyFunc(t Transport) AutoscalingDeleteAutoscalingPolicy { - return func(name string, o ...func(*AutoscalingDeleteAutoscalingPolicyRequest)) (*Response, error) { - var r = AutoscalingDeleteAutoscalingPolicyRequest{Name: name} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// AutoscalingDeleteAutoscalingPolicy - Deletes an autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/autoscaling-delete-autoscaling-policy.html. -// -type AutoscalingDeleteAutoscalingPolicy func(name string, o ...func(*AutoscalingDeleteAutoscalingPolicyRequest)) (*Response, error) - -// AutoscalingDeleteAutoscalingPolicyRequest configures the Autoscaling Delete Autoscaling Policy API request. -// -type AutoscalingDeleteAutoscalingPolicyRequest struct { - Name string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r AutoscalingDeleteAutoscalingPolicyRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "DELETE" - - path.Grow(1 + len("_autoscaling") + 1 + len("policy") + 1 + len(r.Name)) - path.WriteString("/") - path.WriteString("_autoscaling") - path.WriteString("/") - path.WriteString("policy") - path.WriteString("/") - path.WriteString(r.Name) - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f AutoscalingDeleteAutoscalingPolicy) WithContext(v context.Context) func(*AutoscalingDeleteAutoscalingPolicyRequest) { - return func(r *AutoscalingDeleteAutoscalingPolicyRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f AutoscalingDeleteAutoscalingPolicy) WithPretty() func(*AutoscalingDeleteAutoscalingPolicyRequest) { - return func(r *AutoscalingDeleteAutoscalingPolicyRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f AutoscalingDeleteAutoscalingPolicy) WithHuman() func(*AutoscalingDeleteAutoscalingPolicyRequest) { - return func(r *AutoscalingDeleteAutoscalingPolicyRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f AutoscalingDeleteAutoscalingPolicy) WithErrorTrace() func(*AutoscalingDeleteAutoscalingPolicyRequest) { - return func(r *AutoscalingDeleteAutoscalingPolicyRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f AutoscalingDeleteAutoscalingPolicy) WithFilterPath(v ...string) func(*AutoscalingDeleteAutoscalingPolicyRequest) { - return func(r *AutoscalingDeleteAutoscalingPolicyRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f AutoscalingDeleteAutoscalingPolicy) WithHeader(h map[string]string) func(*AutoscalingDeleteAutoscalingPolicyRequest) { - return func(r *AutoscalingDeleteAutoscalingPolicyRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f AutoscalingDeleteAutoscalingPolicy) WithOpaqueID(s string) func(*AutoscalingDeleteAutoscalingPolicyRequest) { - return func(r *AutoscalingDeleteAutoscalingPolicyRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.autoscaling.get_autoscaling_capacity.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.autoscaling.get_autoscaling_capacity.go deleted file mode 100644 index c34192574..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.autoscaling.get_autoscaling_capacity.go +++ /dev/null @@ -1,196 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newAutoscalingGetAutoscalingCapacityFunc(t Transport) AutoscalingGetAutoscalingCapacity { - return func(o ...func(*AutoscalingGetAutoscalingCapacityRequest)) (*Response, error) { - var r = AutoscalingGetAutoscalingCapacityRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// AutoscalingGetAutoscalingCapacity - Gets the current autoscaling capacity based on the configured autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/autoscaling-get-autoscaling-capacity.html. -// -type AutoscalingGetAutoscalingCapacity func(o ...func(*AutoscalingGetAutoscalingCapacityRequest)) (*Response, error) - -// AutoscalingGetAutoscalingCapacityRequest configures the Autoscaling Get Autoscaling Capacity API request. -// -type AutoscalingGetAutoscalingCapacityRequest struct { - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r AutoscalingGetAutoscalingCapacityRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(len("/_autoscaling/capacity")) - path.WriteString("/_autoscaling/capacity") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f AutoscalingGetAutoscalingCapacity) WithContext(v context.Context) func(*AutoscalingGetAutoscalingCapacityRequest) { - return func(r *AutoscalingGetAutoscalingCapacityRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f AutoscalingGetAutoscalingCapacity) WithPretty() func(*AutoscalingGetAutoscalingCapacityRequest) { - return func(r *AutoscalingGetAutoscalingCapacityRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f AutoscalingGetAutoscalingCapacity) WithHuman() func(*AutoscalingGetAutoscalingCapacityRequest) { - return func(r *AutoscalingGetAutoscalingCapacityRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f AutoscalingGetAutoscalingCapacity) WithErrorTrace() func(*AutoscalingGetAutoscalingCapacityRequest) { - return func(r *AutoscalingGetAutoscalingCapacityRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f AutoscalingGetAutoscalingCapacity) WithFilterPath(v ...string) func(*AutoscalingGetAutoscalingCapacityRequest) { - return func(r *AutoscalingGetAutoscalingCapacityRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f AutoscalingGetAutoscalingCapacity) WithHeader(h map[string]string) func(*AutoscalingGetAutoscalingCapacityRequest) { - return func(r *AutoscalingGetAutoscalingCapacityRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f AutoscalingGetAutoscalingCapacity) WithOpaqueID(s string) func(*AutoscalingGetAutoscalingCapacityRequest) { - return func(r *AutoscalingGetAutoscalingCapacityRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.autoscaling.get_autoscaling_decision.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.autoscaling.get_autoscaling_decision.go deleted file mode 100644 index b5e957eab..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.autoscaling.get_autoscaling_decision.go +++ /dev/null @@ -1,198 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.10.0: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newAutoscalingGetAutoscalingDecisionFunc(t Transport) AutoscalingGetAutoscalingDecision { - return func(o ...func(*AutoscalingGetAutoscalingDecisionRequest)) (*Response, error) { - var r = AutoscalingGetAutoscalingDecisionRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// AutoscalingGetAutoscalingDecision - Gets the current autoscaling decision based on the configured autoscaling policy, indicating whether or not autoscaling is needed. -// -// This API is experimental. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/autoscaling-get-autoscaling-decision.html. -// -type AutoscalingGetAutoscalingDecision func(o ...func(*AutoscalingGetAutoscalingDecisionRequest)) (*Response, error) - -// AutoscalingGetAutoscalingDecisionRequest configures the Autoscaling Get Autoscaling Decision API request. -// -type AutoscalingGetAutoscalingDecisionRequest struct { - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r AutoscalingGetAutoscalingDecisionRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(len("/_autoscaling/decision")) - path.WriteString("/_autoscaling/decision") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f AutoscalingGetAutoscalingDecision) WithContext(v context.Context) func(*AutoscalingGetAutoscalingDecisionRequest) { - return func(r *AutoscalingGetAutoscalingDecisionRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f AutoscalingGetAutoscalingDecision) WithPretty() func(*AutoscalingGetAutoscalingDecisionRequest) { - return func(r *AutoscalingGetAutoscalingDecisionRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f AutoscalingGetAutoscalingDecision) WithHuman() func(*AutoscalingGetAutoscalingDecisionRequest) { - return func(r *AutoscalingGetAutoscalingDecisionRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f AutoscalingGetAutoscalingDecision) WithErrorTrace() func(*AutoscalingGetAutoscalingDecisionRequest) { - return func(r *AutoscalingGetAutoscalingDecisionRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f AutoscalingGetAutoscalingDecision) WithFilterPath(v ...string) func(*AutoscalingGetAutoscalingDecisionRequest) { - return func(r *AutoscalingGetAutoscalingDecisionRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f AutoscalingGetAutoscalingDecision) WithHeader(h map[string]string) func(*AutoscalingGetAutoscalingDecisionRequest) { - return func(r *AutoscalingGetAutoscalingDecisionRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f AutoscalingGetAutoscalingDecision) WithOpaqueID(s string) func(*AutoscalingGetAutoscalingDecisionRequest) { - return func(r *AutoscalingGetAutoscalingDecisionRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.autoscaling.get_autoscaling_policy.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.autoscaling.get_autoscaling_policy.go deleted file mode 100644 index 3b62d6de1..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.autoscaling.get_autoscaling_policy.go +++ /dev/null @@ -1,203 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newAutoscalingGetAutoscalingPolicyFunc(t Transport) AutoscalingGetAutoscalingPolicy { - return func(name string, o ...func(*AutoscalingGetAutoscalingPolicyRequest)) (*Response, error) { - var r = AutoscalingGetAutoscalingPolicyRequest{Name: name} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// AutoscalingGetAutoscalingPolicy - Retrieves an autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/autoscaling-get-autoscaling-policy.html. -// -type AutoscalingGetAutoscalingPolicy func(name string, o ...func(*AutoscalingGetAutoscalingPolicyRequest)) (*Response, error) - -// AutoscalingGetAutoscalingPolicyRequest configures the Autoscaling Get Autoscaling Policy API request. -// -type AutoscalingGetAutoscalingPolicyRequest struct { - Name string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r AutoscalingGetAutoscalingPolicyRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_autoscaling") + 1 + len("policy") + 1 + len(r.Name)) - path.WriteString("/") - path.WriteString("_autoscaling") - path.WriteString("/") - path.WriteString("policy") - path.WriteString("/") - path.WriteString(r.Name) - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f AutoscalingGetAutoscalingPolicy) WithContext(v context.Context) func(*AutoscalingGetAutoscalingPolicyRequest) { - return func(r *AutoscalingGetAutoscalingPolicyRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f AutoscalingGetAutoscalingPolicy) WithPretty() func(*AutoscalingGetAutoscalingPolicyRequest) { - return func(r *AutoscalingGetAutoscalingPolicyRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f AutoscalingGetAutoscalingPolicy) WithHuman() func(*AutoscalingGetAutoscalingPolicyRequest) { - return func(r *AutoscalingGetAutoscalingPolicyRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f AutoscalingGetAutoscalingPolicy) WithErrorTrace() func(*AutoscalingGetAutoscalingPolicyRequest) { - return func(r *AutoscalingGetAutoscalingPolicyRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f AutoscalingGetAutoscalingPolicy) WithFilterPath(v ...string) func(*AutoscalingGetAutoscalingPolicyRequest) { - return func(r *AutoscalingGetAutoscalingPolicyRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f AutoscalingGetAutoscalingPolicy) WithHeader(h map[string]string) func(*AutoscalingGetAutoscalingPolicyRequest) { - return func(r *AutoscalingGetAutoscalingPolicyRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f AutoscalingGetAutoscalingPolicy) WithOpaqueID(s string) func(*AutoscalingGetAutoscalingPolicyRequest) { - return func(r *AutoscalingGetAutoscalingPolicyRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.autoscaling.put_autoscaling_policy.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.autoscaling.put_autoscaling_policy.go deleted file mode 100644 index 21b71f4ab..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.autoscaling.put_autoscaling_policy.go +++ /dev/null @@ -1,210 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" -) - -func newAutoscalingPutAutoscalingPolicyFunc(t Transport) AutoscalingPutAutoscalingPolicy { - return func(name string, body io.Reader, o ...func(*AutoscalingPutAutoscalingPolicyRequest)) (*Response, error) { - var r = AutoscalingPutAutoscalingPolicyRequest{Name: name, Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// AutoscalingPutAutoscalingPolicy - Creates a new autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/autoscaling-put-autoscaling-policy.html. -// -type AutoscalingPutAutoscalingPolicy func(name string, body io.Reader, o ...func(*AutoscalingPutAutoscalingPolicyRequest)) (*Response, error) - -// AutoscalingPutAutoscalingPolicyRequest configures the Autoscaling Put Autoscaling Policy API request. -// -type AutoscalingPutAutoscalingPolicyRequest struct { - Body io.Reader - - Name string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r AutoscalingPutAutoscalingPolicyRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - path.Grow(1 + len("_autoscaling") + 1 + len("policy") + 1 + len(r.Name)) - path.WriteString("/") - path.WriteString("_autoscaling") - path.WriteString("/") - path.WriteString("policy") - path.WriteString("/") - path.WriteString(r.Name) - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f AutoscalingPutAutoscalingPolicy) WithContext(v context.Context) func(*AutoscalingPutAutoscalingPolicyRequest) { - return func(r *AutoscalingPutAutoscalingPolicyRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f AutoscalingPutAutoscalingPolicy) WithPretty() func(*AutoscalingPutAutoscalingPolicyRequest) { - return func(r *AutoscalingPutAutoscalingPolicyRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f AutoscalingPutAutoscalingPolicy) WithHuman() func(*AutoscalingPutAutoscalingPolicyRequest) { - return func(r *AutoscalingPutAutoscalingPolicyRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f AutoscalingPutAutoscalingPolicy) WithErrorTrace() func(*AutoscalingPutAutoscalingPolicyRequest) { - return func(r *AutoscalingPutAutoscalingPolicyRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f AutoscalingPutAutoscalingPolicy) WithFilterPath(v ...string) func(*AutoscalingPutAutoscalingPolicyRequest) { - return func(r *AutoscalingPutAutoscalingPolicyRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f AutoscalingPutAutoscalingPolicy) WithHeader(h map[string]string) func(*AutoscalingPutAutoscalingPolicyRequest) { - return func(r *AutoscalingPutAutoscalingPolicyRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f AutoscalingPutAutoscalingPolicy) WithOpaqueID(s string) func(*AutoscalingPutAutoscalingPolicyRequest) { - return func(r *AutoscalingPutAutoscalingPolicyRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.cat.ml_data_frame_analytics.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.cat.ml_data_frame_analytics.go deleted file mode 100644 index fb76d2244..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.cat.ml_data_frame_analytics.go +++ /dev/null @@ -1,323 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newCatMLDataFrameAnalyticsFunc(t Transport) CatMLDataFrameAnalytics { - return func(o ...func(*CatMLDataFrameAnalyticsRequest)) (*Response, error) { - var r = CatMLDataFrameAnalyticsRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// CatMLDataFrameAnalytics - Gets configuration and usage information about data frame analytics jobs. -// -// See full documentation at http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-dfanalytics.html. -// -type CatMLDataFrameAnalytics func(o ...func(*CatMLDataFrameAnalyticsRequest)) (*Response, error) - -// CatMLDataFrameAnalyticsRequest configures the CatML Data Frame Analytics API request. -// -type CatMLDataFrameAnalyticsRequest struct { - DocumentID string - - AllowNoMatch *bool - Bytes string - Format string - H []string - Help *bool - S []string - Time string - V *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r CatMLDataFrameAnalyticsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_cat") + 1 + len("ml") + 1 + len("data_frame") + 1 + len("analytics") + 1 + len(r.DocumentID)) - path.WriteString("/") - path.WriteString("_cat") - path.WriteString("/") - path.WriteString("ml") - path.WriteString("/") - path.WriteString("data_frame") - path.WriteString("/") - path.WriteString("analytics") - if r.DocumentID != "" { - path.WriteString("/") - path.WriteString(r.DocumentID) - } - - params = make(map[string]string) - - if r.AllowNoMatch != nil { - params["allow_no_match"] = strconv.FormatBool(*r.AllowNoMatch) - } - - if r.Bytes != "" { - params["bytes"] = r.Bytes - } - - if r.Format != "" { - params["format"] = r.Format - } - - if len(r.H) > 0 { - params["h"] = strings.Join(r.H, ",") - } - - if r.Help != nil { - params["help"] = strconv.FormatBool(*r.Help) - } - - if len(r.S) > 0 { - params["s"] = strings.Join(r.S, ",") - } - - if r.Time != "" { - params["time"] = r.Time - } - - if r.V != nil { - params["v"] = strconv.FormatBool(*r.V) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f CatMLDataFrameAnalytics) WithContext(v context.Context) func(*CatMLDataFrameAnalyticsRequest) { - return func(r *CatMLDataFrameAnalyticsRequest) { - r.ctx = v - } -} - -// WithDocumentID - the ID of the data frame analytics to fetch. -// -func (f CatMLDataFrameAnalytics) WithDocumentID(v string) func(*CatMLDataFrameAnalyticsRequest) { - return func(r *CatMLDataFrameAnalyticsRequest) { - r.DocumentID = v - } -} - -// WithAllowNoMatch - whether to ignore if a wildcard expression matches no configs. (this includes `_all` string or when no configs have been specified). -// -func (f CatMLDataFrameAnalytics) WithAllowNoMatch(v bool) func(*CatMLDataFrameAnalyticsRequest) { - return func(r *CatMLDataFrameAnalyticsRequest) { - r.AllowNoMatch = &v - } -} - -// WithBytes - the unit in which to display byte values. -// -func (f CatMLDataFrameAnalytics) WithBytes(v string) func(*CatMLDataFrameAnalyticsRequest) { - return func(r *CatMLDataFrameAnalyticsRequest) { - r.Bytes = v - } -} - -// WithFormat - a short version of the accept header, e.g. json, yaml. -// -func (f CatMLDataFrameAnalytics) WithFormat(v string) func(*CatMLDataFrameAnalyticsRequest) { - return func(r *CatMLDataFrameAnalyticsRequest) { - r.Format = v - } -} - -// WithH - comma-separated list of column names to display. -// -func (f CatMLDataFrameAnalytics) WithH(v ...string) func(*CatMLDataFrameAnalyticsRequest) { - return func(r *CatMLDataFrameAnalyticsRequest) { - r.H = v - } -} - -// WithHelp - return help information. -// -func (f CatMLDataFrameAnalytics) WithHelp(v bool) func(*CatMLDataFrameAnalyticsRequest) { - return func(r *CatMLDataFrameAnalyticsRequest) { - r.Help = &v - } -} - -// WithS - comma-separated list of column names or column aliases to sort by. -// -func (f CatMLDataFrameAnalytics) WithS(v ...string) func(*CatMLDataFrameAnalyticsRequest) { - return func(r *CatMLDataFrameAnalyticsRequest) { - r.S = v - } -} - -// WithTime - the unit in which to display time values. -// -func (f CatMLDataFrameAnalytics) WithTime(v string) func(*CatMLDataFrameAnalyticsRequest) { - return func(r *CatMLDataFrameAnalyticsRequest) { - r.Time = v - } -} - -// WithV - verbose mode. display column headers. -// -func (f CatMLDataFrameAnalytics) WithV(v bool) func(*CatMLDataFrameAnalyticsRequest) { - return func(r *CatMLDataFrameAnalyticsRequest) { - r.V = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f CatMLDataFrameAnalytics) WithPretty() func(*CatMLDataFrameAnalyticsRequest) { - return func(r *CatMLDataFrameAnalyticsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f CatMLDataFrameAnalytics) WithHuman() func(*CatMLDataFrameAnalyticsRequest) { - return func(r *CatMLDataFrameAnalyticsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f CatMLDataFrameAnalytics) WithErrorTrace() func(*CatMLDataFrameAnalyticsRequest) { - return func(r *CatMLDataFrameAnalyticsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f CatMLDataFrameAnalytics) WithFilterPath(v ...string) func(*CatMLDataFrameAnalyticsRequest) { - return func(r *CatMLDataFrameAnalyticsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f CatMLDataFrameAnalytics) WithHeader(h map[string]string) func(*CatMLDataFrameAnalyticsRequest) { - return func(r *CatMLDataFrameAnalyticsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f CatMLDataFrameAnalytics) WithOpaqueID(s string) func(*CatMLDataFrameAnalyticsRequest) { - return func(r *CatMLDataFrameAnalyticsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.cat.ml_datafeeds.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.cat.ml_datafeeds.go deleted file mode 100644 index c1d15bd9a..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.cat.ml_datafeeds.go +++ /dev/null @@ -1,321 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newCatMLDatafeedsFunc(t Transport) CatMLDatafeeds { - return func(o ...func(*CatMLDatafeedsRequest)) (*Response, error) { - var r = CatMLDatafeedsRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// CatMLDatafeeds - Gets configuration and usage information about datafeeds. -// -// See full documentation at http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-datafeeds.html. -// -type CatMLDatafeeds func(o ...func(*CatMLDatafeedsRequest)) (*Response, error) - -// CatMLDatafeedsRequest configures the CatML Datafeeds API request. -// -type CatMLDatafeedsRequest struct { - DatafeedID string - - AllowNoDatafeeds *bool - AllowNoMatch *bool - Format string - H []string - Help *bool - S []string - Time string - V *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r CatMLDatafeedsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_cat") + 1 + len("ml") + 1 + len("datafeeds") + 1 + len(r.DatafeedID)) - path.WriteString("/") - path.WriteString("_cat") - path.WriteString("/") - path.WriteString("ml") - path.WriteString("/") - path.WriteString("datafeeds") - if r.DatafeedID != "" { - path.WriteString("/") - path.WriteString(r.DatafeedID) - } - - params = make(map[string]string) - - if r.AllowNoDatafeeds != nil { - params["allow_no_datafeeds"] = strconv.FormatBool(*r.AllowNoDatafeeds) - } - - if r.AllowNoMatch != nil { - params["allow_no_match"] = strconv.FormatBool(*r.AllowNoMatch) - } - - if r.Format != "" { - params["format"] = r.Format - } - - if len(r.H) > 0 { - params["h"] = strings.Join(r.H, ",") - } - - if r.Help != nil { - params["help"] = strconv.FormatBool(*r.Help) - } - - if len(r.S) > 0 { - params["s"] = strings.Join(r.S, ",") - } - - if r.Time != "" { - params["time"] = r.Time - } - - if r.V != nil { - params["v"] = strconv.FormatBool(*r.V) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f CatMLDatafeeds) WithContext(v context.Context) func(*CatMLDatafeedsRequest) { - return func(r *CatMLDatafeedsRequest) { - r.ctx = v - } -} - -// WithDatafeedID - the ID of the datafeeds stats to fetch. -// -func (f CatMLDatafeeds) WithDatafeedID(v string) func(*CatMLDatafeedsRequest) { - return func(r *CatMLDatafeedsRequest) { - r.DatafeedID = v - } -} - -// WithAllowNoDatafeeds - whether to ignore if a wildcard expression matches no datafeeds. (this includes `_all` string or when no datafeeds have been specified). -// -func (f CatMLDatafeeds) WithAllowNoDatafeeds(v bool) func(*CatMLDatafeedsRequest) { - return func(r *CatMLDatafeedsRequest) { - r.AllowNoDatafeeds = &v - } -} - -// WithAllowNoMatch - whether to ignore if a wildcard expression matches no datafeeds. (this includes `_all` string or when no datafeeds have been specified). -// -func (f CatMLDatafeeds) WithAllowNoMatch(v bool) func(*CatMLDatafeedsRequest) { - return func(r *CatMLDatafeedsRequest) { - r.AllowNoMatch = &v - } -} - -// WithFormat - a short version of the accept header, e.g. json, yaml. -// -func (f CatMLDatafeeds) WithFormat(v string) func(*CatMLDatafeedsRequest) { - return func(r *CatMLDatafeedsRequest) { - r.Format = v - } -} - -// WithH - comma-separated list of column names to display. -// -func (f CatMLDatafeeds) WithH(v ...string) func(*CatMLDatafeedsRequest) { - return func(r *CatMLDatafeedsRequest) { - r.H = v - } -} - -// WithHelp - return help information. -// -func (f CatMLDatafeeds) WithHelp(v bool) func(*CatMLDatafeedsRequest) { - return func(r *CatMLDatafeedsRequest) { - r.Help = &v - } -} - -// WithS - comma-separated list of column names or column aliases to sort by. -// -func (f CatMLDatafeeds) WithS(v ...string) func(*CatMLDatafeedsRequest) { - return func(r *CatMLDatafeedsRequest) { - r.S = v - } -} - -// WithTime - the unit in which to display time values. -// -func (f CatMLDatafeeds) WithTime(v string) func(*CatMLDatafeedsRequest) { - return func(r *CatMLDatafeedsRequest) { - r.Time = v - } -} - -// WithV - verbose mode. display column headers. -// -func (f CatMLDatafeeds) WithV(v bool) func(*CatMLDatafeedsRequest) { - return func(r *CatMLDatafeedsRequest) { - r.V = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f CatMLDatafeeds) WithPretty() func(*CatMLDatafeedsRequest) { - return func(r *CatMLDatafeedsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f CatMLDatafeeds) WithHuman() func(*CatMLDatafeedsRequest) { - return func(r *CatMLDatafeedsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f CatMLDatafeeds) WithErrorTrace() func(*CatMLDatafeedsRequest) { - return func(r *CatMLDatafeedsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f CatMLDatafeeds) WithFilterPath(v ...string) func(*CatMLDatafeedsRequest) { - return func(r *CatMLDatafeedsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f CatMLDatafeeds) WithHeader(h map[string]string) func(*CatMLDatafeedsRequest) { - return func(r *CatMLDatafeedsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f CatMLDatafeeds) WithOpaqueID(s string) func(*CatMLDatafeedsRequest) { - return func(r *CatMLDatafeedsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.cat.ml_jobs.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.cat.ml_jobs.go deleted file mode 100644 index 7711d2d43..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.cat.ml_jobs.go +++ /dev/null @@ -1,334 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newCatMLJobsFunc(t Transport) CatMLJobs { - return func(o ...func(*CatMLJobsRequest)) (*Response, error) { - var r = CatMLJobsRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// CatMLJobs - Gets configuration and usage information about anomaly detection jobs. -// -// See full documentation at http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-anomaly-detectors.html. -// -type CatMLJobs func(o ...func(*CatMLJobsRequest)) (*Response, error) - -// CatMLJobsRequest configures the CatML Jobs API request. -// -type CatMLJobsRequest struct { - JobID string - - AllowNoJobs *bool - AllowNoMatch *bool - Bytes string - Format string - H []string - Help *bool - S []string - Time string - V *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r CatMLJobsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_cat") + 1 + len("ml") + 1 + len("anomaly_detectors") + 1 + len(r.JobID)) - path.WriteString("/") - path.WriteString("_cat") - path.WriteString("/") - path.WriteString("ml") - path.WriteString("/") - path.WriteString("anomaly_detectors") - if r.JobID != "" { - path.WriteString("/") - path.WriteString(r.JobID) - } - - params = make(map[string]string) - - if r.AllowNoJobs != nil { - params["allow_no_jobs"] = strconv.FormatBool(*r.AllowNoJobs) - } - - if r.AllowNoMatch != nil { - params["allow_no_match"] = strconv.FormatBool(*r.AllowNoMatch) - } - - if r.Bytes != "" { - params["bytes"] = r.Bytes - } - - if r.Format != "" { - params["format"] = r.Format - } - - if len(r.H) > 0 { - params["h"] = strings.Join(r.H, ",") - } - - if r.Help != nil { - params["help"] = strconv.FormatBool(*r.Help) - } - - if len(r.S) > 0 { - params["s"] = strings.Join(r.S, ",") - } - - if r.Time != "" { - params["time"] = r.Time - } - - if r.V != nil { - params["v"] = strconv.FormatBool(*r.V) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f CatMLJobs) WithContext(v context.Context) func(*CatMLJobsRequest) { - return func(r *CatMLJobsRequest) { - r.ctx = v - } -} - -// WithJobID - the ID of the jobs stats to fetch. -// -func (f CatMLJobs) WithJobID(v string) func(*CatMLJobsRequest) { - return func(r *CatMLJobsRequest) { - r.JobID = v - } -} - -// WithAllowNoJobs - whether to ignore if a wildcard expression matches no jobs. (this includes `_all` string or when no jobs have been specified). -// -func (f CatMLJobs) WithAllowNoJobs(v bool) func(*CatMLJobsRequest) { - return func(r *CatMLJobsRequest) { - r.AllowNoJobs = &v - } -} - -// WithAllowNoMatch - whether to ignore if a wildcard expression matches no jobs. (this includes `_all` string or when no jobs have been specified). -// -func (f CatMLJobs) WithAllowNoMatch(v bool) func(*CatMLJobsRequest) { - return func(r *CatMLJobsRequest) { - r.AllowNoMatch = &v - } -} - -// WithBytes - the unit in which to display byte values. -// -func (f CatMLJobs) WithBytes(v string) func(*CatMLJobsRequest) { - return func(r *CatMLJobsRequest) { - r.Bytes = v - } -} - -// WithFormat - a short version of the accept header, e.g. json, yaml. -// -func (f CatMLJobs) WithFormat(v string) func(*CatMLJobsRequest) { - return func(r *CatMLJobsRequest) { - r.Format = v - } -} - -// WithH - comma-separated list of column names to display. -// -func (f CatMLJobs) WithH(v ...string) func(*CatMLJobsRequest) { - return func(r *CatMLJobsRequest) { - r.H = v - } -} - -// WithHelp - return help information. -// -func (f CatMLJobs) WithHelp(v bool) func(*CatMLJobsRequest) { - return func(r *CatMLJobsRequest) { - r.Help = &v - } -} - -// WithS - comma-separated list of column names or column aliases to sort by. -// -func (f CatMLJobs) WithS(v ...string) func(*CatMLJobsRequest) { - return func(r *CatMLJobsRequest) { - r.S = v - } -} - -// WithTime - the unit in which to display time values. -// -func (f CatMLJobs) WithTime(v string) func(*CatMLJobsRequest) { - return func(r *CatMLJobsRequest) { - r.Time = v - } -} - -// WithV - verbose mode. display column headers. -// -func (f CatMLJobs) WithV(v bool) func(*CatMLJobsRequest) { - return func(r *CatMLJobsRequest) { - r.V = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f CatMLJobs) WithPretty() func(*CatMLJobsRequest) { - return func(r *CatMLJobsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f CatMLJobs) WithHuman() func(*CatMLJobsRequest) { - return func(r *CatMLJobsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f CatMLJobs) WithErrorTrace() func(*CatMLJobsRequest) { - return func(r *CatMLJobsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f CatMLJobs) WithFilterPath(v ...string) func(*CatMLJobsRequest) { - return func(r *CatMLJobsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f CatMLJobs) WithHeader(h map[string]string) func(*CatMLJobsRequest) { - return func(r *CatMLJobsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f CatMLJobs) WithOpaqueID(s string) func(*CatMLJobsRequest) { - return func(r *CatMLJobsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.cat.ml_trained_models.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.cat.ml_trained_models.go deleted file mode 100644 index 003e2fb02..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.cat.ml_trained_models.go +++ /dev/null @@ -1,347 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newCatMLTrainedModelsFunc(t Transport) CatMLTrainedModels { - return func(o ...func(*CatMLTrainedModelsRequest)) (*Response, error) { - var r = CatMLTrainedModelsRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// CatMLTrainedModels - Gets configuration and usage information about inference trained models. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-trained-model.html. -// -type CatMLTrainedModels func(o ...func(*CatMLTrainedModelsRequest)) (*Response, error) - -// CatMLTrainedModelsRequest configures the CatML Trained Models API request. -// -type CatMLTrainedModelsRequest struct { - ModelID string - - AllowNoMatch *bool - Bytes string - Format string - From *int - H []string - Help *bool - S []string - Size *int - Time string - V *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r CatMLTrainedModelsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_cat") + 1 + len("ml") + 1 + len("trained_models") + 1 + len(r.ModelID)) - path.WriteString("/") - path.WriteString("_cat") - path.WriteString("/") - path.WriteString("ml") - path.WriteString("/") - path.WriteString("trained_models") - if r.ModelID != "" { - path.WriteString("/") - path.WriteString(r.ModelID) - } - - params = make(map[string]string) - - if r.AllowNoMatch != nil { - params["allow_no_match"] = strconv.FormatBool(*r.AllowNoMatch) - } - - if r.Bytes != "" { - params["bytes"] = r.Bytes - } - - if r.Format != "" { - params["format"] = r.Format - } - - if r.From != nil { - params["from"] = strconv.FormatInt(int64(*r.From), 10) - } - - if len(r.H) > 0 { - params["h"] = strings.Join(r.H, ",") - } - - if r.Help != nil { - params["help"] = strconv.FormatBool(*r.Help) - } - - if len(r.S) > 0 { - params["s"] = strings.Join(r.S, ",") - } - - if r.Size != nil { - params["size"] = strconv.FormatInt(int64(*r.Size), 10) - } - - if r.Time != "" { - params["time"] = r.Time - } - - if r.V != nil { - params["v"] = strconv.FormatBool(*r.V) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f CatMLTrainedModels) WithContext(v context.Context) func(*CatMLTrainedModelsRequest) { - return func(r *CatMLTrainedModelsRequest) { - r.ctx = v - } -} - -// WithModelID - the ID of the trained models stats to fetch. -// -func (f CatMLTrainedModels) WithModelID(v string) func(*CatMLTrainedModelsRequest) { - return func(r *CatMLTrainedModelsRequest) { - r.ModelID = v - } -} - -// WithAllowNoMatch - whether to ignore if a wildcard expression matches no trained models. (this includes `_all` string or when no trained models have been specified). -// -func (f CatMLTrainedModels) WithAllowNoMatch(v bool) func(*CatMLTrainedModelsRequest) { - return func(r *CatMLTrainedModelsRequest) { - r.AllowNoMatch = &v - } -} - -// WithBytes - the unit in which to display byte values. -// -func (f CatMLTrainedModels) WithBytes(v string) func(*CatMLTrainedModelsRequest) { - return func(r *CatMLTrainedModelsRequest) { - r.Bytes = v - } -} - -// WithFormat - a short version of the accept header, e.g. json, yaml. -// -func (f CatMLTrainedModels) WithFormat(v string) func(*CatMLTrainedModelsRequest) { - return func(r *CatMLTrainedModelsRequest) { - r.Format = v - } -} - -// WithFrom - skips a number of trained models. -// -func (f CatMLTrainedModels) WithFrom(v int) func(*CatMLTrainedModelsRequest) { - return func(r *CatMLTrainedModelsRequest) { - r.From = &v - } -} - -// WithH - comma-separated list of column names to display. -// -func (f CatMLTrainedModels) WithH(v ...string) func(*CatMLTrainedModelsRequest) { - return func(r *CatMLTrainedModelsRequest) { - r.H = v - } -} - -// WithHelp - return help information. -// -func (f CatMLTrainedModels) WithHelp(v bool) func(*CatMLTrainedModelsRequest) { - return func(r *CatMLTrainedModelsRequest) { - r.Help = &v - } -} - -// WithS - comma-separated list of column names or column aliases to sort by. -// -func (f CatMLTrainedModels) WithS(v ...string) func(*CatMLTrainedModelsRequest) { - return func(r *CatMLTrainedModelsRequest) { - r.S = v - } -} - -// WithSize - specifies a max number of trained models to get. -// -func (f CatMLTrainedModels) WithSize(v int) func(*CatMLTrainedModelsRequest) { - return func(r *CatMLTrainedModelsRequest) { - r.Size = &v - } -} - -// WithTime - the unit in which to display time values. -// -func (f CatMLTrainedModels) WithTime(v string) func(*CatMLTrainedModelsRequest) { - return func(r *CatMLTrainedModelsRequest) { - r.Time = v - } -} - -// WithV - verbose mode. display column headers. -// -func (f CatMLTrainedModels) WithV(v bool) func(*CatMLTrainedModelsRequest) { - return func(r *CatMLTrainedModelsRequest) { - r.V = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f CatMLTrainedModels) WithPretty() func(*CatMLTrainedModelsRequest) { - return func(r *CatMLTrainedModelsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f CatMLTrainedModels) WithHuman() func(*CatMLTrainedModelsRequest) { - return func(r *CatMLTrainedModelsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f CatMLTrainedModels) WithErrorTrace() func(*CatMLTrainedModelsRequest) { - return func(r *CatMLTrainedModelsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f CatMLTrainedModels) WithFilterPath(v ...string) func(*CatMLTrainedModelsRequest) { - return func(r *CatMLTrainedModelsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f CatMLTrainedModels) WithHeader(h map[string]string) func(*CatMLTrainedModelsRequest) { - return func(r *CatMLTrainedModelsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f CatMLTrainedModels) WithOpaqueID(s string) func(*CatMLTrainedModelsRequest) { - return func(r *CatMLTrainedModelsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.cat.transforms.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.cat.transforms.go deleted file mode 100644 index 01c9ffaf7..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.cat.transforms.go +++ /dev/null @@ -1,332 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newCatTransformsFunc(t Transport) CatTransforms { - return func(o ...func(*CatTransformsRequest)) (*Response, error) { - var r = CatTransformsRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// CatTransforms - Gets configuration and usage information about transforms. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-transforms.html. -// -type CatTransforms func(o ...func(*CatTransformsRequest)) (*Response, error) - -// CatTransformsRequest configures the Cat Transforms API request. -// -type CatTransformsRequest struct { - TransformID string - - AllowNoMatch *bool - Format string - From *int - H []string - Help *bool - S []string - Size *int - Time string - V *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r CatTransformsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_cat") + 1 + len("transforms") + 1 + len(r.TransformID)) - path.WriteString("/") - path.WriteString("_cat") - path.WriteString("/") - path.WriteString("transforms") - if r.TransformID != "" { - path.WriteString("/") - path.WriteString(r.TransformID) - } - - params = make(map[string]string) - - if r.AllowNoMatch != nil { - params["allow_no_match"] = strconv.FormatBool(*r.AllowNoMatch) - } - - if r.Format != "" { - params["format"] = r.Format - } - - if r.From != nil { - params["from"] = strconv.FormatInt(int64(*r.From), 10) - } - - if len(r.H) > 0 { - params["h"] = strings.Join(r.H, ",") - } - - if r.Help != nil { - params["help"] = strconv.FormatBool(*r.Help) - } - - if len(r.S) > 0 { - params["s"] = strings.Join(r.S, ",") - } - - if r.Size != nil { - params["size"] = strconv.FormatInt(int64(*r.Size), 10) - } - - if r.Time != "" { - params["time"] = r.Time - } - - if r.V != nil { - params["v"] = strconv.FormatBool(*r.V) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f CatTransforms) WithContext(v context.Context) func(*CatTransformsRequest) { - return func(r *CatTransformsRequest) { - r.ctx = v - } -} - -// WithTransformID - the ID of the transform for which to get stats. '_all' or '*' implies all transforms. -// -func (f CatTransforms) WithTransformID(v string) func(*CatTransformsRequest) { - return func(r *CatTransformsRequest) { - r.TransformID = v - } -} - -// WithAllowNoMatch - whether to ignore if a wildcard expression matches no transforms. (this includes `_all` string or when no transforms have been specified). -// -func (f CatTransforms) WithAllowNoMatch(v bool) func(*CatTransformsRequest) { - return func(r *CatTransformsRequest) { - r.AllowNoMatch = &v - } -} - -// WithFormat - a short version of the accept header, e.g. json, yaml. -// -func (f CatTransforms) WithFormat(v string) func(*CatTransformsRequest) { - return func(r *CatTransformsRequest) { - r.Format = v - } -} - -// WithFrom - skips a number of transform configs, defaults to 0. -// -func (f CatTransforms) WithFrom(v int) func(*CatTransformsRequest) { - return func(r *CatTransformsRequest) { - r.From = &v - } -} - -// WithH - comma-separated list of column names to display. -// -func (f CatTransforms) WithH(v ...string) func(*CatTransformsRequest) { - return func(r *CatTransformsRequest) { - r.H = v - } -} - -// WithHelp - return help information. -// -func (f CatTransforms) WithHelp(v bool) func(*CatTransformsRequest) { - return func(r *CatTransformsRequest) { - r.Help = &v - } -} - -// WithS - comma-separated list of column names or column aliases to sort by. -// -func (f CatTransforms) WithS(v ...string) func(*CatTransformsRequest) { - return func(r *CatTransformsRequest) { - r.S = v - } -} - -// WithSize - specifies a max number of transforms to get, defaults to 100. -// -func (f CatTransforms) WithSize(v int) func(*CatTransformsRequest) { - return func(r *CatTransformsRequest) { - r.Size = &v - } -} - -// WithTime - the unit in which to display time values. -// -func (f CatTransforms) WithTime(v string) func(*CatTransformsRequest) { - return func(r *CatTransformsRequest) { - r.Time = v - } -} - -// WithV - verbose mode. display column headers. -// -func (f CatTransforms) WithV(v bool) func(*CatTransformsRequest) { - return func(r *CatTransformsRequest) { - r.V = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f CatTransforms) WithPretty() func(*CatTransformsRequest) { - return func(r *CatTransformsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f CatTransforms) WithHuman() func(*CatTransformsRequest) { - return func(r *CatTransformsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f CatTransforms) WithErrorTrace() func(*CatTransformsRequest) { - return func(r *CatTransformsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f CatTransforms) WithFilterPath(v ...string) func(*CatTransformsRequest) { - return func(r *CatTransformsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f CatTransforms) WithHeader(h map[string]string) func(*CatTransformsRequest) { - return func(r *CatTransformsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f CatTransforms) WithOpaqueID(s string) func(*CatTransformsRequest) { - return func(r *CatTransformsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ccr.delete_auto_follow_pattern.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ccr.delete_auto_follow_pattern.go deleted file mode 100644 index e0d4828cd..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ccr.delete_auto_follow_pattern.go +++ /dev/null @@ -1,203 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newCCRDeleteAutoFollowPatternFunc(t Transport) CCRDeleteAutoFollowPattern { - return func(name string, o ...func(*CCRDeleteAutoFollowPatternRequest)) (*Response, error) { - var r = CCRDeleteAutoFollowPatternRequest{Name: name} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// CCRDeleteAutoFollowPattern - Deletes auto-follow patterns. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-delete-auto-follow-pattern.html. -// -type CCRDeleteAutoFollowPattern func(name string, o ...func(*CCRDeleteAutoFollowPatternRequest)) (*Response, error) - -// CCRDeleteAutoFollowPatternRequest configures the CCR Delete Auto Follow Pattern API request. -// -type CCRDeleteAutoFollowPatternRequest struct { - Name string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r CCRDeleteAutoFollowPatternRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "DELETE" - - path.Grow(1 + len("_ccr") + 1 + len("auto_follow") + 1 + len(r.Name)) - path.WriteString("/") - path.WriteString("_ccr") - path.WriteString("/") - path.WriteString("auto_follow") - path.WriteString("/") - path.WriteString(r.Name) - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f CCRDeleteAutoFollowPattern) WithContext(v context.Context) func(*CCRDeleteAutoFollowPatternRequest) { - return func(r *CCRDeleteAutoFollowPatternRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f CCRDeleteAutoFollowPattern) WithPretty() func(*CCRDeleteAutoFollowPatternRequest) { - return func(r *CCRDeleteAutoFollowPatternRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f CCRDeleteAutoFollowPattern) WithHuman() func(*CCRDeleteAutoFollowPatternRequest) { - return func(r *CCRDeleteAutoFollowPatternRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f CCRDeleteAutoFollowPattern) WithErrorTrace() func(*CCRDeleteAutoFollowPatternRequest) { - return func(r *CCRDeleteAutoFollowPatternRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f CCRDeleteAutoFollowPattern) WithFilterPath(v ...string) func(*CCRDeleteAutoFollowPatternRequest) { - return func(r *CCRDeleteAutoFollowPatternRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f CCRDeleteAutoFollowPattern) WithHeader(h map[string]string) func(*CCRDeleteAutoFollowPatternRequest) { - return func(r *CCRDeleteAutoFollowPatternRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f CCRDeleteAutoFollowPattern) WithOpaqueID(s string) func(*CCRDeleteAutoFollowPatternRequest) { - return func(r *CCRDeleteAutoFollowPatternRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ccr.follow.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ccr.follow.go deleted file mode 100644 index d2839fb77..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ccr.follow.go +++ /dev/null @@ -1,224 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" -) - -func newCCRFollowFunc(t Transport) CCRFollow { - return func(index string, body io.Reader, o ...func(*CCRFollowRequest)) (*Response, error) { - var r = CCRFollowRequest{Index: index, Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// CCRFollow - Creates a new follower index configured to follow the referenced leader index. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-put-follow.html. -// -type CCRFollow func(index string, body io.Reader, o ...func(*CCRFollowRequest)) (*Response, error) - -// CCRFollowRequest configures the CCR Follow API request. -// -type CCRFollowRequest struct { - Index string - - Body io.Reader - - WaitForActiveShards string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r CCRFollowRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - path.Grow(1 + len(r.Index) + 1 + len("_ccr") + 1 + len("follow")) - path.WriteString("/") - path.WriteString(r.Index) - path.WriteString("/") - path.WriteString("_ccr") - path.WriteString("/") - path.WriteString("follow") - - params = make(map[string]string) - - if r.WaitForActiveShards != "" { - params["wait_for_active_shards"] = r.WaitForActiveShards - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f CCRFollow) WithContext(v context.Context) func(*CCRFollowRequest) { - return func(r *CCRFollowRequest) { - r.ctx = v - } -} - -// WithWaitForActiveShards - sets the number of shard copies that must be active before returning. defaults to 0. set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1). -// -func (f CCRFollow) WithWaitForActiveShards(v string) func(*CCRFollowRequest) { - return func(r *CCRFollowRequest) { - r.WaitForActiveShards = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f CCRFollow) WithPretty() func(*CCRFollowRequest) { - return func(r *CCRFollowRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f CCRFollow) WithHuman() func(*CCRFollowRequest) { - return func(r *CCRFollowRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f CCRFollow) WithErrorTrace() func(*CCRFollowRequest) { - return func(r *CCRFollowRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f CCRFollow) WithFilterPath(v ...string) func(*CCRFollowRequest) { - return func(r *CCRFollowRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f CCRFollow) WithHeader(h map[string]string) func(*CCRFollowRequest) { - return func(r *CCRFollowRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f CCRFollow) WithOpaqueID(s string) func(*CCRFollowRequest) { - return func(r *CCRFollowRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ccr.follow_info.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ccr.follow_info.go deleted file mode 100644 index 39dc45f07..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ccr.follow_info.go +++ /dev/null @@ -1,203 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newCCRFollowInfoFunc(t Transport) CCRFollowInfo { - return func(index []string, o ...func(*CCRFollowInfoRequest)) (*Response, error) { - var r = CCRFollowInfoRequest{Index: index} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// CCRFollowInfo - Retrieves information about all follower indices, including parameters and status for each follower index -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-follow-info.html. -// -type CCRFollowInfo func(index []string, o ...func(*CCRFollowInfoRequest)) (*Response, error) - -// CCRFollowInfoRequest configures the CCR Follow Info API request. -// -type CCRFollowInfoRequest struct { - Index []string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r CCRFollowInfoRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len(strings.Join(r.Index, ",")) + 1 + len("_ccr") + 1 + len("info")) - path.WriteString("/") - path.WriteString(strings.Join(r.Index, ",")) - path.WriteString("/") - path.WriteString("_ccr") - path.WriteString("/") - path.WriteString("info") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f CCRFollowInfo) WithContext(v context.Context) func(*CCRFollowInfoRequest) { - return func(r *CCRFollowInfoRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f CCRFollowInfo) WithPretty() func(*CCRFollowInfoRequest) { - return func(r *CCRFollowInfoRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f CCRFollowInfo) WithHuman() func(*CCRFollowInfoRequest) { - return func(r *CCRFollowInfoRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f CCRFollowInfo) WithErrorTrace() func(*CCRFollowInfoRequest) { - return func(r *CCRFollowInfoRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f CCRFollowInfo) WithFilterPath(v ...string) func(*CCRFollowInfoRequest) { - return func(r *CCRFollowInfoRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f CCRFollowInfo) WithHeader(h map[string]string) func(*CCRFollowInfoRequest) { - return func(r *CCRFollowInfoRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f CCRFollowInfo) WithOpaqueID(s string) func(*CCRFollowInfoRequest) { - return func(r *CCRFollowInfoRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ccr.follow_stats.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ccr.follow_stats.go deleted file mode 100644 index 0c10c52c6..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ccr.follow_stats.go +++ /dev/null @@ -1,203 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newCCRFollowStatsFunc(t Transport) CCRFollowStats { - return func(index []string, o ...func(*CCRFollowStatsRequest)) (*Response, error) { - var r = CCRFollowStatsRequest{Index: index} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// CCRFollowStats - Retrieves follower stats. return shard-level stats about the following tasks associated with each shard for the specified indices. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-follow-stats.html. -// -type CCRFollowStats func(index []string, o ...func(*CCRFollowStatsRequest)) (*Response, error) - -// CCRFollowStatsRequest configures the CCR Follow Stats API request. -// -type CCRFollowStatsRequest struct { - Index []string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r CCRFollowStatsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len(strings.Join(r.Index, ",")) + 1 + len("_ccr") + 1 + len("stats")) - path.WriteString("/") - path.WriteString(strings.Join(r.Index, ",")) - path.WriteString("/") - path.WriteString("_ccr") - path.WriteString("/") - path.WriteString("stats") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f CCRFollowStats) WithContext(v context.Context) func(*CCRFollowStatsRequest) { - return func(r *CCRFollowStatsRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f CCRFollowStats) WithPretty() func(*CCRFollowStatsRequest) { - return func(r *CCRFollowStatsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f CCRFollowStats) WithHuman() func(*CCRFollowStatsRequest) { - return func(r *CCRFollowStatsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f CCRFollowStats) WithErrorTrace() func(*CCRFollowStatsRequest) { - return func(r *CCRFollowStatsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f CCRFollowStats) WithFilterPath(v ...string) func(*CCRFollowStatsRequest) { - return func(r *CCRFollowStatsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f CCRFollowStats) WithHeader(h map[string]string) func(*CCRFollowStatsRequest) { - return func(r *CCRFollowStatsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f CCRFollowStats) WithOpaqueID(s string) func(*CCRFollowStatsRequest) { - return func(r *CCRFollowStatsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ccr.forget_follower.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ccr.forget_follower.go deleted file mode 100644 index 81588187f..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ccr.forget_follower.go +++ /dev/null @@ -1,210 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" -) - -func newCCRForgetFollowerFunc(t Transport) CCRForgetFollower { - return func(index string, body io.Reader, o ...func(*CCRForgetFollowerRequest)) (*Response, error) { - var r = CCRForgetFollowerRequest{Index: index, Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// CCRForgetFollower - Removes the follower retention leases from the leader. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-post-forget-follower.html. -// -type CCRForgetFollower func(index string, body io.Reader, o ...func(*CCRForgetFollowerRequest)) (*Response, error) - -// CCRForgetFollowerRequest configures the CCR Forget Follower API request. -// -type CCRForgetFollowerRequest struct { - Index string - - Body io.Reader - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r CCRForgetFollowerRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len(r.Index) + 1 + len("_ccr") + 1 + len("forget_follower")) - path.WriteString("/") - path.WriteString(r.Index) - path.WriteString("/") - path.WriteString("_ccr") - path.WriteString("/") - path.WriteString("forget_follower") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f CCRForgetFollower) WithContext(v context.Context) func(*CCRForgetFollowerRequest) { - return func(r *CCRForgetFollowerRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f CCRForgetFollower) WithPretty() func(*CCRForgetFollowerRequest) { - return func(r *CCRForgetFollowerRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f CCRForgetFollower) WithHuman() func(*CCRForgetFollowerRequest) { - return func(r *CCRForgetFollowerRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f CCRForgetFollower) WithErrorTrace() func(*CCRForgetFollowerRequest) { - return func(r *CCRForgetFollowerRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f CCRForgetFollower) WithFilterPath(v ...string) func(*CCRForgetFollowerRequest) { - return func(r *CCRForgetFollowerRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f CCRForgetFollower) WithHeader(h map[string]string) func(*CCRForgetFollowerRequest) { - return func(r *CCRForgetFollowerRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f CCRForgetFollower) WithOpaqueID(s string) func(*CCRForgetFollowerRequest) { - return func(r *CCRForgetFollowerRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ccr.get_auto_follow_pattern.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ccr.get_auto_follow_pattern.go deleted file mode 100644 index 9db9fa38a..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ccr.get_auto_follow_pattern.go +++ /dev/null @@ -1,213 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newCCRGetAutoFollowPatternFunc(t Transport) CCRGetAutoFollowPattern { - return func(o ...func(*CCRGetAutoFollowPatternRequest)) (*Response, error) { - var r = CCRGetAutoFollowPatternRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// CCRGetAutoFollowPattern - Gets configured auto-follow patterns. Returns the specified auto-follow pattern collection. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-auto-follow-pattern.html. -// -type CCRGetAutoFollowPattern func(o ...func(*CCRGetAutoFollowPatternRequest)) (*Response, error) - -// CCRGetAutoFollowPatternRequest configures the CCR Get Auto Follow Pattern API request. -// -type CCRGetAutoFollowPatternRequest struct { - Name string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r CCRGetAutoFollowPatternRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_ccr") + 1 + len("auto_follow") + 1 + len(r.Name)) - path.WriteString("/") - path.WriteString("_ccr") - path.WriteString("/") - path.WriteString("auto_follow") - if r.Name != "" { - path.WriteString("/") - path.WriteString(r.Name) - } - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f CCRGetAutoFollowPattern) WithContext(v context.Context) func(*CCRGetAutoFollowPatternRequest) { - return func(r *CCRGetAutoFollowPatternRequest) { - r.ctx = v - } -} - -// WithName - the name of the auto follow pattern.. -// -func (f CCRGetAutoFollowPattern) WithName(v string) func(*CCRGetAutoFollowPatternRequest) { - return func(r *CCRGetAutoFollowPatternRequest) { - r.Name = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f CCRGetAutoFollowPattern) WithPretty() func(*CCRGetAutoFollowPatternRequest) { - return func(r *CCRGetAutoFollowPatternRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f CCRGetAutoFollowPattern) WithHuman() func(*CCRGetAutoFollowPatternRequest) { - return func(r *CCRGetAutoFollowPatternRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f CCRGetAutoFollowPattern) WithErrorTrace() func(*CCRGetAutoFollowPatternRequest) { - return func(r *CCRGetAutoFollowPatternRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f CCRGetAutoFollowPattern) WithFilterPath(v ...string) func(*CCRGetAutoFollowPatternRequest) { - return func(r *CCRGetAutoFollowPatternRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f CCRGetAutoFollowPattern) WithHeader(h map[string]string) func(*CCRGetAutoFollowPatternRequest) { - return func(r *CCRGetAutoFollowPatternRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f CCRGetAutoFollowPattern) WithOpaqueID(s string) func(*CCRGetAutoFollowPatternRequest) { - return func(r *CCRGetAutoFollowPatternRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ccr.pause_auto_follow_pattern.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ccr.pause_auto_follow_pattern.go deleted file mode 100644 index 923544075..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ccr.pause_auto_follow_pattern.go +++ /dev/null @@ -1,205 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newCCRPauseAutoFollowPatternFunc(t Transport) CCRPauseAutoFollowPattern { - return func(name string, o ...func(*CCRPauseAutoFollowPatternRequest)) (*Response, error) { - var r = CCRPauseAutoFollowPatternRequest{Name: name} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// CCRPauseAutoFollowPattern - Pauses an auto-follow pattern -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-pause-auto-follow-pattern.html. -// -type CCRPauseAutoFollowPattern func(name string, o ...func(*CCRPauseAutoFollowPatternRequest)) (*Response, error) - -// CCRPauseAutoFollowPatternRequest configures the CCR Pause Auto Follow Pattern API request. -// -type CCRPauseAutoFollowPatternRequest struct { - Name string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r CCRPauseAutoFollowPatternRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_ccr") + 1 + len("auto_follow") + 1 + len(r.Name) + 1 + len("pause")) - path.WriteString("/") - path.WriteString("_ccr") - path.WriteString("/") - path.WriteString("auto_follow") - path.WriteString("/") - path.WriteString(r.Name) - path.WriteString("/") - path.WriteString("pause") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f CCRPauseAutoFollowPattern) WithContext(v context.Context) func(*CCRPauseAutoFollowPatternRequest) { - return func(r *CCRPauseAutoFollowPatternRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f CCRPauseAutoFollowPattern) WithPretty() func(*CCRPauseAutoFollowPatternRequest) { - return func(r *CCRPauseAutoFollowPatternRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f CCRPauseAutoFollowPattern) WithHuman() func(*CCRPauseAutoFollowPatternRequest) { - return func(r *CCRPauseAutoFollowPatternRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f CCRPauseAutoFollowPattern) WithErrorTrace() func(*CCRPauseAutoFollowPatternRequest) { - return func(r *CCRPauseAutoFollowPatternRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f CCRPauseAutoFollowPattern) WithFilterPath(v ...string) func(*CCRPauseAutoFollowPatternRequest) { - return func(r *CCRPauseAutoFollowPatternRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f CCRPauseAutoFollowPattern) WithHeader(h map[string]string) func(*CCRPauseAutoFollowPatternRequest) { - return func(r *CCRPauseAutoFollowPatternRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f CCRPauseAutoFollowPattern) WithOpaqueID(s string) func(*CCRPauseAutoFollowPatternRequest) { - return func(r *CCRPauseAutoFollowPatternRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ccr.pause_follow.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ccr.pause_follow.go deleted file mode 100644 index 6b24ff414..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ccr.pause_follow.go +++ /dev/null @@ -1,203 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newCCRPauseFollowFunc(t Transport) CCRPauseFollow { - return func(index string, o ...func(*CCRPauseFollowRequest)) (*Response, error) { - var r = CCRPauseFollowRequest{Index: index} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// CCRPauseFollow - Pauses a follower index. The follower index will not fetch any additional operations from the leader index. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-post-pause-follow.html. -// -type CCRPauseFollow func(index string, o ...func(*CCRPauseFollowRequest)) (*Response, error) - -// CCRPauseFollowRequest configures the CCR Pause Follow API request. -// -type CCRPauseFollowRequest struct { - Index string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r CCRPauseFollowRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len(r.Index) + 1 + len("_ccr") + 1 + len("pause_follow")) - path.WriteString("/") - path.WriteString(r.Index) - path.WriteString("/") - path.WriteString("_ccr") - path.WriteString("/") - path.WriteString("pause_follow") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f CCRPauseFollow) WithContext(v context.Context) func(*CCRPauseFollowRequest) { - return func(r *CCRPauseFollowRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f CCRPauseFollow) WithPretty() func(*CCRPauseFollowRequest) { - return func(r *CCRPauseFollowRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f CCRPauseFollow) WithHuman() func(*CCRPauseFollowRequest) { - return func(r *CCRPauseFollowRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f CCRPauseFollow) WithErrorTrace() func(*CCRPauseFollowRequest) { - return func(r *CCRPauseFollowRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f CCRPauseFollow) WithFilterPath(v ...string) func(*CCRPauseFollowRequest) { - return func(r *CCRPauseFollowRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f CCRPauseFollow) WithHeader(h map[string]string) func(*CCRPauseFollowRequest) { - return func(r *CCRPauseFollowRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f CCRPauseFollow) WithOpaqueID(s string) func(*CCRPauseFollowRequest) { - return func(r *CCRPauseFollowRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ccr.put_auto_follow_pattern.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ccr.put_auto_follow_pattern.go deleted file mode 100644 index e0def85c9..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ccr.put_auto_follow_pattern.go +++ /dev/null @@ -1,210 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" -) - -func newCCRPutAutoFollowPatternFunc(t Transport) CCRPutAutoFollowPattern { - return func(name string, body io.Reader, o ...func(*CCRPutAutoFollowPatternRequest)) (*Response, error) { - var r = CCRPutAutoFollowPatternRequest{Name: name, Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// CCRPutAutoFollowPattern - Creates a new named collection of auto-follow patterns against a specified remote cluster. Newly created indices on the remote cluster matching any of the specified patterns will be automatically configured as follower indices. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-put-auto-follow-pattern.html. -// -type CCRPutAutoFollowPattern func(name string, body io.Reader, o ...func(*CCRPutAutoFollowPatternRequest)) (*Response, error) - -// CCRPutAutoFollowPatternRequest configures the CCR Put Auto Follow Pattern API request. -// -type CCRPutAutoFollowPatternRequest struct { - Body io.Reader - - Name string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r CCRPutAutoFollowPatternRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - path.Grow(1 + len("_ccr") + 1 + len("auto_follow") + 1 + len(r.Name)) - path.WriteString("/") - path.WriteString("_ccr") - path.WriteString("/") - path.WriteString("auto_follow") - path.WriteString("/") - path.WriteString(r.Name) - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f CCRPutAutoFollowPattern) WithContext(v context.Context) func(*CCRPutAutoFollowPatternRequest) { - return func(r *CCRPutAutoFollowPatternRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f CCRPutAutoFollowPattern) WithPretty() func(*CCRPutAutoFollowPatternRequest) { - return func(r *CCRPutAutoFollowPatternRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f CCRPutAutoFollowPattern) WithHuman() func(*CCRPutAutoFollowPatternRequest) { - return func(r *CCRPutAutoFollowPatternRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f CCRPutAutoFollowPattern) WithErrorTrace() func(*CCRPutAutoFollowPatternRequest) { - return func(r *CCRPutAutoFollowPatternRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f CCRPutAutoFollowPattern) WithFilterPath(v ...string) func(*CCRPutAutoFollowPatternRequest) { - return func(r *CCRPutAutoFollowPatternRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f CCRPutAutoFollowPattern) WithHeader(h map[string]string) func(*CCRPutAutoFollowPatternRequest) { - return func(r *CCRPutAutoFollowPatternRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f CCRPutAutoFollowPattern) WithOpaqueID(s string) func(*CCRPutAutoFollowPatternRequest) { - return func(r *CCRPutAutoFollowPatternRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ccr.resume_auto_follow_pattern.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ccr.resume_auto_follow_pattern.go deleted file mode 100644 index 98a20b320..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ccr.resume_auto_follow_pattern.go +++ /dev/null @@ -1,205 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newCCRResumeAutoFollowPatternFunc(t Transport) CCRResumeAutoFollowPattern { - return func(name string, o ...func(*CCRResumeAutoFollowPatternRequest)) (*Response, error) { - var r = CCRResumeAutoFollowPatternRequest{Name: name} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// CCRResumeAutoFollowPattern - Resumes an auto-follow pattern that has been paused -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-resume-auto-follow-pattern.html. -// -type CCRResumeAutoFollowPattern func(name string, o ...func(*CCRResumeAutoFollowPatternRequest)) (*Response, error) - -// CCRResumeAutoFollowPatternRequest configures the CCR Resume Auto Follow Pattern API request. -// -type CCRResumeAutoFollowPatternRequest struct { - Name string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r CCRResumeAutoFollowPatternRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_ccr") + 1 + len("auto_follow") + 1 + len(r.Name) + 1 + len("resume")) - path.WriteString("/") - path.WriteString("_ccr") - path.WriteString("/") - path.WriteString("auto_follow") - path.WriteString("/") - path.WriteString(r.Name) - path.WriteString("/") - path.WriteString("resume") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f CCRResumeAutoFollowPattern) WithContext(v context.Context) func(*CCRResumeAutoFollowPatternRequest) { - return func(r *CCRResumeAutoFollowPatternRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f CCRResumeAutoFollowPattern) WithPretty() func(*CCRResumeAutoFollowPatternRequest) { - return func(r *CCRResumeAutoFollowPatternRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f CCRResumeAutoFollowPattern) WithHuman() func(*CCRResumeAutoFollowPatternRequest) { - return func(r *CCRResumeAutoFollowPatternRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f CCRResumeAutoFollowPattern) WithErrorTrace() func(*CCRResumeAutoFollowPatternRequest) { - return func(r *CCRResumeAutoFollowPatternRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f CCRResumeAutoFollowPattern) WithFilterPath(v ...string) func(*CCRResumeAutoFollowPatternRequest) { - return func(r *CCRResumeAutoFollowPatternRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f CCRResumeAutoFollowPattern) WithHeader(h map[string]string) func(*CCRResumeAutoFollowPatternRequest) { - return func(r *CCRResumeAutoFollowPatternRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f CCRResumeAutoFollowPattern) WithOpaqueID(s string) func(*CCRResumeAutoFollowPatternRequest) { - return func(r *CCRResumeAutoFollowPatternRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ccr.resume_follow.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ccr.resume_follow.go deleted file mode 100644 index 23bd3a293..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ccr.resume_follow.go +++ /dev/null @@ -1,218 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" -) - -func newCCRResumeFollowFunc(t Transport) CCRResumeFollow { - return func(index string, o ...func(*CCRResumeFollowRequest)) (*Response, error) { - var r = CCRResumeFollowRequest{Index: index} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// CCRResumeFollow - Resumes a follower index that has been paused -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-post-resume-follow.html. -// -type CCRResumeFollow func(index string, o ...func(*CCRResumeFollowRequest)) (*Response, error) - -// CCRResumeFollowRequest configures the CCR Resume Follow API request. -// -type CCRResumeFollowRequest struct { - Index string - - Body io.Reader - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r CCRResumeFollowRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len(r.Index) + 1 + len("_ccr") + 1 + len("resume_follow")) - path.WriteString("/") - path.WriteString(r.Index) - path.WriteString("/") - path.WriteString("_ccr") - path.WriteString("/") - path.WriteString("resume_follow") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f CCRResumeFollow) WithContext(v context.Context) func(*CCRResumeFollowRequest) { - return func(r *CCRResumeFollowRequest) { - r.ctx = v - } -} - -// WithBody - The name of the leader index and other optional ccr related parameters. -// -func (f CCRResumeFollow) WithBody(v io.Reader) func(*CCRResumeFollowRequest) { - return func(r *CCRResumeFollowRequest) { - r.Body = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f CCRResumeFollow) WithPretty() func(*CCRResumeFollowRequest) { - return func(r *CCRResumeFollowRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f CCRResumeFollow) WithHuman() func(*CCRResumeFollowRequest) { - return func(r *CCRResumeFollowRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f CCRResumeFollow) WithErrorTrace() func(*CCRResumeFollowRequest) { - return func(r *CCRResumeFollowRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f CCRResumeFollow) WithFilterPath(v ...string) func(*CCRResumeFollowRequest) { - return func(r *CCRResumeFollowRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f CCRResumeFollow) WithHeader(h map[string]string) func(*CCRResumeFollowRequest) { - return func(r *CCRResumeFollowRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f CCRResumeFollow) WithOpaqueID(s string) func(*CCRResumeFollowRequest) { - return func(r *CCRResumeFollowRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ccr.stats.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ccr.stats.go deleted file mode 100644 index 8647736ee..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ccr.stats.go +++ /dev/null @@ -1,196 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newCCRStatsFunc(t Transport) CCRStats { - return func(o ...func(*CCRStatsRequest)) (*Response, error) { - var r = CCRStatsRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// CCRStats - Gets all stats related to cross-cluster replication. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-stats.html. -// -type CCRStats func(o ...func(*CCRStatsRequest)) (*Response, error) - -// CCRStatsRequest configures the CCR Stats API request. -// -type CCRStatsRequest struct { - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r CCRStatsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(len("/_ccr/stats")) - path.WriteString("/_ccr/stats") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f CCRStats) WithContext(v context.Context) func(*CCRStatsRequest) { - return func(r *CCRStatsRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f CCRStats) WithPretty() func(*CCRStatsRequest) { - return func(r *CCRStatsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f CCRStats) WithHuman() func(*CCRStatsRequest) { - return func(r *CCRStatsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f CCRStats) WithErrorTrace() func(*CCRStatsRequest) { - return func(r *CCRStatsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f CCRStats) WithFilterPath(v ...string) func(*CCRStatsRequest) { - return func(r *CCRStatsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f CCRStats) WithHeader(h map[string]string) func(*CCRStatsRequest) { - return func(r *CCRStatsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f CCRStats) WithOpaqueID(s string) func(*CCRStatsRequest) { - return func(r *CCRStatsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ccr.unfollow.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ccr.unfollow.go deleted file mode 100644 index bd4cda3f5..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ccr.unfollow.go +++ /dev/null @@ -1,203 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newCCRUnfollowFunc(t Transport) CCRUnfollow { - return func(index string, o ...func(*CCRUnfollowRequest)) (*Response, error) { - var r = CCRUnfollowRequest{Index: index} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// CCRUnfollow - Stops the following task associated with a follower index and removes index metadata and settings associated with cross-cluster replication. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-post-unfollow.html. -// -type CCRUnfollow func(index string, o ...func(*CCRUnfollowRequest)) (*Response, error) - -// CCRUnfollowRequest configures the CCR Unfollow API request. -// -type CCRUnfollowRequest struct { - Index string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r CCRUnfollowRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len(r.Index) + 1 + len("_ccr") + 1 + len("unfollow")) - path.WriteString("/") - path.WriteString(r.Index) - path.WriteString("/") - path.WriteString("_ccr") - path.WriteString("/") - path.WriteString("unfollow") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f CCRUnfollow) WithContext(v context.Context) func(*CCRUnfollowRequest) { - return func(r *CCRUnfollowRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f CCRUnfollow) WithPretty() func(*CCRUnfollowRequest) { - return func(r *CCRUnfollowRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f CCRUnfollow) WithHuman() func(*CCRUnfollowRequest) { - return func(r *CCRUnfollowRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f CCRUnfollow) WithErrorTrace() func(*CCRUnfollowRequest) { - return func(r *CCRUnfollowRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f CCRUnfollow) WithFilterPath(v ...string) func(*CCRUnfollowRequest) { - return func(r *CCRUnfollowRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f CCRUnfollow) WithHeader(h map[string]string) func(*CCRUnfollowRequest) { - return func(r *CCRUnfollowRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f CCRUnfollow) WithOpaqueID(s string) func(*CCRUnfollowRequest) { - return func(r *CCRUnfollowRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.close_point_in_time.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.close_point_in_time.go deleted file mode 100644 index c62102597..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.close_point_in_time.go +++ /dev/null @@ -1,211 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" -) - -func newClosePointInTimeFunc(t Transport) ClosePointInTime { - return func(o ...func(*ClosePointInTimeRequest)) (*Response, error) { - var r = ClosePointInTimeRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// ClosePointInTime - Close a point in time -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html. -// -type ClosePointInTime func(o ...func(*ClosePointInTimeRequest)) (*Response, error) - -// ClosePointInTimeRequest configures the Close Point In Time API request. -// -type ClosePointInTimeRequest struct { - Body io.Reader - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r ClosePointInTimeRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "DELETE" - - path.Grow(len("/_pit")) - path.WriteString("/_pit") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f ClosePointInTime) WithContext(v context.Context) func(*ClosePointInTimeRequest) { - return func(r *ClosePointInTimeRequest) { - r.ctx = v - } -} - -// WithBody - a point-in-time id to close. -// -func (f ClosePointInTime) WithBody(v io.Reader) func(*ClosePointInTimeRequest) { - return func(r *ClosePointInTimeRequest) { - r.Body = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f ClosePointInTime) WithPretty() func(*ClosePointInTimeRequest) { - return func(r *ClosePointInTimeRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f ClosePointInTime) WithHuman() func(*ClosePointInTimeRequest) { - return func(r *ClosePointInTimeRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f ClosePointInTime) WithErrorTrace() func(*ClosePointInTimeRequest) { - return func(r *ClosePointInTimeRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f ClosePointInTime) WithFilterPath(v ...string) func(*ClosePointInTimeRequest) { - return func(r *ClosePointInTimeRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f ClosePointInTime) WithHeader(h map[string]string) func(*ClosePointInTimeRequest) { - return func(r *ClosePointInTimeRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f ClosePointInTime) WithOpaqueID(s string) func(*ClosePointInTimeRequest) { - return func(r *ClosePointInTimeRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.data_frame_transform_deprecated.delete_transform.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.data_frame_transform_deprecated.delete_transform.go deleted file mode 100644 index c9128c020..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.data_frame_transform_deprecated.delete_transform.go +++ /dev/null @@ -1,220 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newDataFrameTransformDeprecatedDeleteTransformFunc(t Transport) DataFrameTransformDeprecatedDeleteTransform { - return func(transform_id string, o ...func(*DataFrameTransformDeprecatedDeleteTransformRequest)) (*Response, error) { - var r = DataFrameTransformDeprecatedDeleteTransformRequest{TransformID: transform_id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// DataFrameTransformDeprecatedDeleteTransform - Deletes an existing transform. -// -// This API is beta. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-transform.html. -// -type DataFrameTransformDeprecatedDeleteTransform func(transform_id string, o ...func(*DataFrameTransformDeprecatedDeleteTransformRequest)) (*Response, error) - -// DataFrameTransformDeprecatedDeleteTransformRequest configures the Data Frame Transform Deprecated Delete Transform API request. -// -type DataFrameTransformDeprecatedDeleteTransformRequest struct { - TransformID string - - Force *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r DataFrameTransformDeprecatedDeleteTransformRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "DELETE" - - path.Grow(1 + len("_data_frame") + 1 + len("transforms") + 1 + len(r.TransformID)) - path.WriteString("/") - path.WriteString("_data_frame") - path.WriteString("/") - path.WriteString("transforms") - path.WriteString("/") - path.WriteString(r.TransformID) - - params = make(map[string]string) - - if r.Force != nil { - params["force"] = strconv.FormatBool(*r.Force) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f DataFrameTransformDeprecatedDeleteTransform) WithContext(v context.Context) func(*DataFrameTransformDeprecatedDeleteTransformRequest) { - return func(r *DataFrameTransformDeprecatedDeleteTransformRequest) { - r.ctx = v - } -} - -// WithForce - when `true`, the transform is deleted regardless of its current state. the default value is `false`, meaning that the transform must be `stopped` before it can be deleted.. -// -func (f DataFrameTransformDeprecatedDeleteTransform) WithForce(v bool) func(*DataFrameTransformDeprecatedDeleteTransformRequest) { - return func(r *DataFrameTransformDeprecatedDeleteTransformRequest) { - r.Force = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f DataFrameTransformDeprecatedDeleteTransform) WithPretty() func(*DataFrameTransformDeprecatedDeleteTransformRequest) { - return func(r *DataFrameTransformDeprecatedDeleteTransformRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f DataFrameTransformDeprecatedDeleteTransform) WithHuman() func(*DataFrameTransformDeprecatedDeleteTransformRequest) { - return func(r *DataFrameTransformDeprecatedDeleteTransformRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f DataFrameTransformDeprecatedDeleteTransform) WithErrorTrace() func(*DataFrameTransformDeprecatedDeleteTransformRequest) { - return func(r *DataFrameTransformDeprecatedDeleteTransformRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f DataFrameTransformDeprecatedDeleteTransform) WithFilterPath(v ...string) func(*DataFrameTransformDeprecatedDeleteTransformRequest) { - return func(r *DataFrameTransformDeprecatedDeleteTransformRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f DataFrameTransformDeprecatedDeleteTransform) WithHeader(h map[string]string) func(*DataFrameTransformDeprecatedDeleteTransformRequest) { - return func(r *DataFrameTransformDeprecatedDeleteTransformRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f DataFrameTransformDeprecatedDeleteTransform) WithOpaqueID(s string) func(*DataFrameTransformDeprecatedDeleteTransformRequest) { - return func(r *DataFrameTransformDeprecatedDeleteTransformRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.data_frame_transform_deprecated.get_transform.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.data_frame_transform_deprecated.get_transform.go deleted file mode 100644 index e1d4bc0bc..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.data_frame_transform_deprecated.get_transform.go +++ /dev/null @@ -1,269 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newDataFrameTransformDeprecatedGetTransformFunc(t Transport) DataFrameTransformDeprecatedGetTransform { - return func(o ...func(*DataFrameTransformDeprecatedGetTransformRequest)) (*Response, error) { - var r = DataFrameTransformDeprecatedGetTransformRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// DataFrameTransformDeprecatedGetTransform - Retrieves configuration information for transforms. -// -// This API is beta. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/get-transform.html. -// -type DataFrameTransformDeprecatedGetTransform func(o ...func(*DataFrameTransformDeprecatedGetTransformRequest)) (*Response, error) - -// DataFrameTransformDeprecatedGetTransformRequest configures the Data Frame Transform Deprecated Get Transform API request. -// -type DataFrameTransformDeprecatedGetTransformRequest struct { - TransformID string - - AllowNoMatch *bool - ExcludeGenerated *bool - From *int - Size *int - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r DataFrameTransformDeprecatedGetTransformRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_data_frame") + 1 + len("transforms") + 1 + len(r.TransformID)) - path.WriteString("/") - path.WriteString("_data_frame") - path.WriteString("/") - path.WriteString("transforms") - if r.TransformID != "" { - path.WriteString("/") - path.WriteString(r.TransformID) - } - - params = make(map[string]string) - - if r.AllowNoMatch != nil { - params["allow_no_match"] = strconv.FormatBool(*r.AllowNoMatch) - } - - if r.ExcludeGenerated != nil { - params["exclude_generated"] = strconv.FormatBool(*r.ExcludeGenerated) - } - - if r.From != nil { - params["from"] = strconv.FormatInt(int64(*r.From), 10) - } - - if r.Size != nil { - params["size"] = strconv.FormatInt(int64(*r.Size), 10) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f DataFrameTransformDeprecatedGetTransform) WithContext(v context.Context) func(*DataFrameTransformDeprecatedGetTransformRequest) { - return func(r *DataFrameTransformDeprecatedGetTransformRequest) { - r.ctx = v - } -} - -// WithTransformID - the ID or comma delimited list of ID expressions of the transforms to get, '_all' or '*' implies get all transforms. -// -func (f DataFrameTransformDeprecatedGetTransform) WithTransformID(v string) func(*DataFrameTransformDeprecatedGetTransformRequest) { - return func(r *DataFrameTransformDeprecatedGetTransformRequest) { - r.TransformID = v - } -} - -// WithAllowNoMatch - whether to ignore if a wildcard expression matches no transforms. (this includes `_all` string or when no transforms have been specified). -// -func (f DataFrameTransformDeprecatedGetTransform) WithAllowNoMatch(v bool) func(*DataFrameTransformDeprecatedGetTransformRequest) { - return func(r *DataFrameTransformDeprecatedGetTransformRequest) { - r.AllowNoMatch = &v - } -} - -// WithExcludeGenerated - omits generated fields. allows transform configurations to be easily copied between clusters and within the same cluster. -// -func (f DataFrameTransformDeprecatedGetTransform) WithExcludeGenerated(v bool) func(*DataFrameTransformDeprecatedGetTransformRequest) { - return func(r *DataFrameTransformDeprecatedGetTransformRequest) { - r.ExcludeGenerated = &v - } -} - -// WithFrom - skips a number of transform configs, defaults to 0. -// -func (f DataFrameTransformDeprecatedGetTransform) WithFrom(v int) func(*DataFrameTransformDeprecatedGetTransformRequest) { - return func(r *DataFrameTransformDeprecatedGetTransformRequest) { - r.From = &v - } -} - -// WithSize - specifies a max number of transforms to get, defaults to 100. -// -func (f DataFrameTransformDeprecatedGetTransform) WithSize(v int) func(*DataFrameTransformDeprecatedGetTransformRequest) { - return func(r *DataFrameTransformDeprecatedGetTransformRequest) { - r.Size = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f DataFrameTransformDeprecatedGetTransform) WithPretty() func(*DataFrameTransformDeprecatedGetTransformRequest) { - return func(r *DataFrameTransformDeprecatedGetTransformRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f DataFrameTransformDeprecatedGetTransform) WithHuman() func(*DataFrameTransformDeprecatedGetTransformRequest) { - return func(r *DataFrameTransformDeprecatedGetTransformRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f DataFrameTransformDeprecatedGetTransform) WithErrorTrace() func(*DataFrameTransformDeprecatedGetTransformRequest) { - return func(r *DataFrameTransformDeprecatedGetTransformRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f DataFrameTransformDeprecatedGetTransform) WithFilterPath(v ...string) func(*DataFrameTransformDeprecatedGetTransformRequest) { - return func(r *DataFrameTransformDeprecatedGetTransformRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f DataFrameTransformDeprecatedGetTransform) WithHeader(h map[string]string) func(*DataFrameTransformDeprecatedGetTransformRequest) { - return func(r *DataFrameTransformDeprecatedGetTransformRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f DataFrameTransformDeprecatedGetTransform) WithOpaqueID(s string) func(*DataFrameTransformDeprecatedGetTransformRequest) { - return func(r *DataFrameTransformDeprecatedGetTransformRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.data_frame_transform_deprecated.get_transform_stats.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.data_frame_transform_deprecated.get_transform_stats.go deleted file mode 100644 index 7d465ad35..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.data_frame_transform_deprecated.get_transform_stats.go +++ /dev/null @@ -1,248 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newDataFrameTransformDeprecatedGetTransformStatsFunc(t Transport) DataFrameTransformDeprecatedGetTransformStats { - return func(transform_id string, o ...func(*DataFrameTransformDeprecatedGetTransformStatsRequest)) (*Response, error) { - var r = DataFrameTransformDeprecatedGetTransformStatsRequest{TransformID: transform_id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// DataFrameTransformDeprecatedGetTransformStats - Retrieves usage information for transforms. -// -// This API is beta. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/get-transform-stats.html. -// -type DataFrameTransformDeprecatedGetTransformStats func(transform_id string, o ...func(*DataFrameTransformDeprecatedGetTransformStatsRequest)) (*Response, error) - -// DataFrameTransformDeprecatedGetTransformStatsRequest configures the Data Frame Transform Deprecated Get Transform Stats API request. -// -type DataFrameTransformDeprecatedGetTransformStatsRequest struct { - TransformID string - - AllowNoMatch *bool - From *int - Size *int - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r DataFrameTransformDeprecatedGetTransformStatsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_data_frame") + 1 + len("transforms") + 1 + len(r.TransformID) + 1 + len("_stats")) - path.WriteString("/") - path.WriteString("_data_frame") - path.WriteString("/") - path.WriteString("transforms") - path.WriteString("/") - path.WriteString(r.TransformID) - path.WriteString("/") - path.WriteString("_stats") - - params = make(map[string]string) - - if r.AllowNoMatch != nil { - params["allow_no_match"] = strconv.FormatBool(*r.AllowNoMatch) - } - - if r.From != nil { - params["from"] = strconv.FormatInt(int64(*r.From), 10) - } - - if r.Size != nil { - params["size"] = strconv.FormatInt(int64(*r.Size), 10) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f DataFrameTransformDeprecatedGetTransformStats) WithContext(v context.Context) func(*DataFrameTransformDeprecatedGetTransformStatsRequest) { - return func(r *DataFrameTransformDeprecatedGetTransformStatsRequest) { - r.ctx = v - } -} - -// WithAllowNoMatch - whether to ignore if a wildcard expression matches no transforms. (this includes `_all` string or when no transforms have been specified). -// -func (f DataFrameTransformDeprecatedGetTransformStats) WithAllowNoMatch(v bool) func(*DataFrameTransformDeprecatedGetTransformStatsRequest) { - return func(r *DataFrameTransformDeprecatedGetTransformStatsRequest) { - r.AllowNoMatch = &v - } -} - -// WithFrom - skips a number of transform stats, defaults to 0. -// -func (f DataFrameTransformDeprecatedGetTransformStats) WithFrom(v int) func(*DataFrameTransformDeprecatedGetTransformStatsRequest) { - return func(r *DataFrameTransformDeprecatedGetTransformStatsRequest) { - r.From = &v - } -} - -// WithSize - specifies a max number of transform stats to get, defaults to 100. -// -func (f DataFrameTransformDeprecatedGetTransformStats) WithSize(v int) func(*DataFrameTransformDeprecatedGetTransformStatsRequest) { - return func(r *DataFrameTransformDeprecatedGetTransformStatsRequest) { - r.Size = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f DataFrameTransformDeprecatedGetTransformStats) WithPretty() func(*DataFrameTransformDeprecatedGetTransformStatsRequest) { - return func(r *DataFrameTransformDeprecatedGetTransformStatsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f DataFrameTransformDeprecatedGetTransformStats) WithHuman() func(*DataFrameTransformDeprecatedGetTransformStatsRequest) { - return func(r *DataFrameTransformDeprecatedGetTransformStatsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f DataFrameTransformDeprecatedGetTransformStats) WithErrorTrace() func(*DataFrameTransformDeprecatedGetTransformStatsRequest) { - return func(r *DataFrameTransformDeprecatedGetTransformStatsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f DataFrameTransformDeprecatedGetTransformStats) WithFilterPath(v ...string) func(*DataFrameTransformDeprecatedGetTransformStatsRequest) { - return func(r *DataFrameTransformDeprecatedGetTransformStatsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f DataFrameTransformDeprecatedGetTransformStats) WithHeader(h map[string]string) func(*DataFrameTransformDeprecatedGetTransformStatsRequest) { - return func(r *DataFrameTransformDeprecatedGetTransformStatsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f DataFrameTransformDeprecatedGetTransformStats) WithOpaqueID(s string) func(*DataFrameTransformDeprecatedGetTransformStatsRequest) { - return func(r *DataFrameTransformDeprecatedGetTransformStatsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.data_frame_transform_deprecated.preview_transform.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.data_frame_transform_deprecated.preview_transform.go deleted file mode 100644 index 735cb99c8..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.data_frame_transform_deprecated.preview_transform.go +++ /dev/null @@ -1,205 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" -) - -func newDataFrameTransformDeprecatedPreviewTransformFunc(t Transport) DataFrameTransformDeprecatedPreviewTransform { - return func(body io.Reader, o ...func(*DataFrameTransformDeprecatedPreviewTransformRequest)) (*Response, error) { - var r = DataFrameTransformDeprecatedPreviewTransformRequest{Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// DataFrameTransformDeprecatedPreviewTransform - Previews a transform. -// -// This API is beta. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/preview-transform.html. -// -type DataFrameTransformDeprecatedPreviewTransform func(body io.Reader, o ...func(*DataFrameTransformDeprecatedPreviewTransformRequest)) (*Response, error) - -// DataFrameTransformDeprecatedPreviewTransformRequest configures the Data Frame Transform Deprecated Preview Transform API request. -// -type DataFrameTransformDeprecatedPreviewTransformRequest struct { - Body io.Reader - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r DataFrameTransformDeprecatedPreviewTransformRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(len("/_data_frame/transforms/_preview")) - path.WriteString("/_data_frame/transforms/_preview") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f DataFrameTransformDeprecatedPreviewTransform) WithContext(v context.Context) func(*DataFrameTransformDeprecatedPreviewTransformRequest) { - return func(r *DataFrameTransformDeprecatedPreviewTransformRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f DataFrameTransformDeprecatedPreviewTransform) WithPretty() func(*DataFrameTransformDeprecatedPreviewTransformRequest) { - return func(r *DataFrameTransformDeprecatedPreviewTransformRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f DataFrameTransformDeprecatedPreviewTransform) WithHuman() func(*DataFrameTransformDeprecatedPreviewTransformRequest) { - return func(r *DataFrameTransformDeprecatedPreviewTransformRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f DataFrameTransformDeprecatedPreviewTransform) WithErrorTrace() func(*DataFrameTransformDeprecatedPreviewTransformRequest) { - return func(r *DataFrameTransformDeprecatedPreviewTransformRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f DataFrameTransformDeprecatedPreviewTransform) WithFilterPath(v ...string) func(*DataFrameTransformDeprecatedPreviewTransformRequest) { - return func(r *DataFrameTransformDeprecatedPreviewTransformRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f DataFrameTransformDeprecatedPreviewTransform) WithHeader(h map[string]string) func(*DataFrameTransformDeprecatedPreviewTransformRequest) { - return func(r *DataFrameTransformDeprecatedPreviewTransformRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f DataFrameTransformDeprecatedPreviewTransform) WithOpaqueID(s string) func(*DataFrameTransformDeprecatedPreviewTransformRequest) { - return func(r *DataFrameTransformDeprecatedPreviewTransformRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.data_frame_transform_deprecated.put_transform.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.data_frame_transform_deprecated.put_transform.go deleted file mode 100644 index a0203198e..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.data_frame_transform_deprecated.put_transform.go +++ /dev/null @@ -1,227 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" -) - -func newDataFrameTransformDeprecatedPutTransformFunc(t Transport) DataFrameTransformDeprecatedPutTransform { - return func(body io.Reader, transform_id string, o ...func(*DataFrameTransformDeprecatedPutTransformRequest)) (*Response, error) { - var r = DataFrameTransformDeprecatedPutTransformRequest{Body: body, TransformID: transform_id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// DataFrameTransformDeprecatedPutTransform - Instantiates a transform. -// -// This API is beta. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/put-transform.html. -// -type DataFrameTransformDeprecatedPutTransform func(body io.Reader, transform_id string, o ...func(*DataFrameTransformDeprecatedPutTransformRequest)) (*Response, error) - -// DataFrameTransformDeprecatedPutTransformRequest configures the Data Frame Transform Deprecated Put Transform API request. -// -type DataFrameTransformDeprecatedPutTransformRequest struct { - Body io.Reader - - TransformID string - - DeferValidation *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r DataFrameTransformDeprecatedPutTransformRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - path.Grow(1 + len("_data_frame") + 1 + len("transforms") + 1 + len(r.TransformID)) - path.WriteString("/") - path.WriteString("_data_frame") - path.WriteString("/") - path.WriteString("transforms") - path.WriteString("/") - path.WriteString(r.TransformID) - - params = make(map[string]string) - - if r.DeferValidation != nil { - params["defer_validation"] = strconv.FormatBool(*r.DeferValidation) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f DataFrameTransformDeprecatedPutTransform) WithContext(v context.Context) func(*DataFrameTransformDeprecatedPutTransformRequest) { - return func(r *DataFrameTransformDeprecatedPutTransformRequest) { - r.ctx = v - } -} - -// WithDeferValidation - if validations should be deferred until transform starts, defaults to false.. -// -func (f DataFrameTransformDeprecatedPutTransform) WithDeferValidation(v bool) func(*DataFrameTransformDeprecatedPutTransformRequest) { - return func(r *DataFrameTransformDeprecatedPutTransformRequest) { - r.DeferValidation = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f DataFrameTransformDeprecatedPutTransform) WithPretty() func(*DataFrameTransformDeprecatedPutTransformRequest) { - return func(r *DataFrameTransformDeprecatedPutTransformRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f DataFrameTransformDeprecatedPutTransform) WithHuman() func(*DataFrameTransformDeprecatedPutTransformRequest) { - return func(r *DataFrameTransformDeprecatedPutTransformRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f DataFrameTransformDeprecatedPutTransform) WithErrorTrace() func(*DataFrameTransformDeprecatedPutTransformRequest) { - return func(r *DataFrameTransformDeprecatedPutTransformRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f DataFrameTransformDeprecatedPutTransform) WithFilterPath(v ...string) func(*DataFrameTransformDeprecatedPutTransformRequest) { - return func(r *DataFrameTransformDeprecatedPutTransformRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f DataFrameTransformDeprecatedPutTransform) WithHeader(h map[string]string) func(*DataFrameTransformDeprecatedPutTransformRequest) { - return func(r *DataFrameTransformDeprecatedPutTransformRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f DataFrameTransformDeprecatedPutTransform) WithOpaqueID(s string) func(*DataFrameTransformDeprecatedPutTransformRequest) { - return func(r *DataFrameTransformDeprecatedPutTransformRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.data_frame_transform_deprecated.start_transform.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.data_frame_transform_deprecated.start_transform.go deleted file mode 100644 index 7511cda1b..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.data_frame_transform_deprecated.start_transform.go +++ /dev/null @@ -1,222 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" - "time" -) - -func newDataFrameTransformDeprecatedStartTransformFunc(t Transport) DataFrameTransformDeprecatedStartTransform { - return func(transform_id string, o ...func(*DataFrameTransformDeprecatedStartTransformRequest)) (*Response, error) { - var r = DataFrameTransformDeprecatedStartTransformRequest{TransformID: transform_id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// DataFrameTransformDeprecatedStartTransform - Starts one or more transforms. -// -// This API is beta. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/start-transform.html. -// -type DataFrameTransformDeprecatedStartTransform func(transform_id string, o ...func(*DataFrameTransformDeprecatedStartTransformRequest)) (*Response, error) - -// DataFrameTransformDeprecatedStartTransformRequest configures the Data Frame Transform Deprecated Start Transform API request. -// -type DataFrameTransformDeprecatedStartTransformRequest struct { - TransformID string - - Timeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r DataFrameTransformDeprecatedStartTransformRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_data_frame") + 1 + len("transforms") + 1 + len(r.TransformID) + 1 + len("_start")) - path.WriteString("/") - path.WriteString("_data_frame") - path.WriteString("/") - path.WriteString("transforms") - path.WriteString("/") - path.WriteString(r.TransformID) - path.WriteString("/") - path.WriteString("_start") - - params = make(map[string]string) - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f DataFrameTransformDeprecatedStartTransform) WithContext(v context.Context) func(*DataFrameTransformDeprecatedStartTransformRequest) { - return func(r *DataFrameTransformDeprecatedStartTransformRequest) { - r.ctx = v - } -} - -// WithTimeout - controls the time to wait for the transform to start. -// -func (f DataFrameTransformDeprecatedStartTransform) WithTimeout(v time.Duration) func(*DataFrameTransformDeprecatedStartTransformRequest) { - return func(r *DataFrameTransformDeprecatedStartTransformRequest) { - r.Timeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f DataFrameTransformDeprecatedStartTransform) WithPretty() func(*DataFrameTransformDeprecatedStartTransformRequest) { - return func(r *DataFrameTransformDeprecatedStartTransformRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f DataFrameTransformDeprecatedStartTransform) WithHuman() func(*DataFrameTransformDeprecatedStartTransformRequest) { - return func(r *DataFrameTransformDeprecatedStartTransformRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f DataFrameTransformDeprecatedStartTransform) WithErrorTrace() func(*DataFrameTransformDeprecatedStartTransformRequest) { - return func(r *DataFrameTransformDeprecatedStartTransformRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f DataFrameTransformDeprecatedStartTransform) WithFilterPath(v ...string) func(*DataFrameTransformDeprecatedStartTransformRequest) { - return func(r *DataFrameTransformDeprecatedStartTransformRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f DataFrameTransformDeprecatedStartTransform) WithHeader(h map[string]string) func(*DataFrameTransformDeprecatedStartTransformRequest) { - return func(r *DataFrameTransformDeprecatedStartTransformRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f DataFrameTransformDeprecatedStartTransform) WithOpaqueID(s string) func(*DataFrameTransformDeprecatedStartTransformRequest) { - return func(r *DataFrameTransformDeprecatedStartTransformRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.data_frame_transform_deprecated.stop_transform.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.data_frame_transform_deprecated.stop_transform.go deleted file mode 100644 index 7a7878acc..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.data_frame_transform_deprecated.stop_transform.go +++ /dev/null @@ -1,249 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" - "time" -) - -func newDataFrameTransformDeprecatedStopTransformFunc(t Transport) DataFrameTransformDeprecatedStopTransform { - return func(transform_id string, o ...func(*DataFrameTransformDeprecatedStopTransformRequest)) (*Response, error) { - var r = DataFrameTransformDeprecatedStopTransformRequest{TransformID: transform_id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// DataFrameTransformDeprecatedStopTransform - Stops one or more transforms. -// -// This API is beta. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/stop-transform.html. -// -type DataFrameTransformDeprecatedStopTransform func(transform_id string, o ...func(*DataFrameTransformDeprecatedStopTransformRequest)) (*Response, error) - -// DataFrameTransformDeprecatedStopTransformRequest configures the Data Frame Transform Deprecated Stop Transform API request. -// -type DataFrameTransformDeprecatedStopTransformRequest struct { - TransformID string - - AllowNoMatch *bool - Timeout time.Duration - WaitForCompletion *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r DataFrameTransformDeprecatedStopTransformRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_data_frame") + 1 + len("transforms") + 1 + len(r.TransformID) + 1 + len("_stop")) - path.WriteString("/") - path.WriteString("_data_frame") - path.WriteString("/") - path.WriteString("transforms") - path.WriteString("/") - path.WriteString(r.TransformID) - path.WriteString("/") - path.WriteString("_stop") - - params = make(map[string]string) - - if r.AllowNoMatch != nil { - params["allow_no_match"] = strconv.FormatBool(*r.AllowNoMatch) - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.WaitForCompletion != nil { - params["wait_for_completion"] = strconv.FormatBool(*r.WaitForCompletion) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f DataFrameTransformDeprecatedStopTransform) WithContext(v context.Context) func(*DataFrameTransformDeprecatedStopTransformRequest) { - return func(r *DataFrameTransformDeprecatedStopTransformRequest) { - r.ctx = v - } -} - -// WithAllowNoMatch - whether to ignore if a wildcard expression matches no transforms. (this includes `_all` string or when no transforms have been specified). -// -func (f DataFrameTransformDeprecatedStopTransform) WithAllowNoMatch(v bool) func(*DataFrameTransformDeprecatedStopTransformRequest) { - return func(r *DataFrameTransformDeprecatedStopTransformRequest) { - r.AllowNoMatch = &v - } -} - -// WithTimeout - controls the time to wait until the transform has stopped. default to 30 seconds. -// -func (f DataFrameTransformDeprecatedStopTransform) WithTimeout(v time.Duration) func(*DataFrameTransformDeprecatedStopTransformRequest) { - return func(r *DataFrameTransformDeprecatedStopTransformRequest) { - r.Timeout = v - } -} - -// WithWaitForCompletion - whether to wait for the transform to fully stop before returning or not. default to false. -// -func (f DataFrameTransformDeprecatedStopTransform) WithWaitForCompletion(v bool) func(*DataFrameTransformDeprecatedStopTransformRequest) { - return func(r *DataFrameTransformDeprecatedStopTransformRequest) { - r.WaitForCompletion = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f DataFrameTransformDeprecatedStopTransform) WithPretty() func(*DataFrameTransformDeprecatedStopTransformRequest) { - return func(r *DataFrameTransformDeprecatedStopTransformRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f DataFrameTransformDeprecatedStopTransform) WithHuman() func(*DataFrameTransformDeprecatedStopTransformRequest) { - return func(r *DataFrameTransformDeprecatedStopTransformRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f DataFrameTransformDeprecatedStopTransform) WithErrorTrace() func(*DataFrameTransformDeprecatedStopTransformRequest) { - return func(r *DataFrameTransformDeprecatedStopTransformRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f DataFrameTransformDeprecatedStopTransform) WithFilterPath(v ...string) func(*DataFrameTransformDeprecatedStopTransformRequest) { - return func(r *DataFrameTransformDeprecatedStopTransformRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f DataFrameTransformDeprecatedStopTransform) WithHeader(h map[string]string) func(*DataFrameTransformDeprecatedStopTransformRequest) { - return func(r *DataFrameTransformDeprecatedStopTransformRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f DataFrameTransformDeprecatedStopTransform) WithOpaqueID(s string) func(*DataFrameTransformDeprecatedStopTransformRequest) { - return func(r *DataFrameTransformDeprecatedStopTransformRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.data_frame_transform_deprecated.update_transform.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.data_frame_transform_deprecated.update_transform.go deleted file mode 100644 index 59cbe8dad..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.data_frame_transform_deprecated.update_transform.go +++ /dev/null @@ -1,229 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" -) - -func newDataFrameTransformDeprecatedUpdateTransformFunc(t Transport) DataFrameTransformDeprecatedUpdateTransform { - return func(body io.Reader, transform_id string, o ...func(*DataFrameTransformDeprecatedUpdateTransformRequest)) (*Response, error) { - var r = DataFrameTransformDeprecatedUpdateTransformRequest{Body: body, TransformID: transform_id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// DataFrameTransformDeprecatedUpdateTransform - Updates certain properties of a transform. -// -// This API is beta. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/update-transform.html. -// -type DataFrameTransformDeprecatedUpdateTransform func(body io.Reader, transform_id string, o ...func(*DataFrameTransformDeprecatedUpdateTransformRequest)) (*Response, error) - -// DataFrameTransformDeprecatedUpdateTransformRequest configures the Data Frame Transform Deprecated Update Transform API request. -// -type DataFrameTransformDeprecatedUpdateTransformRequest struct { - Body io.Reader - - TransformID string - - DeferValidation *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r DataFrameTransformDeprecatedUpdateTransformRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_data_frame") + 1 + len("transforms") + 1 + len(r.TransformID) + 1 + len("_update")) - path.WriteString("/") - path.WriteString("_data_frame") - path.WriteString("/") - path.WriteString("transforms") - path.WriteString("/") - path.WriteString(r.TransformID) - path.WriteString("/") - path.WriteString("_update") - - params = make(map[string]string) - - if r.DeferValidation != nil { - params["defer_validation"] = strconv.FormatBool(*r.DeferValidation) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f DataFrameTransformDeprecatedUpdateTransform) WithContext(v context.Context) func(*DataFrameTransformDeprecatedUpdateTransformRequest) { - return func(r *DataFrameTransformDeprecatedUpdateTransformRequest) { - r.ctx = v - } -} - -// WithDeferValidation - if validations should be deferred until transform starts, defaults to false.. -// -func (f DataFrameTransformDeprecatedUpdateTransform) WithDeferValidation(v bool) func(*DataFrameTransformDeprecatedUpdateTransformRequest) { - return func(r *DataFrameTransformDeprecatedUpdateTransformRequest) { - r.DeferValidation = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f DataFrameTransformDeprecatedUpdateTransform) WithPretty() func(*DataFrameTransformDeprecatedUpdateTransformRequest) { - return func(r *DataFrameTransformDeprecatedUpdateTransformRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f DataFrameTransformDeprecatedUpdateTransform) WithHuman() func(*DataFrameTransformDeprecatedUpdateTransformRequest) { - return func(r *DataFrameTransformDeprecatedUpdateTransformRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f DataFrameTransformDeprecatedUpdateTransform) WithErrorTrace() func(*DataFrameTransformDeprecatedUpdateTransformRequest) { - return func(r *DataFrameTransformDeprecatedUpdateTransformRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f DataFrameTransformDeprecatedUpdateTransform) WithFilterPath(v ...string) func(*DataFrameTransformDeprecatedUpdateTransformRequest) { - return func(r *DataFrameTransformDeprecatedUpdateTransformRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f DataFrameTransformDeprecatedUpdateTransform) WithHeader(h map[string]string) func(*DataFrameTransformDeprecatedUpdateTransformRequest) { - return func(r *DataFrameTransformDeprecatedUpdateTransformRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f DataFrameTransformDeprecatedUpdateTransform) WithOpaqueID(s string) func(*DataFrameTransformDeprecatedUpdateTransformRequest) { - return func(r *DataFrameTransformDeprecatedUpdateTransformRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.enrich.delete_policy.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.enrich.delete_policy.go deleted file mode 100644 index 9df0018b7..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.enrich.delete_policy.go +++ /dev/null @@ -1,203 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newEnrichDeletePolicyFunc(t Transport) EnrichDeletePolicy { - return func(name string, o ...func(*EnrichDeletePolicyRequest)) (*Response, error) { - var r = EnrichDeletePolicyRequest{Name: name} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// EnrichDeletePolicy - Deletes an existing enrich policy and its enrich index. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-enrich-policy-api.html. -// -type EnrichDeletePolicy func(name string, o ...func(*EnrichDeletePolicyRequest)) (*Response, error) - -// EnrichDeletePolicyRequest configures the Enrich Delete Policy API request. -// -type EnrichDeletePolicyRequest struct { - Name string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r EnrichDeletePolicyRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "DELETE" - - path.Grow(1 + len("_enrich") + 1 + len("policy") + 1 + len(r.Name)) - path.WriteString("/") - path.WriteString("_enrich") - path.WriteString("/") - path.WriteString("policy") - path.WriteString("/") - path.WriteString(r.Name) - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f EnrichDeletePolicy) WithContext(v context.Context) func(*EnrichDeletePolicyRequest) { - return func(r *EnrichDeletePolicyRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f EnrichDeletePolicy) WithPretty() func(*EnrichDeletePolicyRequest) { - return func(r *EnrichDeletePolicyRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f EnrichDeletePolicy) WithHuman() func(*EnrichDeletePolicyRequest) { - return func(r *EnrichDeletePolicyRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f EnrichDeletePolicy) WithErrorTrace() func(*EnrichDeletePolicyRequest) { - return func(r *EnrichDeletePolicyRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f EnrichDeletePolicy) WithFilterPath(v ...string) func(*EnrichDeletePolicyRequest) { - return func(r *EnrichDeletePolicyRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f EnrichDeletePolicy) WithHeader(h map[string]string) func(*EnrichDeletePolicyRequest) { - return func(r *EnrichDeletePolicyRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f EnrichDeletePolicy) WithOpaqueID(s string) func(*EnrichDeletePolicyRequest) { - return func(r *EnrichDeletePolicyRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.enrich.execute_policy.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.enrich.execute_policy.go deleted file mode 100644 index d05a2a4fc..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.enrich.execute_policy.go +++ /dev/null @@ -1,220 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newEnrichExecutePolicyFunc(t Transport) EnrichExecutePolicy { - return func(name string, o ...func(*EnrichExecutePolicyRequest)) (*Response, error) { - var r = EnrichExecutePolicyRequest{Name: name} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// EnrichExecutePolicy - Creates the enrich index for an existing enrich policy. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/execute-enrich-policy-api.html. -// -type EnrichExecutePolicy func(name string, o ...func(*EnrichExecutePolicyRequest)) (*Response, error) - -// EnrichExecutePolicyRequest configures the Enrich Execute Policy API request. -// -type EnrichExecutePolicyRequest struct { - Name string - - WaitForCompletion *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r EnrichExecutePolicyRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - path.Grow(1 + len("_enrich") + 1 + len("policy") + 1 + len(r.Name) + 1 + len("_execute")) - path.WriteString("/") - path.WriteString("_enrich") - path.WriteString("/") - path.WriteString("policy") - path.WriteString("/") - path.WriteString(r.Name) - path.WriteString("/") - path.WriteString("_execute") - - params = make(map[string]string) - - if r.WaitForCompletion != nil { - params["wait_for_completion"] = strconv.FormatBool(*r.WaitForCompletion) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f EnrichExecutePolicy) WithContext(v context.Context) func(*EnrichExecutePolicyRequest) { - return func(r *EnrichExecutePolicyRequest) { - r.ctx = v - } -} - -// WithWaitForCompletion - should the request should block until the execution is complete.. -// -func (f EnrichExecutePolicy) WithWaitForCompletion(v bool) func(*EnrichExecutePolicyRequest) { - return func(r *EnrichExecutePolicyRequest) { - r.WaitForCompletion = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f EnrichExecutePolicy) WithPretty() func(*EnrichExecutePolicyRequest) { - return func(r *EnrichExecutePolicyRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f EnrichExecutePolicy) WithHuman() func(*EnrichExecutePolicyRequest) { - return func(r *EnrichExecutePolicyRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f EnrichExecutePolicy) WithErrorTrace() func(*EnrichExecutePolicyRequest) { - return func(r *EnrichExecutePolicyRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f EnrichExecutePolicy) WithFilterPath(v ...string) func(*EnrichExecutePolicyRequest) { - return func(r *EnrichExecutePolicyRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f EnrichExecutePolicy) WithHeader(h map[string]string) func(*EnrichExecutePolicyRequest) { - return func(r *EnrichExecutePolicyRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f EnrichExecutePolicy) WithOpaqueID(s string) func(*EnrichExecutePolicyRequest) { - return func(r *EnrichExecutePolicyRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.enrich.get_policy.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.enrich.get_policy.go deleted file mode 100644 index 1da5e3877..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.enrich.get_policy.go +++ /dev/null @@ -1,213 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newEnrichGetPolicyFunc(t Transport) EnrichGetPolicy { - return func(o ...func(*EnrichGetPolicyRequest)) (*Response, error) { - var r = EnrichGetPolicyRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// EnrichGetPolicy - Gets information about an enrich policy. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/get-enrich-policy-api.html. -// -type EnrichGetPolicy func(o ...func(*EnrichGetPolicyRequest)) (*Response, error) - -// EnrichGetPolicyRequest configures the Enrich Get Policy API request. -// -type EnrichGetPolicyRequest struct { - Name []string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r EnrichGetPolicyRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_enrich") + 1 + len("policy") + 1 + len(strings.Join(r.Name, ","))) - path.WriteString("/") - path.WriteString("_enrich") - path.WriteString("/") - path.WriteString("policy") - if len(r.Name) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Name, ",")) - } - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f EnrichGetPolicy) WithContext(v context.Context) func(*EnrichGetPolicyRequest) { - return func(r *EnrichGetPolicyRequest) { - r.ctx = v - } -} - -// WithName - a list of enrich policy names. -// -func (f EnrichGetPolicy) WithName(v ...string) func(*EnrichGetPolicyRequest) { - return func(r *EnrichGetPolicyRequest) { - r.Name = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f EnrichGetPolicy) WithPretty() func(*EnrichGetPolicyRequest) { - return func(r *EnrichGetPolicyRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f EnrichGetPolicy) WithHuman() func(*EnrichGetPolicyRequest) { - return func(r *EnrichGetPolicyRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f EnrichGetPolicy) WithErrorTrace() func(*EnrichGetPolicyRequest) { - return func(r *EnrichGetPolicyRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f EnrichGetPolicy) WithFilterPath(v ...string) func(*EnrichGetPolicyRequest) { - return func(r *EnrichGetPolicyRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f EnrichGetPolicy) WithHeader(h map[string]string) func(*EnrichGetPolicyRequest) { - return func(r *EnrichGetPolicyRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f EnrichGetPolicy) WithOpaqueID(s string) func(*EnrichGetPolicyRequest) { - return func(r *EnrichGetPolicyRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.enrich.put_policy.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.enrich.put_policy.go deleted file mode 100644 index 7b90b9f37..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.enrich.put_policy.go +++ /dev/null @@ -1,210 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" -) - -func newEnrichPutPolicyFunc(t Transport) EnrichPutPolicy { - return func(name string, body io.Reader, o ...func(*EnrichPutPolicyRequest)) (*Response, error) { - var r = EnrichPutPolicyRequest{Name: name, Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// EnrichPutPolicy - Creates a new enrich policy. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/put-enrich-policy-api.html. -// -type EnrichPutPolicy func(name string, body io.Reader, o ...func(*EnrichPutPolicyRequest)) (*Response, error) - -// EnrichPutPolicyRequest configures the Enrich Put Policy API request. -// -type EnrichPutPolicyRequest struct { - Body io.Reader - - Name string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r EnrichPutPolicyRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - path.Grow(1 + len("_enrich") + 1 + len("policy") + 1 + len(r.Name)) - path.WriteString("/") - path.WriteString("_enrich") - path.WriteString("/") - path.WriteString("policy") - path.WriteString("/") - path.WriteString(r.Name) - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f EnrichPutPolicy) WithContext(v context.Context) func(*EnrichPutPolicyRequest) { - return func(r *EnrichPutPolicyRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f EnrichPutPolicy) WithPretty() func(*EnrichPutPolicyRequest) { - return func(r *EnrichPutPolicyRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f EnrichPutPolicy) WithHuman() func(*EnrichPutPolicyRequest) { - return func(r *EnrichPutPolicyRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f EnrichPutPolicy) WithErrorTrace() func(*EnrichPutPolicyRequest) { - return func(r *EnrichPutPolicyRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f EnrichPutPolicy) WithFilterPath(v ...string) func(*EnrichPutPolicyRequest) { - return func(r *EnrichPutPolicyRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f EnrichPutPolicy) WithHeader(h map[string]string) func(*EnrichPutPolicyRequest) { - return func(r *EnrichPutPolicyRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f EnrichPutPolicy) WithOpaqueID(s string) func(*EnrichPutPolicyRequest) { - return func(r *EnrichPutPolicyRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.enrich.stats.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.enrich.stats.go deleted file mode 100644 index 1491ba6c1..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.enrich.stats.go +++ /dev/null @@ -1,196 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newEnrichStatsFunc(t Transport) EnrichStats { - return func(o ...func(*EnrichStatsRequest)) (*Response, error) { - var r = EnrichStatsRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// EnrichStats - Gets enrich coordinator statistics and information about enrich policies that are currently executing. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-stats-api.html. -// -type EnrichStats func(o ...func(*EnrichStatsRequest)) (*Response, error) - -// EnrichStatsRequest configures the Enrich Stats API request. -// -type EnrichStatsRequest struct { - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r EnrichStatsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(len("/_enrich/_stats")) - path.WriteString("/_enrich/_stats") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f EnrichStats) WithContext(v context.Context) func(*EnrichStatsRequest) { - return func(r *EnrichStatsRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f EnrichStats) WithPretty() func(*EnrichStatsRequest) { - return func(r *EnrichStatsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f EnrichStats) WithHuman() func(*EnrichStatsRequest) { - return func(r *EnrichStatsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f EnrichStats) WithErrorTrace() func(*EnrichStatsRequest) { - return func(r *EnrichStatsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f EnrichStats) WithFilterPath(v ...string) func(*EnrichStatsRequest) { - return func(r *EnrichStatsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f EnrichStats) WithHeader(h map[string]string) func(*EnrichStatsRequest) { - return func(r *EnrichStatsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f EnrichStats) WithOpaqueID(s string) func(*EnrichStatsRequest) { - return func(r *EnrichStatsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.eql.delete.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.eql.delete.go deleted file mode 100644 index 7aa182d1c..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.eql.delete.go +++ /dev/null @@ -1,203 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newEqlDeleteFunc(t Transport) EqlDelete { - return func(id string, o ...func(*EqlDeleteRequest)) (*Response, error) { - var r = EqlDeleteRequest{DocumentID: id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// EqlDelete - Deletes an async EQL search by ID. If the search is still running, the search request will be cancelled. Otherwise, the saved search results are deleted. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/eql-search-api.html. -// -type EqlDelete func(id string, o ...func(*EqlDeleteRequest)) (*Response, error) - -// EqlDeleteRequest configures the Eql Delete API request. -// -type EqlDeleteRequest struct { - DocumentID string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r EqlDeleteRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "DELETE" - - path.Grow(1 + len("_eql") + 1 + len("search") + 1 + len(r.DocumentID)) - path.WriteString("/") - path.WriteString("_eql") - path.WriteString("/") - path.WriteString("search") - path.WriteString("/") - path.WriteString(r.DocumentID) - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f EqlDelete) WithContext(v context.Context) func(*EqlDeleteRequest) { - return func(r *EqlDeleteRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f EqlDelete) WithPretty() func(*EqlDeleteRequest) { - return func(r *EqlDeleteRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f EqlDelete) WithHuman() func(*EqlDeleteRequest) { - return func(r *EqlDeleteRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f EqlDelete) WithErrorTrace() func(*EqlDeleteRequest) { - return func(r *EqlDeleteRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f EqlDelete) WithFilterPath(v ...string) func(*EqlDeleteRequest) { - return func(r *EqlDeleteRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f EqlDelete) WithHeader(h map[string]string) func(*EqlDeleteRequest) { - return func(r *EqlDeleteRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f EqlDelete) WithOpaqueID(s string) func(*EqlDeleteRequest) { - return func(r *EqlDeleteRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.eql.get.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.eql.get.go deleted file mode 100644 index 0b76e7be3..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.eql.get.go +++ /dev/null @@ -1,231 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" - "time" -) - -func newEqlGetFunc(t Transport) EqlGet { - return func(id string, o ...func(*EqlGetRequest)) (*Response, error) { - var r = EqlGetRequest{DocumentID: id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// EqlGet - Returns async results from previously executed Event Query Language (EQL) search -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/eql-search-api.html. -// -type EqlGet func(id string, o ...func(*EqlGetRequest)) (*Response, error) - -// EqlGetRequest configures the Eql Get API request. -// -type EqlGetRequest struct { - DocumentID string - - KeepAlive time.Duration - WaitForCompletionTimeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r EqlGetRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_eql") + 1 + len("search") + 1 + len(r.DocumentID)) - path.WriteString("/") - path.WriteString("_eql") - path.WriteString("/") - path.WriteString("search") - path.WriteString("/") - path.WriteString(r.DocumentID) - - params = make(map[string]string) - - if r.KeepAlive != 0 { - params["keep_alive"] = formatDuration(r.KeepAlive) - } - - if r.WaitForCompletionTimeout != 0 { - params["wait_for_completion_timeout"] = formatDuration(r.WaitForCompletionTimeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f EqlGet) WithContext(v context.Context) func(*EqlGetRequest) { - return func(r *EqlGetRequest) { - r.ctx = v - } -} - -// WithKeepAlive - update the time interval in which the results (partial or final) for this search will be available. -// -func (f EqlGet) WithKeepAlive(v time.Duration) func(*EqlGetRequest) { - return func(r *EqlGetRequest) { - r.KeepAlive = v - } -} - -// WithWaitForCompletionTimeout - specify the time that the request should block waiting for the final response. -// -func (f EqlGet) WithWaitForCompletionTimeout(v time.Duration) func(*EqlGetRequest) { - return func(r *EqlGetRequest) { - r.WaitForCompletionTimeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f EqlGet) WithPretty() func(*EqlGetRequest) { - return func(r *EqlGetRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f EqlGet) WithHuman() func(*EqlGetRequest) { - return func(r *EqlGetRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f EqlGet) WithErrorTrace() func(*EqlGetRequest) { - return func(r *EqlGetRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f EqlGet) WithFilterPath(v ...string) func(*EqlGetRequest) { - return func(r *EqlGetRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f EqlGet) WithHeader(h map[string]string) func(*EqlGetRequest) { - return func(r *EqlGetRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f EqlGet) WithOpaqueID(s string) func(*EqlGetRequest) { - return func(r *EqlGetRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.eql.get_status.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.eql.get_status.go deleted file mode 100644 index 52b0f29d2..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.eql.get_status.go +++ /dev/null @@ -1,205 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newEqlGetStatusFunc(t Transport) EqlGetStatus { - return func(id string, o ...func(*EqlGetStatusRequest)) (*Response, error) { - var r = EqlGetStatusRequest{DocumentID: id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// EqlGetStatus - Returns the status of a previously submitted async or stored Event Query Language (EQL) search -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/eql-search-api.html. -// -type EqlGetStatus func(id string, o ...func(*EqlGetStatusRequest)) (*Response, error) - -// EqlGetStatusRequest configures the Eql Get Status API request. -// -type EqlGetStatusRequest struct { - DocumentID string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r EqlGetStatusRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_eql") + 1 + len("search") + 1 + len("status") + 1 + len(r.DocumentID)) - path.WriteString("/") - path.WriteString("_eql") - path.WriteString("/") - path.WriteString("search") - path.WriteString("/") - path.WriteString("status") - path.WriteString("/") - path.WriteString(r.DocumentID) - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f EqlGetStatus) WithContext(v context.Context) func(*EqlGetStatusRequest) { - return func(r *EqlGetStatusRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f EqlGetStatus) WithPretty() func(*EqlGetStatusRequest) { - return func(r *EqlGetStatusRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f EqlGetStatus) WithHuman() func(*EqlGetStatusRequest) { - return func(r *EqlGetStatusRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f EqlGetStatus) WithErrorTrace() func(*EqlGetStatusRequest) { - return func(r *EqlGetStatusRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f EqlGetStatus) WithFilterPath(v ...string) func(*EqlGetStatusRequest) { - return func(r *EqlGetStatusRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f EqlGetStatus) WithHeader(h map[string]string) func(*EqlGetStatusRequest) { - return func(r *EqlGetStatusRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f EqlGetStatus) WithOpaqueID(s string) func(*EqlGetStatusRequest) { - return func(r *EqlGetStatusRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.eql.search.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.eql.search.go deleted file mode 100644 index 6fbb83926..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.eql.search.go +++ /dev/null @@ -1,252 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" - "time" -) - -func newEqlSearchFunc(t Transport) EqlSearch { - return func(index string, body io.Reader, o ...func(*EqlSearchRequest)) (*Response, error) { - var r = EqlSearchRequest{Index: index, Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// EqlSearch - Returns results matching a query expressed in Event Query Language (EQL) -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/eql-search-api.html. -// -type EqlSearch func(index string, body io.Reader, o ...func(*EqlSearchRequest)) (*Response, error) - -// EqlSearchRequest configures the Eql Search API request. -// -type EqlSearchRequest struct { - Index string - - Body io.Reader - - KeepAlive time.Duration - KeepOnCompletion *bool - WaitForCompletionTimeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r EqlSearchRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len(r.Index) + 1 + len("_eql") + 1 + len("search")) - path.WriteString("/") - path.WriteString(r.Index) - path.WriteString("/") - path.WriteString("_eql") - path.WriteString("/") - path.WriteString("search") - - params = make(map[string]string) - - if r.KeepAlive != 0 { - params["keep_alive"] = formatDuration(r.KeepAlive) - } - - if r.KeepOnCompletion != nil { - params["keep_on_completion"] = strconv.FormatBool(*r.KeepOnCompletion) - } - - if r.WaitForCompletionTimeout != 0 { - params["wait_for_completion_timeout"] = formatDuration(r.WaitForCompletionTimeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f EqlSearch) WithContext(v context.Context) func(*EqlSearchRequest) { - return func(r *EqlSearchRequest) { - r.ctx = v - } -} - -// WithKeepAlive - update the time interval in which the results (partial or final) for this search will be available. -// -func (f EqlSearch) WithKeepAlive(v time.Duration) func(*EqlSearchRequest) { - return func(r *EqlSearchRequest) { - r.KeepAlive = v - } -} - -// WithKeepOnCompletion - control whether the response should be stored in the cluster if it completed within the provided [wait_for_completion] time (default: false). -// -func (f EqlSearch) WithKeepOnCompletion(v bool) func(*EqlSearchRequest) { - return func(r *EqlSearchRequest) { - r.KeepOnCompletion = &v - } -} - -// WithWaitForCompletionTimeout - specify the time that the request should block waiting for the final response. -// -func (f EqlSearch) WithWaitForCompletionTimeout(v time.Duration) func(*EqlSearchRequest) { - return func(r *EqlSearchRequest) { - r.WaitForCompletionTimeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f EqlSearch) WithPretty() func(*EqlSearchRequest) { - return func(r *EqlSearchRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f EqlSearch) WithHuman() func(*EqlSearchRequest) { - return func(r *EqlSearchRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f EqlSearch) WithErrorTrace() func(*EqlSearchRequest) { - return func(r *EqlSearchRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f EqlSearch) WithFilterPath(v ...string) func(*EqlSearchRequest) { - return func(r *EqlSearchRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f EqlSearch) WithHeader(h map[string]string) func(*EqlSearchRequest) { - return func(r *EqlSearchRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f EqlSearch) WithOpaqueID(s string) func(*EqlSearchRequest) { - return func(r *EqlSearchRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.graph.explore.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.graph.explore.go deleted file mode 100644 index 6e6e883a1..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.graph.explore.go +++ /dev/null @@ -1,259 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" - "time" -) - -func newGraphExploreFunc(t Transport) GraphExplore { - return func(index []string, o ...func(*GraphExploreRequest)) (*Response, error) { - var r = GraphExploreRequest{Index: index} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// GraphExplore - Explore extracted and summarized information about the documents and terms in an index. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/graph-explore-api.html. -// -type GraphExplore func(index []string, o ...func(*GraphExploreRequest)) (*Response, error) - -// GraphExploreRequest configures the Graph Explore API request. -// -type GraphExploreRequest struct { - Index []string - DocumentType []string - - Body io.Reader - - Routing string - Timeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r GraphExploreRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len(strings.Join(r.Index, ",")) + 1 + len(strings.Join(r.DocumentType, ",")) + 1 + len("_graph") + 1 + len("explore")) - path.WriteString("/") - path.WriteString(strings.Join(r.Index, ",")) - if len(r.DocumentType) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.DocumentType, ",")) - } - path.WriteString("/") - path.WriteString("_graph") - path.WriteString("/") - path.WriteString("explore") - - params = make(map[string]string) - - if r.Routing != "" { - params["routing"] = r.Routing - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f GraphExplore) WithContext(v context.Context) func(*GraphExploreRequest) { - return func(r *GraphExploreRequest) { - r.ctx = v - } -} - -// WithBody - Graph Query DSL. -// -func (f GraphExplore) WithBody(v io.Reader) func(*GraphExploreRequest) { - return func(r *GraphExploreRequest) { - r.Body = v - } -} - -// WithDocumentType - a list of document types to search; leave empty to perform the operation on all types. -// -func (f GraphExplore) WithDocumentType(v ...string) func(*GraphExploreRequest) { - return func(r *GraphExploreRequest) { - r.DocumentType = v - } -} - -// WithRouting - specific routing value. -// -func (f GraphExplore) WithRouting(v string) func(*GraphExploreRequest) { - return func(r *GraphExploreRequest) { - r.Routing = v - } -} - -// WithTimeout - explicit operation timeout. -// -func (f GraphExplore) WithTimeout(v time.Duration) func(*GraphExploreRequest) { - return func(r *GraphExploreRequest) { - r.Timeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f GraphExplore) WithPretty() func(*GraphExploreRequest) { - return func(r *GraphExploreRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f GraphExplore) WithHuman() func(*GraphExploreRequest) { - return func(r *GraphExploreRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f GraphExplore) WithErrorTrace() func(*GraphExploreRequest) { - return func(r *GraphExploreRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f GraphExplore) WithFilterPath(v ...string) func(*GraphExploreRequest) { - return func(r *GraphExploreRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f GraphExplore) WithHeader(h map[string]string) func(*GraphExploreRequest) { - return func(r *GraphExploreRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f GraphExplore) WithOpaqueID(s string) func(*GraphExploreRequest) { - return func(r *GraphExploreRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ilm.delete_lifecycle.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ilm.delete_lifecycle.go deleted file mode 100644 index 51da912e9..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ilm.delete_lifecycle.go +++ /dev/null @@ -1,203 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newILMDeleteLifecycleFunc(t Transport) ILMDeleteLifecycle { - return func(policy string, o ...func(*ILMDeleteLifecycleRequest)) (*Response, error) { - var r = ILMDeleteLifecycleRequest{Policy: policy} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// ILMDeleteLifecycle - Deletes the specified lifecycle policy definition. A currently used policy cannot be deleted. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-delete-lifecycle.html. -// -type ILMDeleteLifecycle func(policy string, o ...func(*ILMDeleteLifecycleRequest)) (*Response, error) - -// ILMDeleteLifecycleRequest configures the ILM Delete Lifecycle API request. -// -type ILMDeleteLifecycleRequest struct { - Policy string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r ILMDeleteLifecycleRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "DELETE" - - path.Grow(1 + len("_ilm") + 1 + len("policy") + 1 + len(r.Policy)) - path.WriteString("/") - path.WriteString("_ilm") - path.WriteString("/") - path.WriteString("policy") - path.WriteString("/") - path.WriteString(r.Policy) - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f ILMDeleteLifecycle) WithContext(v context.Context) func(*ILMDeleteLifecycleRequest) { - return func(r *ILMDeleteLifecycleRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f ILMDeleteLifecycle) WithPretty() func(*ILMDeleteLifecycleRequest) { - return func(r *ILMDeleteLifecycleRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f ILMDeleteLifecycle) WithHuman() func(*ILMDeleteLifecycleRequest) { - return func(r *ILMDeleteLifecycleRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f ILMDeleteLifecycle) WithErrorTrace() func(*ILMDeleteLifecycleRequest) { - return func(r *ILMDeleteLifecycleRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f ILMDeleteLifecycle) WithFilterPath(v ...string) func(*ILMDeleteLifecycleRequest) { - return func(r *ILMDeleteLifecycleRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f ILMDeleteLifecycle) WithHeader(h map[string]string) func(*ILMDeleteLifecycleRequest) { - return func(r *ILMDeleteLifecycleRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f ILMDeleteLifecycle) WithOpaqueID(s string) func(*ILMDeleteLifecycleRequest) { - return func(r *ILMDeleteLifecycleRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ilm.explain_lifecycle.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ilm.explain_lifecycle.go deleted file mode 100644 index cd08fc4f8..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ilm.explain_lifecycle.go +++ /dev/null @@ -1,231 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newILMExplainLifecycleFunc(t Transport) ILMExplainLifecycle { - return func(index string, o ...func(*ILMExplainLifecycleRequest)) (*Response, error) { - var r = ILMExplainLifecycleRequest{Index: index} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// ILMExplainLifecycle - Retrieves information about the index's current lifecycle state, such as the currently executing phase, action, and step. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-explain-lifecycle.html. -// -type ILMExplainLifecycle func(index string, o ...func(*ILMExplainLifecycleRequest)) (*Response, error) - -// ILMExplainLifecycleRequest configures the ILM Explain Lifecycle API request. -// -type ILMExplainLifecycleRequest struct { - Index string - - OnlyErrors *bool - OnlyManaged *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r ILMExplainLifecycleRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len(r.Index) + 1 + len("_ilm") + 1 + len("explain")) - path.WriteString("/") - path.WriteString(r.Index) - path.WriteString("/") - path.WriteString("_ilm") - path.WriteString("/") - path.WriteString("explain") - - params = make(map[string]string) - - if r.OnlyErrors != nil { - params["only_errors"] = strconv.FormatBool(*r.OnlyErrors) - } - - if r.OnlyManaged != nil { - params["only_managed"] = strconv.FormatBool(*r.OnlyManaged) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f ILMExplainLifecycle) WithContext(v context.Context) func(*ILMExplainLifecycleRequest) { - return func(r *ILMExplainLifecycleRequest) { - r.ctx = v - } -} - -// WithOnlyErrors - filters the indices included in the response to ones in an ilm error state, implies only_managed. -// -func (f ILMExplainLifecycle) WithOnlyErrors(v bool) func(*ILMExplainLifecycleRequest) { - return func(r *ILMExplainLifecycleRequest) { - r.OnlyErrors = &v - } -} - -// WithOnlyManaged - filters the indices included in the response to ones managed by ilm. -// -func (f ILMExplainLifecycle) WithOnlyManaged(v bool) func(*ILMExplainLifecycleRequest) { - return func(r *ILMExplainLifecycleRequest) { - r.OnlyManaged = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f ILMExplainLifecycle) WithPretty() func(*ILMExplainLifecycleRequest) { - return func(r *ILMExplainLifecycleRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f ILMExplainLifecycle) WithHuman() func(*ILMExplainLifecycleRequest) { - return func(r *ILMExplainLifecycleRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f ILMExplainLifecycle) WithErrorTrace() func(*ILMExplainLifecycleRequest) { - return func(r *ILMExplainLifecycleRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f ILMExplainLifecycle) WithFilterPath(v ...string) func(*ILMExplainLifecycleRequest) { - return func(r *ILMExplainLifecycleRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f ILMExplainLifecycle) WithHeader(h map[string]string) func(*ILMExplainLifecycleRequest) { - return func(r *ILMExplainLifecycleRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f ILMExplainLifecycle) WithOpaqueID(s string) func(*ILMExplainLifecycleRequest) { - return func(r *ILMExplainLifecycleRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ilm.get_lifecycle.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ilm.get_lifecycle.go deleted file mode 100644 index e5dcf5c44..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ilm.get_lifecycle.go +++ /dev/null @@ -1,213 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newILMGetLifecycleFunc(t Transport) ILMGetLifecycle { - return func(o ...func(*ILMGetLifecycleRequest)) (*Response, error) { - var r = ILMGetLifecycleRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// ILMGetLifecycle - Returns the specified policy definition. Includes the policy version and last modified date. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-get-lifecycle.html. -// -type ILMGetLifecycle func(o ...func(*ILMGetLifecycleRequest)) (*Response, error) - -// ILMGetLifecycleRequest configures the ILM Get Lifecycle API request. -// -type ILMGetLifecycleRequest struct { - Policy string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r ILMGetLifecycleRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_ilm") + 1 + len("policy") + 1 + len(r.Policy)) - path.WriteString("/") - path.WriteString("_ilm") - path.WriteString("/") - path.WriteString("policy") - if r.Policy != "" { - path.WriteString("/") - path.WriteString(r.Policy) - } - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f ILMGetLifecycle) WithContext(v context.Context) func(*ILMGetLifecycleRequest) { - return func(r *ILMGetLifecycleRequest) { - r.ctx = v - } -} - -// WithPolicy - the name of the index lifecycle policy. -// -func (f ILMGetLifecycle) WithPolicy(v string) func(*ILMGetLifecycleRequest) { - return func(r *ILMGetLifecycleRequest) { - r.Policy = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f ILMGetLifecycle) WithPretty() func(*ILMGetLifecycleRequest) { - return func(r *ILMGetLifecycleRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f ILMGetLifecycle) WithHuman() func(*ILMGetLifecycleRequest) { - return func(r *ILMGetLifecycleRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f ILMGetLifecycle) WithErrorTrace() func(*ILMGetLifecycleRequest) { - return func(r *ILMGetLifecycleRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f ILMGetLifecycle) WithFilterPath(v ...string) func(*ILMGetLifecycleRequest) { - return func(r *ILMGetLifecycleRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f ILMGetLifecycle) WithHeader(h map[string]string) func(*ILMGetLifecycleRequest) { - return func(r *ILMGetLifecycleRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f ILMGetLifecycle) WithOpaqueID(s string) func(*ILMGetLifecycleRequest) { - return func(r *ILMGetLifecycleRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ilm.get_status.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ilm.get_status.go deleted file mode 100644 index be6b7292f..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ilm.get_status.go +++ /dev/null @@ -1,196 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newILMGetStatusFunc(t Transport) ILMGetStatus { - return func(o ...func(*ILMGetStatusRequest)) (*Response, error) { - var r = ILMGetStatusRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// ILMGetStatus - Retrieves the current index lifecycle management (ILM) status. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-get-status.html. -// -type ILMGetStatus func(o ...func(*ILMGetStatusRequest)) (*Response, error) - -// ILMGetStatusRequest configures the ILM Get Status API request. -// -type ILMGetStatusRequest struct { - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r ILMGetStatusRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(len("/_ilm/status")) - path.WriteString("/_ilm/status") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f ILMGetStatus) WithContext(v context.Context) func(*ILMGetStatusRequest) { - return func(r *ILMGetStatusRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f ILMGetStatus) WithPretty() func(*ILMGetStatusRequest) { - return func(r *ILMGetStatusRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f ILMGetStatus) WithHuman() func(*ILMGetStatusRequest) { - return func(r *ILMGetStatusRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f ILMGetStatus) WithErrorTrace() func(*ILMGetStatusRequest) { - return func(r *ILMGetStatusRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f ILMGetStatus) WithFilterPath(v ...string) func(*ILMGetStatusRequest) { - return func(r *ILMGetStatusRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f ILMGetStatus) WithHeader(h map[string]string) func(*ILMGetStatusRequest) { - return func(r *ILMGetStatusRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f ILMGetStatus) WithOpaqueID(s string) func(*ILMGetStatusRequest) { - return func(r *ILMGetStatusRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ilm.move_to_step.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ilm.move_to_step.go deleted file mode 100644 index ba5f03138..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ilm.move_to_step.go +++ /dev/null @@ -1,218 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" -) - -func newILMMoveToStepFunc(t Transport) ILMMoveToStep { - return func(index string, o ...func(*ILMMoveToStepRequest)) (*Response, error) { - var r = ILMMoveToStepRequest{Index: index} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// ILMMoveToStep - Manually moves an index into the specified step and executes that step. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-move-to-step.html. -// -type ILMMoveToStep func(index string, o ...func(*ILMMoveToStepRequest)) (*Response, error) - -// ILMMoveToStepRequest configures the ILM Move To Step API request. -// -type ILMMoveToStepRequest struct { - Index string - - Body io.Reader - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r ILMMoveToStepRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_ilm") + 1 + len("move") + 1 + len(r.Index)) - path.WriteString("/") - path.WriteString("_ilm") - path.WriteString("/") - path.WriteString("move") - path.WriteString("/") - path.WriteString(r.Index) - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f ILMMoveToStep) WithContext(v context.Context) func(*ILMMoveToStepRequest) { - return func(r *ILMMoveToStepRequest) { - r.ctx = v - } -} - -// WithBody - The new lifecycle step to move to. -// -func (f ILMMoveToStep) WithBody(v io.Reader) func(*ILMMoveToStepRequest) { - return func(r *ILMMoveToStepRequest) { - r.Body = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f ILMMoveToStep) WithPretty() func(*ILMMoveToStepRequest) { - return func(r *ILMMoveToStepRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f ILMMoveToStep) WithHuman() func(*ILMMoveToStepRequest) { - return func(r *ILMMoveToStepRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f ILMMoveToStep) WithErrorTrace() func(*ILMMoveToStepRequest) { - return func(r *ILMMoveToStepRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f ILMMoveToStep) WithFilterPath(v ...string) func(*ILMMoveToStepRequest) { - return func(r *ILMMoveToStepRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f ILMMoveToStep) WithHeader(h map[string]string) func(*ILMMoveToStepRequest) { - return func(r *ILMMoveToStepRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f ILMMoveToStep) WithOpaqueID(s string) func(*ILMMoveToStepRequest) { - return func(r *ILMMoveToStepRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ilm.put_lifecycle.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ilm.put_lifecycle.go deleted file mode 100644 index 3dd367290..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ilm.put_lifecycle.go +++ /dev/null @@ -1,218 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" -) - -func newILMPutLifecycleFunc(t Transport) ILMPutLifecycle { - return func(policy string, o ...func(*ILMPutLifecycleRequest)) (*Response, error) { - var r = ILMPutLifecycleRequest{Policy: policy} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// ILMPutLifecycle - Creates a lifecycle policy -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-put-lifecycle.html. -// -type ILMPutLifecycle func(policy string, o ...func(*ILMPutLifecycleRequest)) (*Response, error) - -// ILMPutLifecycleRequest configures the ILM Put Lifecycle API request. -// -type ILMPutLifecycleRequest struct { - Body io.Reader - - Policy string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r ILMPutLifecycleRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - path.Grow(1 + len("_ilm") + 1 + len("policy") + 1 + len(r.Policy)) - path.WriteString("/") - path.WriteString("_ilm") - path.WriteString("/") - path.WriteString("policy") - path.WriteString("/") - path.WriteString(r.Policy) - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f ILMPutLifecycle) WithContext(v context.Context) func(*ILMPutLifecycleRequest) { - return func(r *ILMPutLifecycleRequest) { - r.ctx = v - } -} - -// WithBody - The lifecycle policy definition to register. -// -func (f ILMPutLifecycle) WithBody(v io.Reader) func(*ILMPutLifecycleRequest) { - return func(r *ILMPutLifecycleRequest) { - r.Body = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f ILMPutLifecycle) WithPretty() func(*ILMPutLifecycleRequest) { - return func(r *ILMPutLifecycleRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f ILMPutLifecycle) WithHuman() func(*ILMPutLifecycleRequest) { - return func(r *ILMPutLifecycleRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f ILMPutLifecycle) WithErrorTrace() func(*ILMPutLifecycleRequest) { - return func(r *ILMPutLifecycleRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f ILMPutLifecycle) WithFilterPath(v ...string) func(*ILMPutLifecycleRequest) { - return func(r *ILMPutLifecycleRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f ILMPutLifecycle) WithHeader(h map[string]string) func(*ILMPutLifecycleRequest) { - return func(r *ILMPutLifecycleRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f ILMPutLifecycle) WithOpaqueID(s string) func(*ILMPutLifecycleRequest) { - return func(r *ILMPutLifecycleRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ilm.remove_policy.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ilm.remove_policy.go deleted file mode 100644 index ab802c289..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ilm.remove_policy.go +++ /dev/null @@ -1,203 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newILMRemovePolicyFunc(t Transport) ILMRemovePolicy { - return func(index string, o ...func(*ILMRemovePolicyRequest)) (*Response, error) { - var r = ILMRemovePolicyRequest{Index: index} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// ILMRemovePolicy - Removes the assigned lifecycle policy and stops managing the specified index -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-remove-policy.html. -// -type ILMRemovePolicy func(index string, o ...func(*ILMRemovePolicyRequest)) (*Response, error) - -// ILMRemovePolicyRequest configures the ILM Remove Policy API request. -// -type ILMRemovePolicyRequest struct { - Index string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r ILMRemovePolicyRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len(r.Index) + 1 + len("_ilm") + 1 + len("remove")) - path.WriteString("/") - path.WriteString(r.Index) - path.WriteString("/") - path.WriteString("_ilm") - path.WriteString("/") - path.WriteString("remove") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f ILMRemovePolicy) WithContext(v context.Context) func(*ILMRemovePolicyRequest) { - return func(r *ILMRemovePolicyRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f ILMRemovePolicy) WithPretty() func(*ILMRemovePolicyRequest) { - return func(r *ILMRemovePolicyRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f ILMRemovePolicy) WithHuman() func(*ILMRemovePolicyRequest) { - return func(r *ILMRemovePolicyRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f ILMRemovePolicy) WithErrorTrace() func(*ILMRemovePolicyRequest) { - return func(r *ILMRemovePolicyRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f ILMRemovePolicy) WithFilterPath(v ...string) func(*ILMRemovePolicyRequest) { - return func(r *ILMRemovePolicyRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f ILMRemovePolicy) WithHeader(h map[string]string) func(*ILMRemovePolicyRequest) { - return func(r *ILMRemovePolicyRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f ILMRemovePolicy) WithOpaqueID(s string) func(*ILMRemovePolicyRequest) { - return func(r *ILMRemovePolicyRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ilm.retry.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ilm.retry.go deleted file mode 100644 index 87cb85435..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ilm.retry.go +++ /dev/null @@ -1,203 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newILMRetryFunc(t Transport) ILMRetry { - return func(index string, o ...func(*ILMRetryRequest)) (*Response, error) { - var r = ILMRetryRequest{Index: index} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// ILMRetry - Retries executing the policy for an index that is in the ERROR step. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-retry-policy.html. -// -type ILMRetry func(index string, o ...func(*ILMRetryRequest)) (*Response, error) - -// ILMRetryRequest configures the ILM Retry API request. -// -type ILMRetryRequest struct { - Index string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r ILMRetryRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len(r.Index) + 1 + len("_ilm") + 1 + len("retry")) - path.WriteString("/") - path.WriteString(r.Index) - path.WriteString("/") - path.WriteString("_ilm") - path.WriteString("/") - path.WriteString("retry") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f ILMRetry) WithContext(v context.Context) func(*ILMRetryRequest) { - return func(r *ILMRetryRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f ILMRetry) WithPretty() func(*ILMRetryRequest) { - return func(r *ILMRetryRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f ILMRetry) WithHuman() func(*ILMRetryRequest) { - return func(r *ILMRetryRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f ILMRetry) WithErrorTrace() func(*ILMRetryRequest) { - return func(r *ILMRetryRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f ILMRetry) WithFilterPath(v ...string) func(*ILMRetryRequest) { - return func(r *ILMRetryRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f ILMRetry) WithHeader(h map[string]string) func(*ILMRetryRequest) { - return func(r *ILMRetryRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f ILMRetry) WithOpaqueID(s string) func(*ILMRetryRequest) { - return func(r *ILMRetryRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ilm.start.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ilm.start.go deleted file mode 100644 index 9189239b4..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ilm.start.go +++ /dev/null @@ -1,196 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newILMStartFunc(t Transport) ILMStart { - return func(o ...func(*ILMStartRequest)) (*Response, error) { - var r = ILMStartRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// ILMStart - Start the index lifecycle management (ILM) plugin. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-start.html. -// -type ILMStart func(o ...func(*ILMStartRequest)) (*Response, error) - -// ILMStartRequest configures the ILM Start API request. -// -type ILMStartRequest struct { - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r ILMStartRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(len("/_ilm/start")) - path.WriteString("/_ilm/start") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f ILMStart) WithContext(v context.Context) func(*ILMStartRequest) { - return func(r *ILMStartRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f ILMStart) WithPretty() func(*ILMStartRequest) { - return func(r *ILMStartRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f ILMStart) WithHuman() func(*ILMStartRequest) { - return func(r *ILMStartRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f ILMStart) WithErrorTrace() func(*ILMStartRequest) { - return func(r *ILMStartRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f ILMStart) WithFilterPath(v ...string) func(*ILMStartRequest) { - return func(r *ILMStartRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f ILMStart) WithHeader(h map[string]string) func(*ILMStartRequest) { - return func(r *ILMStartRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f ILMStart) WithOpaqueID(s string) func(*ILMStartRequest) { - return func(r *ILMStartRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ilm.stop.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ilm.stop.go deleted file mode 100644 index bd6febd82..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ilm.stop.go +++ /dev/null @@ -1,196 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newILMStopFunc(t Transport) ILMStop { - return func(o ...func(*ILMStopRequest)) (*Response, error) { - var r = ILMStopRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// ILMStop - Halts all lifecycle management operations and stops the index lifecycle management (ILM) plugin -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-stop.html. -// -type ILMStop func(o ...func(*ILMStopRequest)) (*Response, error) - -// ILMStopRequest configures the ILM Stop API request. -// -type ILMStopRequest struct { - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r ILMStopRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(len("/_ilm/stop")) - path.WriteString("/_ilm/stop") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f ILMStop) WithContext(v context.Context) func(*ILMStopRequest) { - return func(r *ILMStopRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f ILMStop) WithPretty() func(*ILMStopRequest) { - return func(r *ILMStopRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f ILMStop) WithHuman() func(*ILMStopRequest) { - return func(r *ILMStopRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f ILMStop) WithErrorTrace() func(*ILMStopRequest) { - return func(r *ILMStopRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f ILMStop) WithFilterPath(v ...string) func(*ILMStopRequest) { - return func(r *ILMStopRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f ILMStop) WithHeader(h map[string]string) func(*ILMStopRequest) { - return func(r *ILMStopRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f ILMStop) WithOpaqueID(s string) func(*ILMStopRequest) { - return func(r *ILMStopRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.indices.create_data_stream.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.indices.create_data_stream.go deleted file mode 100644 index 039369ba6..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.indices.create_data_stream.go +++ /dev/null @@ -1,201 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newIndicesCreateDataStreamFunc(t Transport) IndicesCreateDataStream { - return func(name string, o ...func(*IndicesCreateDataStreamRequest)) (*Response, error) { - var r = IndicesCreateDataStreamRequest{Name: name} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesCreateDataStream - Creates a data stream -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html. -// -type IndicesCreateDataStream func(name string, o ...func(*IndicesCreateDataStreamRequest)) (*Response, error) - -// IndicesCreateDataStreamRequest configures the Indices Create Data Stream API request. -// -type IndicesCreateDataStreamRequest struct { - Name string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesCreateDataStreamRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - path.Grow(1 + len("_data_stream") + 1 + len(r.Name)) - path.WriteString("/") - path.WriteString("_data_stream") - path.WriteString("/") - path.WriteString(r.Name) - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesCreateDataStream) WithContext(v context.Context) func(*IndicesCreateDataStreamRequest) { - return func(r *IndicesCreateDataStreamRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesCreateDataStream) WithPretty() func(*IndicesCreateDataStreamRequest) { - return func(r *IndicesCreateDataStreamRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesCreateDataStream) WithHuman() func(*IndicesCreateDataStreamRequest) { - return func(r *IndicesCreateDataStreamRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesCreateDataStream) WithErrorTrace() func(*IndicesCreateDataStreamRequest) { - return func(r *IndicesCreateDataStreamRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesCreateDataStream) WithFilterPath(v ...string) func(*IndicesCreateDataStreamRequest) { - return func(r *IndicesCreateDataStreamRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesCreateDataStream) WithHeader(h map[string]string) func(*IndicesCreateDataStreamRequest) { - return func(r *IndicesCreateDataStreamRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesCreateDataStream) WithOpaqueID(s string) func(*IndicesCreateDataStreamRequest) { - return func(r *IndicesCreateDataStreamRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.indices.data_streams_stats.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.indices.data_streams_stats.go deleted file mode 100644 index 9873cbc02..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.indices.data_streams_stats.go +++ /dev/null @@ -1,213 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newIndicesDataStreamsStatsFunc(t Transport) IndicesDataStreamsStats { - return func(o ...func(*IndicesDataStreamsStatsRequest)) (*Response, error) { - var r = IndicesDataStreamsStatsRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesDataStreamsStats - Provides statistics on operations happening in a data stream. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html. -// -type IndicesDataStreamsStats func(o ...func(*IndicesDataStreamsStatsRequest)) (*Response, error) - -// IndicesDataStreamsStatsRequest configures the Indices Data Streams Stats API request. -// -type IndicesDataStreamsStatsRequest struct { - Name []string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesDataStreamsStatsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_data_stream") + 1 + len(strings.Join(r.Name, ",")) + 1 + len("_stats")) - path.WriteString("/") - path.WriteString("_data_stream") - if len(r.Name) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Name, ",")) - } - path.WriteString("/") - path.WriteString("_stats") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesDataStreamsStats) WithContext(v context.Context) func(*IndicesDataStreamsStatsRequest) { - return func(r *IndicesDataStreamsStatsRequest) { - r.ctx = v - } -} - -// WithName - a list of data stream names; use _all to perform the operation on all data streams. -// -func (f IndicesDataStreamsStats) WithName(v ...string) func(*IndicesDataStreamsStatsRequest) { - return func(r *IndicesDataStreamsStatsRequest) { - r.Name = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesDataStreamsStats) WithPretty() func(*IndicesDataStreamsStatsRequest) { - return func(r *IndicesDataStreamsStatsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesDataStreamsStats) WithHuman() func(*IndicesDataStreamsStatsRequest) { - return func(r *IndicesDataStreamsStatsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesDataStreamsStats) WithErrorTrace() func(*IndicesDataStreamsStatsRequest) { - return func(r *IndicesDataStreamsStatsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesDataStreamsStats) WithFilterPath(v ...string) func(*IndicesDataStreamsStatsRequest) { - return func(r *IndicesDataStreamsStatsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesDataStreamsStats) WithHeader(h map[string]string) func(*IndicesDataStreamsStatsRequest) { - return func(r *IndicesDataStreamsStatsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesDataStreamsStats) WithOpaqueID(s string) func(*IndicesDataStreamsStatsRequest) { - return func(r *IndicesDataStreamsStatsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.indices.delete_data_stream.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.indices.delete_data_stream.go deleted file mode 100644 index 10f9ae685..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.indices.delete_data_stream.go +++ /dev/null @@ -1,215 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newIndicesDeleteDataStreamFunc(t Transport) IndicesDeleteDataStream { - return func(name []string, o ...func(*IndicesDeleteDataStreamRequest)) (*Response, error) { - var r = IndicesDeleteDataStreamRequest{Name: name} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesDeleteDataStream - Deletes a data stream. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html. -// -type IndicesDeleteDataStream func(name []string, o ...func(*IndicesDeleteDataStreamRequest)) (*Response, error) - -// IndicesDeleteDataStreamRequest configures the Indices Delete Data Stream API request. -// -type IndicesDeleteDataStreamRequest struct { - Name []string - - ExpandWildcards string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesDeleteDataStreamRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "DELETE" - - path.Grow(1 + len("_data_stream") + 1 + len(strings.Join(r.Name, ","))) - path.WriteString("/") - path.WriteString("_data_stream") - path.WriteString("/") - path.WriteString(strings.Join(r.Name, ",")) - - params = make(map[string]string) - - if r.ExpandWildcards != "" { - params["expand_wildcards"] = r.ExpandWildcards - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesDeleteDataStream) WithContext(v context.Context) func(*IndicesDeleteDataStreamRequest) { - return func(r *IndicesDeleteDataStreamRequest) { - r.ctx = v - } -} - -// WithExpandWildcards - whether wildcard expressions should get expanded to open or closed indices (default: open). -// -func (f IndicesDeleteDataStream) WithExpandWildcards(v string) func(*IndicesDeleteDataStreamRequest) { - return func(r *IndicesDeleteDataStreamRequest) { - r.ExpandWildcards = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesDeleteDataStream) WithPretty() func(*IndicesDeleteDataStreamRequest) { - return func(r *IndicesDeleteDataStreamRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesDeleteDataStream) WithHuman() func(*IndicesDeleteDataStreamRequest) { - return func(r *IndicesDeleteDataStreamRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesDeleteDataStream) WithErrorTrace() func(*IndicesDeleteDataStreamRequest) { - return func(r *IndicesDeleteDataStreamRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesDeleteDataStream) WithFilterPath(v ...string) func(*IndicesDeleteDataStreamRequest) { - return func(r *IndicesDeleteDataStreamRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesDeleteDataStream) WithHeader(h map[string]string) func(*IndicesDeleteDataStreamRequest) { - return func(r *IndicesDeleteDataStreamRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesDeleteDataStream) WithOpaqueID(s string) func(*IndicesDeleteDataStreamRequest) { - return func(r *IndicesDeleteDataStreamRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.indices.freeze.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.indices.freeze.go deleted file mode 100644 index bd31b2801..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.indices.freeze.go +++ /dev/null @@ -1,282 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" - "time" -) - -func newIndicesFreezeFunc(t Transport) IndicesFreeze { - return func(index string, o ...func(*IndicesFreezeRequest)) (*Response, error) { - var r = IndicesFreezeRequest{Index: index} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesFreeze - Freezes an index. A frozen index has almost no overhead on the cluster (except for maintaining its metadata in memory) and is read-only. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/freeze-index-api.html. -// -type IndicesFreeze func(index string, o ...func(*IndicesFreezeRequest)) (*Response, error) - -// IndicesFreezeRequest configures the Indices Freeze API request. -// -type IndicesFreezeRequest struct { - Index string - - AllowNoIndices *bool - ExpandWildcards string - IgnoreUnavailable *bool - MasterTimeout time.Duration - Timeout time.Duration - WaitForActiveShards string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesFreezeRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len(r.Index) + 1 + len("_freeze")) - path.WriteString("/") - path.WriteString(r.Index) - path.WriteString("/") - path.WriteString("_freeze") - - params = make(map[string]string) - - if r.AllowNoIndices != nil { - params["allow_no_indices"] = strconv.FormatBool(*r.AllowNoIndices) - } - - if r.ExpandWildcards != "" { - params["expand_wildcards"] = r.ExpandWildcards - } - - if r.IgnoreUnavailable != nil { - params["ignore_unavailable"] = strconv.FormatBool(*r.IgnoreUnavailable) - } - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.WaitForActiveShards != "" { - params["wait_for_active_shards"] = r.WaitForActiveShards - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesFreeze) WithContext(v context.Context) func(*IndicesFreezeRequest) { - return func(r *IndicesFreezeRequest) { - r.ctx = v - } -} - -// WithAllowNoIndices - whether to ignore if a wildcard indices expression resolves into no concrete indices. (this includes `_all` string or when no indices have been specified). -// -func (f IndicesFreeze) WithAllowNoIndices(v bool) func(*IndicesFreezeRequest) { - return func(r *IndicesFreezeRequest) { - r.AllowNoIndices = &v - } -} - -// WithExpandWildcards - whether to expand wildcard expression to concrete indices that are open, closed or both.. -// -func (f IndicesFreeze) WithExpandWildcards(v string) func(*IndicesFreezeRequest) { - return func(r *IndicesFreezeRequest) { - r.ExpandWildcards = v - } -} - -// WithIgnoreUnavailable - whether specified concrete indices should be ignored when unavailable (missing or closed). -// -func (f IndicesFreeze) WithIgnoreUnavailable(v bool) func(*IndicesFreezeRequest) { - return func(r *IndicesFreezeRequest) { - r.IgnoreUnavailable = &v - } -} - -// WithMasterTimeout - specify timeout for connection to master. -// -func (f IndicesFreeze) WithMasterTimeout(v time.Duration) func(*IndicesFreezeRequest) { - return func(r *IndicesFreezeRequest) { - r.MasterTimeout = v - } -} - -// WithTimeout - explicit operation timeout. -// -func (f IndicesFreeze) WithTimeout(v time.Duration) func(*IndicesFreezeRequest) { - return func(r *IndicesFreezeRequest) { - r.Timeout = v - } -} - -// WithWaitForActiveShards - sets the number of active shards to wait for before the operation returns.. -// -func (f IndicesFreeze) WithWaitForActiveShards(v string) func(*IndicesFreezeRequest) { - return func(r *IndicesFreezeRequest) { - r.WaitForActiveShards = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesFreeze) WithPretty() func(*IndicesFreezeRequest) { - return func(r *IndicesFreezeRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesFreeze) WithHuman() func(*IndicesFreezeRequest) { - return func(r *IndicesFreezeRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesFreeze) WithErrorTrace() func(*IndicesFreezeRequest) { - return func(r *IndicesFreezeRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesFreeze) WithFilterPath(v ...string) func(*IndicesFreezeRequest) { - return func(r *IndicesFreezeRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesFreeze) WithHeader(h map[string]string) func(*IndicesFreezeRequest) { - return func(r *IndicesFreezeRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesFreeze) WithOpaqueID(s string) func(*IndicesFreezeRequest) { - return func(r *IndicesFreezeRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.indices.get_data_stream.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.indices.get_data_stream.go deleted file mode 100644 index 025d272ab..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.indices.get_data_stream.go +++ /dev/null @@ -1,225 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newIndicesGetDataStreamFunc(t Transport) IndicesGetDataStream { - return func(o ...func(*IndicesGetDataStreamRequest)) (*Response, error) { - var r = IndicesGetDataStreamRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesGetDataStream - Returns data streams. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html. -// -type IndicesGetDataStream func(o ...func(*IndicesGetDataStreamRequest)) (*Response, error) - -// IndicesGetDataStreamRequest configures the Indices Get Data Stream API request. -// -type IndicesGetDataStreamRequest struct { - Name []string - - ExpandWildcards string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesGetDataStreamRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_data_stream") + 1 + len(strings.Join(r.Name, ","))) - path.WriteString("/") - path.WriteString("_data_stream") - if len(r.Name) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Name, ",")) - } - - params = make(map[string]string) - - if r.ExpandWildcards != "" { - params["expand_wildcards"] = r.ExpandWildcards - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesGetDataStream) WithContext(v context.Context) func(*IndicesGetDataStreamRequest) { - return func(r *IndicesGetDataStreamRequest) { - r.ctx = v - } -} - -// WithName - a list of data streams to get; use `*` to get all data streams. -// -func (f IndicesGetDataStream) WithName(v ...string) func(*IndicesGetDataStreamRequest) { - return func(r *IndicesGetDataStreamRequest) { - r.Name = v - } -} - -// WithExpandWildcards - whether wildcard expressions should get expanded to open or closed indices (default: open). -// -func (f IndicesGetDataStream) WithExpandWildcards(v string) func(*IndicesGetDataStreamRequest) { - return func(r *IndicesGetDataStreamRequest) { - r.ExpandWildcards = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesGetDataStream) WithPretty() func(*IndicesGetDataStreamRequest) { - return func(r *IndicesGetDataStreamRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesGetDataStream) WithHuman() func(*IndicesGetDataStreamRequest) { - return func(r *IndicesGetDataStreamRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesGetDataStream) WithErrorTrace() func(*IndicesGetDataStreamRequest) { - return func(r *IndicesGetDataStreamRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesGetDataStream) WithFilterPath(v ...string) func(*IndicesGetDataStreamRequest) { - return func(r *IndicesGetDataStreamRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesGetDataStream) WithHeader(h map[string]string) func(*IndicesGetDataStreamRequest) { - return func(r *IndicesGetDataStreamRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesGetDataStream) WithOpaqueID(s string) func(*IndicesGetDataStreamRequest) { - return func(r *IndicesGetDataStreamRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.indices.migrate_to_data_stream.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.indices.migrate_to_data_stream.go deleted file mode 100644 index d19976259..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.indices.migrate_to_data_stream.go +++ /dev/null @@ -1,203 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newIndicesMigrateToDataStreamFunc(t Transport) IndicesMigrateToDataStream { - return func(name string, o ...func(*IndicesMigrateToDataStreamRequest)) (*Response, error) { - var r = IndicesMigrateToDataStreamRequest{Name: name} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesMigrateToDataStream - Migrates an alias to a data stream -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html. -// -type IndicesMigrateToDataStream func(name string, o ...func(*IndicesMigrateToDataStreamRequest)) (*Response, error) - -// IndicesMigrateToDataStreamRequest configures the Indices Migrate To Data Stream API request. -// -type IndicesMigrateToDataStreamRequest struct { - Name string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesMigrateToDataStreamRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_data_stream") + 1 + len("_migrate") + 1 + len(r.Name)) - path.WriteString("/") - path.WriteString("_data_stream") - path.WriteString("/") - path.WriteString("_migrate") - path.WriteString("/") - path.WriteString(r.Name) - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesMigrateToDataStream) WithContext(v context.Context) func(*IndicesMigrateToDataStreamRequest) { - return func(r *IndicesMigrateToDataStreamRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesMigrateToDataStream) WithPretty() func(*IndicesMigrateToDataStreamRequest) { - return func(r *IndicesMigrateToDataStreamRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesMigrateToDataStream) WithHuman() func(*IndicesMigrateToDataStreamRequest) { - return func(r *IndicesMigrateToDataStreamRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesMigrateToDataStream) WithErrorTrace() func(*IndicesMigrateToDataStreamRequest) { - return func(r *IndicesMigrateToDataStreamRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesMigrateToDataStream) WithFilterPath(v ...string) func(*IndicesMigrateToDataStreamRequest) { - return func(r *IndicesMigrateToDataStreamRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesMigrateToDataStream) WithHeader(h map[string]string) func(*IndicesMigrateToDataStreamRequest) { - return func(r *IndicesMigrateToDataStreamRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesMigrateToDataStream) WithOpaqueID(s string) func(*IndicesMigrateToDataStreamRequest) { - return func(r *IndicesMigrateToDataStreamRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.indices.promote_data_stream.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.indices.promote_data_stream.go deleted file mode 100644 index d5012a600..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.indices.promote_data_stream.go +++ /dev/null @@ -1,203 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newIndicesPromoteDataStreamFunc(t Transport) IndicesPromoteDataStream { - return func(name string, o ...func(*IndicesPromoteDataStreamRequest)) (*Response, error) { - var r = IndicesPromoteDataStreamRequest{Name: name} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesPromoteDataStream - Promotes a data stream from a replicated data stream managed by CCR to a regular data stream -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html. -// -type IndicesPromoteDataStream func(name string, o ...func(*IndicesPromoteDataStreamRequest)) (*Response, error) - -// IndicesPromoteDataStreamRequest configures the Indices Promote Data Stream API request. -// -type IndicesPromoteDataStreamRequest struct { - Name string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesPromoteDataStreamRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_data_stream") + 1 + len("_promote") + 1 + len(r.Name)) - path.WriteString("/") - path.WriteString("_data_stream") - path.WriteString("/") - path.WriteString("_promote") - path.WriteString("/") - path.WriteString(r.Name) - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesPromoteDataStream) WithContext(v context.Context) func(*IndicesPromoteDataStreamRequest) { - return func(r *IndicesPromoteDataStreamRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesPromoteDataStream) WithPretty() func(*IndicesPromoteDataStreamRequest) { - return func(r *IndicesPromoteDataStreamRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesPromoteDataStream) WithHuman() func(*IndicesPromoteDataStreamRequest) { - return func(r *IndicesPromoteDataStreamRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesPromoteDataStream) WithErrorTrace() func(*IndicesPromoteDataStreamRequest) { - return func(r *IndicesPromoteDataStreamRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesPromoteDataStream) WithFilterPath(v ...string) func(*IndicesPromoteDataStreamRequest) { - return func(r *IndicesPromoteDataStreamRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesPromoteDataStream) WithHeader(h map[string]string) func(*IndicesPromoteDataStreamRequest) { - return func(r *IndicesPromoteDataStreamRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesPromoteDataStream) WithOpaqueID(s string) func(*IndicesPromoteDataStreamRequest) { - return func(r *IndicesPromoteDataStreamRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.indices.reload_search_analyzers.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.indices.reload_search_analyzers.go deleted file mode 100644 index d6129d51a..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.indices.reload_search_analyzers.go +++ /dev/null @@ -1,242 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newIndicesReloadSearchAnalyzersFunc(t Transport) IndicesReloadSearchAnalyzers { - return func(index []string, o ...func(*IndicesReloadSearchAnalyzersRequest)) (*Response, error) { - var r = IndicesReloadSearchAnalyzersRequest{Index: index} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesReloadSearchAnalyzers - Reloads an index's search analyzers and their resources. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-reload-analyzers.html. -// -type IndicesReloadSearchAnalyzers func(index []string, o ...func(*IndicesReloadSearchAnalyzersRequest)) (*Response, error) - -// IndicesReloadSearchAnalyzersRequest configures the Indices Reload Search Analyzers API request. -// -type IndicesReloadSearchAnalyzersRequest struct { - Index []string - - AllowNoIndices *bool - ExpandWildcards string - IgnoreUnavailable *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesReloadSearchAnalyzersRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len(strings.Join(r.Index, ",")) + 1 + len("_reload_search_analyzers")) - path.WriteString("/") - path.WriteString(strings.Join(r.Index, ",")) - path.WriteString("/") - path.WriteString("_reload_search_analyzers") - - params = make(map[string]string) - - if r.AllowNoIndices != nil { - params["allow_no_indices"] = strconv.FormatBool(*r.AllowNoIndices) - } - - if r.ExpandWildcards != "" { - params["expand_wildcards"] = r.ExpandWildcards - } - - if r.IgnoreUnavailable != nil { - params["ignore_unavailable"] = strconv.FormatBool(*r.IgnoreUnavailable) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesReloadSearchAnalyzers) WithContext(v context.Context) func(*IndicesReloadSearchAnalyzersRequest) { - return func(r *IndicesReloadSearchAnalyzersRequest) { - r.ctx = v - } -} - -// WithAllowNoIndices - whether to ignore if a wildcard indices expression resolves into no concrete indices. (this includes `_all` string or when no indices have been specified). -// -func (f IndicesReloadSearchAnalyzers) WithAllowNoIndices(v bool) func(*IndicesReloadSearchAnalyzersRequest) { - return func(r *IndicesReloadSearchAnalyzersRequest) { - r.AllowNoIndices = &v - } -} - -// WithExpandWildcards - whether to expand wildcard expression to concrete indices that are open, closed or both.. -// -func (f IndicesReloadSearchAnalyzers) WithExpandWildcards(v string) func(*IndicesReloadSearchAnalyzersRequest) { - return func(r *IndicesReloadSearchAnalyzersRequest) { - r.ExpandWildcards = v - } -} - -// WithIgnoreUnavailable - whether specified concrete indices should be ignored when unavailable (missing or closed). -// -func (f IndicesReloadSearchAnalyzers) WithIgnoreUnavailable(v bool) func(*IndicesReloadSearchAnalyzersRequest) { - return func(r *IndicesReloadSearchAnalyzersRequest) { - r.IgnoreUnavailable = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesReloadSearchAnalyzers) WithPretty() func(*IndicesReloadSearchAnalyzersRequest) { - return func(r *IndicesReloadSearchAnalyzersRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesReloadSearchAnalyzers) WithHuman() func(*IndicesReloadSearchAnalyzersRequest) { - return func(r *IndicesReloadSearchAnalyzersRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesReloadSearchAnalyzers) WithErrorTrace() func(*IndicesReloadSearchAnalyzersRequest) { - return func(r *IndicesReloadSearchAnalyzersRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesReloadSearchAnalyzers) WithFilterPath(v ...string) func(*IndicesReloadSearchAnalyzersRequest) { - return func(r *IndicesReloadSearchAnalyzersRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesReloadSearchAnalyzers) WithHeader(h map[string]string) func(*IndicesReloadSearchAnalyzersRequest) { - return func(r *IndicesReloadSearchAnalyzersRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesReloadSearchAnalyzers) WithOpaqueID(s string) func(*IndicesReloadSearchAnalyzersRequest) { - return func(r *IndicesReloadSearchAnalyzersRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.indices.unfreeze.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.indices.unfreeze.go deleted file mode 100644 index ea49908ba..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.indices.unfreeze.go +++ /dev/null @@ -1,282 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" - "time" -) - -func newIndicesUnfreezeFunc(t Transport) IndicesUnfreeze { - return func(index string, o ...func(*IndicesUnfreezeRequest)) (*Response, error) { - var r = IndicesUnfreezeRequest{Index: index} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// IndicesUnfreeze - Unfreezes an index. When a frozen index is unfrozen, the index goes through the normal recovery process and becomes writeable again. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/unfreeze-index-api.html. -// -type IndicesUnfreeze func(index string, o ...func(*IndicesUnfreezeRequest)) (*Response, error) - -// IndicesUnfreezeRequest configures the Indices Unfreeze API request. -// -type IndicesUnfreezeRequest struct { - Index string - - AllowNoIndices *bool - ExpandWildcards string - IgnoreUnavailable *bool - MasterTimeout time.Duration - Timeout time.Duration - WaitForActiveShards string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r IndicesUnfreezeRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len(r.Index) + 1 + len("_unfreeze")) - path.WriteString("/") - path.WriteString(r.Index) - path.WriteString("/") - path.WriteString("_unfreeze") - - params = make(map[string]string) - - if r.AllowNoIndices != nil { - params["allow_no_indices"] = strconv.FormatBool(*r.AllowNoIndices) - } - - if r.ExpandWildcards != "" { - params["expand_wildcards"] = r.ExpandWildcards - } - - if r.IgnoreUnavailable != nil { - params["ignore_unavailable"] = strconv.FormatBool(*r.IgnoreUnavailable) - } - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.WaitForActiveShards != "" { - params["wait_for_active_shards"] = r.WaitForActiveShards - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f IndicesUnfreeze) WithContext(v context.Context) func(*IndicesUnfreezeRequest) { - return func(r *IndicesUnfreezeRequest) { - r.ctx = v - } -} - -// WithAllowNoIndices - whether to ignore if a wildcard indices expression resolves into no concrete indices. (this includes `_all` string or when no indices have been specified). -// -func (f IndicesUnfreeze) WithAllowNoIndices(v bool) func(*IndicesUnfreezeRequest) { - return func(r *IndicesUnfreezeRequest) { - r.AllowNoIndices = &v - } -} - -// WithExpandWildcards - whether to expand wildcard expression to concrete indices that are open, closed or both.. -// -func (f IndicesUnfreeze) WithExpandWildcards(v string) func(*IndicesUnfreezeRequest) { - return func(r *IndicesUnfreezeRequest) { - r.ExpandWildcards = v - } -} - -// WithIgnoreUnavailable - whether specified concrete indices should be ignored when unavailable (missing or closed). -// -func (f IndicesUnfreeze) WithIgnoreUnavailable(v bool) func(*IndicesUnfreezeRequest) { - return func(r *IndicesUnfreezeRequest) { - r.IgnoreUnavailable = &v - } -} - -// WithMasterTimeout - specify timeout for connection to master. -// -func (f IndicesUnfreeze) WithMasterTimeout(v time.Duration) func(*IndicesUnfreezeRequest) { - return func(r *IndicesUnfreezeRequest) { - r.MasterTimeout = v - } -} - -// WithTimeout - explicit operation timeout. -// -func (f IndicesUnfreeze) WithTimeout(v time.Duration) func(*IndicesUnfreezeRequest) { - return func(r *IndicesUnfreezeRequest) { - r.Timeout = v - } -} - -// WithWaitForActiveShards - sets the number of active shards to wait for before the operation returns.. -// -func (f IndicesUnfreeze) WithWaitForActiveShards(v string) func(*IndicesUnfreezeRequest) { - return func(r *IndicesUnfreezeRequest) { - r.WaitForActiveShards = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f IndicesUnfreeze) WithPretty() func(*IndicesUnfreezeRequest) { - return func(r *IndicesUnfreezeRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f IndicesUnfreeze) WithHuman() func(*IndicesUnfreezeRequest) { - return func(r *IndicesUnfreezeRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f IndicesUnfreeze) WithErrorTrace() func(*IndicesUnfreezeRequest) { - return func(r *IndicesUnfreezeRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f IndicesUnfreeze) WithFilterPath(v ...string) func(*IndicesUnfreezeRequest) { - return func(r *IndicesUnfreezeRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f IndicesUnfreeze) WithHeader(h map[string]string) func(*IndicesUnfreezeRequest) { - return func(r *IndicesUnfreezeRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f IndicesUnfreeze) WithOpaqueID(s string) func(*IndicesUnfreezeRequest) { - return func(r *IndicesUnfreezeRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.license.delete.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.license.delete.go deleted file mode 100644 index a5e62b57e..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.license.delete.go +++ /dev/null @@ -1,196 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newLicenseDeleteFunc(t Transport) LicenseDelete { - return func(o ...func(*LicenseDeleteRequest)) (*Response, error) { - var r = LicenseDeleteRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// LicenseDelete - Deletes licensing information for the cluster -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-license.html. -// -type LicenseDelete func(o ...func(*LicenseDeleteRequest)) (*Response, error) - -// LicenseDeleteRequest configures the License Delete API request. -// -type LicenseDeleteRequest struct { - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r LicenseDeleteRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "DELETE" - - path.Grow(len("/_license")) - path.WriteString("/_license") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f LicenseDelete) WithContext(v context.Context) func(*LicenseDeleteRequest) { - return func(r *LicenseDeleteRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f LicenseDelete) WithPretty() func(*LicenseDeleteRequest) { - return func(r *LicenseDeleteRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f LicenseDelete) WithHuman() func(*LicenseDeleteRequest) { - return func(r *LicenseDeleteRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f LicenseDelete) WithErrorTrace() func(*LicenseDeleteRequest) { - return func(r *LicenseDeleteRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f LicenseDelete) WithFilterPath(v ...string) func(*LicenseDeleteRequest) { - return func(r *LicenseDeleteRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f LicenseDelete) WithHeader(h map[string]string) func(*LicenseDeleteRequest) { - return func(r *LicenseDeleteRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f LicenseDelete) WithOpaqueID(s string) func(*LicenseDeleteRequest) { - return func(r *LicenseDeleteRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.license.get.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.license.get.go deleted file mode 100644 index 3eb08a272..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.license.get.go +++ /dev/null @@ -1,224 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newLicenseGetFunc(t Transport) LicenseGet { - return func(o ...func(*LicenseGetRequest)) (*Response, error) { - var r = LicenseGetRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// LicenseGet - Retrieves licensing information for the cluster -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/get-license.html. -// -type LicenseGet func(o ...func(*LicenseGetRequest)) (*Response, error) - -// LicenseGetRequest configures the License Get API request. -// -type LicenseGetRequest struct { - AcceptEnterprise *bool - Local *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r LicenseGetRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(len("/_license")) - path.WriteString("/_license") - - params = make(map[string]string) - - if r.AcceptEnterprise != nil { - params["accept_enterprise"] = strconv.FormatBool(*r.AcceptEnterprise) - } - - if r.Local != nil { - params["local"] = strconv.FormatBool(*r.Local) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f LicenseGet) WithContext(v context.Context) func(*LicenseGetRequest) { - return func(r *LicenseGetRequest) { - r.ctx = v - } -} - -// WithAcceptEnterprise - if the active license is an enterprise license, return type as 'enterprise' (default: false). -// -func (f LicenseGet) WithAcceptEnterprise(v bool) func(*LicenseGetRequest) { - return func(r *LicenseGetRequest) { - r.AcceptEnterprise = &v - } -} - -// WithLocal - return local information, do not retrieve the state from master node (default: false). -// -func (f LicenseGet) WithLocal(v bool) func(*LicenseGetRequest) { - return func(r *LicenseGetRequest) { - r.Local = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f LicenseGet) WithPretty() func(*LicenseGetRequest) { - return func(r *LicenseGetRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f LicenseGet) WithHuman() func(*LicenseGetRequest) { - return func(r *LicenseGetRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f LicenseGet) WithErrorTrace() func(*LicenseGetRequest) { - return func(r *LicenseGetRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f LicenseGet) WithFilterPath(v ...string) func(*LicenseGetRequest) { - return func(r *LicenseGetRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f LicenseGet) WithHeader(h map[string]string) func(*LicenseGetRequest) { - return func(r *LicenseGetRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f LicenseGet) WithOpaqueID(s string) func(*LicenseGetRequest) { - return func(r *LicenseGetRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.license.get_basic_status.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.license.get_basic_status.go deleted file mode 100644 index 0c5224f55..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.license.get_basic_status.go +++ /dev/null @@ -1,196 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newLicenseGetBasicStatusFunc(t Transport) LicenseGetBasicStatus { - return func(o ...func(*LicenseGetBasicStatusRequest)) (*Response, error) { - var r = LicenseGetBasicStatusRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// LicenseGetBasicStatus - Retrieves information about the status of the basic license. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/get-basic-status.html. -// -type LicenseGetBasicStatus func(o ...func(*LicenseGetBasicStatusRequest)) (*Response, error) - -// LicenseGetBasicStatusRequest configures the License Get Basic Status API request. -// -type LicenseGetBasicStatusRequest struct { - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r LicenseGetBasicStatusRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(len("/_license/basic_status")) - path.WriteString("/_license/basic_status") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f LicenseGetBasicStatus) WithContext(v context.Context) func(*LicenseGetBasicStatusRequest) { - return func(r *LicenseGetBasicStatusRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f LicenseGetBasicStatus) WithPretty() func(*LicenseGetBasicStatusRequest) { - return func(r *LicenseGetBasicStatusRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f LicenseGetBasicStatus) WithHuman() func(*LicenseGetBasicStatusRequest) { - return func(r *LicenseGetBasicStatusRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f LicenseGetBasicStatus) WithErrorTrace() func(*LicenseGetBasicStatusRequest) { - return func(r *LicenseGetBasicStatusRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f LicenseGetBasicStatus) WithFilterPath(v ...string) func(*LicenseGetBasicStatusRequest) { - return func(r *LicenseGetBasicStatusRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f LicenseGetBasicStatus) WithHeader(h map[string]string) func(*LicenseGetBasicStatusRequest) { - return func(r *LicenseGetBasicStatusRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f LicenseGetBasicStatus) WithOpaqueID(s string) func(*LicenseGetBasicStatusRequest) { - return func(r *LicenseGetBasicStatusRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.license.get_trial_status.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.license.get_trial_status.go deleted file mode 100644 index bee86c254..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.license.get_trial_status.go +++ /dev/null @@ -1,196 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newLicenseGetTrialStatusFunc(t Transport) LicenseGetTrialStatus { - return func(o ...func(*LicenseGetTrialStatusRequest)) (*Response, error) { - var r = LicenseGetTrialStatusRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// LicenseGetTrialStatus - Retrieves information about the status of the trial license. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/get-trial-status.html. -// -type LicenseGetTrialStatus func(o ...func(*LicenseGetTrialStatusRequest)) (*Response, error) - -// LicenseGetTrialStatusRequest configures the License Get Trial Status API request. -// -type LicenseGetTrialStatusRequest struct { - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r LicenseGetTrialStatusRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(len("/_license/trial_status")) - path.WriteString("/_license/trial_status") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f LicenseGetTrialStatus) WithContext(v context.Context) func(*LicenseGetTrialStatusRequest) { - return func(r *LicenseGetTrialStatusRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f LicenseGetTrialStatus) WithPretty() func(*LicenseGetTrialStatusRequest) { - return func(r *LicenseGetTrialStatusRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f LicenseGetTrialStatus) WithHuman() func(*LicenseGetTrialStatusRequest) { - return func(r *LicenseGetTrialStatusRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f LicenseGetTrialStatus) WithErrorTrace() func(*LicenseGetTrialStatusRequest) { - return func(r *LicenseGetTrialStatusRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f LicenseGetTrialStatus) WithFilterPath(v ...string) func(*LicenseGetTrialStatusRequest) { - return func(r *LicenseGetTrialStatusRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f LicenseGetTrialStatus) WithHeader(h map[string]string) func(*LicenseGetTrialStatusRequest) { - return func(r *LicenseGetTrialStatusRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f LicenseGetTrialStatus) WithOpaqueID(s string) func(*LicenseGetTrialStatusRequest) { - return func(r *LicenseGetTrialStatusRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.license.post.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.license.post.go deleted file mode 100644 index 8acaebcec..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.license.post.go +++ /dev/null @@ -1,226 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" -) - -func newLicensePostFunc(t Transport) LicensePost { - return func(o ...func(*LicensePostRequest)) (*Response, error) { - var r = LicensePostRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// LicensePost - Updates the license for the cluster. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/update-license.html. -// -type LicensePost func(o ...func(*LicensePostRequest)) (*Response, error) - -// LicensePostRequest configures the License Post API request. -// -type LicensePostRequest struct { - Body io.Reader - - Acknowledge *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r LicensePostRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - path.Grow(len("/_license")) - path.WriteString("/_license") - - params = make(map[string]string) - - if r.Acknowledge != nil { - params["acknowledge"] = strconv.FormatBool(*r.Acknowledge) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f LicensePost) WithContext(v context.Context) func(*LicensePostRequest) { - return func(r *LicensePostRequest) { - r.ctx = v - } -} - -// WithBody - licenses to be installed. -// -func (f LicensePost) WithBody(v io.Reader) func(*LicensePostRequest) { - return func(r *LicensePostRequest) { - r.Body = v - } -} - -// WithAcknowledge - whether the user has acknowledged acknowledge messages (default: false). -// -func (f LicensePost) WithAcknowledge(v bool) func(*LicensePostRequest) { - return func(r *LicensePostRequest) { - r.Acknowledge = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f LicensePost) WithPretty() func(*LicensePostRequest) { - return func(r *LicensePostRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f LicensePost) WithHuman() func(*LicensePostRequest) { - return func(r *LicensePostRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f LicensePost) WithErrorTrace() func(*LicensePostRequest) { - return func(r *LicensePostRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f LicensePost) WithFilterPath(v ...string) func(*LicensePostRequest) { - return func(r *LicensePostRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f LicensePost) WithHeader(h map[string]string) func(*LicensePostRequest) { - return func(r *LicensePostRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f LicensePost) WithOpaqueID(s string) func(*LicensePostRequest) { - return func(r *LicensePostRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.license.post_start_basic.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.license.post_start_basic.go deleted file mode 100644 index 594c4c9bf..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.license.post_start_basic.go +++ /dev/null @@ -1,211 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newLicensePostStartBasicFunc(t Transport) LicensePostStartBasic { - return func(o ...func(*LicensePostStartBasicRequest)) (*Response, error) { - var r = LicensePostStartBasicRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// LicensePostStartBasic - Starts an indefinite basic license. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/start-basic.html. -// -type LicensePostStartBasic func(o ...func(*LicensePostStartBasicRequest)) (*Response, error) - -// LicensePostStartBasicRequest configures the License Post Start Basic API request. -// -type LicensePostStartBasicRequest struct { - Acknowledge *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r LicensePostStartBasicRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(len("/_license/start_basic")) - path.WriteString("/_license/start_basic") - - params = make(map[string]string) - - if r.Acknowledge != nil { - params["acknowledge"] = strconv.FormatBool(*r.Acknowledge) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f LicensePostStartBasic) WithContext(v context.Context) func(*LicensePostStartBasicRequest) { - return func(r *LicensePostStartBasicRequest) { - r.ctx = v - } -} - -// WithAcknowledge - whether the user has acknowledged acknowledge messages (default: false). -// -func (f LicensePostStartBasic) WithAcknowledge(v bool) func(*LicensePostStartBasicRequest) { - return func(r *LicensePostStartBasicRequest) { - r.Acknowledge = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f LicensePostStartBasic) WithPretty() func(*LicensePostStartBasicRequest) { - return func(r *LicensePostStartBasicRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f LicensePostStartBasic) WithHuman() func(*LicensePostStartBasicRequest) { - return func(r *LicensePostStartBasicRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f LicensePostStartBasic) WithErrorTrace() func(*LicensePostStartBasicRequest) { - return func(r *LicensePostStartBasicRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f LicensePostStartBasic) WithFilterPath(v ...string) func(*LicensePostStartBasicRequest) { - return func(r *LicensePostStartBasicRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f LicensePostStartBasic) WithHeader(h map[string]string) func(*LicensePostStartBasicRequest) { - return func(r *LicensePostStartBasicRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f LicensePostStartBasic) WithOpaqueID(s string) func(*LicensePostStartBasicRequest) { - return func(r *LicensePostStartBasicRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.license.post_start_trial.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.license.post_start_trial.go deleted file mode 100644 index 50eee6617..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.license.post_start_trial.go +++ /dev/null @@ -1,224 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newLicensePostStartTrialFunc(t Transport) LicensePostStartTrial { - return func(o ...func(*LicensePostStartTrialRequest)) (*Response, error) { - var r = LicensePostStartTrialRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// LicensePostStartTrial - starts a limited time trial license. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/start-trial.html. -// -type LicensePostStartTrial func(o ...func(*LicensePostStartTrialRequest)) (*Response, error) - -// LicensePostStartTrialRequest configures the License Post Start Trial API request. -// -type LicensePostStartTrialRequest struct { - Acknowledge *bool - DocumentType string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r LicensePostStartTrialRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(len("/_license/start_trial")) - path.WriteString("/_license/start_trial") - - params = make(map[string]string) - - if r.Acknowledge != nil { - params["acknowledge"] = strconv.FormatBool(*r.Acknowledge) - } - - if r.DocumentType != "" { - params["type"] = r.DocumentType - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f LicensePostStartTrial) WithContext(v context.Context) func(*LicensePostStartTrialRequest) { - return func(r *LicensePostStartTrialRequest) { - r.ctx = v - } -} - -// WithAcknowledge - whether the user has acknowledged acknowledge messages (default: false). -// -func (f LicensePostStartTrial) WithAcknowledge(v bool) func(*LicensePostStartTrialRequest) { - return func(r *LicensePostStartTrialRequest) { - r.Acknowledge = &v - } -} - -// WithDocumentType - the type of trial license to generate (default: "trial"). -// -func (f LicensePostStartTrial) WithDocumentType(v string) func(*LicensePostStartTrialRequest) { - return func(r *LicensePostStartTrialRequest) { - r.DocumentType = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f LicensePostStartTrial) WithPretty() func(*LicensePostStartTrialRequest) { - return func(r *LicensePostStartTrialRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f LicensePostStartTrial) WithHuman() func(*LicensePostStartTrialRequest) { - return func(r *LicensePostStartTrialRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f LicensePostStartTrial) WithErrorTrace() func(*LicensePostStartTrialRequest) { - return func(r *LicensePostStartTrialRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f LicensePostStartTrial) WithFilterPath(v ...string) func(*LicensePostStartTrialRequest) { - return func(r *LicensePostStartTrialRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f LicensePostStartTrial) WithHeader(h map[string]string) func(*LicensePostStartTrialRequest) { - return func(r *LicensePostStartTrialRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f LicensePostStartTrial) WithOpaqueID(s string) func(*LicensePostStartTrialRequest) { - return func(r *LicensePostStartTrialRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.logstash.delete_pipeline.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.logstash.delete_pipeline.go deleted file mode 100644 index f47a18473..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.logstash.delete_pipeline.go +++ /dev/null @@ -1,203 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newLogstashDeletePipelineFunc(t Transport) LogstashDeletePipeline { - return func(id string, o ...func(*LogstashDeletePipelineRequest)) (*Response, error) { - var r = LogstashDeletePipelineRequest{DocumentID: id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// LogstashDeletePipeline - Deletes Logstash Pipelines used by Central Management -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/logstash-api-delete-pipeline.html. -// -type LogstashDeletePipeline func(id string, o ...func(*LogstashDeletePipelineRequest)) (*Response, error) - -// LogstashDeletePipelineRequest configures the Logstash Delete Pipeline API request. -// -type LogstashDeletePipelineRequest struct { - DocumentID string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r LogstashDeletePipelineRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "DELETE" - - path.Grow(1 + len("_logstash") + 1 + len("pipeline") + 1 + len(r.DocumentID)) - path.WriteString("/") - path.WriteString("_logstash") - path.WriteString("/") - path.WriteString("pipeline") - path.WriteString("/") - path.WriteString(r.DocumentID) - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f LogstashDeletePipeline) WithContext(v context.Context) func(*LogstashDeletePipelineRequest) { - return func(r *LogstashDeletePipelineRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f LogstashDeletePipeline) WithPretty() func(*LogstashDeletePipelineRequest) { - return func(r *LogstashDeletePipelineRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f LogstashDeletePipeline) WithHuman() func(*LogstashDeletePipelineRequest) { - return func(r *LogstashDeletePipelineRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f LogstashDeletePipeline) WithErrorTrace() func(*LogstashDeletePipelineRequest) { - return func(r *LogstashDeletePipelineRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f LogstashDeletePipeline) WithFilterPath(v ...string) func(*LogstashDeletePipelineRequest) { - return func(r *LogstashDeletePipelineRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f LogstashDeletePipeline) WithHeader(h map[string]string) func(*LogstashDeletePipelineRequest) { - return func(r *LogstashDeletePipelineRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f LogstashDeletePipeline) WithOpaqueID(s string) func(*LogstashDeletePipelineRequest) { - return func(r *LogstashDeletePipelineRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.logstash.get_pipeline.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.logstash.get_pipeline.go deleted file mode 100644 index 11fc87a16..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.logstash.get_pipeline.go +++ /dev/null @@ -1,203 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newLogstashGetPipelineFunc(t Transport) LogstashGetPipeline { - return func(id string, o ...func(*LogstashGetPipelineRequest)) (*Response, error) { - var r = LogstashGetPipelineRequest{DocumentID: id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// LogstashGetPipeline - Retrieves Logstash Pipelines used by Central Management -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/logstash-api-get-pipeline.html. -// -type LogstashGetPipeline func(id string, o ...func(*LogstashGetPipelineRequest)) (*Response, error) - -// LogstashGetPipelineRequest configures the Logstash Get Pipeline API request. -// -type LogstashGetPipelineRequest struct { - DocumentID string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r LogstashGetPipelineRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_logstash") + 1 + len("pipeline") + 1 + len(r.DocumentID)) - path.WriteString("/") - path.WriteString("_logstash") - path.WriteString("/") - path.WriteString("pipeline") - path.WriteString("/") - path.WriteString(r.DocumentID) - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f LogstashGetPipeline) WithContext(v context.Context) func(*LogstashGetPipelineRequest) { - return func(r *LogstashGetPipelineRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f LogstashGetPipeline) WithPretty() func(*LogstashGetPipelineRequest) { - return func(r *LogstashGetPipelineRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f LogstashGetPipeline) WithHuman() func(*LogstashGetPipelineRequest) { - return func(r *LogstashGetPipelineRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f LogstashGetPipeline) WithErrorTrace() func(*LogstashGetPipelineRequest) { - return func(r *LogstashGetPipelineRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f LogstashGetPipeline) WithFilterPath(v ...string) func(*LogstashGetPipelineRequest) { - return func(r *LogstashGetPipelineRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f LogstashGetPipeline) WithHeader(h map[string]string) func(*LogstashGetPipelineRequest) { - return func(r *LogstashGetPipelineRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f LogstashGetPipeline) WithOpaqueID(s string) func(*LogstashGetPipelineRequest) { - return func(r *LogstashGetPipelineRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.logstash.put_pipeline.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.logstash.put_pipeline.go deleted file mode 100644 index b609c0233..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.logstash.put_pipeline.go +++ /dev/null @@ -1,210 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" -) - -func newLogstashPutPipelineFunc(t Transport) LogstashPutPipeline { - return func(id string, body io.Reader, o ...func(*LogstashPutPipelineRequest)) (*Response, error) { - var r = LogstashPutPipelineRequest{DocumentID: id, Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// LogstashPutPipeline - Adds and updates Logstash Pipelines used for Central Management -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/logstash-api-put-pipeline.html. -// -type LogstashPutPipeline func(id string, body io.Reader, o ...func(*LogstashPutPipelineRequest)) (*Response, error) - -// LogstashPutPipelineRequest configures the Logstash Put Pipeline API request. -// -type LogstashPutPipelineRequest struct { - DocumentID string - - Body io.Reader - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r LogstashPutPipelineRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - path.Grow(1 + len("_logstash") + 1 + len("pipeline") + 1 + len(r.DocumentID)) - path.WriteString("/") - path.WriteString("_logstash") - path.WriteString("/") - path.WriteString("pipeline") - path.WriteString("/") - path.WriteString(r.DocumentID) - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f LogstashPutPipeline) WithContext(v context.Context) func(*LogstashPutPipelineRequest) { - return func(r *LogstashPutPipelineRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f LogstashPutPipeline) WithPretty() func(*LogstashPutPipelineRequest) { - return func(r *LogstashPutPipelineRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f LogstashPutPipeline) WithHuman() func(*LogstashPutPipelineRequest) { - return func(r *LogstashPutPipelineRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f LogstashPutPipeline) WithErrorTrace() func(*LogstashPutPipelineRequest) { - return func(r *LogstashPutPipelineRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f LogstashPutPipeline) WithFilterPath(v ...string) func(*LogstashPutPipelineRequest) { - return func(r *LogstashPutPipelineRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f LogstashPutPipeline) WithHeader(h map[string]string) func(*LogstashPutPipelineRequest) { - return func(r *LogstashPutPipelineRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f LogstashPutPipeline) WithOpaqueID(s string) func(*LogstashPutPipelineRequest) { - return func(r *LogstashPutPipelineRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.migration.deprecations.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.migration.deprecations.go deleted file mode 100644 index f9e2ad7f3..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.migration.deprecations.go +++ /dev/null @@ -1,213 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newMigrationDeprecationsFunc(t Transport) MigrationDeprecations { - return func(o ...func(*MigrationDeprecationsRequest)) (*Response, error) { - var r = MigrationDeprecationsRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MigrationDeprecations - Retrieves information about different cluster, node, and index level settings that use deprecated features that will be removed or changed in the next major version. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/migration-api-deprecation.html. -// -type MigrationDeprecations func(o ...func(*MigrationDeprecationsRequest)) (*Response, error) - -// MigrationDeprecationsRequest configures the Migration Deprecations API request. -// -type MigrationDeprecationsRequest struct { - Index string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MigrationDeprecationsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len(r.Index) + 1 + len("_migration") + 1 + len("deprecations")) - if r.Index != "" { - path.WriteString("/") - path.WriteString(r.Index) - } - path.WriteString("/") - path.WriteString("_migration") - path.WriteString("/") - path.WriteString("deprecations") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MigrationDeprecations) WithContext(v context.Context) func(*MigrationDeprecationsRequest) { - return func(r *MigrationDeprecationsRequest) { - r.ctx = v - } -} - -// WithIndex - index pattern. -// -func (f MigrationDeprecations) WithIndex(v string) func(*MigrationDeprecationsRequest) { - return func(r *MigrationDeprecationsRequest) { - r.Index = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MigrationDeprecations) WithPretty() func(*MigrationDeprecationsRequest) { - return func(r *MigrationDeprecationsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MigrationDeprecations) WithHuman() func(*MigrationDeprecationsRequest) { - return func(r *MigrationDeprecationsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MigrationDeprecations) WithErrorTrace() func(*MigrationDeprecationsRequest) { - return func(r *MigrationDeprecationsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MigrationDeprecations) WithFilterPath(v ...string) func(*MigrationDeprecationsRequest) { - return func(r *MigrationDeprecationsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MigrationDeprecations) WithHeader(h map[string]string) func(*MigrationDeprecationsRequest) { - return func(r *MigrationDeprecationsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MigrationDeprecations) WithOpaqueID(s string) func(*MigrationDeprecationsRequest) { - return func(r *MigrationDeprecationsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.close_job.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.close_job.go deleted file mode 100644 index 785d8f6ff..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.close_job.go +++ /dev/null @@ -1,275 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" - "time" -) - -func newMLCloseJobFunc(t Transport) MLCloseJob { - return func(job_id string, o ...func(*MLCloseJobRequest)) (*Response, error) { - var r = MLCloseJobRequest{JobID: job_id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLCloseJob - Closes one or more anomaly detection jobs. A job can be opened and closed multiple times throughout its lifecycle. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-close-job.html. -// -type MLCloseJob func(job_id string, o ...func(*MLCloseJobRequest)) (*Response, error) - -// MLCloseJobRequest configures the ML Close Job API request. -// -type MLCloseJobRequest struct { - Body io.Reader - - JobID string - - AllowNoJobs *bool - AllowNoMatch *bool - Force *bool - Timeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLCloseJobRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_ml") + 1 + len("anomaly_detectors") + 1 + len(r.JobID) + 1 + len("_close")) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("anomaly_detectors") - path.WriteString("/") - path.WriteString(r.JobID) - path.WriteString("/") - path.WriteString("_close") - - params = make(map[string]string) - - if r.AllowNoJobs != nil { - params["allow_no_jobs"] = strconv.FormatBool(*r.AllowNoJobs) - } - - if r.AllowNoMatch != nil { - params["allow_no_match"] = strconv.FormatBool(*r.AllowNoMatch) - } - - if r.Force != nil { - params["force"] = strconv.FormatBool(*r.Force) - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLCloseJob) WithContext(v context.Context) func(*MLCloseJobRequest) { - return func(r *MLCloseJobRequest) { - r.ctx = v - } -} - -// WithBody - The URL params optionally sent in the body. -// -func (f MLCloseJob) WithBody(v io.Reader) func(*MLCloseJobRequest) { - return func(r *MLCloseJobRequest) { - r.Body = v - } -} - -// WithAllowNoJobs - whether to ignore if a wildcard expression matches no jobs. (this includes `_all` string or when no jobs have been specified). -// -func (f MLCloseJob) WithAllowNoJobs(v bool) func(*MLCloseJobRequest) { - return func(r *MLCloseJobRequest) { - r.AllowNoJobs = &v - } -} - -// WithAllowNoMatch - whether to ignore if a wildcard expression matches no jobs. (this includes `_all` string or when no jobs have been specified). -// -func (f MLCloseJob) WithAllowNoMatch(v bool) func(*MLCloseJobRequest) { - return func(r *MLCloseJobRequest) { - r.AllowNoMatch = &v - } -} - -// WithForce - true if the job should be forcefully closed. -// -func (f MLCloseJob) WithForce(v bool) func(*MLCloseJobRequest) { - return func(r *MLCloseJobRequest) { - r.Force = &v - } -} - -// WithTimeout - controls the time to wait until a job has closed. default to 30 minutes. -// -func (f MLCloseJob) WithTimeout(v time.Duration) func(*MLCloseJobRequest) { - return func(r *MLCloseJobRequest) { - r.Timeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLCloseJob) WithPretty() func(*MLCloseJobRequest) { - return func(r *MLCloseJobRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLCloseJob) WithHuman() func(*MLCloseJobRequest) { - return func(r *MLCloseJobRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLCloseJob) WithErrorTrace() func(*MLCloseJobRequest) { - return func(r *MLCloseJobRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLCloseJob) WithFilterPath(v ...string) func(*MLCloseJobRequest) { - return func(r *MLCloseJobRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLCloseJob) WithHeader(h map[string]string) func(*MLCloseJobRequest) { - return func(r *MLCloseJobRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLCloseJob) WithOpaqueID(s string) func(*MLCloseJobRequest) { - return func(r *MLCloseJobRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.delete_calendar.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.delete_calendar.go deleted file mode 100644 index a0ea460c4..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.delete_calendar.go +++ /dev/null @@ -1,203 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newMLDeleteCalendarFunc(t Transport) MLDeleteCalendar { - return func(calendar_id string, o ...func(*MLDeleteCalendarRequest)) (*Response, error) { - var r = MLDeleteCalendarRequest{CalendarID: calendar_id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLDeleteCalendar - Deletes a calendar. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-calendar.html. -// -type MLDeleteCalendar func(calendar_id string, o ...func(*MLDeleteCalendarRequest)) (*Response, error) - -// MLDeleteCalendarRequest configures the ML Delete Calendar API request. -// -type MLDeleteCalendarRequest struct { - CalendarID string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLDeleteCalendarRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "DELETE" - - path.Grow(1 + len("_ml") + 1 + len("calendars") + 1 + len(r.CalendarID)) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("calendars") - path.WriteString("/") - path.WriteString(r.CalendarID) - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLDeleteCalendar) WithContext(v context.Context) func(*MLDeleteCalendarRequest) { - return func(r *MLDeleteCalendarRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLDeleteCalendar) WithPretty() func(*MLDeleteCalendarRequest) { - return func(r *MLDeleteCalendarRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLDeleteCalendar) WithHuman() func(*MLDeleteCalendarRequest) { - return func(r *MLDeleteCalendarRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLDeleteCalendar) WithErrorTrace() func(*MLDeleteCalendarRequest) { - return func(r *MLDeleteCalendarRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLDeleteCalendar) WithFilterPath(v ...string) func(*MLDeleteCalendarRequest) { - return func(r *MLDeleteCalendarRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLDeleteCalendar) WithHeader(h map[string]string) func(*MLDeleteCalendarRequest) { - return func(r *MLDeleteCalendarRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLDeleteCalendar) WithOpaqueID(s string) func(*MLDeleteCalendarRequest) { - return func(r *MLDeleteCalendarRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.delete_calendar_event.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.delete_calendar_event.go deleted file mode 100644 index 0ec314295..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.delete_calendar_event.go +++ /dev/null @@ -1,208 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newMLDeleteCalendarEventFunc(t Transport) MLDeleteCalendarEvent { - return func(calendar_id string, event_id string, o ...func(*MLDeleteCalendarEventRequest)) (*Response, error) { - var r = MLDeleteCalendarEventRequest{CalendarID: calendar_id, EventID: event_id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLDeleteCalendarEvent - Deletes scheduled events from a calendar. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-calendar-event.html. -// -type MLDeleteCalendarEvent func(calendar_id string, event_id string, o ...func(*MLDeleteCalendarEventRequest)) (*Response, error) - -// MLDeleteCalendarEventRequest configures the ML Delete Calendar Event API request. -// -type MLDeleteCalendarEventRequest struct { - CalendarID string - EventID string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLDeleteCalendarEventRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "DELETE" - - path.Grow(1 + len("_ml") + 1 + len("calendars") + 1 + len(r.CalendarID) + 1 + len("events") + 1 + len(r.EventID)) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("calendars") - path.WriteString("/") - path.WriteString(r.CalendarID) - path.WriteString("/") - path.WriteString("events") - path.WriteString("/") - path.WriteString(r.EventID) - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLDeleteCalendarEvent) WithContext(v context.Context) func(*MLDeleteCalendarEventRequest) { - return func(r *MLDeleteCalendarEventRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLDeleteCalendarEvent) WithPretty() func(*MLDeleteCalendarEventRequest) { - return func(r *MLDeleteCalendarEventRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLDeleteCalendarEvent) WithHuman() func(*MLDeleteCalendarEventRequest) { - return func(r *MLDeleteCalendarEventRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLDeleteCalendarEvent) WithErrorTrace() func(*MLDeleteCalendarEventRequest) { - return func(r *MLDeleteCalendarEventRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLDeleteCalendarEvent) WithFilterPath(v ...string) func(*MLDeleteCalendarEventRequest) { - return func(r *MLDeleteCalendarEventRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLDeleteCalendarEvent) WithHeader(h map[string]string) func(*MLDeleteCalendarEventRequest) { - return func(r *MLDeleteCalendarEventRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLDeleteCalendarEvent) WithOpaqueID(s string) func(*MLDeleteCalendarEventRequest) { - return func(r *MLDeleteCalendarEventRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.delete_calendar_job.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.delete_calendar_job.go deleted file mode 100644 index bd013043e..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.delete_calendar_job.go +++ /dev/null @@ -1,208 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newMLDeleteCalendarJobFunc(t Transport) MLDeleteCalendarJob { - return func(calendar_id string, job_id string, o ...func(*MLDeleteCalendarJobRequest)) (*Response, error) { - var r = MLDeleteCalendarJobRequest{CalendarID: calendar_id, JobID: job_id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLDeleteCalendarJob - Deletes anomaly detection jobs from a calendar. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-calendar-job.html. -// -type MLDeleteCalendarJob func(calendar_id string, job_id string, o ...func(*MLDeleteCalendarJobRequest)) (*Response, error) - -// MLDeleteCalendarJobRequest configures the ML Delete Calendar Job API request. -// -type MLDeleteCalendarJobRequest struct { - CalendarID string - JobID string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLDeleteCalendarJobRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "DELETE" - - path.Grow(1 + len("_ml") + 1 + len("calendars") + 1 + len(r.CalendarID) + 1 + len("jobs") + 1 + len(r.JobID)) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("calendars") - path.WriteString("/") - path.WriteString(r.CalendarID) - path.WriteString("/") - path.WriteString("jobs") - path.WriteString("/") - path.WriteString(r.JobID) - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLDeleteCalendarJob) WithContext(v context.Context) func(*MLDeleteCalendarJobRequest) { - return func(r *MLDeleteCalendarJobRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLDeleteCalendarJob) WithPretty() func(*MLDeleteCalendarJobRequest) { - return func(r *MLDeleteCalendarJobRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLDeleteCalendarJob) WithHuman() func(*MLDeleteCalendarJobRequest) { - return func(r *MLDeleteCalendarJobRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLDeleteCalendarJob) WithErrorTrace() func(*MLDeleteCalendarJobRequest) { - return func(r *MLDeleteCalendarJobRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLDeleteCalendarJob) WithFilterPath(v ...string) func(*MLDeleteCalendarJobRequest) { - return func(r *MLDeleteCalendarJobRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLDeleteCalendarJob) WithHeader(h map[string]string) func(*MLDeleteCalendarJobRequest) { - return func(r *MLDeleteCalendarJobRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLDeleteCalendarJob) WithOpaqueID(s string) func(*MLDeleteCalendarJobRequest) { - return func(r *MLDeleteCalendarJobRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.delete_data_frame_analytics.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.delete_data_frame_analytics.go deleted file mode 100644 index 4ad8c2ebc..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.delete_data_frame_analytics.go +++ /dev/null @@ -1,234 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" - "time" -) - -func newMLDeleteDataFrameAnalyticsFunc(t Transport) MLDeleteDataFrameAnalytics { - return func(id string, o ...func(*MLDeleteDataFrameAnalyticsRequest)) (*Response, error) { - var r = MLDeleteDataFrameAnalyticsRequest{ID: id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLDeleteDataFrameAnalytics - Deletes an existing data frame analytics job. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-dfanalytics.html. -// -type MLDeleteDataFrameAnalytics func(id string, o ...func(*MLDeleteDataFrameAnalyticsRequest)) (*Response, error) - -// MLDeleteDataFrameAnalyticsRequest configures the ML Delete Data Frame Analytics API request. -// -type MLDeleteDataFrameAnalyticsRequest struct { - ID string - - Force *bool - Timeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLDeleteDataFrameAnalyticsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "DELETE" - - path.Grow(1 + len("_ml") + 1 + len("data_frame") + 1 + len("analytics") + 1 + len(r.ID)) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("data_frame") - path.WriteString("/") - path.WriteString("analytics") - path.WriteString("/") - path.WriteString(r.ID) - - params = make(map[string]string) - - if r.Force != nil { - params["force"] = strconv.FormatBool(*r.Force) - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLDeleteDataFrameAnalytics) WithContext(v context.Context) func(*MLDeleteDataFrameAnalyticsRequest) { - return func(r *MLDeleteDataFrameAnalyticsRequest) { - r.ctx = v - } -} - -// WithForce - true if the job should be forcefully deleted. -// -func (f MLDeleteDataFrameAnalytics) WithForce(v bool) func(*MLDeleteDataFrameAnalyticsRequest) { - return func(r *MLDeleteDataFrameAnalyticsRequest) { - r.Force = &v - } -} - -// WithTimeout - controls the time to wait until a job is deleted. defaults to 1 minute. -// -func (f MLDeleteDataFrameAnalytics) WithTimeout(v time.Duration) func(*MLDeleteDataFrameAnalyticsRequest) { - return func(r *MLDeleteDataFrameAnalyticsRequest) { - r.Timeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLDeleteDataFrameAnalytics) WithPretty() func(*MLDeleteDataFrameAnalyticsRequest) { - return func(r *MLDeleteDataFrameAnalyticsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLDeleteDataFrameAnalytics) WithHuman() func(*MLDeleteDataFrameAnalyticsRequest) { - return func(r *MLDeleteDataFrameAnalyticsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLDeleteDataFrameAnalytics) WithErrorTrace() func(*MLDeleteDataFrameAnalyticsRequest) { - return func(r *MLDeleteDataFrameAnalyticsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLDeleteDataFrameAnalytics) WithFilterPath(v ...string) func(*MLDeleteDataFrameAnalyticsRequest) { - return func(r *MLDeleteDataFrameAnalyticsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLDeleteDataFrameAnalytics) WithHeader(h map[string]string) func(*MLDeleteDataFrameAnalyticsRequest) { - return func(r *MLDeleteDataFrameAnalyticsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLDeleteDataFrameAnalytics) WithOpaqueID(s string) func(*MLDeleteDataFrameAnalyticsRequest) { - return func(r *MLDeleteDataFrameAnalyticsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.delete_datafeed.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.delete_datafeed.go deleted file mode 100644 index d9517e3b8..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.delete_datafeed.go +++ /dev/null @@ -1,218 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newMLDeleteDatafeedFunc(t Transport) MLDeleteDatafeed { - return func(datafeed_id string, o ...func(*MLDeleteDatafeedRequest)) (*Response, error) { - var r = MLDeleteDatafeedRequest{DatafeedID: datafeed_id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLDeleteDatafeed - Deletes an existing datafeed. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-datafeed.html. -// -type MLDeleteDatafeed func(datafeed_id string, o ...func(*MLDeleteDatafeedRequest)) (*Response, error) - -// MLDeleteDatafeedRequest configures the ML Delete Datafeed API request. -// -type MLDeleteDatafeedRequest struct { - DatafeedID string - - Force *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLDeleteDatafeedRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "DELETE" - - path.Grow(1 + len("_ml") + 1 + len("datafeeds") + 1 + len(r.DatafeedID)) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("datafeeds") - path.WriteString("/") - path.WriteString(r.DatafeedID) - - params = make(map[string]string) - - if r.Force != nil { - params["force"] = strconv.FormatBool(*r.Force) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLDeleteDatafeed) WithContext(v context.Context) func(*MLDeleteDatafeedRequest) { - return func(r *MLDeleteDatafeedRequest) { - r.ctx = v - } -} - -// WithForce - true if the datafeed should be forcefully deleted. -// -func (f MLDeleteDatafeed) WithForce(v bool) func(*MLDeleteDatafeedRequest) { - return func(r *MLDeleteDatafeedRequest) { - r.Force = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLDeleteDatafeed) WithPretty() func(*MLDeleteDatafeedRequest) { - return func(r *MLDeleteDatafeedRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLDeleteDatafeed) WithHuman() func(*MLDeleteDatafeedRequest) { - return func(r *MLDeleteDatafeedRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLDeleteDatafeed) WithErrorTrace() func(*MLDeleteDatafeedRequest) { - return func(r *MLDeleteDatafeedRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLDeleteDatafeed) WithFilterPath(v ...string) func(*MLDeleteDatafeedRequest) { - return func(r *MLDeleteDatafeedRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLDeleteDatafeed) WithHeader(h map[string]string) func(*MLDeleteDatafeedRequest) { - return func(r *MLDeleteDatafeedRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLDeleteDatafeed) WithOpaqueID(s string) func(*MLDeleteDatafeedRequest) { - return func(r *MLDeleteDatafeedRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.delete_expired_data.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.delete_expired_data.go deleted file mode 100644 index 1a068545d..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.delete_expired_data.go +++ /dev/null @@ -1,257 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" - "time" -) - -func newMLDeleteExpiredDataFunc(t Transport) MLDeleteExpiredData { - return func(o ...func(*MLDeleteExpiredDataRequest)) (*Response, error) { - var r = MLDeleteExpiredDataRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLDeleteExpiredData - Deletes expired and unused machine learning data. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-expired-data.html. -// -type MLDeleteExpiredData func(o ...func(*MLDeleteExpiredDataRequest)) (*Response, error) - -// MLDeleteExpiredDataRequest configures the ML Delete Expired Data API request. -// -type MLDeleteExpiredDataRequest struct { - Body io.Reader - - JobID string - - RequestsPerSecond *int - Timeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLDeleteExpiredDataRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "DELETE" - - path.Grow(1 + len("_ml") + 1 + len("_delete_expired_data") + 1 + len(r.JobID)) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("_delete_expired_data") - if r.JobID != "" { - path.WriteString("/") - path.WriteString(r.JobID) - } - - params = make(map[string]string) - - if r.RequestsPerSecond != nil { - params["requests_per_second"] = strconv.FormatInt(int64(*r.RequestsPerSecond), 10) - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLDeleteExpiredData) WithContext(v context.Context) func(*MLDeleteExpiredDataRequest) { - return func(r *MLDeleteExpiredDataRequest) { - r.ctx = v - } -} - -// WithBody - deleting expired data parameters. -// -func (f MLDeleteExpiredData) WithBody(v io.Reader) func(*MLDeleteExpiredDataRequest) { - return func(r *MLDeleteExpiredDataRequest) { - r.Body = v - } -} - -// WithJobID - the ID of the job(s) to perform expired data hygiene for. -// -func (f MLDeleteExpiredData) WithJobID(v string) func(*MLDeleteExpiredDataRequest) { - return func(r *MLDeleteExpiredDataRequest) { - r.JobID = v - } -} - -// WithRequestsPerSecond - the desired requests per second for the deletion processes.. -// -func (f MLDeleteExpiredData) WithRequestsPerSecond(v int) func(*MLDeleteExpiredDataRequest) { - return func(r *MLDeleteExpiredDataRequest) { - r.RequestsPerSecond = &v - } -} - -// WithTimeout - how long can the underlying delete processes run until they are canceled. -// -func (f MLDeleteExpiredData) WithTimeout(v time.Duration) func(*MLDeleteExpiredDataRequest) { - return func(r *MLDeleteExpiredDataRequest) { - r.Timeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLDeleteExpiredData) WithPretty() func(*MLDeleteExpiredDataRequest) { - return func(r *MLDeleteExpiredDataRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLDeleteExpiredData) WithHuman() func(*MLDeleteExpiredDataRequest) { - return func(r *MLDeleteExpiredDataRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLDeleteExpiredData) WithErrorTrace() func(*MLDeleteExpiredDataRequest) { - return func(r *MLDeleteExpiredDataRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLDeleteExpiredData) WithFilterPath(v ...string) func(*MLDeleteExpiredDataRequest) { - return func(r *MLDeleteExpiredDataRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLDeleteExpiredData) WithHeader(h map[string]string) func(*MLDeleteExpiredDataRequest) { - return func(r *MLDeleteExpiredDataRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLDeleteExpiredData) WithOpaqueID(s string) func(*MLDeleteExpiredDataRequest) { - return func(r *MLDeleteExpiredDataRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.delete_filter.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.delete_filter.go deleted file mode 100644 index fe67f26ce..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.delete_filter.go +++ /dev/null @@ -1,203 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newMLDeleteFilterFunc(t Transport) MLDeleteFilter { - return func(filter_id string, o ...func(*MLDeleteFilterRequest)) (*Response, error) { - var r = MLDeleteFilterRequest{FilterID: filter_id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLDeleteFilter - Deletes a filter. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-filter.html. -// -type MLDeleteFilter func(filter_id string, o ...func(*MLDeleteFilterRequest)) (*Response, error) - -// MLDeleteFilterRequest configures the ML Delete Filter API request. -// -type MLDeleteFilterRequest struct { - FilterID string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLDeleteFilterRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "DELETE" - - path.Grow(1 + len("_ml") + 1 + len("filters") + 1 + len(r.FilterID)) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("filters") - path.WriteString("/") - path.WriteString(r.FilterID) - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLDeleteFilter) WithContext(v context.Context) func(*MLDeleteFilterRequest) { - return func(r *MLDeleteFilterRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLDeleteFilter) WithPretty() func(*MLDeleteFilterRequest) { - return func(r *MLDeleteFilterRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLDeleteFilter) WithHuman() func(*MLDeleteFilterRequest) { - return func(r *MLDeleteFilterRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLDeleteFilter) WithErrorTrace() func(*MLDeleteFilterRequest) { - return func(r *MLDeleteFilterRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLDeleteFilter) WithFilterPath(v ...string) func(*MLDeleteFilterRequest) { - return func(r *MLDeleteFilterRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLDeleteFilter) WithHeader(h map[string]string) func(*MLDeleteFilterRequest) { - return func(r *MLDeleteFilterRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLDeleteFilter) WithOpaqueID(s string) func(*MLDeleteFilterRequest) { - return func(r *MLDeleteFilterRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.delete_forecast.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.delete_forecast.go deleted file mode 100644 index 027850983..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.delete_forecast.go +++ /dev/null @@ -1,247 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" - "time" -) - -func newMLDeleteForecastFunc(t Transport) MLDeleteForecast { - return func(job_id string, o ...func(*MLDeleteForecastRequest)) (*Response, error) { - var r = MLDeleteForecastRequest{JobID: job_id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLDeleteForecast - Deletes forecasts from a machine learning job. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-forecast.html. -// -type MLDeleteForecast func(job_id string, o ...func(*MLDeleteForecastRequest)) (*Response, error) - -// MLDeleteForecastRequest configures the ML Delete Forecast API request. -// -type MLDeleteForecastRequest struct { - ForecastID string - JobID string - - AllowNoForecasts *bool - Timeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLDeleteForecastRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "DELETE" - - path.Grow(1 + len("_ml") + 1 + len("anomaly_detectors") + 1 + len(r.JobID) + 1 + len("_forecast") + 1 + len(r.ForecastID)) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("anomaly_detectors") - path.WriteString("/") - path.WriteString(r.JobID) - path.WriteString("/") - path.WriteString("_forecast") - if r.ForecastID != "" { - path.WriteString("/") - path.WriteString(r.ForecastID) - } - - params = make(map[string]string) - - if r.AllowNoForecasts != nil { - params["allow_no_forecasts"] = strconv.FormatBool(*r.AllowNoForecasts) - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLDeleteForecast) WithContext(v context.Context) func(*MLDeleteForecastRequest) { - return func(r *MLDeleteForecastRequest) { - r.ctx = v - } -} - -// WithForecastID - the ID of the forecast to delete, can be comma delimited list. leaving blank implies `_all`. -// -func (f MLDeleteForecast) WithForecastID(v string) func(*MLDeleteForecastRequest) { - return func(r *MLDeleteForecastRequest) { - r.ForecastID = v - } -} - -// WithAllowNoForecasts - whether to ignore if `_all` matches no forecasts. -// -func (f MLDeleteForecast) WithAllowNoForecasts(v bool) func(*MLDeleteForecastRequest) { - return func(r *MLDeleteForecastRequest) { - r.AllowNoForecasts = &v - } -} - -// WithTimeout - controls the time to wait until the forecast(s) are deleted. default to 30 seconds. -// -func (f MLDeleteForecast) WithTimeout(v time.Duration) func(*MLDeleteForecastRequest) { - return func(r *MLDeleteForecastRequest) { - r.Timeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLDeleteForecast) WithPretty() func(*MLDeleteForecastRequest) { - return func(r *MLDeleteForecastRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLDeleteForecast) WithHuman() func(*MLDeleteForecastRequest) { - return func(r *MLDeleteForecastRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLDeleteForecast) WithErrorTrace() func(*MLDeleteForecastRequest) { - return func(r *MLDeleteForecastRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLDeleteForecast) WithFilterPath(v ...string) func(*MLDeleteForecastRequest) { - return func(r *MLDeleteForecastRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLDeleteForecast) WithHeader(h map[string]string) func(*MLDeleteForecastRequest) { - return func(r *MLDeleteForecastRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLDeleteForecast) WithOpaqueID(s string) func(*MLDeleteForecastRequest) { - return func(r *MLDeleteForecastRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.delete_job.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.delete_job.go deleted file mode 100644 index bbf2feed7..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.delete_job.go +++ /dev/null @@ -1,231 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newMLDeleteJobFunc(t Transport) MLDeleteJob { - return func(job_id string, o ...func(*MLDeleteJobRequest)) (*Response, error) { - var r = MLDeleteJobRequest{JobID: job_id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLDeleteJob - Deletes an existing anomaly detection job. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-job.html. -// -type MLDeleteJob func(job_id string, o ...func(*MLDeleteJobRequest)) (*Response, error) - -// MLDeleteJobRequest configures the ML Delete Job API request. -// -type MLDeleteJobRequest struct { - JobID string - - Force *bool - WaitForCompletion *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLDeleteJobRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "DELETE" - - path.Grow(1 + len("_ml") + 1 + len("anomaly_detectors") + 1 + len(r.JobID)) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("anomaly_detectors") - path.WriteString("/") - path.WriteString(r.JobID) - - params = make(map[string]string) - - if r.Force != nil { - params["force"] = strconv.FormatBool(*r.Force) - } - - if r.WaitForCompletion != nil { - params["wait_for_completion"] = strconv.FormatBool(*r.WaitForCompletion) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLDeleteJob) WithContext(v context.Context) func(*MLDeleteJobRequest) { - return func(r *MLDeleteJobRequest) { - r.ctx = v - } -} - -// WithForce - true if the job should be forcefully deleted. -// -func (f MLDeleteJob) WithForce(v bool) func(*MLDeleteJobRequest) { - return func(r *MLDeleteJobRequest) { - r.Force = &v - } -} - -// WithWaitForCompletion - should this request wait until the operation has completed before returning. -// -func (f MLDeleteJob) WithWaitForCompletion(v bool) func(*MLDeleteJobRequest) { - return func(r *MLDeleteJobRequest) { - r.WaitForCompletion = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLDeleteJob) WithPretty() func(*MLDeleteJobRequest) { - return func(r *MLDeleteJobRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLDeleteJob) WithHuman() func(*MLDeleteJobRequest) { - return func(r *MLDeleteJobRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLDeleteJob) WithErrorTrace() func(*MLDeleteJobRequest) { - return func(r *MLDeleteJobRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLDeleteJob) WithFilterPath(v ...string) func(*MLDeleteJobRequest) { - return func(r *MLDeleteJobRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLDeleteJob) WithHeader(h map[string]string) func(*MLDeleteJobRequest) { - return func(r *MLDeleteJobRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLDeleteJob) WithOpaqueID(s string) func(*MLDeleteJobRequest) { - return func(r *MLDeleteJobRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.delete_model_snapshot.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.delete_model_snapshot.go deleted file mode 100644 index 1b52e36fa..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.delete_model_snapshot.go +++ /dev/null @@ -1,208 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newMLDeleteModelSnapshotFunc(t Transport) MLDeleteModelSnapshot { - return func(snapshot_id string, job_id string, o ...func(*MLDeleteModelSnapshotRequest)) (*Response, error) { - var r = MLDeleteModelSnapshotRequest{SnapshotID: snapshot_id, JobID: job_id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLDeleteModelSnapshot - Deletes an existing model snapshot. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-snapshot.html. -// -type MLDeleteModelSnapshot func(snapshot_id string, job_id string, o ...func(*MLDeleteModelSnapshotRequest)) (*Response, error) - -// MLDeleteModelSnapshotRequest configures the ML Delete Model Snapshot API request. -// -type MLDeleteModelSnapshotRequest struct { - JobID string - SnapshotID string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLDeleteModelSnapshotRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "DELETE" - - path.Grow(1 + len("_ml") + 1 + len("anomaly_detectors") + 1 + len(r.JobID) + 1 + len("model_snapshots") + 1 + len(r.SnapshotID)) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("anomaly_detectors") - path.WriteString("/") - path.WriteString(r.JobID) - path.WriteString("/") - path.WriteString("model_snapshots") - path.WriteString("/") - path.WriteString(r.SnapshotID) - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLDeleteModelSnapshot) WithContext(v context.Context) func(*MLDeleteModelSnapshotRequest) { - return func(r *MLDeleteModelSnapshotRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLDeleteModelSnapshot) WithPretty() func(*MLDeleteModelSnapshotRequest) { - return func(r *MLDeleteModelSnapshotRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLDeleteModelSnapshot) WithHuman() func(*MLDeleteModelSnapshotRequest) { - return func(r *MLDeleteModelSnapshotRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLDeleteModelSnapshot) WithErrorTrace() func(*MLDeleteModelSnapshotRequest) { - return func(r *MLDeleteModelSnapshotRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLDeleteModelSnapshot) WithFilterPath(v ...string) func(*MLDeleteModelSnapshotRequest) { - return func(r *MLDeleteModelSnapshotRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLDeleteModelSnapshot) WithHeader(h map[string]string) func(*MLDeleteModelSnapshotRequest) { - return func(r *MLDeleteModelSnapshotRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLDeleteModelSnapshot) WithOpaqueID(s string) func(*MLDeleteModelSnapshotRequest) { - return func(r *MLDeleteModelSnapshotRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.delete_trained_model.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.delete_trained_model.go deleted file mode 100644 index 5d206c248..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.delete_trained_model.go +++ /dev/null @@ -1,203 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newMLDeleteTrainedModelFunc(t Transport) MLDeleteTrainedModel { - return func(model_id string, o ...func(*MLDeleteTrainedModelRequest)) (*Response, error) { - var r = MLDeleteTrainedModelRequest{ModelID: model_id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLDeleteTrainedModel - Deletes an existing trained inference model that is currently not referenced by an ingest pipeline. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-trained-models.html. -// -type MLDeleteTrainedModel func(model_id string, o ...func(*MLDeleteTrainedModelRequest)) (*Response, error) - -// MLDeleteTrainedModelRequest configures the ML Delete Trained Model API request. -// -type MLDeleteTrainedModelRequest struct { - ModelID string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLDeleteTrainedModelRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "DELETE" - - path.Grow(1 + len("_ml") + 1 + len("trained_models") + 1 + len(r.ModelID)) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("trained_models") - path.WriteString("/") - path.WriteString(r.ModelID) - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLDeleteTrainedModel) WithContext(v context.Context) func(*MLDeleteTrainedModelRequest) { - return func(r *MLDeleteTrainedModelRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLDeleteTrainedModel) WithPretty() func(*MLDeleteTrainedModelRequest) { - return func(r *MLDeleteTrainedModelRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLDeleteTrainedModel) WithHuman() func(*MLDeleteTrainedModelRequest) { - return func(r *MLDeleteTrainedModelRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLDeleteTrainedModel) WithErrorTrace() func(*MLDeleteTrainedModelRequest) { - return func(r *MLDeleteTrainedModelRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLDeleteTrainedModel) WithFilterPath(v ...string) func(*MLDeleteTrainedModelRequest) { - return func(r *MLDeleteTrainedModelRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLDeleteTrainedModel) WithHeader(h map[string]string) func(*MLDeleteTrainedModelRequest) { - return func(r *MLDeleteTrainedModelRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLDeleteTrainedModel) WithOpaqueID(s string) func(*MLDeleteTrainedModelRequest) { - return func(r *MLDeleteTrainedModelRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.delete_trained_model_alias.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.delete_trained_model_alias.go deleted file mode 100644 index 7e5ab81d5..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.delete_trained_model_alias.go +++ /dev/null @@ -1,208 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newMLDeleteTrainedModelAliasFunc(t Transport) MLDeleteTrainedModelAlias { - return func(model_alias string, model_id string, o ...func(*MLDeleteTrainedModelAliasRequest)) (*Response, error) { - var r = MLDeleteTrainedModelAliasRequest{ModelAlias: model_alias, ModelID: model_id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLDeleteTrainedModelAlias - Deletes a model alias that refers to the trained model -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-trained-models-aliases.html. -// -type MLDeleteTrainedModelAlias func(model_alias string, model_id string, o ...func(*MLDeleteTrainedModelAliasRequest)) (*Response, error) - -// MLDeleteTrainedModelAliasRequest configures the ML Delete Trained Model Alias API request. -// -type MLDeleteTrainedModelAliasRequest struct { - ModelAlias string - ModelID string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLDeleteTrainedModelAliasRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "DELETE" - - path.Grow(1 + len("_ml") + 1 + len("trained_models") + 1 + len(r.ModelID) + 1 + len("model_aliases") + 1 + len(r.ModelAlias)) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("trained_models") - path.WriteString("/") - path.WriteString(r.ModelID) - path.WriteString("/") - path.WriteString("model_aliases") - path.WriteString("/") - path.WriteString(r.ModelAlias) - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLDeleteTrainedModelAlias) WithContext(v context.Context) func(*MLDeleteTrainedModelAliasRequest) { - return func(r *MLDeleteTrainedModelAliasRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLDeleteTrainedModelAlias) WithPretty() func(*MLDeleteTrainedModelAliasRequest) { - return func(r *MLDeleteTrainedModelAliasRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLDeleteTrainedModelAlias) WithHuman() func(*MLDeleteTrainedModelAliasRequest) { - return func(r *MLDeleteTrainedModelAliasRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLDeleteTrainedModelAlias) WithErrorTrace() func(*MLDeleteTrainedModelAliasRequest) { - return func(r *MLDeleteTrainedModelAliasRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLDeleteTrainedModelAlias) WithFilterPath(v ...string) func(*MLDeleteTrainedModelAliasRequest) { - return func(r *MLDeleteTrainedModelAliasRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLDeleteTrainedModelAlias) WithHeader(h map[string]string) func(*MLDeleteTrainedModelAliasRequest) { - return func(r *MLDeleteTrainedModelAliasRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLDeleteTrainedModelAlias) WithOpaqueID(s string) func(*MLDeleteTrainedModelAliasRequest) { - return func(r *MLDeleteTrainedModelAliasRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.estimate_model_memory.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.estimate_model_memory.go deleted file mode 100644 index 4c5138284..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.estimate_model_memory.go +++ /dev/null @@ -1,203 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" -) - -func newMLEstimateModelMemoryFunc(t Transport) MLEstimateModelMemory { - return func(body io.Reader, o ...func(*MLEstimateModelMemoryRequest)) (*Response, error) { - var r = MLEstimateModelMemoryRequest{Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLEstimateModelMemory - Estimates the model memory -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-apis.html. -// -type MLEstimateModelMemory func(body io.Reader, o ...func(*MLEstimateModelMemoryRequest)) (*Response, error) - -// MLEstimateModelMemoryRequest configures the ML Estimate Model Memory API request. -// -type MLEstimateModelMemoryRequest struct { - Body io.Reader - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLEstimateModelMemoryRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(len("/_ml/anomaly_detectors/_estimate_model_memory")) - path.WriteString("/_ml/anomaly_detectors/_estimate_model_memory") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLEstimateModelMemory) WithContext(v context.Context) func(*MLEstimateModelMemoryRequest) { - return func(r *MLEstimateModelMemoryRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLEstimateModelMemory) WithPretty() func(*MLEstimateModelMemoryRequest) { - return func(r *MLEstimateModelMemoryRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLEstimateModelMemory) WithHuman() func(*MLEstimateModelMemoryRequest) { - return func(r *MLEstimateModelMemoryRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLEstimateModelMemory) WithErrorTrace() func(*MLEstimateModelMemoryRequest) { - return func(r *MLEstimateModelMemoryRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLEstimateModelMemory) WithFilterPath(v ...string) func(*MLEstimateModelMemoryRequest) { - return func(r *MLEstimateModelMemoryRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLEstimateModelMemory) WithHeader(h map[string]string) func(*MLEstimateModelMemoryRequest) { - return func(r *MLEstimateModelMemoryRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLEstimateModelMemory) WithOpaqueID(s string) func(*MLEstimateModelMemoryRequest) { - return func(r *MLEstimateModelMemoryRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.evaluate_data_frame.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.evaluate_data_frame.go deleted file mode 100644 index e08c149d9..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.evaluate_data_frame.go +++ /dev/null @@ -1,203 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" -) - -func newMLEvaluateDataFrameFunc(t Transport) MLEvaluateDataFrame { - return func(body io.Reader, o ...func(*MLEvaluateDataFrameRequest)) (*Response, error) { - var r = MLEvaluateDataFrameRequest{Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLEvaluateDataFrame - Evaluates the data frame analytics for an annotated index. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/evaluate-dfanalytics.html. -// -type MLEvaluateDataFrame func(body io.Reader, o ...func(*MLEvaluateDataFrameRequest)) (*Response, error) - -// MLEvaluateDataFrameRequest configures the ML Evaluate Data Frame API request. -// -type MLEvaluateDataFrameRequest struct { - Body io.Reader - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLEvaluateDataFrameRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(len("/_ml/data_frame/_evaluate")) - path.WriteString("/_ml/data_frame/_evaluate") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLEvaluateDataFrame) WithContext(v context.Context) func(*MLEvaluateDataFrameRequest) { - return func(r *MLEvaluateDataFrameRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLEvaluateDataFrame) WithPretty() func(*MLEvaluateDataFrameRequest) { - return func(r *MLEvaluateDataFrameRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLEvaluateDataFrame) WithHuman() func(*MLEvaluateDataFrameRequest) { - return func(r *MLEvaluateDataFrameRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLEvaluateDataFrame) WithErrorTrace() func(*MLEvaluateDataFrameRequest) { - return func(r *MLEvaluateDataFrameRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLEvaluateDataFrame) WithFilterPath(v ...string) func(*MLEvaluateDataFrameRequest) { - return func(r *MLEvaluateDataFrameRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLEvaluateDataFrame) WithHeader(h map[string]string) func(*MLEvaluateDataFrameRequest) { - return func(r *MLEvaluateDataFrameRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLEvaluateDataFrame) WithOpaqueID(s string) func(*MLEvaluateDataFrameRequest) { - return func(r *MLEvaluateDataFrameRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.explain_data_frame_analytics.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.explain_data_frame_analytics.go deleted file mode 100644 index 45b17a506..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.explain_data_frame_analytics.go +++ /dev/null @@ -1,232 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" -) - -func newMLExplainDataFrameAnalyticsFunc(t Transport) MLExplainDataFrameAnalytics { - return func(o ...func(*MLExplainDataFrameAnalyticsRequest)) (*Response, error) { - var r = MLExplainDataFrameAnalyticsRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLExplainDataFrameAnalytics - Explains a data frame analytics config. -// -// See full documentation at http://www.elastic.co/guide/en/elasticsearch/reference/current/explain-dfanalytics.html. -// -type MLExplainDataFrameAnalytics func(o ...func(*MLExplainDataFrameAnalyticsRequest)) (*Response, error) - -// MLExplainDataFrameAnalyticsRequest configures the ML Explain Data Frame Analytics API request. -// -type MLExplainDataFrameAnalyticsRequest struct { - DocumentID string - - Body io.Reader - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLExplainDataFrameAnalyticsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_ml") + 1 + len("data_frame") + 1 + len("analytics") + 1 + len(r.DocumentID) + 1 + len("_explain")) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("data_frame") - path.WriteString("/") - path.WriteString("analytics") - if r.DocumentID != "" { - path.WriteString("/") - path.WriteString(r.DocumentID) - } - path.WriteString("/") - path.WriteString("_explain") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLExplainDataFrameAnalytics) WithContext(v context.Context) func(*MLExplainDataFrameAnalyticsRequest) { - return func(r *MLExplainDataFrameAnalyticsRequest) { - r.ctx = v - } -} - -// WithBody - The data frame analytics config to explain. -// -func (f MLExplainDataFrameAnalytics) WithBody(v io.Reader) func(*MLExplainDataFrameAnalyticsRequest) { - return func(r *MLExplainDataFrameAnalyticsRequest) { - r.Body = v - } -} - -// WithDocumentID - the ID of the data frame analytics to explain. -// -func (f MLExplainDataFrameAnalytics) WithDocumentID(v string) func(*MLExplainDataFrameAnalyticsRequest) { - return func(r *MLExplainDataFrameAnalyticsRequest) { - r.DocumentID = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLExplainDataFrameAnalytics) WithPretty() func(*MLExplainDataFrameAnalyticsRequest) { - return func(r *MLExplainDataFrameAnalyticsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLExplainDataFrameAnalytics) WithHuman() func(*MLExplainDataFrameAnalyticsRequest) { - return func(r *MLExplainDataFrameAnalyticsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLExplainDataFrameAnalytics) WithErrorTrace() func(*MLExplainDataFrameAnalyticsRequest) { - return func(r *MLExplainDataFrameAnalyticsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLExplainDataFrameAnalytics) WithFilterPath(v ...string) func(*MLExplainDataFrameAnalyticsRequest) { - return func(r *MLExplainDataFrameAnalyticsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLExplainDataFrameAnalytics) WithHeader(h map[string]string) func(*MLExplainDataFrameAnalyticsRequest) { - return func(r *MLExplainDataFrameAnalyticsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLExplainDataFrameAnalytics) WithOpaqueID(s string) func(*MLExplainDataFrameAnalyticsRequest) { - return func(r *MLExplainDataFrameAnalyticsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.find_file_structure.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.find_file_structure.go deleted file mode 100644 index 97d1594b9..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.find_file_structure.go +++ /dev/null @@ -1,390 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" - "time" -) - -func newMLFindFileStructureFunc(t Transport) MLFindFileStructure { - return func(body io.Reader, o ...func(*MLFindFileStructureRequest)) (*Response, error) { - var r = MLFindFileStructureRequest{Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLFindFileStructure - Finds the structure of a text file. The text file must contain data that is suitable to be ingested into Elasticsearch. -// -// This API is experimental. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/find-structure.html. -// -type MLFindFileStructure func(body io.Reader, o ...func(*MLFindFileStructureRequest)) (*Response, error) - -// MLFindFileStructureRequest configures the ML Find File Structure API request. -// -type MLFindFileStructureRequest struct { - Body io.Reader - - Charset string - ColumnNames []string - Delimiter string - Explain *bool - Format string - GrokPattern string - HasHeaderRow *bool - LineMergeSizeLimit *int - LinesToSample *int - Quote string - ShouldTrimFields *bool - Timeout time.Duration - TimestampField string - TimestampFormat string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLFindFileStructureRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(len("/_ml/find_file_structure")) - path.WriteString("/_ml/find_file_structure") - - params = make(map[string]string) - - if r.Charset != "" { - params["charset"] = r.Charset - } - - if len(r.ColumnNames) > 0 { - params["column_names"] = strings.Join(r.ColumnNames, ",") - } - - if r.Delimiter != "" { - params["delimiter"] = r.Delimiter - } - - if r.Explain != nil { - params["explain"] = strconv.FormatBool(*r.Explain) - } - - if r.Format != "" { - params["format"] = r.Format - } - - if r.GrokPattern != "" { - params["grok_pattern"] = r.GrokPattern - } - - if r.HasHeaderRow != nil { - params["has_header_row"] = strconv.FormatBool(*r.HasHeaderRow) - } - - if r.LineMergeSizeLimit != nil { - params["line_merge_size_limit"] = strconv.FormatInt(int64(*r.LineMergeSizeLimit), 10) - } - - if r.LinesToSample != nil { - params["lines_to_sample"] = strconv.FormatInt(int64(*r.LinesToSample), 10) - } - - if r.Quote != "" { - params["quote"] = r.Quote - } - - if r.ShouldTrimFields != nil { - params["should_trim_fields"] = strconv.FormatBool(*r.ShouldTrimFields) - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.TimestampField != "" { - params["timestamp_field"] = r.TimestampField - } - - if r.TimestampFormat != "" { - params["timestamp_format"] = r.TimestampFormat - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLFindFileStructure) WithContext(v context.Context) func(*MLFindFileStructureRequest) { - return func(r *MLFindFileStructureRequest) { - r.ctx = v - } -} - -// WithCharset - optional parameter to specify the character set of the file. -// -func (f MLFindFileStructure) WithCharset(v string) func(*MLFindFileStructureRequest) { - return func(r *MLFindFileStructureRequest) { - r.Charset = v - } -} - -// WithColumnNames - optional parameter containing a comma separated list of the column names for a delimited file. -// -func (f MLFindFileStructure) WithColumnNames(v ...string) func(*MLFindFileStructureRequest) { - return func(r *MLFindFileStructureRequest) { - r.ColumnNames = v - } -} - -// WithDelimiter - optional parameter to specify the delimiter character for a delimited file - must be a single character. -// -func (f MLFindFileStructure) WithDelimiter(v string) func(*MLFindFileStructureRequest) { - return func(r *MLFindFileStructureRequest) { - r.Delimiter = v - } -} - -// WithExplain - whether to include a commentary on how the structure was derived. -// -func (f MLFindFileStructure) WithExplain(v bool) func(*MLFindFileStructureRequest) { - return func(r *MLFindFileStructureRequest) { - r.Explain = &v - } -} - -// WithFormat - optional parameter to specify the high level file format. -// -func (f MLFindFileStructure) WithFormat(v string) func(*MLFindFileStructureRequest) { - return func(r *MLFindFileStructureRequest) { - r.Format = v - } -} - -// WithGrokPattern - optional parameter to specify the grok pattern that should be used to extract fields from messages in a semi-structured text file. -// -func (f MLFindFileStructure) WithGrokPattern(v string) func(*MLFindFileStructureRequest) { - return func(r *MLFindFileStructureRequest) { - r.GrokPattern = v - } -} - -// WithHasHeaderRow - optional parameter to specify whether a delimited file includes the column names in its first row. -// -func (f MLFindFileStructure) WithHasHeaderRow(v bool) func(*MLFindFileStructureRequest) { - return func(r *MLFindFileStructureRequest) { - r.HasHeaderRow = &v - } -} - -// WithLineMergeSizeLimit - maximum number of characters permitted in a single message when lines are merged to create messages.. -// -func (f MLFindFileStructure) WithLineMergeSizeLimit(v int) func(*MLFindFileStructureRequest) { - return func(r *MLFindFileStructureRequest) { - r.LineMergeSizeLimit = &v - } -} - -// WithLinesToSample - how many lines of the file should be included in the analysis. -// -func (f MLFindFileStructure) WithLinesToSample(v int) func(*MLFindFileStructureRequest) { - return func(r *MLFindFileStructureRequest) { - r.LinesToSample = &v - } -} - -// WithQuote - optional parameter to specify the quote character for a delimited file - must be a single character. -// -func (f MLFindFileStructure) WithQuote(v string) func(*MLFindFileStructureRequest) { - return func(r *MLFindFileStructureRequest) { - r.Quote = v - } -} - -// WithShouldTrimFields - optional parameter to specify whether the values between delimiters in a delimited file should have whitespace trimmed from them. -// -func (f MLFindFileStructure) WithShouldTrimFields(v bool) func(*MLFindFileStructureRequest) { - return func(r *MLFindFileStructureRequest) { - r.ShouldTrimFields = &v - } -} - -// WithTimeout - timeout after which the analysis will be aborted. -// -func (f MLFindFileStructure) WithTimeout(v time.Duration) func(*MLFindFileStructureRequest) { - return func(r *MLFindFileStructureRequest) { - r.Timeout = v - } -} - -// WithTimestampField - optional parameter to specify the timestamp field in the file. -// -func (f MLFindFileStructure) WithTimestampField(v string) func(*MLFindFileStructureRequest) { - return func(r *MLFindFileStructureRequest) { - r.TimestampField = v - } -} - -// WithTimestampFormat - optional parameter to specify the timestamp format in the file - may be either a joda or java time format. -// -func (f MLFindFileStructure) WithTimestampFormat(v string) func(*MLFindFileStructureRequest) { - return func(r *MLFindFileStructureRequest) { - r.TimestampFormat = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLFindFileStructure) WithPretty() func(*MLFindFileStructureRequest) { - return func(r *MLFindFileStructureRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLFindFileStructure) WithHuman() func(*MLFindFileStructureRequest) { - return func(r *MLFindFileStructureRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLFindFileStructure) WithErrorTrace() func(*MLFindFileStructureRequest) { - return func(r *MLFindFileStructureRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLFindFileStructure) WithFilterPath(v ...string) func(*MLFindFileStructureRequest) { - return func(r *MLFindFileStructureRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLFindFileStructure) WithHeader(h map[string]string) func(*MLFindFileStructureRequest) { - return func(r *MLFindFileStructureRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLFindFileStructure) WithOpaqueID(s string) func(*MLFindFileStructureRequest) { - return func(r *MLFindFileStructureRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.flush_job.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.flush_job.go deleted file mode 100644 index 59a671f69..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.flush_job.go +++ /dev/null @@ -1,287 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" -) - -func newMLFlushJobFunc(t Transport) MLFlushJob { - return func(job_id string, o ...func(*MLFlushJobRequest)) (*Response, error) { - var r = MLFlushJobRequest{JobID: job_id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLFlushJob - Forces any buffered data to be processed by the job. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-flush-job.html. -// -type MLFlushJob func(job_id string, o ...func(*MLFlushJobRequest)) (*Response, error) - -// MLFlushJobRequest configures the ML Flush Job API request. -// -type MLFlushJobRequest struct { - Body io.Reader - - JobID string - - AdvanceTime string - CalcInterim *bool - End string - SkipTime string - Start string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLFlushJobRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_ml") + 1 + len("anomaly_detectors") + 1 + len(r.JobID) + 1 + len("_flush")) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("anomaly_detectors") - path.WriteString("/") - path.WriteString(r.JobID) - path.WriteString("/") - path.WriteString("_flush") - - params = make(map[string]string) - - if r.AdvanceTime != "" { - params["advance_time"] = r.AdvanceTime - } - - if r.CalcInterim != nil { - params["calc_interim"] = strconv.FormatBool(*r.CalcInterim) - } - - if r.End != "" { - params["end"] = r.End - } - - if r.SkipTime != "" { - params["skip_time"] = r.SkipTime - } - - if r.Start != "" { - params["start"] = r.Start - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLFlushJob) WithContext(v context.Context) func(*MLFlushJobRequest) { - return func(r *MLFlushJobRequest) { - r.ctx = v - } -} - -// WithBody - Flush parameters. -// -func (f MLFlushJob) WithBody(v io.Reader) func(*MLFlushJobRequest) { - return func(r *MLFlushJobRequest) { - r.Body = v - } -} - -// WithAdvanceTime - advances time to the given value generating results and updating the model for the advanced interval. -// -func (f MLFlushJob) WithAdvanceTime(v string) func(*MLFlushJobRequest) { - return func(r *MLFlushJobRequest) { - r.AdvanceTime = v - } -} - -// WithCalcInterim - calculates interim results for the most recent bucket or all buckets within the latency period. -// -func (f MLFlushJob) WithCalcInterim(v bool) func(*MLFlushJobRequest) { - return func(r *MLFlushJobRequest) { - r.CalcInterim = &v - } -} - -// WithEnd - when used in conjunction with calc_interim, specifies the range of buckets on which to calculate interim results. -// -func (f MLFlushJob) WithEnd(v string) func(*MLFlushJobRequest) { - return func(r *MLFlushJobRequest) { - r.End = v - } -} - -// WithSkipTime - skips time to the given value without generating results or updating the model for the skipped interval. -// -func (f MLFlushJob) WithSkipTime(v string) func(*MLFlushJobRequest) { - return func(r *MLFlushJobRequest) { - r.SkipTime = v - } -} - -// WithStart - when used in conjunction with calc_interim, specifies the range of buckets on which to calculate interim results. -// -func (f MLFlushJob) WithStart(v string) func(*MLFlushJobRequest) { - return func(r *MLFlushJobRequest) { - r.Start = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLFlushJob) WithPretty() func(*MLFlushJobRequest) { - return func(r *MLFlushJobRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLFlushJob) WithHuman() func(*MLFlushJobRequest) { - return func(r *MLFlushJobRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLFlushJob) WithErrorTrace() func(*MLFlushJobRequest) { - return func(r *MLFlushJobRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLFlushJob) WithFilterPath(v ...string) func(*MLFlushJobRequest) { - return func(r *MLFlushJobRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLFlushJob) WithHeader(h map[string]string) func(*MLFlushJobRequest) { - return func(r *MLFlushJobRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLFlushJob) WithOpaqueID(s string) func(*MLFlushJobRequest) { - return func(r *MLFlushJobRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.forecast.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.forecast.go deleted file mode 100644 index 22e92c737..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.forecast.go +++ /dev/null @@ -1,246 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" - "time" -) - -func newMLForecastFunc(t Transport) MLForecast { - return func(job_id string, o ...func(*MLForecastRequest)) (*Response, error) { - var r = MLForecastRequest{JobID: job_id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLForecast - Predicts the future behavior of a time series by using its historical behavior. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-forecast.html. -// -type MLForecast func(job_id string, o ...func(*MLForecastRequest)) (*Response, error) - -// MLForecastRequest configures the ML Forecast API request. -// -type MLForecastRequest struct { - JobID string - - Duration time.Duration - ExpiresIn time.Duration - MaxModelMemory string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLForecastRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_ml") + 1 + len("anomaly_detectors") + 1 + len(r.JobID) + 1 + len("_forecast")) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("anomaly_detectors") - path.WriteString("/") - path.WriteString(r.JobID) - path.WriteString("/") - path.WriteString("_forecast") - - params = make(map[string]string) - - if r.Duration != 0 { - params["duration"] = formatDuration(r.Duration) - } - - if r.ExpiresIn != 0 { - params["expires_in"] = formatDuration(r.ExpiresIn) - } - - if r.MaxModelMemory != "" { - params["max_model_memory"] = r.MaxModelMemory - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLForecast) WithContext(v context.Context) func(*MLForecastRequest) { - return func(r *MLForecastRequest) { - r.ctx = v - } -} - -// WithDuration - the duration of the forecast. -// -func (f MLForecast) WithDuration(v time.Duration) func(*MLForecastRequest) { - return func(r *MLForecastRequest) { - r.Duration = v - } -} - -// WithExpiresIn - the time interval after which the forecast expires. expired forecasts will be deleted at the first opportunity.. -// -func (f MLForecast) WithExpiresIn(v time.Duration) func(*MLForecastRequest) { - return func(r *MLForecastRequest) { - r.ExpiresIn = v - } -} - -// WithMaxModelMemory - the max memory able to be used by the forecast. default is 20mb.. -// -func (f MLForecast) WithMaxModelMemory(v string) func(*MLForecastRequest) { - return func(r *MLForecastRequest) { - r.MaxModelMemory = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLForecast) WithPretty() func(*MLForecastRequest) { - return func(r *MLForecastRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLForecast) WithHuman() func(*MLForecastRequest) { - return func(r *MLForecastRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLForecast) WithErrorTrace() func(*MLForecastRequest) { - return func(r *MLForecastRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLForecast) WithFilterPath(v ...string) func(*MLForecastRequest) { - return func(r *MLForecastRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLForecast) WithHeader(h map[string]string) func(*MLForecastRequest) { - return func(r *MLForecastRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLForecast) WithOpaqueID(s string) func(*MLForecastRequest) { - return func(r *MLForecastRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_buckets.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_buckets.go deleted file mode 100644 index e53f86654..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_buckets.go +++ /dev/null @@ -1,355 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "fmt" - "io" - "net/http" - "strconv" - "strings" -) - -func newMLGetBucketsFunc(t Transport) MLGetBuckets { - return func(job_id string, o ...func(*MLGetBucketsRequest)) (*Response, error) { - var r = MLGetBucketsRequest{JobID: job_id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLGetBuckets - Retrieves anomaly detection job results for one or more buckets. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-bucket.html. -// -type MLGetBuckets func(job_id string, o ...func(*MLGetBucketsRequest)) (*Response, error) - -// MLGetBucketsRequest configures the ML Get Buckets API request. -// -type MLGetBucketsRequest struct { - Body io.Reader - - JobID string - Timestamp string - - AnomalyScore interface{} - Desc *bool - End string - ExcludeInterim *bool - Expand *bool - From *int - Size *int - Sort string - Start string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLGetBucketsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_ml") + 1 + len("anomaly_detectors") + 1 + len(r.JobID) + 1 + len("results") + 1 + len("buckets") + 1 + len(r.Timestamp)) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("anomaly_detectors") - path.WriteString("/") - path.WriteString(r.JobID) - path.WriteString("/") - path.WriteString("results") - path.WriteString("/") - path.WriteString("buckets") - if r.Timestamp != "" { - path.WriteString("/") - path.WriteString(r.Timestamp) - } - - params = make(map[string]string) - - if r.AnomalyScore != nil { - params["anomaly_score"] = fmt.Sprintf("%v", r.AnomalyScore) - } - - if r.Desc != nil { - params["desc"] = strconv.FormatBool(*r.Desc) - } - - if r.End != "" { - params["end"] = r.End - } - - if r.ExcludeInterim != nil { - params["exclude_interim"] = strconv.FormatBool(*r.ExcludeInterim) - } - - if r.Expand != nil { - params["expand"] = strconv.FormatBool(*r.Expand) - } - - if r.From != nil { - params["from"] = strconv.FormatInt(int64(*r.From), 10) - } - - if r.Size != nil { - params["size"] = strconv.FormatInt(int64(*r.Size), 10) - } - - if r.Sort != "" { - params["sort"] = r.Sort - } - - if r.Start != "" { - params["start"] = r.Start - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLGetBuckets) WithContext(v context.Context) func(*MLGetBucketsRequest) { - return func(r *MLGetBucketsRequest) { - r.ctx = v - } -} - -// WithBody - Bucket selection details if not provided in URI. -// -func (f MLGetBuckets) WithBody(v io.Reader) func(*MLGetBucketsRequest) { - return func(r *MLGetBucketsRequest) { - r.Body = v - } -} - -// WithTimestamp - the timestamp of the desired single bucket result. -// -func (f MLGetBuckets) WithTimestamp(v string) func(*MLGetBucketsRequest) { - return func(r *MLGetBucketsRequest) { - r.Timestamp = v - } -} - -// WithAnomalyScore - filter for the most anomalous buckets. -// -func (f MLGetBuckets) WithAnomalyScore(v interface{}) func(*MLGetBucketsRequest) { - return func(r *MLGetBucketsRequest) { - r.AnomalyScore = v - } -} - -// WithDesc - set the sort direction. -// -func (f MLGetBuckets) WithDesc(v bool) func(*MLGetBucketsRequest) { - return func(r *MLGetBucketsRequest) { - r.Desc = &v - } -} - -// WithEnd - end time filter for buckets. -// -func (f MLGetBuckets) WithEnd(v string) func(*MLGetBucketsRequest) { - return func(r *MLGetBucketsRequest) { - r.End = v - } -} - -// WithExcludeInterim - exclude interim results. -// -func (f MLGetBuckets) WithExcludeInterim(v bool) func(*MLGetBucketsRequest) { - return func(r *MLGetBucketsRequest) { - r.ExcludeInterim = &v - } -} - -// WithExpand - include anomaly records. -// -func (f MLGetBuckets) WithExpand(v bool) func(*MLGetBucketsRequest) { - return func(r *MLGetBucketsRequest) { - r.Expand = &v - } -} - -// WithFrom - skips a number of buckets. -// -func (f MLGetBuckets) WithFrom(v int) func(*MLGetBucketsRequest) { - return func(r *MLGetBucketsRequest) { - r.From = &v - } -} - -// WithSize - specifies a max number of buckets to get. -// -func (f MLGetBuckets) WithSize(v int) func(*MLGetBucketsRequest) { - return func(r *MLGetBucketsRequest) { - r.Size = &v - } -} - -// WithSort - sort buckets by a particular field. -// -func (f MLGetBuckets) WithSort(v string) func(*MLGetBucketsRequest) { - return func(r *MLGetBucketsRequest) { - r.Sort = v - } -} - -// WithStart - start time filter for buckets. -// -func (f MLGetBuckets) WithStart(v string) func(*MLGetBucketsRequest) { - return func(r *MLGetBucketsRequest) { - r.Start = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLGetBuckets) WithPretty() func(*MLGetBucketsRequest) { - return func(r *MLGetBucketsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLGetBuckets) WithHuman() func(*MLGetBucketsRequest) { - return func(r *MLGetBucketsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLGetBuckets) WithErrorTrace() func(*MLGetBucketsRequest) { - return func(r *MLGetBucketsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLGetBuckets) WithFilterPath(v ...string) func(*MLGetBucketsRequest) { - return func(r *MLGetBucketsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLGetBuckets) WithHeader(h map[string]string) func(*MLGetBucketsRequest) { - return func(r *MLGetBucketsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLGetBuckets) WithOpaqueID(s string) func(*MLGetBucketsRequest) { - return func(r *MLGetBucketsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_calendar_events.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_calendar_events.go deleted file mode 100644 index d3749c7cc..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_calendar_events.go +++ /dev/null @@ -1,273 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "fmt" - "net/http" - "strconv" - "strings" -) - -func newMLGetCalendarEventsFunc(t Transport) MLGetCalendarEvents { - return func(calendar_id string, o ...func(*MLGetCalendarEventsRequest)) (*Response, error) { - var r = MLGetCalendarEventsRequest{CalendarID: calendar_id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLGetCalendarEvents - Retrieves information about the scheduled events in calendars. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-calendar-event.html. -// -type MLGetCalendarEvents func(calendar_id string, o ...func(*MLGetCalendarEventsRequest)) (*Response, error) - -// MLGetCalendarEventsRequest configures the ML Get Calendar Events API request. -// -type MLGetCalendarEventsRequest struct { - CalendarID string - - End interface{} - From *int - JobID string - Size *int - Start string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLGetCalendarEventsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_ml") + 1 + len("calendars") + 1 + len(r.CalendarID) + 1 + len("events")) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("calendars") - path.WriteString("/") - path.WriteString(r.CalendarID) - path.WriteString("/") - path.WriteString("events") - - params = make(map[string]string) - - if r.End != nil { - params["end"] = fmt.Sprintf("%v", r.End) - } - - if r.From != nil { - params["from"] = strconv.FormatInt(int64(*r.From), 10) - } - - if r.JobID != "" { - params["job_id"] = r.JobID - } - - if r.Size != nil { - params["size"] = strconv.FormatInt(int64(*r.Size), 10) - } - - if r.Start != "" { - params["start"] = r.Start - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLGetCalendarEvents) WithContext(v context.Context) func(*MLGetCalendarEventsRequest) { - return func(r *MLGetCalendarEventsRequest) { - r.ctx = v - } -} - -// WithEnd - get events before this time. -// -func (f MLGetCalendarEvents) WithEnd(v interface{}) func(*MLGetCalendarEventsRequest) { - return func(r *MLGetCalendarEventsRequest) { - r.End = v - } -} - -// WithFrom - skips a number of events. -// -func (f MLGetCalendarEvents) WithFrom(v int) func(*MLGetCalendarEventsRequest) { - return func(r *MLGetCalendarEventsRequest) { - r.From = &v - } -} - -// WithJobID - get events for the job. when this option is used calendar_id must be '_all'. -// -func (f MLGetCalendarEvents) WithJobID(v string) func(*MLGetCalendarEventsRequest) { - return func(r *MLGetCalendarEventsRequest) { - r.JobID = v - } -} - -// WithSize - specifies a max number of events to get. -// -func (f MLGetCalendarEvents) WithSize(v int) func(*MLGetCalendarEventsRequest) { - return func(r *MLGetCalendarEventsRequest) { - r.Size = &v - } -} - -// WithStart - get events after this time. -// -func (f MLGetCalendarEvents) WithStart(v string) func(*MLGetCalendarEventsRequest) { - return func(r *MLGetCalendarEventsRequest) { - r.Start = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLGetCalendarEvents) WithPretty() func(*MLGetCalendarEventsRequest) { - return func(r *MLGetCalendarEventsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLGetCalendarEvents) WithHuman() func(*MLGetCalendarEventsRequest) { - return func(r *MLGetCalendarEventsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLGetCalendarEvents) WithErrorTrace() func(*MLGetCalendarEventsRequest) { - return func(r *MLGetCalendarEventsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLGetCalendarEvents) WithFilterPath(v ...string) func(*MLGetCalendarEventsRequest) { - return func(r *MLGetCalendarEventsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLGetCalendarEvents) WithHeader(h map[string]string) func(*MLGetCalendarEventsRequest) { - return func(r *MLGetCalendarEventsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLGetCalendarEvents) WithOpaqueID(s string) func(*MLGetCalendarEventsRequest) { - return func(r *MLGetCalendarEventsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_calendars.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_calendars.go deleted file mode 100644 index e2ba8e257..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_calendars.go +++ /dev/null @@ -1,256 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" -) - -func newMLGetCalendarsFunc(t Transport) MLGetCalendars { - return func(o ...func(*MLGetCalendarsRequest)) (*Response, error) { - var r = MLGetCalendarsRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLGetCalendars - Retrieves configuration information for calendars. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-calendar.html. -// -type MLGetCalendars func(o ...func(*MLGetCalendarsRequest)) (*Response, error) - -// MLGetCalendarsRequest configures the ML Get Calendars API request. -// -type MLGetCalendarsRequest struct { - Body io.Reader - - CalendarID string - - From *int - Size *int - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLGetCalendarsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_ml") + 1 + len("calendars") + 1 + len(r.CalendarID)) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("calendars") - if r.CalendarID != "" { - path.WriteString("/") - path.WriteString(r.CalendarID) - } - - params = make(map[string]string) - - if r.From != nil { - params["from"] = strconv.FormatInt(int64(*r.From), 10) - } - - if r.Size != nil { - params["size"] = strconv.FormatInt(int64(*r.Size), 10) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLGetCalendars) WithContext(v context.Context) func(*MLGetCalendarsRequest) { - return func(r *MLGetCalendarsRequest) { - r.ctx = v - } -} - -// WithBody - The from and size parameters optionally sent in the body. -// -func (f MLGetCalendars) WithBody(v io.Reader) func(*MLGetCalendarsRequest) { - return func(r *MLGetCalendarsRequest) { - r.Body = v - } -} - -// WithCalendarID - the ID of the calendar to fetch. -// -func (f MLGetCalendars) WithCalendarID(v string) func(*MLGetCalendarsRequest) { - return func(r *MLGetCalendarsRequest) { - r.CalendarID = v - } -} - -// WithFrom - skips a number of calendars. -// -func (f MLGetCalendars) WithFrom(v int) func(*MLGetCalendarsRequest) { - return func(r *MLGetCalendarsRequest) { - r.From = &v - } -} - -// WithSize - specifies a max number of calendars to get. -// -func (f MLGetCalendars) WithSize(v int) func(*MLGetCalendarsRequest) { - return func(r *MLGetCalendarsRequest) { - r.Size = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLGetCalendars) WithPretty() func(*MLGetCalendarsRequest) { - return func(r *MLGetCalendarsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLGetCalendars) WithHuman() func(*MLGetCalendarsRequest) { - return func(r *MLGetCalendarsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLGetCalendars) WithErrorTrace() func(*MLGetCalendarsRequest) { - return func(r *MLGetCalendarsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLGetCalendars) WithFilterPath(v ...string) func(*MLGetCalendarsRequest) { - return func(r *MLGetCalendarsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLGetCalendars) WithHeader(h map[string]string) func(*MLGetCalendarsRequest) { - return func(r *MLGetCalendarsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLGetCalendars) WithOpaqueID(s string) func(*MLGetCalendarsRequest) { - return func(r *MLGetCalendarsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_categories.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_categories.go deleted file mode 100644 index 373452195..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_categories.go +++ /dev/null @@ -1,278 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" -) - -func newMLGetCategoriesFunc(t Transport) MLGetCategories { - return func(job_id string, o ...func(*MLGetCategoriesRequest)) (*Response, error) { - var r = MLGetCategoriesRequest{JobID: job_id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLGetCategories - Retrieves anomaly detection job results for one or more categories. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-category.html. -// -type MLGetCategories func(job_id string, o ...func(*MLGetCategoriesRequest)) (*Response, error) - -// MLGetCategoriesRequest configures the ML Get Categories API request. -// -type MLGetCategoriesRequest struct { - Body io.Reader - - CategoryID *int - JobID string - - From *int - PartitionFieldValue string - Size *int - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLGetCategoriesRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_ml") + 1 + len("anomaly_detectors") + 1 + len(r.JobID) + 1 + len("results") + 1 + len("categories")) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("anomaly_detectors") - path.WriteString("/") - path.WriteString(r.JobID) - path.WriteString("/") - path.WriteString("results") - path.WriteString("/") - path.WriteString("categories") - if r.CategoryID != nil { - value := strconv.FormatInt(int64(*r.CategoryID), 10) - path.Grow(1 + len(value)) - path.WriteString("/") - path.WriteString(value) - } - - params = make(map[string]string) - - if r.From != nil { - params["from"] = strconv.FormatInt(int64(*r.From), 10) - } - - if r.PartitionFieldValue != "" { - params["partition_field_value"] = r.PartitionFieldValue - } - - if r.Size != nil { - params["size"] = strconv.FormatInt(int64(*r.Size), 10) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLGetCategories) WithContext(v context.Context) func(*MLGetCategoriesRequest) { - return func(r *MLGetCategoriesRequest) { - r.ctx = v - } -} - -// WithBody - Category selection details if not provided in URI. -// -func (f MLGetCategories) WithBody(v io.Reader) func(*MLGetCategoriesRequest) { - return func(r *MLGetCategoriesRequest) { - r.Body = v - } -} - -// WithCategoryID - the identifier of the category definition of interest. -// -func (f MLGetCategories) WithCategoryID(v int) func(*MLGetCategoriesRequest) { - return func(r *MLGetCategoriesRequest) { - r.CategoryID = &v - } -} - -// WithFrom - skips a number of categories. -// -func (f MLGetCategories) WithFrom(v int) func(*MLGetCategoriesRequest) { - return func(r *MLGetCategoriesRequest) { - r.From = &v - } -} - -// WithPartitionFieldValue - specifies the partition to retrieve categories for. this is optional, and should never be used for jobs where per-partition categorization is disabled.. -// -func (f MLGetCategories) WithPartitionFieldValue(v string) func(*MLGetCategoriesRequest) { - return func(r *MLGetCategoriesRequest) { - r.PartitionFieldValue = v - } -} - -// WithSize - specifies a max number of categories to get. -// -func (f MLGetCategories) WithSize(v int) func(*MLGetCategoriesRequest) { - return func(r *MLGetCategoriesRequest) { - r.Size = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLGetCategories) WithPretty() func(*MLGetCategoriesRequest) { - return func(r *MLGetCategoriesRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLGetCategories) WithHuman() func(*MLGetCategoriesRequest) { - return func(r *MLGetCategoriesRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLGetCategories) WithErrorTrace() func(*MLGetCategoriesRequest) { - return func(r *MLGetCategoriesRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLGetCategories) WithFilterPath(v ...string) func(*MLGetCategoriesRequest) { - return func(r *MLGetCategoriesRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLGetCategories) WithHeader(h map[string]string) func(*MLGetCategoriesRequest) { - return func(r *MLGetCategoriesRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLGetCategories) WithOpaqueID(s string) func(*MLGetCategoriesRequest) { - return func(r *MLGetCategoriesRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_data_frame_analytics.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_data_frame_analytics.go deleted file mode 100644 index e21b7dbf0..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_data_frame_analytics.go +++ /dev/null @@ -1,269 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newMLGetDataFrameAnalyticsFunc(t Transport) MLGetDataFrameAnalytics { - return func(o ...func(*MLGetDataFrameAnalyticsRequest)) (*Response, error) { - var r = MLGetDataFrameAnalyticsRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLGetDataFrameAnalytics - Retrieves configuration information for data frame analytics jobs. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/get-dfanalytics.html. -// -type MLGetDataFrameAnalytics func(o ...func(*MLGetDataFrameAnalyticsRequest)) (*Response, error) - -// MLGetDataFrameAnalyticsRequest configures the ML Get Data Frame Analytics API request. -// -type MLGetDataFrameAnalyticsRequest struct { - ID string - - AllowNoMatch *bool - ExcludeGenerated *bool - From *int - Size *int - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLGetDataFrameAnalyticsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_ml") + 1 + len("data_frame") + 1 + len("analytics") + 1 + len(r.ID)) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("data_frame") - path.WriteString("/") - path.WriteString("analytics") - if r.ID != "" { - path.WriteString("/") - path.WriteString(r.ID) - } - - params = make(map[string]string) - - if r.AllowNoMatch != nil { - params["allow_no_match"] = strconv.FormatBool(*r.AllowNoMatch) - } - - if r.ExcludeGenerated != nil { - params["exclude_generated"] = strconv.FormatBool(*r.ExcludeGenerated) - } - - if r.From != nil { - params["from"] = strconv.FormatInt(int64(*r.From), 10) - } - - if r.Size != nil { - params["size"] = strconv.FormatInt(int64(*r.Size), 10) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLGetDataFrameAnalytics) WithContext(v context.Context) func(*MLGetDataFrameAnalyticsRequest) { - return func(r *MLGetDataFrameAnalyticsRequest) { - r.ctx = v - } -} - -// WithID - the ID of the data frame analytics to fetch. -// -func (f MLGetDataFrameAnalytics) WithID(v string) func(*MLGetDataFrameAnalyticsRequest) { - return func(r *MLGetDataFrameAnalyticsRequest) { - r.ID = v - } -} - -// WithAllowNoMatch - whether to ignore if a wildcard expression matches no data frame analytics. (this includes `_all` string or when no data frame analytics have been specified). -// -func (f MLGetDataFrameAnalytics) WithAllowNoMatch(v bool) func(*MLGetDataFrameAnalyticsRequest) { - return func(r *MLGetDataFrameAnalyticsRequest) { - r.AllowNoMatch = &v - } -} - -// WithExcludeGenerated - omits fields that are illegal to set on data frame analytics put. -// -func (f MLGetDataFrameAnalytics) WithExcludeGenerated(v bool) func(*MLGetDataFrameAnalyticsRequest) { - return func(r *MLGetDataFrameAnalyticsRequest) { - r.ExcludeGenerated = &v - } -} - -// WithFrom - skips a number of analytics. -// -func (f MLGetDataFrameAnalytics) WithFrom(v int) func(*MLGetDataFrameAnalyticsRequest) { - return func(r *MLGetDataFrameAnalyticsRequest) { - r.From = &v - } -} - -// WithSize - specifies a max number of analytics to get. -// -func (f MLGetDataFrameAnalytics) WithSize(v int) func(*MLGetDataFrameAnalyticsRequest) { - return func(r *MLGetDataFrameAnalyticsRequest) { - r.Size = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLGetDataFrameAnalytics) WithPretty() func(*MLGetDataFrameAnalyticsRequest) { - return func(r *MLGetDataFrameAnalyticsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLGetDataFrameAnalytics) WithHuman() func(*MLGetDataFrameAnalyticsRequest) { - return func(r *MLGetDataFrameAnalyticsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLGetDataFrameAnalytics) WithErrorTrace() func(*MLGetDataFrameAnalyticsRequest) { - return func(r *MLGetDataFrameAnalyticsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLGetDataFrameAnalytics) WithFilterPath(v ...string) func(*MLGetDataFrameAnalyticsRequest) { - return func(r *MLGetDataFrameAnalyticsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLGetDataFrameAnalytics) WithHeader(h map[string]string) func(*MLGetDataFrameAnalyticsRequest) { - return func(r *MLGetDataFrameAnalyticsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLGetDataFrameAnalytics) WithOpaqueID(s string) func(*MLGetDataFrameAnalyticsRequest) { - return func(r *MLGetDataFrameAnalyticsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_data_frame_analytics_stats.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_data_frame_analytics_stats.go deleted file mode 100644 index c7fffb8ae..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_data_frame_analytics_stats.go +++ /dev/null @@ -1,271 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newMLGetDataFrameAnalyticsStatsFunc(t Transport) MLGetDataFrameAnalyticsStats { - return func(o ...func(*MLGetDataFrameAnalyticsStatsRequest)) (*Response, error) { - var r = MLGetDataFrameAnalyticsStatsRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLGetDataFrameAnalyticsStats - Retrieves usage information for data frame analytics jobs. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/get-dfanalytics-stats.html. -// -type MLGetDataFrameAnalyticsStats func(o ...func(*MLGetDataFrameAnalyticsStatsRequest)) (*Response, error) - -// MLGetDataFrameAnalyticsStatsRequest configures the ML Get Data Frame Analytics Stats API request. -// -type MLGetDataFrameAnalyticsStatsRequest struct { - ID string - - AllowNoMatch *bool - From *int - Size *int - Verbose *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLGetDataFrameAnalyticsStatsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_ml") + 1 + len("data_frame") + 1 + len("analytics") + 1 + len(r.ID) + 1 + len("_stats")) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("data_frame") - path.WriteString("/") - path.WriteString("analytics") - if r.ID != "" { - path.WriteString("/") - path.WriteString(r.ID) - } - path.WriteString("/") - path.WriteString("_stats") - - params = make(map[string]string) - - if r.AllowNoMatch != nil { - params["allow_no_match"] = strconv.FormatBool(*r.AllowNoMatch) - } - - if r.From != nil { - params["from"] = strconv.FormatInt(int64(*r.From), 10) - } - - if r.Size != nil { - params["size"] = strconv.FormatInt(int64(*r.Size), 10) - } - - if r.Verbose != nil { - params["verbose"] = strconv.FormatBool(*r.Verbose) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLGetDataFrameAnalyticsStats) WithContext(v context.Context) func(*MLGetDataFrameAnalyticsStatsRequest) { - return func(r *MLGetDataFrameAnalyticsStatsRequest) { - r.ctx = v - } -} - -// WithID - the ID of the data frame analytics stats to fetch. -// -func (f MLGetDataFrameAnalyticsStats) WithID(v string) func(*MLGetDataFrameAnalyticsStatsRequest) { - return func(r *MLGetDataFrameAnalyticsStatsRequest) { - r.ID = v - } -} - -// WithAllowNoMatch - whether to ignore if a wildcard expression matches no data frame analytics. (this includes `_all` string or when no data frame analytics have been specified). -// -func (f MLGetDataFrameAnalyticsStats) WithAllowNoMatch(v bool) func(*MLGetDataFrameAnalyticsStatsRequest) { - return func(r *MLGetDataFrameAnalyticsStatsRequest) { - r.AllowNoMatch = &v - } -} - -// WithFrom - skips a number of analytics. -// -func (f MLGetDataFrameAnalyticsStats) WithFrom(v int) func(*MLGetDataFrameAnalyticsStatsRequest) { - return func(r *MLGetDataFrameAnalyticsStatsRequest) { - r.From = &v - } -} - -// WithSize - specifies a max number of analytics to get. -// -func (f MLGetDataFrameAnalyticsStats) WithSize(v int) func(*MLGetDataFrameAnalyticsStatsRequest) { - return func(r *MLGetDataFrameAnalyticsStatsRequest) { - r.Size = &v - } -} - -// WithVerbose - whether the stats response should be verbose. -// -func (f MLGetDataFrameAnalyticsStats) WithVerbose(v bool) func(*MLGetDataFrameAnalyticsStatsRequest) { - return func(r *MLGetDataFrameAnalyticsStatsRequest) { - r.Verbose = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLGetDataFrameAnalyticsStats) WithPretty() func(*MLGetDataFrameAnalyticsStatsRequest) { - return func(r *MLGetDataFrameAnalyticsStatsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLGetDataFrameAnalyticsStats) WithHuman() func(*MLGetDataFrameAnalyticsStatsRequest) { - return func(r *MLGetDataFrameAnalyticsStatsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLGetDataFrameAnalyticsStats) WithErrorTrace() func(*MLGetDataFrameAnalyticsStatsRequest) { - return func(r *MLGetDataFrameAnalyticsStatsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLGetDataFrameAnalyticsStats) WithFilterPath(v ...string) func(*MLGetDataFrameAnalyticsStatsRequest) { - return func(r *MLGetDataFrameAnalyticsStatsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLGetDataFrameAnalyticsStats) WithHeader(h map[string]string) func(*MLGetDataFrameAnalyticsStatsRequest) { - return func(r *MLGetDataFrameAnalyticsStatsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLGetDataFrameAnalyticsStats) WithOpaqueID(s string) func(*MLGetDataFrameAnalyticsStatsRequest) { - return func(r *MLGetDataFrameAnalyticsStatsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_datafeed_stats.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_datafeed_stats.go deleted file mode 100644 index 7f7a3f225..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_datafeed_stats.go +++ /dev/null @@ -1,243 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newMLGetDatafeedStatsFunc(t Transport) MLGetDatafeedStats { - return func(o ...func(*MLGetDatafeedStatsRequest)) (*Response, error) { - var r = MLGetDatafeedStatsRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLGetDatafeedStats - Retrieves usage information for datafeeds. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed-stats.html. -// -type MLGetDatafeedStats func(o ...func(*MLGetDatafeedStatsRequest)) (*Response, error) - -// MLGetDatafeedStatsRequest configures the ML Get Datafeed Stats API request. -// -type MLGetDatafeedStatsRequest struct { - DatafeedID string - - AllowNoDatafeeds *bool - AllowNoMatch *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLGetDatafeedStatsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_ml") + 1 + len("datafeeds") + 1 + len(r.DatafeedID) + 1 + len("_stats")) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("datafeeds") - if r.DatafeedID != "" { - path.WriteString("/") - path.WriteString(r.DatafeedID) - } - path.WriteString("/") - path.WriteString("_stats") - - params = make(map[string]string) - - if r.AllowNoDatafeeds != nil { - params["allow_no_datafeeds"] = strconv.FormatBool(*r.AllowNoDatafeeds) - } - - if r.AllowNoMatch != nil { - params["allow_no_match"] = strconv.FormatBool(*r.AllowNoMatch) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLGetDatafeedStats) WithContext(v context.Context) func(*MLGetDatafeedStatsRequest) { - return func(r *MLGetDatafeedStatsRequest) { - r.ctx = v - } -} - -// WithDatafeedID - the ID of the datafeeds stats to fetch. -// -func (f MLGetDatafeedStats) WithDatafeedID(v string) func(*MLGetDatafeedStatsRequest) { - return func(r *MLGetDatafeedStatsRequest) { - r.DatafeedID = v - } -} - -// WithAllowNoDatafeeds - whether to ignore if a wildcard expression matches no datafeeds. (this includes `_all` string or when no datafeeds have been specified). -// -func (f MLGetDatafeedStats) WithAllowNoDatafeeds(v bool) func(*MLGetDatafeedStatsRequest) { - return func(r *MLGetDatafeedStatsRequest) { - r.AllowNoDatafeeds = &v - } -} - -// WithAllowNoMatch - whether to ignore if a wildcard expression matches no datafeeds. (this includes `_all` string or when no datafeeds have been specified). -// -func (f MLGetDatafeedStats) WithAllowNoMatch(v bool) func(*MLGetDatafeedStatsRequest) { - return func(r *MLGetDatafeedStatsRequest) { - r.AllowNoMatch = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLGetDatafeedStats) WithPretty() func(*MLGetDatafeedStatsRequest) { - return func(r *MLGetDatafeedStatsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLGetDatafeedStats) WithHuman() func(*MLGetDatafeedStatsRequest) { - return func(r *MLGetDatafeedStatsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLGetDatafeedStats) WithErrorTrace() func(*MLGetDatafeedStatsRequest) { - return func(r *MLGetDatafeedStatsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLGetDatafeedStats) WithFilterPath(v ...string) func(*MLGetDatafeedStatsRequest) { - return func(r *MLGetDatafeedStatsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLGetDatafeedStats) WithHeader(h map[string]string) func(*MLGetDatafeedStatsRequest) { - return func(r *MLGetDatafeedStatsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLGetDatafeedStats) WithOpaqueID(s string) func(*MLGetDatafeedStatsRequest) { - return func(r *MLGetDatafeedStatsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_datafeeds.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_datafeeds.go deleted file mode 100644 index 3c49d00b9..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_datafeeds.go +++ /dev/null @@ -1,254 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newMLGetDatafeedsFunc(t Transport) MLGetDatafeeds { - return func(o ...func(*MLGetDatafeedsRequest)) (*Response, error) { - var r = MLGetDatafeedsRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLGetDatafeeds - Retrieves configuration information for datafeeds. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed.html. -// -type MLGetDatafeeds func(o ...func(*MLGetDatafeedsRequest)) (*Response, error) - -// MLGetDatafeedsRequest configures the ML Get Datafeeds API request. -// -type MLGetDatafeedsRequest struct { - DatafeedID string - - AllowNoDatafeeds *bool - AllowNoMatch *bool - ExcludeGenerated *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLGetDatafeedsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_ml") + 1 + len("datafeeds") + 1 + len(r.DatafeedID)) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("datafeeds") - if r.DatafeedID != "" { - path.WriteString("/") - path.WriteString(r.DatafeedID) - } - - params = make(map[string]string) - - if r.AllowNoDatafeeds != nil { - params["allow_no_datafeeds"] = strconv.FormatBool(*r.AllowNoDatafeeds) - } - - if r.AllowNoMatch != nil { - params["allow_no_match"] = strconv.FormatBool(*r.AllowNoMatch) - } - - if r.ExcludeGenerated != nil { - params["exclude_generated"] = strconv.FormatBool(*r.ExcludeGenerated) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLGetDatafeeds) WithContext(v context.Context) func(*MLGetDatafeedsRequest) { - return func(r *MLGetDatafeedsRequest) { - r.ctx = v - } -} - -// WithDatafeedID - the ID of the datafeeds to fetch. -// -func (f MLGetDatafeeds) WithDatafeedID(v string) func(*MLGetDatafeedsRequest) { - return func(r *MLGetDatafeedsRequest) { - r.DatafeedID = v - } -} - -// WithAllowNoDatafeeds - whether to ignore if a wildcard expression matches no datafeeds. (this includes `_all` string or when no datafeeds have been specified). -// -func (f MLGetDatafeeds) WithAllowNoDatafeeds(v bool) func(*MLGetDatafeedsRequest) { - return func(r *MLGetDatafeedsRequest) { - r.AllowNoDatafeeds = &v - } -} - -// WithAllowNoMatch - whether to ignore if a wildcard expression matches no datafeeds. (this includes `_all` string or when no datafeeds have been specified). -// -func (f MLGetDatafeeds) WithAllowNoMatch(v bool) func(*MLGetDatafeedsRequest) { - return func(r *MLGetDatafeedsRequest) { - r.AllowNoMatch = &v - } -} - -// WithExcludeGenerated - omits fields that are illegal to set on datafeed put. -// -func (f MLGetDatafeeds) WithExcludeGenerated(v bool) func(*MLGetDatafeedsRequest) { - return func(r *MLGetDatafeedsRequest) { - r.ExcludeGenerated = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLGetDatafeeds) WithPretty() func(*MLGetDatafeedsRequest) { - return func(r *MLGetDatafeedsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLGetDatafeeds) WithHuman() func(*MLGetDatafeedsRequest) { - return func(r *MLGetDatafeedsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLGetDatafeeds) WithErrorTrace() func(*MLGetDatafeedsRequest) { - return func(r *MLGetDatafeedsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLGetDatafeeds) WithFilterPath(v ...string) func(*MLGetDatafeedsRequest) { - return func(r *MLGetDatafeedsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLGetDatafeeds) WithHeader(h map[string]string) func(*MLGetDatafeedsRequest) { - return func(r *MLGetDatafeedsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLGetDatafeeds) WithOpaqueID(s string) func(*MLGetDatafeedsRequest) { - return func(r *MLGetDatafeedsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_filters.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_filters.go deleted file mode 100644 index 0921453a4..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_filters.go +++ /dev/null @@ -1,241 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newMLGetFiltersFunc(t Transport) MLGetFilters { - return func(o ...func(*MLGetFiltersRequest)) (*Response, error) { - var r = MLGetFiltersRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLGetFilters - Retrieves filters. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-filter.html. -// -type MLGetFilters func(o ...func(*MLGetFiltersRequest)) (*Response, error) - -// MLGetFiltersRequest configures the ML Get Filters API request. -// -type MLGetFiltersRequest struct { - FilterID string - - From *int - Size *int - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLGetFiltersRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_ml") + 1 + len("filters") + 1 + len(r.FilterID)) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("filters") - if r.FilterID != "" { - path.WriteString("/") - path.WriteString(r.FilterID) - } - - params = make(map[string]string) - - if r.From != nil { - params["from"] = strconv.FormatInt(int64(*r.From), 10) - } - - if r.Size != nil { - params["size"] = strconv.FormatInt(int64(*r.Size), 10) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLGetFilters) WithContext(v context.Context) func(*MLGetFiltersRequest) { - return func(r *MLGetFiltersRequest) { - r.ctx = v - } -} - -// WithFilterID - the ID of the filter to fetch. -// -func (f MLGetFilters) WithFilterID(v string) func(*MLGetFiltersRequest) { - return func(r *MLGetFiltersRequest) { - r.FilterID = v - } -} - -// WithFrom - skips a number of filters. -// -func (f MLGetFilters) WithFrom(v int) func(*MLGetFiltersRequest) { - return func(r *MLGetFiltersRequest) { - r.From = &v - } -} - -// WithSize - specifies a max number of filters to get. -// -func (f MLGetFilters) WithSize(v int) func(*MLGetFiltersRequest) { - return func(r *MLGetFiltersRequest) { - r.Size = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLGetFilters) WithPretty() func(*MLGetFiltersRequest) { - return func(r *MLGetFiltersRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLGetFilters) WithHuman() func(*MLGetFiltersRequest) { - return func(r *MLGetFiltersRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLGetFilters) WithErrorTrace() func(*MLGetFiltersRequest) { - return func(r *MLGetFiltersRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLGetFilters) WithFilterPath(v ...string) func(*MLGetFiltersRequest) { - return func(r *MLGetFiltersRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLGetFilters) WithHeader(h map[string]string) func(*MLGetFiltersRequest) { - return func(r *MLGetFiltersRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLGetFilters) WithOpaqueID(s string) func(*MLGetFiltersRequest) { - return func(r *MLGetFiltersRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_influencers.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_influencers.go deleted file mode 100644 index 0622074f0..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_influencers.go +++ /dev/null @@ -1,329 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "fmt" - "io" - "net/http" - "strconv" - "strings" -) - -func newMLGetInfluencersFunc(t Transport) MLGetInfluencers { - return func(job_id string, o ...func(*MLGetInfluencersRequest)) (*Response, error) { - var r = MLGetInfluencersRequest{JobID: job_id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLGetInfluencers - Retrieves anomaly detection job results for one or more influencers. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-influencer.html. -// -type MLGetInfluencers func(job_id string, o ...func(*MLGetInfluencersRequest)) (*Response, error) - -// MLGetInfluencersRequest configures the ML Get Influencers API request. -// -type MLGetInfluencersRequest struct { - Body io.Reader - - JobID string - - Desc *bool - End string - ExcludeInterim *bool - From *int - InfluencerScore interface{} - Size *int - Sort string - Start string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLGetInfluencersRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_ml") + 1 + len("anomaly_detectors") + 1 + len(r.JobID) + 1 + len("results") + 1 + len("influencers")) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("anomaly_detectors") - path.WriteString("/") - path.WriteString(r.JobID) - path.WriteString("/") - path.WriteString("results") - path.WriteString("/") - path.WriteString("influencers") - - params = make(map[string]string) - - if r.Desc != nil { - params["desc"] = strconv.FormatBool(*r.Desc) - } - - if r.End != "" { - params["end"] = r.End - } - - if r.ExcludeInterim != nil { - params["exclude_interim"] = strconv.FormatBool(*r.ExcludeInterim) - } - - if r.From != nil { - params["from"] = strconv.FormatInt(int64(*r.From), 10) - } - - if r.InfluencerScore != nil { - params["influencer_score"] = fmt.Sprintf("%v", r.InfluencerScore) - } - - if r.Size != nil { - params["size"] = strconv.FormatInt(int64(*r.Size), 10) - } - - if r.Sort != "" { - params["sort"] = r.Sort - } - - if r.Start != "" { - params["start"] = r.Start - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLGetInfluencers) WithContext(v context.Context) func(*MLGetInfluencersRequest) { - return func(r *MLGetInfluencersRequest) { - r.ctx = v - } -} - -// WithBody - Influencer selection criteria. -// -func (f MLGetInfluencers) WithBody(v io.Reader) func(*MLGetInfluencersRequest) { - return func(r *MLGetInfluencersRequest) { - r.Body = v - } -} - -// WithDesc - whether the results should be sorted in decending order. -// -func (f MLGetInfluencers) WithDesc(v bool) func(*MLGetInfluencersRequest) { - return func(r *MLGetInfluencersRequest) { - r.Desc = &v - } -} - -// WithEnd - end timestamp for the requested influencers. -// -func (f MLGetInfluencers) WithEnd(v string) func(*MLGetInfluencersRequest) { - return func(r *MLGetInfluencersRequest) { - r.End = v - } -} - -// WithExcludeInterim - exclude interim results. -// -func (f MLGetInfluencers) WithExcludeInterim(v bool) func(*MLGetInfluencersRequest) { - return func(r *MLGetInfluencersRequest) { - r.ExcludeInterim = &v - } -} - -// WithFrom - skips a number of influencers. -// -func (f MLGetInfluencers) WithFrom(v int) func(*MLGetInfluencersRequest) { - return func(r *MLGetInfluencersRequest) { - r.From = &v - } -} - -// WithInfluencerScore - influencer score threshold for the requested influencers. -// -func (f MLGetInfluencers) WithInfluencerScore(v interface{}) func(*MLGetInfluencersRequest) { - return func(r *MLGetInfluencersRequest) { - r.InfluencerScore = v - } -} - -// WithSize - specifies a max number of influencers to get. -// -func (f MLGetInfluencers) WithSize(v int) func(*MLGetInfluencersRequest) { - return func(r *MLGetInfluencersRequest) { - r.Size = &v - } -} - -// WithSort - sort field for the requested influencers. -// -func (f MLGetInfluencers) WithSort(v string) func(*MLGetInfluencersRequest) { - return func(r *MLGetInfluencersRequest) { - r.Sort = v - } -} - -// WithStart - start timestamp for the requested influencers. -// -func (f MLGetInfluencers) WithStart(v string) func(*MLGetInfluencersRequest) { - return func(r *MLGetInfluencersRequest) { - r.Start = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLGetInfluencers) WithPretty() func(*MLGetInfluencersRequest) { - return func(r *MLGetInfluencersRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLGetInfluencers) WithHuman() func(*MLGetInfluencersRequest) { - return func(r *MLGetInfluencersRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLGetInfluencers) WithErrorTrace() func(*MLGetInfluencersRequest) { - return func(r *MLGetInfluencersRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLGetInfluencers) WithFilterPath(v ...string) func(*MLGetInfluencersRequest) { - return func(r *MLGetInfluencersRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLGetInfluencers) WithHeader(h map[string]string) func(*MLGetInfluencersRequest) { - return func(r *MLGetInfluencersRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLGetInfluencers) WithOpaqueID(s string) func(*MLGetInfluencersRequest) { - return func(r *MLGetInfluencersRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_job_stats.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_job_stats.go deleted file mode 100644 index 47e1d8b43..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_job_stats.go +++ /dev/null @@ -1,243 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newMLGetJobStatsFunc(t Transport) MLGetJobStats { - return func(o ...func(*MLGetJobStatsRequest)) (*Response, error) { - var r = MLGetJobStatsRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLGetJobStats - Retrieves usage information for anomaly detection jobs. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job-stats.html. -// -type MLGetJobStats func(o ...func(*MLGetJobStatsRequest)) (*Response, error) - -// MLGetJobStatsRequest configures the ML Get Job Stats API request. -// -type MLGetJobStatsRequest struct { - JobID string - - AllowNoJobs *bool - AllowNoMatch *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLGetJobStatsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_ml") + 1 + len("anomaly_detectors") + 1 + len(r.JobID) + 1 + len("_stats")) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("anomaly_detectors") - if r.JobID != "" { - path.WriteString("/") - path.WriteString(r.JobID) - } - path.WriteString("/") - path.WriteString("_stats") - - params = make(map[string]string) - - if r.AllowNoJobs != nil { - params["allow_no_jobs"] = strconv.FormatBool(*r.AllowNoJobs) - } - - if r.AllowNoMatch != nil { - params["allow_no_match"] = strconv.FormatBool(*r.AllowNoMatch) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLGetJobStats) WithContext(v context.Context) func(*MLGetJobStatsRequest) { - return func(r *MLGetJobStatsRequest) { - r.ctx = v - } -} - -// WithJobID - the ID of the jobs stats to fetch. -// -func (f MLGetJobStats) WithJobID(v string) func(*MLGetJobStatsRequest) { - return func(r *MLGetJobStatsRequest) { - r.JobID = v - } -} - -// WithAllowNoJobs - whether to ignore if a wildcard expression matches no jobs. (this includes `_all` string or when no jobs have been specified). -// -func (f MLGetJobStats) WithAllowNoJobs(v bool) func(*MLGetJobStatsRequest) { - return func(r *MLGetJobStatsRequest) { - r.AllowNoJobs = &v - } -} - -// WithAllowNoMatch - whether to ignore if a wildcard expression matches no jobs. (this includes `_all` string or when no jobs have been specified). -// -func (f MLGetJobStats) WithAllowNoMatch(v bool) func(*MLGetJobStatsRequest) { - return func(r *MLGetJobStatsRequest) { - r.AllowNoMatch = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLGetJobStats) WithPretty() func(*MLGetJobStatsRequest) { - return func(r *MLGetJobStatsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLGetJobStats) WithHuman() func(*MLGetJobStatsRequest) { - return func(r *MLGetJobStatsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLGetJobStats) WithErrorTrace() func(*MLGetJobStatsRequest) { - return func(r *MLGetJobStatsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLGetJobStats) WithFilterPath(v ...string) func(*MLGetJobStatsRequest) { - return func(r *MLGetJobStatsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLGetJobStats) WithHeader(h map[string]string) func(*MLGetJobStatsRequest) { - return func(r *MLGetJobStatsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLGetJobStats) WithOpaqueID(s string) func(*MLGetJobStatsRequest) { - return func(r *MLGetJobStatsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_jobs.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_jobs.go deleted file mode 100644 index 159d467e7..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_jobs.go +++ /dev/null @@ -1,254 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newMLGetJobsFunc(t Transport) MLGetJobs { - return func(o ...func(*MLGetJobsRequest)) (*Response, error) { - var r = MLGetJobsRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLGetJobs - Retrieves configuration information for anomaly detection jobs. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job.html. -// -type MLGetJobs func(o ...func(*MLGetJobsRequest)) (*Response, error) - -// MLGetJobsRequest configures the ML Get Jobs API request. -// -type MLGetJobsRequest struct { - JobID string - - AllowNoJobs *bool - AllowNoMatch *bool - ExcludeGenerated *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLGetJobsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_ml") + 1 + len("anomaly_detectors") + 1 + len(r.JobID)) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("anomaly_detectors") - if r.JobID != "" { - path.WriteString("/") - path.WriteString(r.JobID) - } - - params = make(map[string]string) - - if r.AllowNoJobs != nil { - params["allow_no_jobs"] = strconv.FormatBool(*r.AllowNoJobs) - } - - if r.AllowNoMatch != nil { - params["allow_no_match"] = strconv.FormatBool(*r.AllowNoMatch) - } - - if r.ExcludeGenerated != nil { - params["exclude_generated"] = strconv.FormatBool(*r.ExcludeGenerated) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLGetJobs) WithContext(v context.Context) func(*MLGetJobsRequest) { - return func(r *MLGetJobsRequest) { - r.ctx = v - } -} - -// WithJobID - the ID of the jobs to fetch. -// -func (f MLGetJobs) WithJobID(v string) func(*MLGetJobsRequest) { - return func(r *MLGetJobsRequest) { - r.JobID = v - } -} - -// WithAllowNoJobs - whether to ignore if a wildcard expression matches no jobs. (this includes `_all` string or when no jobs have been specified). -// -func (f MLGetJobs) WithAllowNoJobs(v bool) func(*MLGetJobsRequest) { - return func(r *MLGetJobsRequest) { - r.AllowNoJobs = &v - } -} - -// WithAllowNoMatch - whether to ignore if a wildcard expression matches no jobs. (this includes `_all` string or when no jobs have been specified). -// -func (f MLGetJobs) WithAllowNoMatch(v bool) func(*MLGetJobsRequest) { - return func(r *MLGetJobsRequest) { - r.AllowNoMatch = &v - } -} - -// WithExcludeGenerated - omits fields that are illegal to set on job put. -// -func (f MLGetJobs) WithExcludeGenerated(v bool) func(*MLGetJobsRequest) { - return func(r *MLGetJobsRequest) { - r.ExcludeGenerated = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLGetJobs) WithPretty() func(*MLGetJobsRequest) { - return func(r *MLGetJobsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLGetJobs) WithHuman() func(*MLGetJobsRequest) { - return func(r *MLGetJobsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLGetJobs) WithErrorTrace() func(*MLGetJobsRequest) { - return func(r *MLGetJobsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLGetJobs) WithFilterPath(v ...string) func(*MLGetJobsRequest) { - return func(r *MLGetJobsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLGetJobs) WithHeader(h map[string]string) func(*MLGetJobsRequest) { - return func(r *MLGetJobsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLGetJobs) WithOpaqueID(s string) func(*MLGetJobsRequest) { - return func(r *MLGetJobsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_model_snapshots.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_model_snapshots.go deleted file mode 100644 index 0bcaae8f3..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_model_snapshots.go +++ /dev/null @@ -1,314 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "fmt" - "io" - "net/http" - "strconv" - "strings" -) - -func newMLGetModelSnapshotsFunc(t Transport) MLGetModelSnapshots { - return func(job_id string, o ...func(*MLGetModelSnapshotsRequest)) (*Response, error) { - var r = MLGetModelSnapshotsRequest{JobID: job_id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLGetModelSnapshots - Retrieves information about model snapshots. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-snapshot.html. -// -type MLGetModelSnapshots func(job_id string, o ...func(*MLGetModelSnapshotsRequest)) (*Response, error) - -// MLGetModelSnapshotsRequest configures the ML Get Model Snapshots API request. -// -type MLGetModelSnapshotsRequest struct { - Body io.Reader - - JobID string - SnapshotID string - - Desc *bool - End interface{} - From *int - Size *int - Sort string - Start interface{} - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLGetModelSnapshotsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_ml") + 1 + len("anomaly_detectors") + 1 + len(r.JobID) + 1 + len("model_snapshots") + 1 + len(r.SnapshotID)) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("anomaly_detectors") - path.WriteString("/") - path.WriteString(r.JobID) - path.WriteString("/") - path.WriteString("model_snapshots") - if r.SnapshotID != "" { - path.WriteString("/") - path.WriteString(r.SnapshotID) - } - - params = make(map[string]string) - - if r.Desc != nil { - params["desc"] = strconv.FormatBool(*r.Desc) - } - - if r.End != nil { - params["end"] = fmt.Sprintf("%v", r.End) - } - - if r.From != nil { - params["from"] = strconv.FormatInt(int64(*r.From), 10) - } - - if r.Size != nil { - params["size"] = strconv.FormatInt(int64(*r.Size), 10) - } - - if r.Sort != "" { - params["sort"] = r.Sort - } - - if r.Start != nil { - params["start"] = fmt.Sprintf("%v", r.Start) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLGetModelSnapshots) WithContext(v context.Context) func(*MLGetModelSnapshotsRequest) { - return func(r *MLGetModelSnapshotsRequest) { - r.ctx = v - } -} - -// WithBody - Model snapshot selection criteria. -// -func (f MLGetModelSnapshots) WithBody(v io.Reader) func(*MLGetModelSnapshotsRequest) { - return func(r *MLGetModelSnapshotsRequest) { - r.Body = v - } -} - -// WithSnapshotID - the ID of the snapshot to fetch. -// -func (f MLGetModelSnapshots) WithSnapshotID(v string) func(*MLGetModelSnapshotsRequest) { - return func(r *MLGetModelSnapshotsRequest) { - r.SnapshotID = v - } -} - -// WithDesc - true if the results should be sorted in descending order. -// -func (f MLGetModelSnapshots) WithDesc(v bool) func(*MLGetModelSnapshotsRequest) { - return func(r *MLGetModelSnapshotsRequest) { - r.Desc = &v - } -} - -// WithEnd - the filter 'end' query parameter. -// -func (f MLGetModelSnapshots) WithEnd(v interface{}) func(*MLGetModelSnapshotsRequest) { - return func(r *MLGetModelSnapshotsRequest) { - r.End = v - } -} - -// WithFrom - skips a number of documents. -// -func (f MLGetModelSnapshots) WithFrom(v int) func(*MLGetModelSnapshotsRequest) { - return func(r *MLGetModelSnapshotsRequest) { - r.From = &v - } -} - -// WithSize - the default number of documents returned in queries as a string.. -// -func (f MLGetModelSnapshots) WithSize(v int) func(*MLGetModelSnapshotsRequest) { - return func(r *MLGetModelSnapshotsRequest) { - r.Size = &v - } -} - -// WithSort - name of the field to sort on. -// -func (f MLGetModelSnapshots) WithSort(v string) func(*MLGetModelSnapshotsRequest) { - return func(r *MLGetModelSnapshotsRequest) { - r.Sort = v - } -} - -// WithStart - the filter 'start' query parameter. -// -func (f MLGetModelSnapshots) WithStart(v interface{}) func(*MLGetModelSnapshotsRequest) { - return func(r *MLGetModelSnapshotsRequest) { - r.Start = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLGetModelSnapshots) WithPretty() func(*MLGetModelSnapshotsRequest) { - return func(r *MLGetModelSnapshotsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLGetModelSnapshots) WithHuman() func(*MLGetModelSnapshotsRequest) { - return func(r *MLGetModelSnapshotsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLGetModelSnapshots) WithErrorTrace() func(*MLGetModelSnapshotsRequest) { - return func(r *MLGetModelSnapshotsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLGetModelSnapshots) WithFilterPath(v ...string) func(*MLGetModelSnapshotsRequest) { - return func(r *MLGetModelSnapshotsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLGetModelSnapshots) WithHeader(h map[string]string) func(*MLGetModelSnapshotsRequest) { - return func(r *MLGetModelSnapshotsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLGetModelSnapshots) WithOpaqueID(s string) func(*MLGetModelSnapshotsRequest) { - return func(r *MLGetModelSnapshotsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_overall_buckets.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_overall_buckets.go deleted file mode 100644 index 08523e775..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_overall_buckets.go +++ /dev/null @@ -1,329 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "fmt" - "io" - "net/http" - "strconv" - "strings" -) - -func newMLGetOverallBucketsFunc(t Transport) MLGetOverallBuckets { - return func(job_id string, o ...func(*MLGetOverallBucketsRequest)) (*Response, error) { - var r = MLGetOverallBucketsRequest{JobID: job_id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLGetOverallBuckets - Retrieves overall bucket results that summarize the bucket results of multiple anomaly detection jobs. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-overall-buckets.html. -// -type MLGetOverallBuckets func(job_id string, o ...func(*MLGetOverallBucketsRequest)) (*Response, error) - -// MLGetOverallBucketsRequest configures the ML Get Overall Buckets API request. -// -type MLGetOverallBucketsRequest struct { - Body io.Reader - - JobID string - - AllowNoJobs *bool - AllowNoMatch *bool - BucketSpan string - End string - ExcludeInterim *bool - OverallScore interface{} - Start string - TopN *int - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLGetOverallBucketsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_ml") + 1 + len("anomaly_detectors") + 1 + len(r.JobID) + 1 + len("results") + 1 + len("overall_buckets")) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("anomaly_detectors") - path.WriteString("/") - path.WriteString(r.JobID) - path.WriteString("/") - path.WriteString("results") - path.WriteString("/") - path.WriteString("overall_buckets") - - params = make(map[string]string) - - if r.AllowNoJobs != nil { - params["allow_no_jobs"] = strconv.FormatBool(*r.AllowNoJobs) - } - - if r.AllowNoMatch != nil { - params["allow_no_match"] = strconv.FormatBool(*r.AllowNoMatch) - } - - if r.BucketSpan != "" { - params["bucket_span"] = r.BucketSpan - } - - if r.End != "" { - params["end"] = r.End - } - - if r.ExcludeInterim != nil { - params["exclude_interim"] = strconv.FormatBool(*r.ExcludeInterim) - } - - if r.OverallScore != nil { - params["overall_score"] = fmt.Sprintf("%v", r.OverallScore) - } - - if r.Start != "" { - params["start"] = r.Start - } - - if r.TopN != nil { - params["top_n"] = strconv.FormatInt(int64(*r.TopN), 10) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLGetOverallBuckets) WithContext(v context.Context) func(*MLGetOverallBucketsRequest) { - return func(r *MLGetOverallBucketsRequest) { - r.ctx = v - } -} - -// WithBody - Overall bucket selection details if not provided in URI. -// -func (f MLGetOverallBuckets) WithBody(v io.Reader) func(*MLGetOverallBucketsRequest) { - return func(r *MLGetOverallBucketsRequest) { - r.Body = v - } -} - -// WithAllowNoJobs - whether to ignore if a wildcard expression matches no jobs. (this includes `_all` string or when no jobs have been specified). -// -func (f MLGetOverallBuckets) WithAllowNoJobs(v bool) func(*MLGetOverallBucketsRequest) { - return func(r *MLGetOverallBucketsRequest) { - r.AllowNoJobs = &v - } -} - -// WithAllowNoMatch - whether to ignore if a wildcard expression matches no jobs. (this includes `_all` string or when no jobs have been specified). -// -func (f MLGetOverallBuckets) WithAllowNoMatch(v bool) func(*MLGetOverallBucketsRequest) { - return func(r *MLGetOverallBucketsRequest) { - r.AllowNoMatch = &v - } -} - -// WithBucketSpan - the span of the overall buckets. defaults to the longest job bucket_span. -// -func (f MLGetOverallBuckets) WithBucketSpan(v string) func(*MLGetOverallBucketsRequest) { - return func(r *MLGetOverallBucketsRequest) { - r.BucketSpan = v - } -} - -// WithEnd - returns overall buckets with timestamps earlier than this time. -// -func (f MLGetOverallBuckets) WithEnd(v string) func(*MLGetOverallBucketsRequest) { - return func(r *MLGetOverallBucketsRequest) { - r.End = v - } -} - -// WithExcludeInterim - if true overall buckets that include interim buckets will be excluded. -// -func (f MLGetOverallBuckets) WithExcludeInterim(v bool) func(*MLGetOverallBucketsRequest) { - return func(r *MLGetOverallBucketsRequest) { - r.ExcludeInterim = &v - } -} - -// WithOverallScore - returns overall buckets with overall scores higher than this value. -// -func (f MLGetOverallBuckets) WithOverallScore(v interface{}) func(*MLGetOverallBucketsRequest) { - return func(r *MLGetOverallBucketsRequest) { - r.OverallScore = v - } -} - -// WithStart - returns overall buckets with timestamps after this time. -// -func (f MLGetOverallBuckets) WithStart(v string) func(*MLGetOverallBucketsRequest) { - return func(r *MLGetOverallBucketsRequest) { - r.Start = v - } -} - -// WithTopN - the number of top job bucket scores to be used in the overall_score calculation. -// -func (f MLGetOverallBuckets) WithTopN(v int) func(*MLGetOverallBucketsRequest) { - return func(r *MLGetOverallBucketsRequest) { - r.TopN = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLGetOverallBuckets) WithPretty() func(*MLGetOverallBucketsRequest) { - return func(r *MLGetOverallBucketsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLGetOverallBuckets) WithHuman() func(*MLGetOverallBucketsRequest) { - return func(r *MLGetOverallBucketsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLGetOverallBuckets) WithErrorTrace() func(*MLGetOverallBucketsRequest) { - return func(r *MLGetOverallBucketsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLGetOverallBuckets) WithFilterPath(v ...string) func(*MLGetOverallBucketsRequest) { - return func(r *MLGetOverallBucketsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLGetOverallBuckets) WithHeader(h map[string]string) func(*MLGetOverallBucketsRequest) { - return func(r *MLGetOverallBucketsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLGetOverallBuckets) WithOpaqueID(s string) func(*MLGetOverallBucketsRequest) { - return func(r *MLGetOverallBucketsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_records.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_records.go deleted file mode 100644 index 095883c3d..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_records.go +++ /dev/null @@ -1,329 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "fmt" - "io" - "net/http" - "strconv" - "strings" -) - -func newMLGetRecordsFunc(t Transport) MLGetRecords { - return func(job_id string, o ...func(*MLGetRecordsRequest)) (*Response, error) { - var r = MLGetRecordsRequest{JobID: job_id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLGetRecords - Retrieves anomaly records for an anomaly detection job. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-record.html. -// -type MLGetRecords func(job_id string, o ...func(*MLGetRecordsRequest)) (*Response, error) - -// MLGetRecordsRequest configures the ML Get Records API request. -// -type MLGetRecordsRequest struct { - Body io.Reader - - JobID string - - Desc *bool - End string - ExcludeInterim *bool - From *int - RecordScore interface{} - Size *int - Sort string - Start string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLGetRecordsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_ml") + 1 + len("anomaly_detectors") + 1 + len(r.JobID) + 1 + len("results") + 1 + len("records")) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("anomaly_detectors") - path.WriteString("/") - path.WriteString(r.JobID) - path.WriteString("/") - path.WriteString("results") - path.WriteString("/") - path.WriteString("records") - - params = make(map[string]string) - - if r.Desc != nil { - params["desc"] = strconv.FormatBool(*r.Desc) - } - - if r.End != "" { - params["end"] = r.End - } - - if r.ExcludeInterim != nil { - params["exclude_interim"] = strconv.FormatBool(*r.ExcludeInterim) - } - - if r.From != nil { - params["from"] = strconv.FormatInt(int64(*r.From), 10) - } - - if r.RecordScore != nil { - params["record_score"] = fmt.Sprintf("%v", r.RecordScore) - } - - if r.Size != nil { - params["size"] = strconv.FormatInt(int64(*r.Size), 10) - } - - if r.Sort != "" { - params["sort"] = r.Sort - } - - if r.Start != "" { - params["start"] = r.Start - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLGetRecords) WithContext(v context.Context) func(*MLGetRecordsRequest) { - return func(r *MLGetRecordsRequest) { - r.ctx = v - } -} - -// WithBody - Record selection criteria. -// -func (f MLGetRecords) WithBody(v io.Reader) func(*MLGetRecordsRequest) { - return func(r *MLGetRecordsRequest) { - r.Body = v - } -} - -// WithDesc - set the sort direction. -// -func (f MLGetRecords) WithDesc(v bool) func(*MLGetRecordsRequest) { - return func(r *MLGetRecordsRequest) { - r.Desc = &v - } -} - -// WithEnd - end time filter for records. -// -func (f MLGetRecords) WithEnd(v string) func(*MLGetRecordsRequest) { - return func(r *MLGetRecordsRequest) { - r.End = v - } -} - -// WithExcludeInterim - exclude interim results. -// -func (f MLGetRecords) WithExcludeInterim(v bool) func(*MLGetRecordsRequest) { - return func(r *MLGetRecordsRequest) { - r.ExcludeInterim = &v - } -} - -// WithFrom - skips a number of records. -// -func (f MLGetRecords) WithFrom(v int) func(*MLGetRecordsRequest) { - return func(r *MLGetRecordsRequest) { - r.From = &v - } -} - -// WithRecordScore - returns records with anomaly scores greater or equal than this value. -// -func (f MLGetRecords) WithRecordScore(v interface{}) func(*MLGetRecordsRequest) { - return func(r *MLGetRecordsRequest) { - r.RecordScore = v - } -} - -// WithSize - specifies a max number of records to get. -// -func (f MLGetRecords) WithSize(v int) func(*MLGetRecordsRequest) { - return func(r *MLGetRecordsRequest) { - r.Size = &v - } -} - -// WithSort - sort records by a particular field. -// -func (f MLGetRecords) WithSort(v string) func(*MLGetRecordsRequest) { - return func(r *MLGetRecordsRequest) { - r.Sort = v - } -} - -// WithStart - start time filter for records. -// -func (f MLGetRecords) WithStart(v string) func(*MLGetRecordsRequest) { - return func(r *MLGetRecordsRequest) { - r.Start = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLGetRecords) WithPretty() func(*MLGetRecordsRequest) { - return func(r *MLGetRecordsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLGetRecords) WithHuman() func(*MLGetRecordsRequest) { - return func(r *MLGetRecordsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLGetRecords) WithErrorTrace() func(*MLGetRecordsRequest) { - return func(r *MLGetRecordsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLGetRecords) WithFilterPath(v ...string) func(*MLGetRecordsRequest) { - return func(r *MLGetRecordsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLGetRecords) WithHeader(h map[string]string) func(*MLGetRecordsRequest) { - return func(r *MLGetRecordsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLGetRecords) WithOpaqueID(s string) func(*MLGetRecordsRequest) { - return func(r *MLGetRecordsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_trained_models.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_trained_models.go deleted file mode 100644 index f333b4210..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_trained_models.go +++ /dev/null @@ -1,319 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newMLGetTrainedModelsFunc(t Transport) MLGetTrainedModels { - return func(o ...func(*MLGetTrainedModelsRequest)) (*Response, error) { - var r = MLGetTrainedModelsRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLGetTrainedModels - Retrieves configuration information for a trained inference model. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/get-trained-models.html. -// -type MLGetTrainedModels func(o ...func(*MLGetTrainedModelsRequest)) (*Response, error) - -// MLGetTrainedModelsRequest configures the ML Get Trained Models API request. -// -type MLGetTrainedModelsRequest struct { - ModelID string - - AllowNoMatch *bool - DecompressDefinition *bool - ExcludeGenerated *bool - From *int - Include string - IncludeModelDefinition *bool - Size *int - Tags []string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLGetTrainedModelsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_ml") + 1 + len("trained_models") + 1 + len(r.ModelID)) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("trained_models") - if r.ModelID != "" { - path.WriteString("/") - path.WriteString(r.ModelID) - } - - params = make(map[string]string) - - if r.AllowNoMatch != nil { - params["allow_no_match"] = strconv.FormatBool(*r.AllowNoMatch) - } - - if r.DecompressDefinition != nil { - params["decompress_definition"] = strconv.FormatBool(*r.DecompressDefinition) - } - - if r.ExcludeGenerated != nil { - params["exclude_generated"] = strconv.FormatBool(*r.ExcludeGenerated) - } - - if r.From != nil { - params["from"] = strconv.FormatInt(int64(*r.From), 10) - } - - if r.Include != "" { - params["include"] = r.Include - } - - if r.IncludeModelDefinition != nil { - params["include_model_definition"] = strconv.FormatBool(*r.IncludeModelDefinition) - } - - if r.Size != nil { - params["size"] = strconv.FormatInt(int64(*r.Size), 10) - } - - if len(r.Tags) > 0 { - params["tags"] = strings.Join(r.Tags, ",") - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLGetTrainedModels) WithContext(v context.Context) func(*MLGetTrainedModelsRequest) { - return func(r *MLGetTrainedModelsRequest) { - r.ctx = v - } -} - -// WithModelID - the ID of the trained models to fetch. -// -func (f MLGetTrainedModels) WithModelID(v string) func(*MLGetTrainedModelsRequest) { - return func(r *MLGetTrainedModelsRequest) { - r.ModelID = v - } -} - -// WithAllowNoMatch - whether to ignore if a wildcard expression matches no trained models. (this includes `_all` string or when no trained models have been specified). -// -func (f MLGetTrainedModels) WithAllowNoMatch(v bool) func(*MLGetTrainedModelsRequest) { - return func(r *MLGetTrainedModelsRequest) { - r.AllowNoMatch = &v - } -} - -// WithDecompressDefinition - should the model definition be decompressed into valid json or returned in a custom compressed format. defaults to true.. -// -func (f MLGetTrainedModels) WithDecompressDefinition(v bool) func(*MLGetTrainedModelsRequest) { - return func(r *MLGetTrainedModelsRequest) { - r.DecompressDefinition = &v - } -} - -// WithExcludeGenerated - omits fields that are illegal to set on model put. -// -func (f MLGetTrainedModels) WithExcludeGenerated(v bool) func(*MLGetTrainedModelsRequest) { - return func(r *MLGetTrainedModelsRequest) { - r.ExcludeGenerated = &v - } -} - -// WithFrom - skips a number of trained models. -// -func (f MLGetTrainedModels) WithFrom(v int) func(*MLGetTrainedModelsRequest) { - return func(r *MLGetTrainedModelsRequest) { - r.From = &v - } -} - -// WithInclude - a comma-separate list of fields to optionally include. valid options are 'definition' and 'total_feature_importance'. default is none.. -// -func (f MLGetTrainedModels) WithInclude(v string) func(*MLGetTrainedModelsRequest) { - return func(r *MLGetTrainedModelsRequest) { - r.Include = v - } -} - -// WithIncludeModelDefinition - should the full model definition be included in the results. these definitions can be large. so be cautious when including them. defaults to false.. -// -func (f MLGetTrainedModels) WithIncludeModelDefinition(v bool) func(*MLGetTrainedModelsRequest) { - return func(r *MLGetTrainedModelsRequest) { - r.IncludeModelDefinition = &v - } -} - -// WithSize - specifies a max number of trained models to get. -// -func (f MLGetTrainedModels) WithSize(v int) func(*MLGetTrainedModelsRequest) { - return func(r *MLGetTrainedModelsRequest) { - r.Size = &v - } -} - -// WithTags - a list of tags that the model must have.. -// -func (f MLGetTrainedModels) WithTags(v ...string) func(*MLGetTrainedModelsRequest) { - return func(r *MLGetTrainedModelsRequest) { - r.Tags = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLGetTrainedModels) WithPretty() func(*MLGetTrainedModelsRequest) { - return func(r *MLGetTrainedModelsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLGetTrainedModels) WithHuman() func(*MLGetTrainedModelsRequest) { - return func(r *MLGetTrainedModelsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLGetTrainedModels) WithErrorTrace() func(*MLGetTrainedModelsRequest) { - return func(r *MLGetTrainedModelsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLGetTrainedModels) WithFilterPath(v ...string) func(*MLGetTrainedModelsRequest) { - return func(r *MLGetTrainedModelsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLGetTrainedModels) WithHeader(h map[string]string) func(*MLGetTrainedModelsRequest) { - return func(r *MLGetTrainedModelsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLGetTrainedModels) WithOpaqueID(s string) func(*MLGetTrainedModelsRequest) { - return func(r *MLGetTrainedModelsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_trained_models_stats.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_trained_models_stats.go deleted file mode 100644 index 8437423f5..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.get_trained_models_stats.go +++ /dev/null @@ -1,256 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newMLGetTrainedModelsStatsFunc(t Transport) MLGetTrainedModelsStats { - return func(o ...func(*MLGetTrainedModelsStatsRequest)) (*Response, error) { - var r = MLGetTrainedModelsStatsRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLGetTrainedModelsStats - Retrieves usage information for trained inference models. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/get-trained-models-stats.html. -// -type MLGetTrainedModelsStats func(o ...func(*MLGetTrainedModelsStatsRequest)) (*Response, error) - -// MLGetTrainedModelsStatsRequest configures the ML Get Trained Models Stats API request. -// -type MLGetTrainedModelsStatsRequest struct { - ModelID string - - AllowNoMatch *bool - From *int - Size *int - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLGetTrainedModelsStatsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_ml") + 1 + len("trained_models") + 1 + len(r.ModelID) + 1 + len("_stats")) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("trained_models") - if r.ModelID != "" { - path.WriteString("/") - path.WriteString(r.ModelID) - } - path.WriteString("/") - path.WriteString("_stats") - - params = make(map[string]string) - - if r.AllowNoMatch != nil { - params["allow_no_match"] = strconv.FormatBool(*r.AllowNoMatch) - } - - if r.From != nil { - params["from"] = strconv.FormatInt(int64(*r.From), 10) - } - - if r.Size != nil { - params["size"] = strconv.FormatInt(int64(*r.Size), 10) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLGetTrainedModelsStats) WithContext(v context.Context) func(*MLGetTrainedModelsStatsRequest) { - return func(r *MLGetTrainedModelsStatsRequest) { - r.ctx = v - } -} - -// WithModelID - the ID of the trained models stats to fetch. -// -func (f MLGetTrainedModelsStats) WithModelID(v string) func(*MLGetTrainedModelsStatsRequest) { - return func(r *MLGetTrainedModelsStatsRequest) { - r.ModelID = v - } -} - -// WithAllowNoMatch - whether to ignore if a wildcard expression matches no trained models. (this includes `_all` string or when no trained models have been specified). -// -func (f MLGetTrainedModelsStats) WithAllowNoMatch(v bool) func(*MLGetTrainedModelsStatsRequest) { - return func(r *MLGetTrainedModelsStatsRequest) { - r.AllowNoMatch = &v - } -} - -// WithFrom - skips a number of trained models. -// -func (f MLGetTrainedModelsStats) WithFrom(v int) func(*MLGetTrainedModelsStatsRequest) { - return func(r *MLGetTrainedModelsStatsRequest) { - r.From = &v - } -} - -// WithSize - specifies a max number of trained models to get. -// -func (f MLGetTrainedModelsStats) WithSize(v int) func(*MLGetTrainedModelsStatsRequest) { - return func(r *MLGetTrainedModelsStatsRequest) { - r.Size = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLGetTrainedModelsStats) WithPretty() func(*MLGetTrainedModelsStatsRequest) { - return func(r *MLGetTrainedModelsStatsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLGetTrainedModelsStats) WithHuman() func(*MLGetTrainedModelsStatsRequest) { - return func(r *MLGetTrainedModelsStatsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLGetTrainedModelsStats) WithErrorTrace() func(*MLGetTrainedModelsStatsRequest) { - return func(r *MLGetTrainedModelsStatsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLGetTrainedModelsStats) WithFilterPath(v ...string) func(*MLGetTrainedModelsStatsRequest) { - return func(r *MLGetTrainedModelsStatsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLGetTrainedModelsStats) WithHeader(h map[string]string) func(*MLGetTrainedModelsStatsRequest) { - return func(r *MLGetTrainedModelsStatsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLGetTrainedModelsStats) WithOpaqueID(s string) func(*MLGetTrainedModelsStatsRequest) { - return func(r *MLGetTrainedModelsStatsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.info.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.info.go deleted file mode 100644 index b9e5c62ae..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.info.go +++ /dev/null @@ -1,196 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newMLInfoFunc(t Transport) MLInfo { - return func(o ...func(*MLInfoRequest)) (*Response, error) { - var r = MLInfoRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLInfo - Returns defaults and limits used by machine learning. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/get-ml-info.html. -// -type MLInfo func(o ...func(*MLInfoRequest)) (*Response, error) - -// MLInfoRequest configures the ML Info API request. -// -type MLInfoRequest struct { - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLInfoRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(len("/_ml/info")) - path.WriteString("/_ml/info") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLInfo) WithContext(v context.Context) func(*MLInfoRequest) { - return func(r *MLInfoRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLInfo) WithPretty() func(*MLInfoRequest) { - return func(r *MLInfoRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLInfo) WithHuman() func(*MLInfoRequest) { - return func(r *MLInfoRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLInfo) WithErrorTrace() func(*MLInfoRequest) { - return func(r *MLInfoRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLInfo) WithFilterPath(v ...string) func(*MLInfoRequest) { - return func(r *MLInfoRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLInfo) WithHeader(h map[string]string) func(*MLInfoRequest) { - return func(r *MLInfoRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLInfo) WithOpaqueID(s string) func(*MLInfoRequest) { - return func(r *MLInfoRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.open_job.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.open_job.go deleted file mode 100644 index cd1000031..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.open_job.go +++ /dev/null @@ -1,205 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newMLOpenJobFunc(t Transport) MLOpenJob { - return func(job_id string, o ...func(*MLOpenJobRequest)) (*Response, error) { - var r = MLOpenJobRequest{JobID: job_id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLOpenJob - Opens one or more anomaly detection jobs. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-open-job.html. -// -type MLOpenJob func(job_id string, o ...func(*MLOpenJobRequest)) (*Response, error) - -// MLOpenJobRequest configures the ML Open Job API request. -// -type MLOpenJobRequest struct { - JobID string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLOpenJobRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_ml") + 1 + len("anomaly_detectors") + 1 + len(r.JobID) + 1 + len("_open")) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("anomaly_detectors") - path.WriteString("/") - path.WriteString(r.JobID) - path.WriteString("/") - path.WriteString("_open") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLOpenJob) WithContext(v context.Context) func(*MLOpenJobRequest) { - return func(r *MLOpenJobRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLOpenJob) WithPretty() func(*MLOpenJobRequest) { - return func(r *MLOpenJobRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLOpenJob) WithHuman() func(*MLOpenJobRequest) { - return func(r *MLOpenJobRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLOpenJob) WithErrorTrace() func(*MLOpenJobRequest) { - return func(r *MLOpenJobRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLOpenJob) WithFilterPath(v ...string) func(*MLOpenJobRequest) { - return func(r *MLOpenJobRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLOpenJob) WithHeader(h map[string]string) func(*MLOpenJobRequest) { - return func(r *MLOpenJobRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLOpenJob) WithOpaqueID(s string) func(*MLOpenJobRequest) { - return func(r *MLOpenJobRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.post_calendar_events.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.post_calendar_events.go deleted file mode 100644 index e3da32846..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.post_calendar_events.go +++ /dev/null @@ -1,212 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" -) - -func newMLPostCalendarEventsFunc(t Transport) MLPostCalendarEvents { - return func(calendar_id string, body io.Reader, o ...func(*MLPostCalendarEventsRequest)) (*Response, error) { - var r = MLPostCalendarEventsRequest{CalendarID: calendar_id, Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLPostCalendarEvents - Posts scheduled events in a calendar. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-post-calendar-event.html. -// -type MLPostCalendarEvents func(calendar_id string, body io.Reader, o ...func(*MLPostCalendarEventsRequest)) (*Response, error) - -// MLPostCalendarEventsRequest configures the ML Post Calendar Events API request. -// -type MLPostCalendarEventsRequest struct { - Body io.Reader - - CalendarID string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLPostCalendarEventsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_ml") + 1 + len("calendars") + 1 + len(r.CalendarID) + 1 + len("events")) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("calendars") - path.WriteString("/") - path.WriteString(r.CalendarID) - path.WriteString("/") - path.WriteString("events") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLPostCalendarEvents) WithContext(v context.Context) func(*MLPostCalendarEventsRequest) { - return func(r *MLPostCalendarEventsRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLPostCalendarEvents) WithPretty() func(*MLPostCalendarEventsRequest) { - return func(r *MLPostCalendarEventsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLPostCalendarEvents) WithHuman() func(*MLPostCalendarEventsRequest) { - return func(r *MLPostCalendarEventsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLPostCalendarEvents) WithErrorTrace() func(*MLPostCalendarEventsRequest) { - return func(r *MLPostCalendarEventsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLPostCalendarEvents) WithFilterPath(v ...string) func(*MLPostCalendarEventsRequest) { - return func(r *MLPostCalendarEventsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLPostCalendarEvents) WithHeader(h map[string]string) func(*MLPostCalendarEventsRequest) { - return func(r *MLPostCalendarEventsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLPostCalendarEvents) WithOpaqueID(s string) func(*MLPostCalendarEventsRequest) { - return func(r *MLPostCalendarEventsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.post_data.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.post_data.go deleted file mode 100644 index 9b9a0ed59..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.post_data.go +++ /dev/null @@ -1,239 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" -) - -func newMLPostDataFunc(t Transport) MLPostData { - return func(job_id string, body io.Reader, o ...func(*MLPostDataRequest)) (*Response, error) { - var r = MLPostDataRequest{JobID: job_id, Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLPostData - Sends data to an anomaly detection job for analysis. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-post-data.html. -// -type MLPostData func(job_id string, body io.Reader, o ...func(*MLPostDataRequest)) (*Response, error) - -// MLPostDataRequest configures the ML Post Data API request. -// -type MLPostDataRequest struct { - Body io.Reader - - JobID string - - ResetEnd string - ResetStart string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLPostDataRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_ml") + 1 + len("anomaly_detectors") + 1 + len(r.JobID) + 1 + len("_data")) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("anomaly_detectors") - path.WriteString("/") - path.WriteString(r.JobID) - path.WriteString("/") - path.WriteString("_data") - - params = make(map[string]string) - - if r.ResetEnd != "" { - params["reset_end"] = r.ResetEnd - } - - if r.ResetStart != "" { - params["reset_start"] = r.ResetStart - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLPostData) WithContext(v context.Context) func(*MLPostDataRequest) { - return func(r *MLPostDataRequest) { - r.ctx = v - } -} - -// WithResetEnd - optional parameter to specify the end of the bucket resetting range. -// -func (f MLPostData) WithResetEnd(v string) func(*MLPostDataRequest) { - return func(r *MLPostDataRequest) { - r.ResetEnd = v - } -} - -// WithResetStart - optional parameter to specify the start of the bucket resetting range. -// -func (f MLPostData) WithResetStart(v string) func(*MLPostDataRequest) { - return func(r *MLPostDataRequest) { - r.ResetStart = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLPostData) WithPretty() func(*MLPostDataRequest) { - return func(r *MLPostDataRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLPostData) WithHuman() func(*MLPostDataRequest) { - return func(r *MLPostDataRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLPostData) WithErrorTrace() func(*MLPostDataRequest) { - return func(r *MLPostDataRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLPostData) WithFilterPath(v ...string) func(*MLPostDataRequest) { - return func(r *MLPostDataRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLPostData) WithHeader(h map[string]string) func(*MLPostDataRequest) { - return func(r *MLPostDataRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLPostData) WithOpaqueID(s string) func(*MLPostDataRequest) { - return func(r *MLPostDataRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.preview_data_frame_analytics.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.preview_data_frame_analytics.go deleted file mode 100644 index cae20c5c1..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.preview_data_frame_analytics.go +++ /dev/null @@ -1,232 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" -) - -func newMLPreviewDataFrameAnalyticsFunc(t Transport) MLPreviewDataFrameAnalytics { - return func(o ...func(*MLPreviewDataFrameAnalyticsRequest)) (*Response, error) { - var r = MLPreviewDataFrameAnalyticsRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLPreviewDataFrameAnalytics - Previews that will be analyzed given a data frame analytics config. -// -// See full documentation at http://www.elastic.co/guide/en/elasticsearch/reference/current/preview-dfanalytics.html. -// -type MLPreviewDataFrameAnalytics func(o ...func(*MLPreviewDataFrameAnalyticsRequest)) (*Response, error) - -// MLPreviewDataFrameAnalyticsRequest configures the ML Preview Data Frame Analytics API request. -// -type MLPreviewDataFrameAnalyticsRequest struct { - DocumentID string - - Body io.Reader - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLPreviewDataFrameAnalyticsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_ml") + 1 + len("data_frame") + 1 + len("analytics") + 1 + len(r.DocumentID) + 1 + len("_preview")) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("data_frame") - path.WriteString("/") - path.WriteString("analytics") - if r.DocumentID != "" { - path.WriteString("/") - path.WriteString(r.DocumentID) - } - path.WriteString("/") - path.WriteString("_preview") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLPreviewDataFrameAnalytics) WithContext(v context.Context) func(*MLPreviewDataFrameAnalyticsRequest) { - return func(r *MLPreviewDataFrameAnalyticsRequest) { - r.ctx = v - } -} - -// WithBody - The data frame analytics config to preview. -// -func (f MLPreviewDataFrameAnalytics) WithBody(v io.Reader) func(*MLPreviewDataFrameAnalyticsRequest) { - return func(r *MLPreviewDataFrameAnalyticsRequest) { - r.Body = v - } -} - -// WithDocumentID - the ID of the data frame analytics to preview. -// -func (f MLPreviewDataFrameAnalytics) WithDocumentID(v string) func(*MLPreviewDataFrameAnalyticsRequest) { - return func(r *MLPreviewDataFrameAnalyticsRequest) { - r.DocumentID = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLPreviewDataFrameAnalytics) WithPretty() func(*MLPreviewDataFrameAnalyticsRequest) { - return func(r *MLPreviewDataFrameAnalyticsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLPreviewDataFrameAnalytics) WithHuman() func(*MLPreviewDataFrameAnalyticsRequest) { - return func(r *MLPreviewDataFrameAnalyticsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLPreviewDataFrameAnalytics) WithErrorTrace() func(*MLPreviewDataFrameAnalyticsRequest) { - return func(r *MLPreviewDataFrameAnalyticsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLPreviewDataFrameAnalytics) WithFilterPath(v ...string) func(*MLPreviewDataFrameAnalyticsRequest) { - return func(r *MLPreviewDataFrameAnalyticsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLPreviewDataFrameAnalytics) WithHeader(h map[string]string) func(*MLPreviewDataFrameAnalyticsRequest) { - return func(r *MLPreviewDataFrameAnalyticsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLPreviewDataFrameAnalytics) WithOpaqueID(s string) func(*MLPreviewDataFrameAnalyticsRequest) { - return func(r *MLPreviewDataFrameAnalyticsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.preview_datafeed.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.preview_datafeed.go deleted file mode 100644 index 14d4407ae..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.preview_datafeed.go +++ /dev/null @@ -1,230 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" -) - -func newMLPreviewDatafeedFunc(t Transport) MLPreviewDatafeed { - return func(o ...func(*MLPreviewDatafeedRequest)) (*Response, error) { - var r = MLPreviewDatafeedRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLPreviewDatafeed - Previews a datafeed. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-preview-datafeed.html. -// -type MLPreviewDatafeed func(o ...func(*MLPreviewDatafeedRequest)) (*Response, error) - -// MLPreviewDatafeedRequest configures the ML Preview Datafeed API request. -// -type MLPreviewDatafeedRequest struct { - Body io.Reader - - DatafeedID string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLPreviewDatafeedRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_ml") + 1 + len("datafeeds") + 1 + len(r.DatafeedID) + 1 + len("_preview")) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("datafeeds") - if r.DatafeedID != "" { - path.WriteString("/") - path.WriteString(r.DatafeedID) - } - path.WriteString("/") - path.WriteString("_preview") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLPreviewDatafeed) WithContext(v context.Context) func(*MLPreviewDatafeedRequest) { - return func(r *MLPreviewDatafeedRequest) { - r.ctx = v - } -} - -// WithBody - The datafeed config and job config with which to execute the preview. -// -func (f MLPreviewDatafeed) WithBody(v io.Reader) func(*MLPreviewDatafeedRequest) { - return func(r *MLPreviewDatafeedRequest) { - r.Body = v - } -} - -// WithDatafeedID - the ID of the datafeed to preview. -// -func (f MLPreviewDatafeed) WithDatafeedID(v string) func(*MLPreviewDatafeedRequest) { - return func(r *MLPreviewDatafeedRequest) { - r.DatafeedID = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLPreviewDatafeed) WithPretty() func(*MLPreviewDatafeedRequest) { - return func(r *MLPreviewDatafeedRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLPreviewDatafeed) WithHuman() func(*MLPreviewDatafeedRequest) { - return func(r *MLPreviewDatafeedRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLPreviewDatafeed) WithErrorTrace() func(*MLPreviewDatafeedRequest) { - return func(r *MLPreviewDatafeedRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLPreviewDatafeed) WithFilterPath(v ...string) func(*MLPreviewDatafeedRequest) { - return func(r *MLPreviewDatafeedRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLPreviewDatafeed) WithHeader(h map[string]string) func(*MLPreviewDatafeedRequest) { - return func(r *MLPreviewDatafeedRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLPreviewDatafeed) WithOpaqueID(s string) func(*MLPreviewDatafeedRequest) { - return func(r *MLPreviewDatafeedRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.put_calendar.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.put_calendar.go deleted file mode 100644 index d479b533a..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.put_calendar.go +++ /dev/null @@ -1,218 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" -) - -func newMLPutCalendarFunc(t Transport) MLPutCalendar { - return func(calendar_id string, o ...func(*MLPutCalendarRequest)) (*Response, error) { - var r = MLPutCalendarRequest{CalendarID: calendar_id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLPutCalendar - Instantiates a calendar. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-calendar.html. -// -type MLPutCalendar func(calendar_id string, o ...func(*MLPutCalendarRequest)) (*Response, error) - -// MLPutCalendarRequest configures the ML Put Calendar API request. -// -type MLPutCalendarRequest struct { - Body io.Reader - - CalendarID string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLPutCalendarRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - path.Grow(1 + len("_ml") + 1 + len("calendars") + 1 + len(r.CalendarID)) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("calendars") - path.WriteString("/") - path.WriteString(r.CalendarID) - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLPutCalendar) WithContext(v context.Context) func(*MLPutCalendarRequest) { - return func(r *MLPutCalendarRequest) { - r.ctx = v - } -} - -// WithBody - The calendar details. -// -func (f MLPutCalendar) WithBody(v io.Reader) func(*MLPutCalendarRequest) { - return func(r *MLPutCalendarRequest) { - r.Body = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLPutCalendar) WithPretty() func(*MLPutCalendarRequest) { - return func(r *MLPutCalendarRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLPutCalendar) WithHuman() func(*MLPutCalendarRequest) { - return func(r *MLPutCalendarRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLPutCalendar) WithErrorTrace() func(*MLPutCalendarRequest) { - return func(r *MLPutCalendarRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLPutCalendar) WithFilterPath(v ...string) func(*MLPutCalendarRequest) { - return func(r *MLPutCalendarRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLPutCalendar) WithHeader(h map[string]string) func(*MLPutCalendarRequest) { - return func(r *MLPutCalendarRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLPutCalendar) WithOpaqueID(s string) func(*MLPutCalendarRequest) { - return func(r *MLPutCalendarRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.put_calendar_job.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.put_calendar_job.go deleted file mode 100644 index f8c7ac854..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.put_calendar_job.go +++ /dev/null @@ -1,208 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newMLPutCalendarJobFunc(t Transport) MLPutCalendarJob { - return func(calendar_id string, job_id string, o ...func(*MLPutCalendarJobRequest)) (*Response, error) { - var r = MLPutCalendarJobRequest{CalendarID: calendar_id, JobID: job_id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLPutCalendarJob - Adds an anomaly detection job to a calendar. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-calendar-job.html. -// -type MLPutCalendarJob func(calendar_id string, job_id string, o ...func(*MLPutCalendarJobRequest)) (*Response, error) - -// MLPutCalendarJobRequest configures the ML Put Calendar Job API request. -// -type MLPutCalendarJobRequest struct { - CalendarID string - JobID string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLPutCalendarJobRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - path.Grow(1 + len("_ml") + 1 + len("calendars") + 1 + len(r.CalendarID) + 1 + len("jobs") + 1 + len(r.JobID)) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("calendars") - path.WriteString("/") - path.WriteString(r.CalendarID) - path.WriteString("/") - path.WriteString("jobs") - path.WriteString("/") - path.WriteString(r.JobID) - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLPutCalendarJob) WithContext(v context.Context) func(*MLPutCalendarJobRequest) { - return func(r *MLPutCalendarJobRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLPutCalendarJob) WithPretty() func(*MLPutCalendarJobRequest) { - return func(r *MLPutCalendarJobRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLPutCalendarJob) WithHuman() func(*MLPutCalendarJobRequest) { - return func(r *MLPutCalendarJobRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLPutCalendarJob) WithErrorTrace() func(*MLPutCalendarJobRequest) { - return func(r *MLPutCalendarJobRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLPutCalendarJob) WithFilterPath(v ...string) func(*MLPutCalendarJobRequest) { - return func(r *MLPutCalendarJobRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLPutCalendarJob) WithHeader(h map[string]string) func(*MLPutCalendarJobRequest) { - return func(r *MLPutCalendarJobRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLPutCalendarJob) WithOpaqueID(s string) func(*MLPutCalendarJobRequest) { - return func(r *MLPutCalendarJobRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.put_data_frame_analytics.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.put_data_frame_analytics.go deleted file mode 100644 index 479cbae3f..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.put_data_frame_analytics.go +++ /dev/null @@ -1,212 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" -) - -func newMLPutDataFrameAnalyticsFunc(t Transport) MLPutDataFrameAnalytics { - return func(id string, body io.Reader, o ...func(*MLPutDataFrameAnalyticsRequest)) (*Response, error) { - var r = MLPutDataFrameAnalyticsRequest{ID: id, Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLPutDataFrameAnalytics - Instantiates a data frame analytics job. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/put-dfanalytics.html. -// -type MLPutDataFrameAnalytics func(id string, body io.Reader, o ...func(*MLPutDataFrameAnalyticsRequest)) (*Response, error) - -// MLPutDataFrameAnalyticsRequest configures the ML Put Data Frame Analytics API request. -// -type MLPutDataFrameAnalyticsRequest struct { - ID string - - Body io.Reader - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLPutDataFrameAnalyticsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - path.Grow(1 + len("_ml") + 1 + len("data_frame") + 1 + len("analytics") + 1 + len(r.ID)) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("data_frame") - path.WriteString("/") - path.WriteString("analytics") - path.WriteString("/") - path.WriteString(r.ID) - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLPutDataFrameAnalytics) WithContext(v context.Context) func(*MLPutDataFrameAnalyticsRequest) { - return func(r *MLPutDataFrameAnalyticsRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLPutDataFrameAnalytics) WithPretty() func(*MLPutDataFrameAnalyticsRequest) { - return func(r *MLPutDataFrameAnalyticsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLPutDataFrameAnalytics) WithHuman() func(*MLPutDataFrameAnalyticsRequest) { - return func(r *MLPutDataFrameAnalyticsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLPutDataFrameAnalytics) WithErrorTrace() func(*MLPutDataFrameAnalyticsRequest) { - return func(r *MLPutDataFrameAnalyticsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLPutDataFrameAnalytics) WithFilterPath(v ...string) func(*MLPutDataFrameAnalyticsRequest) { - return func(r *MLPutDataFrameAnalyticsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLPutDataFrameAnalytics) WithHeader(h map[string]string) func(*MLPutDataFrameAnalyticsRequest) { - return func(r *MLPutDataFrameAnalyticsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLPutDataFrameAnalytics) WithOpaqueID(s string) func(*MLPutDataFrameAnalyticsRequest) { - return func(r *MLPutDataFrameAnalyticsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.put_datafeed.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.put_datafeed.go deleted file mode 100644 index b736c197f..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.put_datafeed.go +++ /dev/null @@ -1,264 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" -) - -func newMLPutDatafeedFunc(t Transport) MLPutDatafeed { - return func(body io.Reader, datafeed_id string, o ...func(*MLPutDatafeedRequest)) (*Response, error) { - var r = MLPutDatafeedRequest{Body: body, DatafeedID: datafeed_id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLPutDatafeed - Instantiates a datafeed. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-datafeed.html. -// -type MLPutDatafeed func(body io.Reader, datafeed_id string, o ...func(*MLPutDatafeedRequest)) (*Response, error) - -// MLPutDatafeedRequest configures the ML Put Datafeed API request. -// -type MLPutDatafeedRequest struct { - Body io.Reader - - DatafeedID string - - AllowNoIndices *bool - ExpandWildcards string - IgnoreThrottled *bool - IgnoreUnavailable *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLPutDatafeedRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - path.Grow(1 + len("_ml") + 1 + len("datafeeds") + 1 + len(r.DatafeedID)) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("datafeeds") - path.WriteString("/") - path.WriteString(r.DatafeedID) - - params = make(map[string]string) - - if r.AllowNoIndices != nil { - params["allow_no_indices"] = strconv.FormatBool(*r.AllowNoIndices) - } - - if r.ExpandWildcards != "" { - params["expand_wildcards"] = r.ExpandWildcards - } - - if r.IgnoreThrottled != nil { - params["ignore_throttled"] = strconv.FormatBool(*r.IgnoreThrottled) - } - - if r.IgnoreUnavailable != nil { - params["ignore_unavailable"] = strconv.FormatBool(*r.IgnoreUnavailable) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLPutDatafeed) WithContext(v context.Context) func(*MLPutDatafeedRequest) { - return func(r *MLPutDatafeedRequest) { - r.ctx = v - } -} - -// WithAllowNoIndices - ignore if the source indices expressions resolves to no concrete indices (default: true). -// -func (f MLPutDatafeed) WithAllowNoIndices(v bool) func(*MLPutDatafeedRequest) { - return func(r *MLPutDatafeedRequest) { - r.AllowNoIndices = &v - } -} - -// WithExpandWildcards - whether source index expressions should get expanded to open or closed indices (default: open). -// -func (f MLPutDatafeed) WithExpandWildcards(v string) func(*MLPutDatafeedRequest) { - return func(r *MLPutDatafeedRequest) { - r.ExpandWildcards = v - } -} - -// WithIgnoreThrottled - ignore indices that are marked as throttled (default: true). -// -func (f MLPutDatafeed) WithIgnoreThrottled(v bool) func(*MLPutDatafeedRequest) { - return func(r *MLPutDatafeedRequest) { - r.IgnoreThrottled = &v - } -} - -// WithIgnoreUnavailable - ignore unavailable indexes (default: false). -// -func (f MLPutDatafeed) WithIgnoreUnavailable(v bool) func(*MLPutDatafeedRequest) { - return func(r *MLPutDatafeedRequest) { - r.IgnoreUnavailable = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLPutDatafeed) WithPretty() func(*MLPutDatafeedRequest) { - return func(r *MLPutDatafeedRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLPutDatafeed) WithHuman() func(*MLPutDatafeedRequest) { - return func(r *MLPutDatafeedRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLPutDatafeed) WithErrorTrace() func(*MLPutDatafeedRequest) { - return func(r *MLPutDatafeedRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLPutDatafeed) WithFilterPath(v ...string) func(*MLPutDatafeedRequest) { - return func(r *MLPutDatafeedRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLPutDatafeed) WithHeader(h map[string]string) func(*MLPutDatafeedRequest) { - return func(r *MLPutDatafeedRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLPutDatafeed) WithOpaqueID(s string) func(*MLPutDatafeedRequest) { - return func(r *MLPutDatafeedRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.put_filter.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.put_filter.go deleted file mode 100644 index 12e155ffc..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.put_filter.go +++ /dev/null @@ -1,210 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" -) - -func newMLPutFilterFunc(t Transport) MLPutFilter { - return func(body io.Reader, filter_id string, o ...func(*MLPutFilterRequest)) (*Response, error) { - var r = MLPutFilterRequest{Body: body, FilterID: filter_id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLPutFilter - Instantiates a filter. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-filter.html. -// -type MLPutFilter func(body io.Reader, filter_id string, o ...func(*MLPutFilterRequest)) (*Response, error) - -// MLPutFilterRequest configures the ML Put Filter API request. -// -type MLPutFilterRequest struct { - Body io.Reader - - FilterID string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLPutFilterRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - path.Grow(1 + len("_ml") + 1 + len("filters") + 1 + len(r.FilterID)) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("filters") - path.WriteString("/") - path.WriteString(r.FilterID) - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLPutFilter) WithContext(v context.Context) func(*MLPutFilterRequest) { - return func(r *MLPutFilterRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLPutFilter) WithPretty() func(*MLPutFilterRequest) { - return func(r *MLPutFilterRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLPutFilter) WithHuman() func(*MLPutFilterRequest) { - return func(r *MLPutFilterRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLPutFilter) WithErrorTrace() func(*MLPutFilterRequest) { - return func(r *MLPutFilterRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLPutFilter) WithFilterPath(v ...string) func(*MLPutFilterRequest) { - return func(r *MLPutFilterRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLPutFilter) WithHeader(h map[string]string) func(*MLPutFilterRequest) { - return func(r *MLPutFilterRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLPutFilter) WithOpaqueID(s string) func(*MLPutFilterRequest) { - return func(r *MLPutFilterRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.put_job.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.put_job.go deleted file mode 100644 index 81e185174..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.put_job.go +++ /dev/null @@ -1,210 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" -) - -func newMLPutJobFunc(t Transport) MLPutJob { - return func(job_id string, body io.Reader, o ...func(*MLPutJobRequest)) (*Response, error) { - var r = MLPutJobRequest{JobID: job_id, Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLPutJob - Instantiates an anomaly detection job. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-job.html. -// -type MLPutJob func(job_id string, body io.Reader, o ...func(*MLPutJobRequest)) (*Response, error) - -// MLPutJobRequest configures the ML Put Job API request. -// -type MLPutJobRequest struct { - Body io.Reader - - JobID string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLPutJobRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - path.Grow(1 + len("_ml") + 1 + len("anomaly_detectors") + 1 + len(r.JobID)) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("anomaly_detectors") - path.WriteString("/") - path.WriteString(r.JobID) - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLPutJob) WithContext(v context.Context) func(*MLPutJobRequest) { - return func(r *MLPutJobRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLPutJob) WithPretty() func(*MLPutJobRequest) { - return func(r *MLPutJobRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLPutJob) WithHuman() func(*MLPutJobRequest) { - return func(r *MLPutJobRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLPutJob) WithErrorTrace() func(*MLPutJobRequest) { - return func(r *MLPutJobRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLPutJob) WithFilterPath(v ...string) func(*MLPutJobRequest) { - return func(r *MLPutJobRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLPutJob) WithHeader(h map[string]string) func(*MLPutJobRequest) { - return func(r *MLPutJobRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLPutJob) WithOpaqueID(s string) func(*MLPutJobRequest) { - return func(r *MLPutJobRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.put_trained_model.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.put_trained_model.go deleted file mode 100644 index e1b2eab33..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.put_trained_model.go +++ /dev/null @@ -1,210 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" -) - -func newMLPutTrainedModelFunc(t Transport) MLPutTrainedModel { - return func(body io.Reader, model_id string, o ...func(*MLPutTrainedModelRequest)) (*Response, error) { - var r = MLPutTrainedModelRequest{Body: body, ModelID: model_id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLPutTrainedModel - Creates an inference trained model. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/put-trained-models.html. -// -type MLPutTrainedModel func(body io.Reader, model_id string, o ...func(*MLPutTrainedModelRequest)) (*Response, error) - -// MLPutTrainedModelRequest configures the ML Put Trained Model API request. -// -type MLPutTrainedModelRequest struct { - Body io.Reader - - ModelID string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLPutTrainedModelRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - path.Grow(1 + len("_ml") + 1 + len("trained_models") + 1 + len(r.ModelID)) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("trained_models") - path.WriteString("/") - path.WriteString(r.ModelID) - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLPutTrainedModel) WithContext(v context.Context) func(*MLPutTrainedModelRequest) { - return func(r *MLPutTrainedModelRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLPutTrainedModel) WithPretty() func(*MLPutTrainedModelRequest) { - return func(r *MLPutTrainedModelRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLPutTrainedModel) WithHuman() func(*MLPutTrainedModelRequest) { - return func(r *MLPutTrainedModelRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLPutTrainedModel) WithErrorTrace() func(*MLPutTrainedModelRequest) { - return func(r *MLPutTrainedModelRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLPutTrainedModel) WithFilterPath(v ...string) func(*MLPutTrainedModelRequest) { - return func(r *MLPutTrainedModelRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLPutTrainedModel) WithHeader(h map[string]string) func(*MLPutTrainedModelRequest) { - return func(r *MLPutTrainedModelRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLPutTrainedModel) WithOpaqueID(s string) func(*MLPutTrainedModelRequest) { - return func(r *MLPutTrainedModelRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.put_trained_model_alias.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.put_trained_model_alias.go deleted file mode 100644 index 9a3bbe01a..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.put_trained_model_alias.go +++ /dev/null @@ -1,223 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newMLPutTrainedModelAliasFunc(t Transport) MLPutTrainedModelAlias { - return func(model_alias string, model_id string, o ...func(*MLPutTrainedModelAliasRequest)) (*Response, error) { - var r = MLPutTrainedModelAliasRequest{ModelAlias: model_alias, ModelID: model_id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLPutTrainedModelAlias - Creates a new model alias (or reassigns an existing one) to refer to the trained model -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/put-trained-models-aliases.html. -// -type MLPutTrainedModelAlias func(model_alias string, model_id string, o ...func(*MLPutTrainedModelAliasRequest)) (*Response, error) - -// MLPutTrainedModelAliasRequest configures the ML Put Trained Model Alias API request. -// -type MLPutTrainedModelAliasRequest struct { - ModelAlias string - ModelID string - - Reassign *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLPutTrainedModelAliasRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - path.Grow(1 + len("_ml") + 1 + len("trained_models") + 1 + len(r.ModelID) + 1 + len("model_aliases") + 1 + len(r.ModelAlias)) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("trained_models") - path.WriteString("/") - path.WriteString(r.ModelID) - path.WriteString("/") - path.WriteString("model_aliases") - path.WriteString("/") - path.WriteString(r.ModelAlias) - - params = make(map[string]string) - - if r.Reassign != nil { - params["reassign"] = strconv.FormatBool(*r.Reassign) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLPutTrainedModelAlias) WithContext(v context.Context) func(*MLPutTrainedModelAliasRequest) { - return func(r *MLPutTrainedModelAliasRequest) { - r.ctx = v - } -} - -// WithReassign - if the model_alias already exists and points to a separate model_id, this parameter must be true. defaults to false.. -// -func (f MLPutTrainedModelAlias) WithReassign(v bool) func(*MLPutTrainedModelAliasRequest) { - return func(r *MLPutTrainedModelAliasRequest) { - r.Reassign = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLPutTrainedModelAlias) WithPretty() func(*MLPutTrainedModelAliasRequest) { - return func(r *MLPutTrainedModelAliasRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLPutTrainedModelAlias) WithHuman() func(*MLPutTrainedModelAliasRequest) { - return func(r *MLPutTrainedModelAliasRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLPutTrainedModelAlias) WithErrorTrace() func(*MLPutTrainedModelAliasRequest) { - return func(r *MLPutTrainedModelAliasRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLPutTrainedModelAlias) WithFilterPath(v ...string) func(*MLPutTrainedModelAliasRequest) { - return func(r *MLPutTrainedModelAliasRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLPutTrainedModelAlias) WithHeader(h map[string]string) func(*MLPutTrainedModelAliasRequest) { - return func(r *MLPutTrainedModelAliasRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLPutTrainedModelAlias) WithOpaqueID(s string) func(*MLPutTrainedModelAliasRequest) { - return func(r *MLPutTrainedModelAliasRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.revert_model_snapshot.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.revert_model_snapshot.go deleted file mode 100644 index 16851f1eb..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.revert_model_snapshot.go +++ /dev/null @@ -1,240 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" -) - -func newMLRevertModelSnapshotFunc(t Transport) MLRevertModelSnapshot { - return func(snapshot_id string, job_id string, o ...func(*MLRevertModelSnapshotRequest)) (*Response, error) { - var r = MLRevertModelSnapshotRequest{SnapshotID: snapshot_id, JobID: job_id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLRevertModelSnapshot - Reverts to a specific snapshot. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-revert-snapshot.html. -// -type MLRevertModelSnapshot func(snapshot_id string, job_id string, o ...func(*MLRevertModelSnapshotRequest)) (*Response, error) - -// MLRevertModelSnapshotRequest configures the ML Revert Model Snapshot API request. -// -type MLRevertModelSnapshotRequest struct { - Body io.Reader - - JobID string - SnapshotID string - - DeleteInterveningResults *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLRevertModelSnapshotRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_ml") + 1 + len("anomaly_detectors") + 1 + len(r.JobID) + 1 + len("model_snapshots") + 1 + len(r.SnapshotID) + 1 + len("_revert")) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("anomaly_detectors") - path.WriteString("/") - path.WriteString(r.JobID) - path.WriteString("/") - path.WriteString("model_snapshots") - path.WriteString("/") - path.WriteString(r.SnapshotID) - path.WriteString("/") - path.WriteString("_revert") - - params = make(map[string]string) - - if r.DeleteInterveningResults != nil { - params["delete_intervening_results"] = strconv.FormatBool(*r.DeleteInterveningResults) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLRevertModelSnapshot) WithContext(v context.Context) func(*MLRevertModelSnapshotRequest) { - return func(r *MLRevertModelSnapshotRequest) { - r.ctx = v - } -} - -// WithBody - Reversion options. -// -func (f MLRevertModelSnapshot) WithBody(v io.Reader) func(*MLRevertModelSnapshotRequest) { - return func(r *MLRevertModelSnapshotRequest) { - r.Body = v - } -} - -// WithDeleteInterveningResults - should we reset the results back to the time of the snapshot?. -// -func (f MLRevertModelSnapshot) WithDeleteInterveningResults(v bool) func(*MLRevertModelSnapshotRequest) { - return func(r *MLRevertModelSnapshotRequest) { - r.DeleteInterveningResults = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLRevertModelSnapshot) WithPretty() func(*MLRevertModelSnapshotRequest) { - return func(r *MLRevertModelSnapshotRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLRevertModelSnapshot) WithHuman() func(*MLRevertModelSnapshotRequest) { - return func(r *MLRevertModelSnapshotRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLRevertModelSnapshot) WithErrorTrace() func(*MLRevertModelSnapshotRequest) { - return func(r *MLRevertModelSnapshotRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLRevertModelSnapshot) WithFilterPath(v ...string) func(*MLRevertModelSnapshotRequest) { - return func(r *MLRevertModelSnapshotRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLRevertModelSnapshot) WithHeader(h map[string]string) func(*MLRevertModelSnapshotRequest) { - return func(r *MLRevertModelSnapshotRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLRevertModelSnapshot) WithOpaqueID(s string) func(*MLRevertModelSnapshotRequest) { - return func(r *MLRevertModelSnapshotRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.set_upgrade_mode.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.set_upgrade_mode.go deleted file mode 100644 index c5aaa4cb9..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.set_upgrade_mode.go +++ /dev/null @@ -1,225 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" - "time" -) - -func newMLSetUpgradeModeFunc(t Transport) MLSetUpgradeMode { - return func(o ...func(*MLSetUpgradeModeRequest)) (*Response, error) { - var r = MLSetUpgradeModeRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLSetUpgradeMode - Sets a cluster wide upgrade_mode setting that prepares machine learning indices for an upgrade. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-set-upgrade-mode.html. -// -type MLSetUpgradeMode func(o ...func(*MLSetUpgradeModeRequest)) (*Response, error) - -// MLSetUpgradeModeRequest configures the ML Set Upgrade Mode API request. -// -type MLSetUpgradeModeRequest struct { - Enabled *bool - Timeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLSetUpgradeModeRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(len("/_ml/set_upgrade_mode")) - path.WriteString("/_ml/set_upgrade_mode") - - params = make(map[string]string) - - if r.Enabled != nil { - params["enabled"] = strconv.FormatBool(*r.Enabled) - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLSetUpgradeMode) WithContext(v context.Context) func(*MLSetUpgradeModeRequest) { - return func(r *MLSetUpgradeModeRequest) { - r.ctx = v - } -} - -// WithEnabled - whether to enable upgrade_mode ml setting or not. defaults to false.. -// -func (f MLSetUpgradeMode) WithEnabled(v bool) func(*MLSetUpgradeModeRequest) { - return func(r *MLSetUpgradeModeRequest) { - r.Enabled = &v - } -} - -// WithTimeout - controls the time to wait before action times out. defaults to 30 seconds. -// -func (f MLSetUpgradeMode) WithTimeout(v time.Duration) func(*MLSetUpgradeModeRequest) { - return func(r *MLSetUpgradeModeRequest) { - r.Timeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLSetUpgradeMode) WithPretty() func(*MLSetUpgradeModeRequest) { - return func(r *MLSetUpgradeModeRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLSetUpgradeMode) WithHuman() func(*MLSetUpgradeModeRequest) { - return func(r *MLSetUpgradeModeRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLSetUpgradeMode) WithErrorTrace() func(*MLSetUpgradeModeRequest) { - return func(r *MLSetUpgradeModeRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLSetUpgradeMode) WithFilterPath(v ...string) func(*MLSetUpgradeModeRequest) { - return func(r *MLSetUpgradeModeRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLSetUpgradeMode) WithHeader(h map[string]string) func(*MLSetUpgradeModeRequest) { - return func(r *MLSetUpgradeModeRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLSetUpgradeMode) WithOpaqueID(s string) func(*MLSetUpgradeModeRequest) { - return func(r *MLSetUpgradeModeRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.start_data_frame_analytics.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.start_data_frame_analytics.go deleted file mode 100644 index 3359cf92e..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.start_data_frame_analytics.go +++ /dev/null @@ -1,237 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" - "time" -) - -func newMLStartDataFrameAnalyticsFunc(t Transport) MLStartDataFrameAnalytics { - return func(id string, o ...func(*MLStartDataFrameAnalyticsRequest)) (*Response, error) { - var r = MLStartDataFrameAnalyticsRequest{ID: id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLStartDataFrameAnalytics - Starts a data frame analytics job. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/start-dfanalytics.html. -// -type MLStartDataFrameAnalytics func(id string, o ...func(*MLStartDataFrameAnalyticsRequest)) (*Response, error) - -// MLStartDataFrameAnalyticsRequest configures the ML Start Data Frame Analytics API request. -// -type MLStartDataFrameAnalyticsRequest struct { - ID string - - Body io.Reader - - Timeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLStartDataFrameAnalyticsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_ml") + 1 + len("data_frame") + 1 + len("analytics") + 1 + len(r.ID) + 1 + len("_start")) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("data_frame") - path.WriteString("/") - path.WriteString("analytics") - path.WriteString("/") - path.WriteString(r.ID) - path.WriteString("/") - path.WriteString("_start") - - params = make(map[string]string) - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLStartDataFrameAnalytics) WithContext(v context.Context) func(*MLStartDataFrameAnalyticsRequest) { - return func(r *MLStartDataFrameAnalyticsRequest) { - r.ctx = v - } -} - -// WithBody - The start data frame analytics parameters. -// -func (f MLStartDataFrameAnalytics) WithBody(v io.Reader) func(*MLStartDataFrameAnalyticsRequest) { - return func(r *MLStartDataFrameAnalyticsRequest) { - r.Body = v - } -} - -// WithTimeout - controls the time to wait until the task has started. defaults to 20 seconds. -// -func (f MLStartDataFrameAnalytics) WithTimeout(v time.Duration) func(*MLStartDataFrameAnalyticsRequest) { - return func(r *MLStartDataFrameAnalyticsRequest) { - r.Timeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLStartDataFrameAnalytics) WithPretty() func(*MLStartDataFrameAnalyticsRequest) { - return func(r *MLStartDataFrameAnalyticsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLStartDataFrameAnalytics) WithHuman() func(*MLStartDataFrameAnalyticsRequest) { - return func(r *MLStartDataFrameAnalyticsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLStartDataFrameAnalytics) WithErrorTrace() func(*MLStartDataFrameAnalyticsRequest) { - return func(r *MLStartDataFrameAnalyticsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLStartDataFrameAnalytics) WithFilterPath(v ...string) func(*MLStartDataFrameAnalyticsRequest) { - return func(r *MLStartDataFrameAnalyticsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLStartDataFrameAnalytics) WithHeader(h map[string]string) func(*MLStartDataFrameAnalyticsRequest) { - return func(r *MLStartDataFrameAnalyticsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLStartDataFrameAnalytics) WithOpaqueID(s string) func(*MLStartDataFrameAnalyticsRequest) { - return func(r *MLStartDataFrameAnalyticsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.start_datafeed.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.start_datafeed.go deleted file mode 100644 index 535bd9aed..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.start_datafeed.go +++ /dev/null @@ -1,261 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" - "time" -) - -func newMLStartDatafeedFunc(t Transport) MLStartDatafeed { - return func(datafeed_id string, o ...func(*MLStartDatafeedRequest)) (*Response, error) { - var r = MLStartDatafeedRequest{DatafeedID: datafeed_id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLStartDatafeed - Starts one or more datafeeds. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-start-datafeed.html. -// -type MLStartDatafeed func(datafeed_id string, o ...func(*MLStartDatafeedRequest)) (*Response, error) - -// MLStartDatafeedRequest configures the ML Start Datafeed API request. -// -type MLStartDatafeedRequest struct { - Body io.Reader - - DatafeedID string - - End string - Start string - Timeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLStartDatafeedRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_ml") + 1 + len("datafeeds") + 1 + len(r.DatafeedID) + 1 + len("_start")) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("datafeeds") - path.WriteString("/") - path.WriteString(r.DatafeedID) - path.WriteString("/") - path.WriteString("_start") - - params = make(map[string]string) - - if r.End != "" { - params["end"] = r.End - } - - if r.Start != "" { - params["start"] = r.Start - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLStartDatafeed) WithContext(v context.Context) func(*MLStartDatafeedRequest) { - return func(r *MLStartDatafeedRequest) { - r.ctx = v - } -} - -// WithBody - The start datafeed parameters. -// -func (f MLStartDatafeed) WithBody(v io.Reader) func(*MLStartDatafeedRequest) { - return func(r *MLStartDatafeedRequest) { - r.Body = v - } -} - -// WithEnd - the end time when the datafeed should stop. when not set, the datafeed continues in real time. -// -func (f MLStartDatafeed) WithEnd(v string) func(*MLStartDatafeedRequest) { - return func(r *MLStartDatafeedRequest) { - r.End = v - } -} - -// WithStart - the start time from where the datafeed should begin. -// -func (f MLStartDatafeed) WithStart(v string) func(*MLStartDatafeedRequest) { - return func(r *MLStartDatafeedRequest) { - r.Start = v - } -} - -// WithTimeout - controls the time to wait until a datafeed has started. default to 20 seconds. -// -func (f MLStartDatafeed) WithTimeout(v time.Duration) func(*MLStartDatafeedRequest) { - return func(r *MLStartDatafeedRequest) { - r.Timeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLStartDatafeed) WithPretty() func(*MLStartDatafeedRequest) { - return func(r *MLStartDatafeedRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLStartDatafeed) WithHuman() func(*MLStartDatafeedRequest) { - return func(r *MLStartDatafeedRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLStartDatafeed) WithErrorTrace() func(*MLStartDatafeedRequest) { - return func(r *MLStartDatafeedRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLStartDatafeed) WithFilterPath(v ...string) func(*MLStartDatafeedRequest) { - return func(r *MLStartDatafeedRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLStartDatafeed) WithHeader(h map[string]string) func(*MLStartDatafeedRequest) { - return func(r *MLStartDatafeedRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLStartDatafeed) WithOpaqueID(s string) func(*MLStartDatafeedRequest) { - return func(r *MLStartDatafeedRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.stop_data_frame_analytics.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.stop_data_frame_analytics.go deleted file mode 100644 index a5950bac8..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.stop_data_frame_analytics.go +++ /dev/null @@ -1,264 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" - "time" -) - -func newMLStopDataFrameAnalyticsFunc(t Transport) MLStopDataFrameAnalytics { - return func(id string, o ...func(*MLStopDataFrameAnalyticsRequest)) (*Response, error) { - var r = MLStopDataFrameAnalyticsRequest{ID: id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLStopDataFrameAnalytics - Stops one or more data frame analytics jobs. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/stop-dfanalytics.html. -// -type MLStopDataFrameAnalytics func(id string, o ...func(*MLStopDataFrameAnalyticsRequest)) (*Response, error) - -// MLStopDataFrameAnalyticsRequest configures the ML Stop Data Frame Analytics API request. -// -type MLStopDataFrameAnalyticsRequest struct { - ID string - - Body io.Reader - - AllowNoMatch *bool - Force *bool - Timeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLStopDataFrameAnalyticsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_ml") + 1 + len("data_frame") + 1 + len("analytics") + 1 + len(r.ID) + 1 + len("_stop")) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("data_frame") - path.WriteString("/") - path.WriteString("analytics") - path.WriteString("/") - path.WriteString(r.ID) - path.WriteString("/") - path.WriteString("_stop") - - params = make(map[string]string) - - if r.AllowNoMatch != nil { - params["allow_no_match"] = strconv.FormatBool(*r.AllowNoMatch) - } - - if r.Force != nil { - params["force"] = strconv.FormatBool(*r.Force) - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLStopDataFrameAnalytics) WithContext(v context.Context) func(*MLStopDataFrameAnalyticsRequest) { - return func(r *MLStopDataFrameAnalyticsRequest) { - r.ctx = v - } -} - -// WithBody - The stop data frame analytics parameters. -// -func (f MLStopDataFrameAnalytics) WithBody(v io.Reader) func(*MLStopDataFrameAnalyticsRequest) { - return func(r *MLStopDataFrameAnalyticsRequest) { - r.Body = v - } -} - -// WithAllowNoMatch - whether to ignore if a wildcard expression matches no data frame analytics. (this includes `_all` string or when no data frame analytics have been specified). -// -func (f MLStopDataFrameAnalytics) WithAllowNoMatch(v bool) func(*MLStopDataFrameAnalyticsRequest) { - return func(r *MLStopDataFrameAnalyticsRequest) { - r.AllowNoMatch = &v - } -} - -// WithForce - true if the data frame analytics should be forcefully stopped. -// -func (f MLStopDataFrameAnalytics) WithForce(v bool) func(*MLStopDataFrameAnalyticsRequest) { - return func(r *MLStopDataFrameAnalyticsRequest) { - r.Force = &v - } -} - -// WithTimeout - controls the time to wait until the task has stopped. defaults to 20 seconds. -// -func (f MLStopDataFrameAnalytics) WithTimeout(v time.Duration) func(*MLStopDataFrameAnalyticsRequest) { - return func(r *MLStopDataFrameAnalyticsRequest) { - r.Timeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLStopDataFrameAnalytics) WithPretty() func(*MLStopDataFrameAnalyticsRequest) { - return func(r *MLStopDataFrameAnalyticsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLStopDataFrameAnalytics) WithHuman() func(*MLStopDataFrameAnalyticsRequest) { - return func(r *MLStopDataFrameAnalyticsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLStopDataFrameAnalytics) WithErrorTrace() func(*MLStopDataFrameAnalyticsRequest) { - return func(r *MLStopDataFrameAnalyticsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLStopDataFrameAnalytics) WithFilterPath(v ...string) func(*MLStopDataFrameAnalyticsRequest) { - return func(r *MLStopDataFrameAnalyticsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLStopDataFrameAnalytics) WithHeader(h map[string]string) func(*MLStopDataFrameAnalyticsRequest) { - return func(r *MLStopDataFrameAnalyticsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLStopDataFrameAnalytics) WithOpaqueID(s string) func(*MLStopDataFrameAnalyticsRequest) { - return func(r *MLStopDataFrameAnalyticsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.stop_datafeed.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.stop_datafeed.go deleted file mode 100644 index e20656452..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.stop_datafeed.go +++ /dev/null @@ -1,275 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" - "time" -) - -func newMLStopDatafeedFunc(t Transport) MLStopDatafeed { - return func(datafeed_id string, o ...func(*MLStopDatafeedRequest)) (*Response, error) { - var r = MLStopDatafeedRequest{DatafeedID: datafeed_id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLStopDatafeed - Stops one or more datafeeds. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-stop-datafeed.html. -// -type MLStopDatafeed func(datafeed_id string, o ...func(*MLStopDatafeedRequest)) (*Response, error) - -// MLStopDatafeedRequest configures the ML Stop Datafeed API request. -// -type MLStopDatafeedRequest struct { - Body io.Reader - - DatafeedID string - - AllowNoDatafeeds *bool - AllowNoMatch *bool - Force *bool - Timeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLStopDatafeedRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_ml") + 1 + len("datafeeds") + 1 + len(r.DatafeedID) + 1 + len("_stop")) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("datafeeds") - path.WriteString("/") - path.WriteString(r.DatafeedID) - path.WriteString("/") - path.WriteString("_stop") - - params = make(map[string]string) - - if r.AllowNoDatafeeds != nil { - params["allow_no_datafeeds"] = strconv.FormatBool(*r.AllowNoDatafeeds) - } - - if r.AllowNoMatch != nil { - params["allow_no_match"] = strconv.FormatBool(*r.AllowNoMatch) - } - - if r.Force != nil { - params["force"] = strconv.FormatBool(*r.Force) - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLStopDatafeed) WithContext(v context.Context) func(*MLStopDatafeedRequest) { - return func(r *MLStopDatafeedRequest) { - r.ctx = v - } -} - -// WithBody - The URL params optionally sent in the body. -// -func (f MLStopDatafeed) WithBody(v io.Reader) func(*MLStopDatafeedRequest) { - return func(r *MLStopDatafeedRequest) { - r.Body = v - } -} - -// WithAllowNoDatafeeds - whether to ignore if a wildcard expression matches no datafeeds. (this includes `_all` string or when no datafeeds have been specified). -// -func (f MLStopDatafeed) WithAllowNoDatafeeds(v bool) func(*MLStopDatafeedRequest) { - return func(r *MLStopDatafeedRequest) { - r.AllowNoDatafeeds = &v - } -} - -// WithAllowNoMatch - whether to ignore if a wildcard expression matches no datafeeds. (this includes `_all` string or when no datafeeds have been specified). -// -func (f MLStopDatafeed) WithAllowNoMatch(v bool) func(*MLStopDatafeedRequest) { - return func(r *MLStopDatafeedRequest) { - r.AllowNoMatch = &v - } -} - -// WithForce - true if the datafeed should be forcefully stopped.. -// -func (f MLStopDatafeed) WithForce(v bool) func(*MLStopDatafeedRequest) { - return func(r *MLStopDatafeedRequest) { - r.Force = &v - } -} - -// WithTimeout - controls the time to wait until a datafeed has stopped. default to 20 seconds. -// -func (f MLStopDatafeed) WithTimeout(v time.Duration) func(*MLStopDatafeedRequest) { - return func(r *MLStopDatafeedRequest) { - r.Timeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLStopDatafeed) WithPretty() func(*MLStopDatafeedRequest) { - return func(r *MLStopDatafeedRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLStopDatafeed) WithHuman() func(*MLStopDatafeedRequest) { - return func(r *MLStopDatafeedRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLStopDatafeed) WithErrorTrace() func(*MLStopDatafeedRequest) { - return func(r *MLStopDatafeedRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLStopDatafeed) WithFilterPath(v ...string) func(*MLStopDatafeedRequest) { - return func(r *MLStopDatafeedRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLStopDatafeed) WithHeader(h map[string]string) func(*MLStopDatafeedRequest) { - return func(r *MLStopDatafeedRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLStopDatafeed) WithOpaqueID(s string) func(*MLStopDatafeedRequest) { - return func(r *MLStopDatafeedRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.update_data_frame_analytics.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.update_data_frame_analytics.go deleted file mode 100644 index 373a2277f..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.update_data_frame_analytics.go +++ /dev/null @@ -1,214 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" -) - -func newMLUpdateDataFrameAnalyticsFunc(t Transport) MLUpdateDataFrameAnalytics { - return func(id string, body io.Reader, o ...func(*MLUpdateDataFrameAnalyticsRequest)) (*Response, error) { - var r = MLUpdateDataFrameAnalyticsRequest{DocumentID: id, Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLUpdateDataFrameAnalytics - Updates certain properties of a data frame analytics job. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/update-dfanalytics.html. -// -type MLUpdateDataFrameAnalytics func(id string, body io.Reader, o ...func(*MLUpdateDataFrameAnalyticsRequest)) (*Response, error) - -// MLUpdateDataFrameAnalyticsRequest configures the ML Update Data Frame Analytics API request. -// -type MLUpdateDataFrameAnalyticsRequest struct { - DocumentID string - - Body io.Reader - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLUpdateDataFrameAnalyticsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_ml") + 1 + len("data_frame") + 1 + len("analytics") + 1 + len(r.DocumentID) + 1 + len("_update")) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("data_frame") - path.WriteString("/") - path.WriteString("analytics") - path.WriteString("/") - path.WriteString(r.DocumentID) - path.WriteString("/") - path.WriteString("_update") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLUpdateDataFrameAnalytics) WithContext(v context.Context) func(*MLUpdateDataFrameAnalyticsRequest) { - return func(r *MLUpdateDataFrameAnalyticsRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLUpdateDataFrameAnalytics) WithPretty() func(*MLUpdateDataFrameAnalyticsRequest) { - return func(r *MLUpdateDataFrameAnalyticsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLUpdateDataFrameAnalytics) WithHuman() func(*MLUpdateDataFrameAnalyticsRequest) { - return func(r *MLUpdateDataFrameAnalyticsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLUpdateDataFrameAnalytics) WithErrorTrace() func(*MLUpdateDataFrameAnalyticsRequest) { - return func(r *MLUpdateDataFrameAnalyticsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLUpdateDataFrameAnalytics) WithFilterPath(v ...string) func(*MLUpdateDataFrameAnalyticsRequest) { - return func(r *MLUpdateDataFrameAnalyticsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLUpdateDataFrameAnalytics) WithHeader(h map[string]string) func(*MLUpdateDataFrameAnalyticsRequest) { - return func(r *MLUpdateDataFrameAnalyticsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLUpdateDataFrameAnalytics) WithOpaqueID(s string) func(*MLUpdateDataFrameAnalyticsRequest) { - return func(r *MLUpdateDataFrameAnalyticsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.update_datafeed.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.update_datafeed.go deleted file mode 100644 index 737be8147..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.update_datafeed.go +++ /dev/null @@ -1,266 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" -) - -func newMLUpdateDatafeedFunc(t Transport) MLUpdateDatafeed { - return func(body io.Reader, datafeed_id string, o ...func(*MLUpdateDatafeedRequest)) (*Response, error) { - var r = MLUpdateDatafeedRequest{Body: body, DatafeedID: datafeed_id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLUpdateDatafeed - Updates certain properties of a datafeed. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-datafeed.html. -// -type MLUpdateDatafeed func(body io.Reader, datafeed_id string, o ...func(*MLUpdateDatafeedRequest)) (*Response, error) - -// MLUpdateDatafeedRequest configures the ML Update Datafeed API request. -// -type MLUpdateDatafeedRequest struct { - Body io.Reader - - DatafeedID string - - AllowNoIndices *bool - ExpandWildcards string - IgnoreThrottled *bool - IgnoreUnavailable *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLUpdateDatafeedRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_ml") + 1 + len("datafeeds") + 1 + len(r.DatafeedID) + 1 + len("_update")) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("datafeeds") - path.WriteString("/") - path.WriteString(r.DatafeedID) - path.WriteString("/") - path.WriteString("_update") - - params = make(map[string]string) - - if r.AllowNoIndices != nil { - params["allow_no_indices"] = strconv.FormatBool(*r.AllowNoIndices) - } - - if r.ExpandWildcards != "" { - params["expand_wildcards"] = r.ExpandWildcards - } - - if r.IgnoreThrottled != nil { - params["ignore_throttled"] = strconv.FormatBool(*r.IgnoreThrottled) - } - - if r.IgnoreUnavailable != nil { - params["ignore_unavailable"] = strconv.FormatBool(*r.IgnoreUnavailable) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLUpdateDatafeed) WithContext(v context.Context) func(*MLUpdateDatafeedRequest) { - return func(r *MLUpdateDatafeedRequest) { - r.ctx = v - } -} - -// WithAllowNoIndices - ignore if the source indices expressions resolves to no concrete indices (default: true). -// -func (f MLUpdateDatafeed) WithAllowNoIndices(v bool) func(*MLUpdateDatafeedRequest) { - return func(r *MLUpdateDatafeedRequest) { - r.AllowNoIndices = &v - } -} - -// WithExpandWildcards - whether source index expressions should get expanded to open or closed indices (default: open). -// -func (f MLUpdateDatafeed) WithExpandWildcards(v string) func(*MLUpdateDatafeedRequest) { - return func(r *MLUpdateDatafeedRequest) { - r.ExpandWildcards = v - } -} - -// WithIgnoreThrottled - ignore indices that are marked as throttled (default: true). -// -func (f MLUpdateDatafeed) WithIgnoreThrottled(v bool) func(*MLUpdateDatafeedRequest) { - return func(r *MLUpdateDatafeedRequest) { - r.IgnoreThrottled = &v - } -} - -// WithIgnoreUnavailable - ignore unavailable indexes (default: false). -// -func (f MLUpdateDatafeed) WithIgnoreUnavailable(v bool) func(*MLUpdateDatafeedRequest) { - return func(r *MLUpdateDatafeedRequest) { - r.IgnoreUnavailable = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLUpdateDatafeed) WithPretty() func(*MLUpdateDatafeedRequest) { - return func(r *MLUpdateDatafeedRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLUpdateDatafeed) WithHuman() func(*MLUpdateDatafeedRequest) { - return func(r *MLUpdateDatafeedRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLUpdateDatafeed) WithErrorTrace() func(*MLUpdateDatafeedRequest) { - return func(r *MLUpdateDatafeedRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLUpdateDatafeed) WithFilterPath(v ...string) func(*MLUpdateDatafeedRequest) { - return func(r *MLUpdateDatafeedRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLUpdateDatafeed) WithHeader(h map[string]string) func(*MLUpdateDatafeedRequest) { - return func(r *MLUpdateDatafeedRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLUpdateDatafeed) WithOpaqueID(s string) func(*MLUpdateDatafeedRequest) { - return func(r *MLUpdateDatafeedRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.update_filter.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.update_filter.go deleted file mode 100644 index b9f60cb88..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.update_filter.go +++ /dev/null @@ -1,212 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" -) - -func newMLUpdateFilterFunc(t Transport) MLUpdateFilter { - return func(body io.Reader, filter_id string, o ...func(*MLUpdateFilterRequest)) (*Response, error) { - var r = MLUpdateFilterRequest{Body: body, FilterID: filter_id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLUpdateFilter - Updates the description of a filter, adds items, or removes items. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-filter.html. -// -type MLUpdateFilter func(body io.Reader, filter_id string, o ...func(*MLUpdateFilterRequest)) (*Response, error) - -// MLUpdateFilterRequest configures the ML Update Filter API request. -// -type MLUpdateFilterRequest struct { - Body io.Reader - - FilterID string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLUpdateFilterRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_ml") + 1 + len("filters") + 1 + len(r.FilterID) + 1 + len("_update")) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("filters") - path.WriteString("/") - path.WriteString(r.FilterID) - path.WriteString("/") - path.WriteString("_update") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLUpdateFilter) WithContext(v context.Context) func(*MLUpdateFilterRequest) { - return func(r *MLUpdateFilterRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLUpdateFilter) WithPretty() func(*MLUpdateFilterRequest) { - return func(r *MLUpdateFilterRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLUpdateFilter) WithHuman() func(*MLUpdateFilterRequest) { - return func(r *MLUpdateFilterRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLUpdateFilter) WithErrorTrace() func(*MLUpdateFilterRequest) { - return func(r *MLUpdateFilterRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLUpdateFilter) WithFilterPath(v ...string) func(*MLUpdateFilterRequest) { - return func(r *MLUpdateFilterRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLUpdateFilter) WithHeader(h map[string]string) func(*MLUpdateFilterRequest) { - return func(r *MLUpdateFilterRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLUpdateFilter) WithOpaqueID(s string) func(*MLUpdateFilterRequest) { - return func(r *MLUpdateFilterRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.update_job.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.update_job.go deleted file mode 100644 index c132597a5..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.update_job.go +++ /dev/null @@ -1,212 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" -) - -func newMLUpdateJobFunc(t Transport) MLUpdateJob { - return func(job_id string, body io.Reader, o ...func(*MLUpdateJobRequest)) (*Response, error) { - var r = MLUpdateJobRequest{JobID: job_id, Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLUpdateJob - Updates certain properties of an anomaly detection job. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-job.html. -// -type MLUpdateJob func(job_id string, body io.Reader, o ...func(*MLUpdateJobRequest)) (*Response, error) - -// MLUpdateJobRequest configures the ML Update Job API request. -// -type MLUpdateJobRequest struct { - Body io.Reader - - JobID string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLUpdateJobRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_ml") + 1 + len("anomaly_detectors") + 1 + len(r.JobID) + 1 + len("_update")) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("anomaly_detectors") - path.WriteString("/") - path.WriteString(r.JobID) - path.WriteString("/") - path.WriteString("_update") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLUpdateJob) WithContext(v context.Context) func(*MLUpdateJobRequest) { - return func(r *MLUpdateJobRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLUpdateJob) WithPretty() func(*MLUpdateJobRequest) { - return func(r *MLUpdateJobRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLUpdateJob) WithHuman() func(*MLUpdateJobRequest) { - return func(r *MLUpdateJobRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLUpdateJob) WithErrorTrace() func(*MLUpdateJobRequest) { - return func(r *MLUpdateJobRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLUpdateJob) WithFilterPath(v ...string) func(*MLUpdateJobRequest) { - return func(r *MLUpdateJobRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLUpdateJob) WithHeader(h map[string]string) func(*MLUpdateJobRequest) { - return func(r *MLUpdateJobRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLUpdateJob) WithOpaqueID(s string) func(*MLUpdateJobRequest) { - return func(r *MLUpdateJobRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.update_model_snapshot.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.update_model_snapshot.go deleted file mode 100644 index 21ad6d22b..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.update_model_snapshot.go +++ /dev/null @@ -1,217 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" -) - -func newMLUpdateModelSnapshotFunc(t Transport) MLUpdateModelSnapshot { - return func(snapshot_id string, job_id string, body io.Reader, o ...func(*MLUpdateModelSnapshotRequest)) (*Response, error) { - var r = MLUpdateModelSnapshotRequest{SnapshotID: snapshot_id, JobID: job_id, Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLUpdateModelSnapshot - Updates certain properties of a snapshot. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-snapshot.html. -// -type MLUpdateModelSnapshot func(snapshot_id string, job_id string, body io.Reader, o ...func(*MLUpdateModelSnapshotRequest)) (*Response, error) - -// MLUpdateModelSnapshotRequest configures the ML Update Model Snapshot API request. -// -type MLUpdateModelSnapshotRequest struct { - Body io.Reader - - JobID string - SnapshotID string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLUpdateModelSnapshotRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_ml") + 1 + len("anomaly_detectors") + 1 + len(r.JobID) + 1 + len("model_snapshots") + 1 + len(r.SnapshotID) + 1 + len("_update")) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("anomaly_detectors") - path.WriteString("/") - path.WriteString(r.JobID) - path.WriteString("/") - path.WriteString("model_snapshots") - path.WriteString("/") - path.WriteString(r.SnapshotID) - path.WriteString("/") - path.WriteString("_update") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLUpdateModelSnapshot) WithContext(v context.Context) func(*MLUpdateModelSnapshotRequest) { - return func(r *MLUpdateModelSnapshotRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLUpdateModelSnapshot) WithPretty() func(*MLUpdateModelSnapshotRequest) { - return func(r *MLUpdateModelSnapshotRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLUpdateModelSnapshot) WithHuman() func(*MLUpdateModelSnapshotRequest) { - return func(r *MLUpdateModelSnapshotRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLUpdateModelSnapshot) WithErrorTrace() func(*MLUpdateModelSnapshotRequest) { - return func(r *MLUpdateModelSnapshotRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLUpdateModelSnapshot) WithFilterPath(v ...string) func(*MLUpdateModelSnapshotRequest) { - return func(r *MLUpdateModelSnapshotRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLUpdateModelSnapshot) WithHeader(h map[string]string) func(*MLUpdateModelSnapshotRequest) { - return func(r *MLUpdateModelSnapshotRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLUpdateModelSnapshot) WithOpaqueID(s string) func(*MLUpdateModelSnapshotRequest) { - return func(r *MLUpdateModelSnapshotRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.upgrade_job_snapshot.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.upgrade_job_snapshot.go deleted file mode 100644 index 06836db55..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.upgrade_job_snapshot.go +++ /dev/null @@ -1,239 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" - "time" -) - -func newMLUpgradeJobSnapshotFunc(t Transport) MLUpgradeJobSnapshot { - return func(snapshot_id string, job_id string, o ...func(*MLUpgradeJobSnapshotRequest)) (*Response, error) { - var r = MLUpgradeJobSnapshotRequest{SnapshotID: snapshot_id, JobID: job_id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLUpgradeJobSnapshot - Upgrades a given job snapshot to the current major version. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-upgrade-job-model-snapshot.html. -// -type MLUpgradeJobSnapshot func(snapshot_id string, job_id string, o ...func(*MLUpgradeJobSnapshotRequest)) (*Response, error) - -// MLUpgradeJobSnapshotRequest configures the ML Upgrade Job Snapshot API request. -// -type MLUpgradeJobSnapshotRequest struct { - JobID string - SnapshotID string - - Timeout time.Duration - WaitForCompletion *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLUpgradeJobSnapshotRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_ml") + 1 + len("anomaly_detectors") + 1 + len(r.JobID) + 1 + len("model_snapshots") + 1 + len(r.SnapshotID) + 1 + len("_upgrade")) - path.WriteString("/") - path.WriteString("_ml") - path.WriteString("/") - path.WriteString("anomaly_detectors") - path.WriteString("/") - path.WriteString(r.JobID) - path.WriteString("/") - path.WriteString("model_snapshots") - path.WriteString("/") - path.WriteString(r.SnapshotID) - path.WriteString("/") - path.WriteString("_upgrade") - - params = make(map[string]string) - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.WaitForCompletion != nil { - params["wait_for_completion"] = strconv.FormatBool(*r.WaitForCompletion) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLUpgradeJobSnapshot) WithContext(v context.Context) func(*MLUpgradeJobSnapshotRequest) { - return func(r *MLUpgradeJobSnapshotRequest) { - r.ctx = v - } -} - -// WithTimeout - how long should the api wait for the job to be opened and the old snapshot to be loaded.. -// -func (f MLUpgradeJobSnapshot) WithTimeout(v time.Duration) func(*MLUpgradeJobSnapshotRequest) { - return func(r *MLUpgradeJobSnapshotRequest) { - r.Timeout = v - } -} - -// WithWaitForCompletion - should the request wait until the task is complete before responding to the caller. default is false.. -// -func (f MLUpgradeJobSnapshot) WithWaitForCompletion(v bool) func(*MLUpgradeJobSnapshotRequest) { - return func(r *MLUpgradeJobSnapshotRequest) { - r.WaitForCompletion = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLUpgradeJobSnapshot) WithPretty() func(*MLUpgradeJobSnapshotRequest) { - return func(r *MLUpgradeJobSnapshotRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLUpgradeJobSnapshot) WithHuman() func(*MLUpgradeJobSnapshotRequest) { - return func(r *MLUpgradeJobSnapshotRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLUpgradeJobSnapshot) WithErrorTrace() func(*MLUpgradeJobSnapshotRequest) { - return func(r *MLUpgradeJobSnapshotRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLUpgradeJobSnapshot) WithFilterPath(v ...string) func(*MLUpgradeJobSnapshotRequest) { - return func(r *MLUpgradeJobSnapshotRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLUpgradeJobSnapshot) WithHeader(h map[string]string) func(*MLUpgradeJobSnapshotRequest) { - return func(r *MLUpgradeJobSnapshotRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLUpgradeJobSnapshot) WithOpaqueID(s string) func(*MLUpgradeJobSnapshotRequest) { - return func(r *MLUpgradeJobSnapshotRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.validate.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.validate.go deleted file mode 100644 index 85f51ed21..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.validate.go +++ /dev/null @@ -1,203 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" -) - -func newMLValidateFunc(t Transport) MLValidate { - return func(body io.Reader, o ...func(*MLValidateRequest)) (*Response, error) { - var r = MLValidateRequest{Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLValidate - Validates an anomaly detection job. -// -// See full documentation at https://www.elastic.co/guide/en/machine-learning/current/ml-jobs.html. -// -type MLValidate func(body io.Reader, o ...func(*MLValidateRequest)) (*Response, error) - -// MLValidateRequest configures the ML Validate API request. -// -type MLValidateRequest struct { - Body io.Reader - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLValidateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(len("/_ml/anomaly_detectors/_validate")) - path.WriteString("/_ml/anomaly_detectors/_validate") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLValidate) WithContext(v context.Context) func(*MLValidateRequest) { - return func(r *MLValidateRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLValidate) WithPretty() func(*MLValidateRequest) { - return func(r *MLValidateRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLValidate) WithHuman() func(*MLValidateRequest) { - return func(r *MLValidateRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLValidate) WithErrorTrace() func(*MLValidateRequest) { - return func(r *MLValidateRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLValidate) WithFilterPath(v ...string) func(*MLValidateRequest) { - return func(r *MLValidateRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLValidate) WithHeader(h map[string]string) func(*MLValidateRequest) { - return func(r *MLValidateRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLValidate) WithOpaqueID(s string) func(*MLValidateRequest) { - return func(r *MLValidateRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.validate_detector.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.validate_detector.go deleted file mode 100644 index bde660bd1..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ml.validate_detector.go +++ /dev/null @@ -1,203 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" -) - -func newMLValidateDetectorFunc(t Transport) MLValidateDetector { - return func(body io.Reader, o ...func(*MLValidateDetectorRequest)) (*Response, error) { - var r = MLValidateDetectorRequest{Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MLValidateDetector - Validates an anomaly detection detector. -// -// See full documentation at https://www.elastic.co/guide/en/machine-learning/current/ml-jobs.html. -// -type MLValidateDetector func(body io.Reader, o ...func(*MLValidateDetectorRequest)) (*Response, error) - -// MLValidateDetectorRequest configures the ML Validate Detector API request. -// -type MLValidateDetectorRequest struct { - Body io.Reader - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MLValidateDetectorRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(len("/_ml/anomaly_detectors/_validate/detector")) - path.WriteString("/_ml/anomaly_detectors/_validate/detector") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MLValidateDetector) WithContext(v context.Context) func(*MLValidateDetectorRequest) { - return func(r *MLValidateDetectorRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MLValidateDetector) WithPretty() func(*MLValidateDetectorRequest) { - return func(r *MLValidateDetectorRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MLValidateDetector) WithHuman() func(*MLValidateDetectorRequest) { - return func(r *MLValidateDetectorRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MLValidateDetector) WithErrorTrace() func(*MLValidateDetectorRequest) { - return func(r *MLValidateDetectorRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MLValidateDetector) WithFilterPath(v ...string) func(*MLValidateDetectorRequest) { - return func(r *MLValidateDetectorRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MLValidateDetector) WithHeader(h map[string]string) func(*MLValidateDetectorRequest) { - return func(r *MLValidateDetectorRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MLValidateDetector) WithOpaqueID(s string) func(*MLValidateDetectorRequest) { - return func(r *MLValidateDetectorRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.monitoring.bulk.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.monitoring.bulk.go deleted file mode 100644 index ff85b6f79..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.monitoring.bulk.go +++ /dev/null @@ -1,262 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" -) - -func newMonitoringBulkFunc(t Transport) MonitoringBulk { - return func(body io.Reader, o ...func(*MonitoringBulkRequest)) (*Response, error) { - var r = MonitoringBulkRequest{Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// MonitoringBulk - Used by the monitoring features to send monitoring data. -// -// This API is experimental. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/monitor-elasticsearch-cluster.html. -// -type MonitoringBulk func(body io.Reader, o ...func(*MonitoringBulkRequest)) (*Response, error) - -// MonitoringBulkRequest configures the Monitoring Bulk API request. -// -type MonitoringBulkRequest struct { - DocumentType string - - Body io.Reader - - Interval string - SystemAPIVersion string - SystemID string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r MonitoringBulkRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_monitoring") + 1 + len(r.DocumentType) + 1 + len("bulk")) - path.WriteString("/") - path.WriteString("_monitoring") - if r.DocumentType != "" { - path.WriteString("/") - path.WriteString(r.DocumentType) - } - path.WriteString("/") - path.WriteString("bulk") - - params = make(map[string]string) - - if r.Interval != "" { - params["interval"] = r.Interval - } - - if r.SystemAPIVersion != "" { - params["system_api_version"] = r.SystemAPIVersion - } - - if r.SystemID != "" { - params["system_id"] = r.SystemID - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f MonitoringBulk) WithContext(v context.Context) func(*MonitoringBulkRequest) { - return func(r *MonitoringBulkRequest) { - r.ctx = v - } -} - -// WithDocumentType - default document type for items which don't provide one. -// -func (f MonitoringBulk) WithDocumentType(v string) func(*MonitoringBulkRequest) { - return func(r *MonitoringBulkRequest) { - r.DocumentType = v - } -} - -// WithInterval - collection interval (e.g., '10s' or '10000ms') of the payload. -// -func (f MonitoringBulk) WithInterval(v string) func(*MonitoringBulkRequest) { - return func(r *MonitoringBulkRequest) { - r.Interval = v - } -} - -// WithSystemAPIVersion - api version of the monitored system. -// -func (f MonitoringBulk) WithSystemAPIVersion(v string) func(*MonitoringBulkRequest) { - return func(r *MonitoringBulkRequest) { - r.SystemAPIVersion = v - } -} - -// WithSystemID - identifier of the monitored system. -// -func (f MonitoringBulk) WithSystemID(v string) func(*MonitoringBulkRequest) { - return func(r *MonitoringBulkRequest) { - r.SystemID = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f MonitoringBulk) WithPretty() func(*MonitoringBulkRequest) { - return func(r *MonitoringBulkRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f MonitoringBulk) WithHuman() func(*MonitoringBulkRequest) { - return func(r *MonitoringBulkRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f MonitoringBulk) WithErrorTrace() func(*MonitoringBulkRequest) { - return func(r *MonitoringBulkRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f MonitoringBulk) WithFilterPath(v ...string) func(*MonitoringBulkRequest) { - return func(r *MonitoringBulkRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f MonitoringBulk) WithHeader(h map[string]string) func(*MonitoringBulkRequest) { - return func(r *MonitoringBulkRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f MonitoringBulk) WithOpaqueID(s string) func(*MonitoringBulkRequest) { - return func(r *MonitoringBulkRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.open_point_in_time.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.open_point_in_time.go deleted file mode 100644 index 44cf779c9..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.open_point_in_time.go +++ /dev/null @@ -1,278 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newOpenPointInTimeFunc(t Transport) OpenPointInTime { - return func(o ...func(*OpenPointInTimeRequest)) (*Response, error) { - var r = OpenPointInTimeRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// OpenPointInTime - Open a point in time that can be used in subsequent searches -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/point-in-time-api.html. -// -type OpenPointInTime func(o ...func(*OpenPointInTimeRequest)) (*Response, error) - -// OpenPointInTimeRequest configures the Open Point In Time API request. -// -type OpenPointInTimeRequest struct { - Index []string - - ExpandWildcards string - IgnoreUnavailable *bool - KeepAlive string - Preference string - Routing string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r OpenPointInTimeRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len(strings.Join(r.Index, ",")) + 1 + len("_pit")) - if len(r.Index) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Index, ",")) - } - path.WriteString("/") - path.WriteString("_pit") - - params = make(map[string]string) - - if r.ExpandWildcards != "" { - params["expand_wildcards"] = r.ExpandWildcards - } - - if r.IgnoreUnavailable != nil { - params["ignore_unavailable"] = strconv.FormatBool(*r.IgnoreUnavailable) - } - - if r.KeepAlive != "" { - params["keep_alive"] = r.KeepAlive - } - - if r.Preference != "" { - params["preference"] = r.Preference - } - - if r.Routing != "" { - params["routing"] = r.Routing - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f OpenPointInTime) WithContext(v context.Context) func(*OpenPointInTimeRequest) { - return func(r *OpenPointInTimeRequest) { - r.ctx = v - } -} - -// WithIndex - a list of index names to open point in time; use _all to perform the operation on all indices. -// -func (f OpenPointInTime) WithIndex(v ...string) func(*OpenPointInTimeRequest) { - return func(r *OpenPointInTimeRequest) { - r.Index = v - } -} - -// WithExpandWildcards - whether to expand wildcard expression to concrete indices that are open, closed or both.. -// -func (f OpenPointInTime) WithExpandWildcards(v string) func(*OpenPointInTimeRequest) { - return func(r *OpenPointInTimeRequest) { - r.ExpandWildcards = v - } -} - -// WithIgnoreUnavailable - whether specified concrete indices should be ignored when unavailable (missing or closed). -// -func (f OpenPointInTime) WithIgnoreUnavailable(v bool) func(*OpenPointInTimeRequest) { - return func(r *OpenPointInTimeRequest) { - r.IgnoreUnavailable = &v - } -} - -// WithKeepAlive - specific the time to live for the point in time. -// -func (f OpenPointInTime) WithKeepAlive(v string) func(*OpenPointInTimeRequest) { - return func(r *OpenPointInTimeRequest) { - r.KeepAlive = v - } -} - -// WithPreference - specify the node or shard the operation should be performed on (default: random). -// -func (f OpenPointInTime) WithPreference(v string) func(*OpenPointInTimeRequest) { - return func(r *OpenPointInTimeRequest) { - r.Preference = v - } -} - -// WithRouting - specific routing value. -// -func (f OpenPointInTime) WithRouting(v string) func(*OpenPointInTimeRequest) { - return func(r *OpenPointInTimeRequest) { - r.Routing = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f OpenPointInTime) WithPretty() func(*OpenPointInTimeRequest) { - return func(r *OpenPointInTimeRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f OpenPointInTime) WithHuman() func(*OpenPointInTimeRequest) { - return func(r *OpenPointInTimeRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f OpenPointInTime) WithErrorTrace() func(*OpenPointInTimeRequest) { - return func(r *OpenPointInTimeRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f OpenPointInTime) WithFilterPath(v ...string) func(*OpenPointInTimeRequest) { - return func(r *OpenPointInTimeRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f OpenPointInTime) WithHeader(h map[string]string) func(*OpenPointInTimeRequest) { - return func(r *OpenPointInTimeRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f OpenPointInTime) WithOpaqueID(s string) func(*OpenPointInTimeRequest) { - return func(r *OpenPointInTimeRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.rollup.delete_job.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.rollup.delete_job.go deleted file mode 100644 index 5aa438437..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.rollup.delete_job.go +++ /dev/null @@ -1,205 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newRollupDeleteJobFunc(t Transport) RollupDeleteJob { - return func(id string, o ...func(*RollupDeleteJobRequest)) (*Response, error) { - var r = RollupDeleteJobRequest{JobID: id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// RollupDeleteJob - Deletes an existing rollup job. -// -// This API is experimental. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/rollup-delete-job.html. -// -type RollupDeleteJob func(id string, o ...func(*RollupDeleteJobRequest)) (*Response, error) - -// RollupDeleteJobRequest configures the Rollup Delete Job API request. -// -type RollupDeleteJobRequest struct { - JobID string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r RollupDeleteJobRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "DELETE" - - path.Grow(1 + len("_rollup") + 1 + len("job") + 1 + len(r.JobID)) - path.WriteString("/") - path.WriteString("_rollup") - path.WriteString("/") - path.WriteString("job") - path.WriteString("/") - path.WriteString(r.JobID) - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f RollupDeleteJob) WithContext(v context.Context) func(*RollupDeleteJobRequest) { - return func(r *RollupDeleteJobRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f RollupDeleteJob) WithPretty() func(*RollupDeleteJobRequest) { - return func(r *RollupDeleteJobRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f RollupDeleteJob) WithHuman() func(*RollupDeleteJobRequest) { - return func(r *RollupDeleteJobRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f RollupDeleteJob) WithErrorTrace() func(*RollupDeleteJobRequest) { - return func(r *RollupDeleteJobRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f RollupDeleteJob) WithFilterPath(v ...string) func(*RollupDeleteJobRequest) { - return func(r *RollupDeleteJobRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f RollupDeleteJob) WithHeader(h map[string]string) func(*RollupDeleteJobRequest) { - return func(r *RollupDeleteJobRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f RollupDeleteJob) WithOpaqueID(s string) func(*RollupDeleteJobRequest) { - return func(r *RollupDeleteJobRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.rollup.get_jobs.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.rollup.get_jobs.go deleted file mode 100644 index 793df6270..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.rollup.get_jobs.go +++ /dev/null @@ -1,215 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newRollupGetJobsFunc(t Transport) RollupGetJobs { - return func(o ...func(*RollupGetJobsRequest)) (*Response, error) { - var r = RollupGetJobsRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// RollupGetJobs - Retrieves the configuration, stats, and status of rollup jobs. -// -// This API is experimental. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/rollup-get-job.html. -// -type RollupGetJobs func(o ...func(*RollupGetJobsRequest)) (*Response, error) - -// RollupGetJobsRequest configures the Rollup Get Jobs API request. -// -type RollupGetJobsRequest struct { - JobID string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r RollupGetJobsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_rollup") + 1 + len("job") + 1 + len(r.JobID)) - path.WriteString("/") - path.WriteString("_rollup") - path.WriteString("/") - path.WriteString("job") - if r.JobID != "" { - path.WriteString("/") - path.WriteString(r.JobID) - } - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f RollupGetJobs) WithContext(v context.Context) func(*RollupGetJobsRequest) { - return func(r *RollupGetJobsRequest) { - r.ctx = v - } -} - -// WithJobID - the ID of the job(s) to fetch. accepts glob patterns, or left blank for all jobs. -// -func (f RollupGetJobs) WithJobID(v string) func(*RollupGetJobsRequest) { - return func(r *RollupGetJobsRequest) { - r.JobID = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f RollupGetJobs) WithPretty() func(*RollupGetJobsRequest) { - return func(r *RollupGetJobsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f RollupGetJobs) WithHuman() func(*RollupGetJobsRequest) { - return func(r *RollupGetJobsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f RollupGetJobs) WithErrorTrace() func(*RollupGetJobsRequest) { - return func(r *RollupGetJobsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f RollupGetJobs) WithFilterPath(v ...string) func(*RollupGetJobsRequest) { - return func(r *RollupGetJobsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f RollupGetJobs) WithHeader(h map[string]string) func(*RollupGetJobsRequest) { - return func(r *RollupGetJobsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f RollupGetJobs) WithOpaqueID(s string) func(*RollupGetJobsRequest) { - return func(r *RollupGetJobsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.rollup.get_rollup_caps.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.rollup.get_rollup_caps.go deleted file mode 100644 index 610eed084..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.rollup.get_rollup_caps.go +++ /dev/null @@ -1,215 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newRollupGetRollupCapsFunc(t Transport) RollupGetRollupCaps { - return func(o ...func(*RollupGetRollupCapsRequest)) (*Response, error) { - var r = RollupGetRollupCapsRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// RollupGetRollupCaps - Returns the capabilities of any rollup jobs that have been configured for a specific index or index pattern. -// -// This API is experimental. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/rollup-get-rollup-caps.html. -// -type RollupGetRollupCaps func(o ...func(*RollupGetRollupCapsRequest)) (*Response, error) - -// RollupGetRollupCapsRequest configures the Rollup Get Rollup Caps API request. -// -type RollupGetRollupCapsRequest struct { - Index string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r RollupGetRollupCapsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_rollup") + 1 + len("data") + 1 + len(r.Index)) - path.WriteString("/") - path.WriteString("_rollup") - path.WriteString("/") - path.WriteString("data") - if r.Index != "" { - path.WriteString("/") - path.WriteString(r.Index) - } - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f RollupGetRollupCaps) WithContext(v context.Context) func(*RollupGetRollupCapsRequest) { - return func(r *RollupGetRollupCapsRequest) { - r.ctx = v - } -} - -// WithIndex - the ID of the index to check rollup capabilities on, or left blank for all jobs. -// -func (f RollupGetRollupCaps) WithIndex(v string) func(*RollupGetRollupCapsRequest) { - return func(r *RollupGetRollupCapsRequest) { - r.Index = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f RollupGetRollupCaps) WithPretty() func(*RollupGetRollupCapsRequest) { - return func(r *RollupGetRollupCapsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f RollupGetRollupCaps) WithHuman() func(*RollupGetRollupCapsRequest) { - return func(r *RollupGetRollupCapsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f RollupGetRollupCaps) WithErrorTrace() func(*RollupGetRollupCapsRequest) { - return func(r *RollupGetRollupCapsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f RollupGetRollupCaps) WithFilterPath(v ...string) func(*RollupGetRollupCapsRequest) { - return func(r *RollupGetRollupCapsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f RollupGetRollupCaps) WithHeader(h map[string]string) func(*RollupGetRollupCapsRequest) { - return func(r *RollupGetRollupCapsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f RollupGetRollupCaps) WithOpaqueID(s string) func(*RollupGetRollupCapsRequest) { - return func(r *RollupGetRollupCapsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.rollup.get_rollup_index_caps.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.rollup.get_rollup_index_caps.go deleted file mode 100644 index 3cd0ee180..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.rollup.get_rollup_index_caps.go +++ /dev/null @@ -1,205 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newRollupGetRollupIndexCapsFunc(t Transport) RollupGetRollupIndexCaps { - return func(index string, o ...func(*RollupGetRollupIndexCapsRequest)) (*Response, error) { - var r = RollupGetRollupIndexCapsRequest{Index: index} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// RollupGetRollupIndexCaps - Returns the rollup capabilities of all jobs inside of a rollup index (e.g. the index where rollup data is stored). -// -// This API is experimental. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/rollup-get-rollup-index-caps.html. -// -type RollupGetRollupIndexCaps func(index string, o ...func(*RollupGetRollupIndexCapsRequest)) (*Response, error) - -// RollupGetRollupIndexCapsRequest configures the Rollup Get Rollup Index Caps API request. -// -type RollupGetRollupIndexCapsRequest struct { - Index string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r RollupGetRollupIndexCapsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len(r.Index) + 1 + len("_rollup") + 1 + len("data")) - path.WriteString("/") - path.WriteString(r.Index) - path.WriteString("/") - path.WriteString("_rollup") - path.WriteString("/") - path.WriteString("data") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f RollupGetRollupIndexCaps) WithContext(v context.Context) func(*RollupGetRollupIndexCapsRequest) { - return func(r *RollupGetRollupIndexCapsRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f RollupGetRollupIndexCaps) WithPretty() func(*RollupGetRollupIndexCapsRequest) { - return func(r *RollupGetRollupIndexCapsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f RollupGetRollupIndexCaps) WithHuman() func(*RollupGetRollupIndexCapsRequest) { - return func(r *RollupGetRollupIndexCapsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f RollupGetRollupIndexCaps) WithErrorTrace() func(*RollupGetRollupIndexCapsRequest) { - return func(r *RollupGetRollupIndexCapsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f RollupGetRollupIndexCaps) WithFilterPath(v ...string) func(*RollupGetRollupIndexCapsRequest) { - return func(r *RollupGetRollupIndexCapsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f RollupGetRollupIndexCaps) WithHeader(h map[string]string) func(*RollupGetRollupIndexCapsRequest) { - return func(r *RollupGetRollupIndexCapsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f RollupGetRollupIndexCaps) WithOpaqueID(s string) func(*RollupGetRollupIndexCapsRequest) { - return func(r *RollupGetRollupIndexCapsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.rollup.put_job.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.rollup.put_job.go deleted file mode 100644 index d54de1d9b..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.rollup.put_job.go +++ /dev/null @@ -1,212 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" -) - -func newRollupPutJobFunc(t Transport) RollupPutJob { - return func(id string, body io.Reader, o ...func(*RollupPutJobRequest)) (*Response, error) { - var r = RollupPutJobRequest{JobID: id, Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// RollupPutJob - Creates a rollup job. -// -// This API is experimental. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/rollup-put-job.html. -// -type RollupPutJob func(id string, body io.Reader, o ...func(*RollupPutJobRequest)) (*Response, error) - -// RollupPutJobRequest configures the Rollup Put Job API request. -// -type RollupPutJobRequest struct { - JobID string - - Body io.Reader - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r RollupPutJobRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - path.Grow(1 + len("_rollup") + 1 + len("job") + 1 + len(r.JobID)) - path.WriteString("/") - path.WriteString("_rollup") - path.WriteString("/") - path.WriteString("job") - path.WriteString("/") - path.WriteString(r.JobID) - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f RollupPutJob) WithContext(v context.Context) func(*RollupPutJobRequest) { - return func(r *RollupPutJobRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f RollupPutJob) WithPretty() func(*RollupPutJobRequest) { - return func(r *RollupPutJobRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f RollupPutJob) WithHuman() func(*RollupPutJobRequest) { - return func(r *RollupPutJobRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f RollupPutJob) WithErrorTrace() func(*RollupPutJobRequest) { - return func(r *RollupPutJobRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f RollupPutJob) WithFilterPath(v ...string) func(*RollupPutJobRequest) { - return func(r *RollupPutJobRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f RollupPutJob) WithHeader(h map[string]string) func(*RollupPutJobRequest) { - return func(r *RollupPutJobRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f RollupPutJob) WithOpaqueID(s string) func(*RollupPutJobRequest) { - return func(r *RollupPutJobRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.rollup.rollup.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.rollup.rollup.go deleted file mode 100644 index 8cc296ff0..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.rollup.rollup.go +++ /dev/null @@ -1,212 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" -) - -func newRollupRollupFunc(t Transport) RollupRollup { - return func(index string, body io.Reader, rollup_index string, o ...func(*RollupRollupRequest)) (*Response, error) { - var r = RollupRollupRequest{Index: index, Body: body, RollupIndex: rollup_index} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// RollupRollup - Rollup an index -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/rollup-api.html. -// -type RollupRollup func(index string, body io.Reader, rollup_index string, o ...func(*RollupRollupRequest)) (*Response, error) - -// RollupRollupRequest configures the Rollup Rollup API request. -// -type RollupRollupRequest struct { - Index string - - Body io.Reader - - RollupIndex string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r RollupRollupRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len(r.Index) + 1 + len("_rollup") + 1 + len(r.RollupIndex)) - path.WriteString("/") - path.WriteString(r.Index) - path.WriteString("/") - path.WriteString("_rollup") - path.WriteString("/") - path.WriteString(r.RollupIndex) - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f RollupRollup) WithContext(v context.Context) func(*RollupRollupRequest) { - return func(r *RollupRollupRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f RollupRollup) WithPretty() func(*RollupRollupRequest) { - return func(r *RollupRollupRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f RollupRollup) WithHuman() func(*RollupRollupRequest) { - return func(r *RollupRollupRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f RollupRollup) WithErrorTrace() func(*RollupRollupRequest) { - return func(r *RollupRollupRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f RollupRollup) WithFilterPath(v ...string) func(*RollupRollupRequest) { - return func(r *RollupRollupRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f RollupRollup) WithHeader(h map[string]string) func(*RollupRollupRequest) { - return func(r *RollupRollupRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f RollupRollup) WithOpaqueID(s string) func(*RollupRollupRequest) { - return func(r *RollupRollupRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.rollup.rollup_search.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.rollup.rollup_search.go deleted file mode 100644 index 5bb122c1b..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.rollup.rollup_search.go +++ /dev/null @@ -1,251 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" -) - -func newRollupRollupSearchFunc(t Transport) RollupRollupSearch { - return func(index []string, body io.Reader, o ...func(*RollupRollupSearchRequest)) (*Response, error) { - var r = RollupRollupSearchRequest{Index: index, Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// RollupRollupSearch - Enables searching rolled-up data using the standard query DSL. -// -// This API is experimental. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/rollup-search.html. -// -type RollupRollupSearch func(index []string, body io.Reader, o ...func(*RollupRollupSearchRequest)) (*Response, error) - -// RollupRollupSearchRequest configures the Rollup Rollup Search API request. -// -type RollupRollupSearchRequest struct { - Index []string - DocumentType string - - Body io.Reader - - RestTotalHitsAsInt *bool - TypedKeys *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r RollupRollupSearchRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len(strings.Join(r.Index, ",")) + 1 + len(r.DocumentType) + 1 + len("_rollup_search")) - path.WriteString("/") - path.WriteString(strings.Join(r.Index, ",")) - if r.DocumentType != "" { - path.WriteString("/") - path.WriteString(r.DocumentType) - } - path.WriteString("/") - path.WriteString("_rollup_search") - - params = make(map[string]string) - - if r.RestTotalHitsAsInt != nil { - params["rest_total_hits_as_int"] = strconv.FormatBool(*r.RestTotalHitsAsInt) - } - - if r.TypedKeys != nil { - params["typed_keys"] = strconv.FormatBool(*r.TypedKeys) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f RollupRollupSearch) WithContext(v context.Context) func(*RollupRollupSearchRequest) { - return func(r *RollupRollupSearchRequest) { - r.ctx = v - } -} - -// WithDocumentType - the doc type inside the index. -// -func (f RollupRollupSearch) WithDocumentType(v string) func(*RollupRollupSearchRequest) { - return func(r *RollupRollupSearchRequest) { - r.DocumentType = v - } -} - -// WithRestTotalHitsAsInt - indicates whether hits.total should be rendered as an integer or an object in the rest search response. -// -func (f RollupRollupSearch) WithRestTotalHitsAsInt(v bool) func(*RollupRollupSearchRequest) { - return func(r *RollupRollupSearchRequest) { - r.RestTotalHitsAsInt = &v - } -} - -// WithTypedKeys - specify whether aggregation and suggester names should be prefixed by their respective types in the response. -// -func (f RollupRollupSearch) WithTypedKeys(v bool) func(*RollupRollupSearchRequest) { - return func(r *RollupRollupSearchRequest) { - r.TypedKeys = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f RollupRollupSearch) WithPretty() func(*RollupRollupSearchRequest) { - return func(r *RollupRollupSearchRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f RollupRollupSearch) WithHuman() func(*RollupRollupSearchRequest) { - return func(r *RollupRollupSearchRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f RollupRollupSearch) WithErrorTrace() func(*RollupRollupSearchRequest) { - return func(r *RollupRollupSearchRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f RollupRollupSearch) WithFilterPath(v ...string) func(*RollupRollupSearchRequest) { - return func(r *RollupRollupSearchRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f RollupRollupSearch) WithHeader(h map[string]string) func(*RollupRollupSearchRequest) { - return func(r *RollupRollupSearchRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f RollupRollupSearch) WithOpaqueID(s string) func(*RollupRollupSearchRequest) { - return func(r *RollupRollupSearchRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.rollup.start_job.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.rollup.start_job.go deleted file mode 100644 index ac76396b4..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.rollup.start_job.go +++ /dev/null @@ -1,207 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newRollupStartJobFunc(t Transport) RollupStartJob { - return func(id string, o ...func(*RollupStartJobRequest)) (*Response, error) { - var r = RollupStartJobRequest{JobID: id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// RollupStartJob - Starts an existing, stopped rollup job. -// -// This API is experimental. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/rollup-start-job.html. -// -type RollupStartJob func(id string, o ...func(*RollupStartJobRequest)) (*Response, error) - -// RollupStartJobRequest configures the Rollup Start Job API request. -// -type RollupStartJobRequest struct { - JobID string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r RollupStartJobRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_rollup") + 1 + len("job") + 1 + len(r.JobID) + 1 + len("_start")) - path.WriteString("/") - path.WriteString("_rollup") - path.WriteString("/") - path.WriteString("job") - path.WriteString("/") - path.WriteString(r.JobID) - path.WriteString("/") - path.WriteString("_start") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f RollupStartJob) WithContext(v context.Context) func(*RollupStartJobRequest) { - return func(r *RollupStartJobRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f RollupStartJob) WithPretty() func(*RollupStartJobRequest) { - return func(r *RollupStartJobRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f RollupStartJob) WithHuman() func(*RollupStartJobRequest) { - return func(r *RollupStartJobRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f RollupStartJob) WithErrorTrace() func(*RollupStartJobRequest) { - return func(r *RollupStartJobRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f RollupStartJob) WithFilterPath(v ...string) func(*RollupStartJobRequest) { - return func(r *RollupStartJobRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f RollupStartJob) WithHeader(h map[string]string) func(*RollupStartJobRequest) { - return func(r *RollupStartJobRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f RollupStartJob) WithOpaqueID(s string) func(*RollupStartJobRequest) { - return func(r *RollupStartJobRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.rollup.stop_job.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.rollup.stop_job.go deleted file mode 100644 index ccbeba5a6..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.rollup.stop_job.go +++ /dev/null @@ -1,236 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" - "time" -) - -func newRollupStopJobFunc(t Transport) RollupStopJob { - return func(id string, o ...func(*RollupStopJobRequest)) (*Response, error) { - var r = RollupStopJobRequest{JobID: id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// RollupStopJob - Stops an existing, started rollup job. -// -// This API is experimental. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/rollup-stop-job.html. -// -type RollupStopJob func(id string, o ...func(*RollupStopJobRequest)) (*Response, error) - -// RollupStopJobRequest configures the Rollup Stop Job API request. -// -type RollupStopJobRequest struct { - JobID string - - Timeout time.Duration - WaitForCompletion *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r RollupStopJobRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_rollup") + 1 + len("job") + 1 + len(r.JobID) + 1 + len("_stop")) - path.WriteString("/") - path.WriteString("_rollup") - path.WriteString("/") - path.WriteString("job") - path.WriteString("/") - path.WriteString(r.JobID) - path.WriteString("/") - path.WriteString("_stop") - - params = make(map[string]string) - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.WaitForCompletion != nil { - params["wait_for_completion"] = strconv.FormatBool(*r.WaitForCompletion) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f RollupStopJob) WithContext(v context.Context) func(*RollupStopJobRequest) { - return func(r *RollupStopJobRequest) { - r.ctx = v - } -} - -// WithTimeout - block for (at maximum) the specified duration while waiting for the job to stop. defaults to 30s.. -// -func (f RollupStopJob) WithTimeout(v time.Duration) func(*RollupStopJobRequest) { - return func(r *RollupStopJobRequest) { - r.Timeout = v - } -} - -// WithWaitForCompletion - true if the api should block until the job has fully stopped, false if should be executed async. defaults to false.. -// -func (f RollupStopJob) WithWaitForCompletion(v bool) func(*RollupStopJobRequest) { - return func(r *RollupStopJobRequest) { - r.WaitForCompletion = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f RollupStopJob) WithPretty() func(*RollupStopJobRequest) { - return func(r *RollupStopJobRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f RollupStopJob) WithHuman() func(*RollupStopJobRequest) { - return func(r *RollupStopJobRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f RollupStopJob) WithErrorTrace() func(*RollupStopJobRequest) { - return func(r *RollupStopJobRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f RollupStopJob) WithFilterPath(v ...string) func(*RollupStopJobRequest) { - return func(r *RollupStopJobRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f RollupStopJob) WithHeader(h map[string]string) func(*RollupStopJobRequest) { - return func(r *RollupStopJobRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f RollupStopJob) WithOpaqueID(s string) func(*RollupStopJobRequest) { - return func(r *RollupStopJobRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.searchable_snapshots.cache_stats.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.searchable_snapshots.cache_stats.go deleted file mode 100644 index aef3ce73d..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.searchable_snapshots.cache_stats.go +++ /dev/null @@ -1,217 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newSearchableSnapshotsCacheStatsFunc(t Transport) SearchableSnapshotsCacheStats { - return func(o ...func(*SearchableSnapshotsCacheStatsRequest)) (*Response, error) { - var r = SearchableSnapshotsCacheStatsRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SearchableSnapshotsCacheStats - Retrieve node-level cache statistics about searchable snapshots. -// -// This API is experimental. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/searchable-snapshots-apis.html. -// -type SearchableSnapshotsCacheStats func(o ...func(*SearchableSnapshotsCacheStatsRequest)) (*Response, error) - -// SearchableSnapshotsCacheStatsRequest configures the Searchable Snapshots Cache Stats API request. -// -type SearchableSnapshotsCacheStatsRequest struct { - NodeID []string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SearchableSnapshotsCacheStatsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_searchable_snapshots") + 1 + len(strings.Join(r.NodeID, ",")) + 1 + len("cache") + 1 + len("stats")) - path.WriteString("/") - path.WriteString("_searchable_snapshots") - if len(r.NodeID) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.NodeID, ",")) - } - path.WriteString("/") - path.WriteString("cache") - path.WriteString("/") - path.WriteString("stats") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SearchableSnapshotsCacheStats) WithContext(v context.Context) func(*SearchableSnapshotsCacheStatsRequest) { - return func(r *SearchableSnapshotsCacheStatsRequest) { - r.ctx = v - } -} - -// WithNodeID - a list of node ids or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes. -// -func (f SearchableSnapshotsCacheStats) WithNodeID(v ...string) func(*SearchableSnapshotsCacheStatsRequest) { - return func(r *SearchableSnapshotsCacheStatsRequest) { - r.NodeID = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SearchableSnapshotsCacheStats) WithPretty() func(*SearchableSnapshotsCacheStatsRequest) { - return func(r *SearchableSnapshotsCacheStatsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SearchableSnapshotsCacheStats) WithHuman() func(*SearchableSnapshotsCacheStatsRequest) { - return func(r *SearchableSnapshotsCacheStatsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SearchableSnapshotsCacheStats) WithErrorTrace() func(*SearchableSnapshotsCacheStatsRequest) { - return func(r *SearchableSnapshotsCacheStatsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SearchableSnapshotsCacheStats) WithFilterPath(v ...string) func(*SearchableSnapshotsCacheStatsRequest) { - return func(r *SearchableSnapshotsCacheStatsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SearchableSnapshotsCacheStats) WithHeader(h map[string]string) func(*SearchableSnapshotsCacheStatsRequest) { - return func(r *SearchableSnapshotsCacheStatsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SearchableSnapshotsCacheStats) WithOpaqueID(s string) func(*SearchableSnapshotsCacheStatsRequest) { - return func(r *SearchableSnapshotsCacheStatsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.searchable_snapshots.clear_cache.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.searchable_snapshots.clear_cache.go deleted file mode 100644 index afc6b0fa2..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.searchable_snapshots.clear_cache.go +++ /dev/null @@ -1,262 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newSearchableSnapshotsClearCacheFunc(t Transport) SearchableSnapshotsClearCache { - return func(o ...func(*SearchableSnapshotsClearCacheRequest)) (*Response, error) { - var r = SearchableSnapshotsClearCacheRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SearchableSnapshotsClearCache - Clear the cache of searchable snapshots. -// -// This API is experimental. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/searchable-snapshots-apis.html. -// -type SearchableSnapshotsClearCache func(o ...func(*SearchableSnapshotsClearCacheRequest)) (*Response, error) - -// SearchableSnapshotsClearCacheRequest configures the Searchable Snapshots Clear Cache API request. -// -type SearchableSnapshotsClearCacheRequest struct { - Index []string - - AllowNoIndices *bool - ExpandWildcards string - IgnoreUnavailable *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SearchableSnapshotsClearCacheRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len(strings.Join(r.Index, ",")) + 1 + len("_searchable_snapshots") + 1 + len("cache") + 1 + len("clear")) - if len(r.Index) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Index, ",")) - } - path.WriteString("/") - path.WriteString("_searchable_snapshots") - path.WriteString("/") - path.WriteString("cache") - path.WriteString("/") - path.WriteString("clear") - - params = make(map[string]string) - - if r.AllowNoIndices != nil { - params["allow_no_indices"] = strconv.FormatBool(*r.AllowNoIndices) - } - - if r.ExpandWildcards != "" { - params["expand_wildcards"] = r.ExpandWildcards - } - - if r.IgnoreUnavailable != nil { - params["ignore_unavailable"] = strconv.FormatBool(*r.IgnoreUnavailable) - } - - if len(r.Index) > 0 { - params["index"] = strings.Join(r.Index, ",") - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SearchableSnapshotsClearCache) WithContext(v context.Context) func(*SearchableSnapshotsClearCacheRequest) { - return func(r *SearchableSnapshotsClearCacheRequest) { - r.ctx = v - } -} - -// WithIndex - a list of index names. -// -func (f SearchableSnapshotsClearCache) WithIndex(v ...string) func(*SearchableSnapshotsClearCacheRequest) { - return func(r *SearchableSnapshotsClearCacheRequest) { - r.Index = v - } -} - -// WithAllowNoIndices - whether to ignore if a wildcard indices expression resolves into no concrete indices. (this includes `_all` string or when no indices have been specified). -// -func (f SearchableSnapshotsClearCache) WithAllowNoIndices(v bool) func(*SearchableSnapshotsClearCacheRequest) { - return func(r *SearchableSnapshotsClearCacheRequest) { - r.AllowNoIndices = &v - } -} - -// WithExpandWildcards - whether to expand wildcard expression to concrete indices that are open, closed or both.. -// -func (f SearchableSnapshotsClearCache) WithExpandWildcards(v string) func(*SearchableSnapshotsClearCacheRequest) { - return func(r *SearchableSnapshotsClearCacheRequest) { - r.ExpandWildcards = v - } -} - -// WithIgnoreUnavailable - whether specified concrete indices should be ignored when unavailable (missing or closed). -// -func (f SearchableSnapshotsClearCache) WithIgnoreUnavailable(v bool) func(*SearchableSnapshotsClearCacheRequest) { - return func(r *SearchableSnapshotsClearCacheRequest) { - r.IgnoreUnavailable = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SearchableSnapshotsClearCache) WithPretty() func(*SearchableSnapshotsClearCacheRequest) { - return func(r *SearchableSnapshotsClearCacheRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SearchableSnapshotsClearCache) WithHuman() func(*SearchableSnapshotsClearCacheRequest) { - return func(r *SearchableSnapshotsClearCacheRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SearchableSnapshotsClearCache) WithErrorTrace() func(*SearchableSnapshotsClearCacheRequest) { - return func(r *SearchableSnapshotsClearCacheRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SearchableSnapshotsClearCache) WithFilterPath(v ...string) func(*SearchableSnapshotsClearCacheRequest) { - return func(r *SearchableSnapshotsClearCacheRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SearchableSnapshotsClearCache) WithHeader(h map[string]string) func(*SearchableSnapshotsClearCacheRequest) { - return func(r *SearchableSnapshotsClearCacheRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SearchableSnapshotsClearCache) WithOpaqueID(s string) func(*SearchableSnapshotsClearCacheRequest) { - return func(r *SearchableSnapshotsClearCacheRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.searchable_snapshots.mount.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.searchable_snapshots.mount.go deleted file mode 100644 index 7c971364c..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.searchable_snapshots.mount.go +++ /dev/null @@ -1,257 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" - "time" -) - -func newSearchableSnapshotsMountFunc(t Transport) SearchableSnapshotsMount { - return func(repository string, snapshot string, body io.Reader, o ...func(*SearchableSnapshotsMountRequest)) (*Response, error) { - var r = SearchableSnapshotsMountRequest{Repository: repository, Snapshot: snapshot, Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SearchableSnapshotsMount - Mount a snapshot as a searchable index. -// -// This API is experimental. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/searchable-snapshots-api-mount-snapshot.html. -// -type SearchableSnapshotsMount func(repository string, snapshot string, body io.Reader, o ...func(*SearchableSnapshotsMountRequest)) (*Response, error) - -// SearchableSnapshotsMountRequest configures the Searchable Snapshots Mount API request. -// -type SearchableSnapshotsMountRequest struct { - Body io.Reader - - Repository string - Snapshot string - - MasterTimeout time.Duration - Storage string - WaitForCompletion *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SearchableSnapshotsMountRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_snapshot") + 1 + len(r.Repository) + 1 + len(r.Snapshot) + 1 + len("_mount")) - path.WriteString("/") - path.WriteString("_snapshot") - path.WriteString("/") - path.WriteString(r.Repository) - path.WriteString("/") - path.WriteString(r.Snapshot) - path.WriteString("/") - path.WriteString("_mount") - - params = make(map[string]string) - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Storage != "" { - params["storage"] = r.Storage - } - - if r.WaitForCompletion != nil { - params["wait_for_completion"] = strconv.FormatBool(*r.WaitForCompletion) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SearchableSnapshotsMount) WithContext(v context.Context) func(*SearchableSnapshotsMountRequest) { - return func(r *SearchableSnapshotsMountRequest) { - r.ctx = v - } -} - -// WithMasterTimeout - explicit operation timeout for connection to master node. -// -func (f SearchableSnapshotsMount) WithMasterTimeout(v time.Duration) func(*SearchableSnapshotsMountRequest) { - return func(r *SearchableSnapshotsMountRequest) { - r.MasterTimeout = v - } -} - -// WithStorage - selects the kind of local storage used to accelerate searches. experimental, and defaults to `full_copy`. -// -func (f SearchableSnapshotsMount) WithStorage(v string) func(*SearchableSnapshotsMountRequest) { - return func(r *SearchableSnapshotsMountRequest) { - r.Storage = v - } -} - -// WithWaitForCompletion - should this request wait until the operation has completed before returning. -// -func (f SearchableSnapshotsMount) WithWaitForCompletion(v bool) func(*SearchableSnapshotsMountRequest) { - return func(r *SearchableSnapshotsMountRequest) { - r.WaitForCompletion = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SearchableSnapshotsMount) WithPretty() func(*SearchableSnapshotsMountRequest) { - return func(r *SearchableSnapshotsMountRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SearchableSnapshotsMount) WithHuman() func(*SearchableSnapshotsMountRequest) { - return func(r *SearchableSnapshotsMountRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SearchableSnapshotsMount) WithErrorTrace() func(*SearchableSnapshotsMountRequest) { - return func(r *SearchableSnapshotsMountRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SearchableSnapshotsMount) WithFilterPath(v ...string) func(*SearchableSnapshotsMountRequest) { - return func(r *SearchableSnapshotsMountRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SearchableSnapshotsMount) WithHeader(h map[string]string) func(*SearchableSnapshotsMountRequest) { - return func(r *SearchableSnapshotsMountRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SearchableSnapshotsMount) WithOpaqueID(s string) func(*SearchableSnapshotsMountRequest) { - return func(r *SearchableSnapshotsMountRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.searchable_snapshots.repository_stats.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.searchable_snapshots.repository_stats.go deleted file mode 100644 index fcf0ba453..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.searchable_snapshots.repository_stats.go +++ /dev/null @@ -1,205 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newSearchableSnapshotsRepositoryStatsFunc(t Transport) SearchableSnapshotsRepositoryStats { - return func(repository string, o ...func(*SearchableSnapshotsRepositoryStatsRequest)) (*Response, error) { - var r = SearchableSnapshotsRepositoryStatsRequest{Repository: repository} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SearchableSnapshotsRepositoryStats - DEPRECATED: This API is replaced by the Repositories Metering API. -// -// This API is experimental. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/searchable-snapshots-apis.html. -// -type SearchableSnapshotsRepositoryStats func(repository string, o ...func(*SearchableSnapshotsRepositoryStatsRequest)) (*Response, error) - -// SearchableSnapshotsRepositoryStatsRequest configures the Searchable Snapshots Repository Stats API request. -// -type SearchableSnapshotsRepositoryStatsRequest struct { - Repository string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SearchableSnapshotsRepositoryStatsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_snapshot") + 1 + len(r.Repository) + 1 + len("_stats")) - path.WriteString("/") - path.WriteString("_snapshot") - path.WriteString("/") - path.WriteString(r.Repository) - path.WriteString("/") - path.WriteString("_stats") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SearchableSnapshotsRepositoryStats) WithContext(v context.Context) func(*SearchableSnapshotsRepositoryStatsRequest) { - return func(r *SearchableSnapshotsRepositoryStatsRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SearchableSnapshotsRepositoryStats) WithPretty() func(*SearchableSnapshotsRepositoryStatsRequest) { - return func(r *SearchableSnapshotsRepositoryStatsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SearchableSnapshotsRepositoryStats) WithHuman() func(*SearchableSnapshotsRepositoryStatsRequest) { - return func(r *SearchableSnapshotsRepositoryStatsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SearchableSnapshotsRepositoryStats) WithErrorTrace() func(*SearchableSnapshotsRepositoryStatsRequest) { - return func(r *SearchableSnapshotsRepositoryStatsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SearchableSnapshotsRepositoryStats) WithFilterPath(v ...string) func(*SearchableSnapshotsRepositoryStatsRequest) { - return func(r *SearchableSnapshotsRepositoryStatsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SearchableSnapshotsRepositoryStats) WithHeader(h map[string]string) func(*SearchableSnapshotsRepositoryStatsRequest) { - return func(r *SearchableSnapshotsRepositoryStatsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SearchableSnapshotsRepositoryStats) WithOpaqueID(s string) func(*SearchableSnapshotsRepositoryStatsRequest) { - return func(r *SearchableSnapshotsRepositoryStatsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.searchable_snapshots.stats.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.searchable_snapshots.stats.go deleted file mode 100644 index 2ebf5b405..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.searchable_snapshots.stats.go +++ /dev/null @@ -1,229 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newSearchableSnapshotsStatsFunc(t Transport) SearchableSnapshotsStats { - return func(o ...func(*SearchableSnapshotsStatsRequest)) (*Response, error) { - var r = SearchableSnapshotsStatsRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SearchableSnapshotsStats - Retrieve shard-level statistics about searchable snapshots. -// -// This API is experimental. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/searchable-snapshots-apis.html. -// -type SearchableSnapshotsStats func(o ...func(*SearchableSnapshotsStatsRequest)) (*Response, error) - -// SearchableSnapshotsStatsRequest configures the Searchable Snapshots Stats API request. -// -type SearchableSnapshotsStatsRequest struct { - Index []string - - Level string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SearchableSnapshotsStatsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len(strings.Join(r.Index, ",")) + 1 + len("_searchable_snapshots") + 1 + len("stats")) - if len(r.Index) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Index, ",")) - } - path.WriteString("/") - path.WriteString("_searchable_snapshots") - path.WriteString("/") - path.WriteString("stats") - - params = make(map[string]string) - - if r.Level != "" { - params["level"] = r.Level - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SearchableSnapshotsStats) WithContext(v context.Context) func(*SearchableSnapshotsStatsRequest) { - return func(r *SearchableSnapshotsStatsRequest) { - r.ctx = v - } -} - -// WithIndex - a list of index names. -// -func (f SearchableSnapshotsStats) WithIndex(v ...string) func(*SearchableSnapshotsStatsRequest) { - return func(r *SearchableSnapshotsStatsRequest) { - r.Index = v - } -} - -// WithLevel - return stats aggregated at cluster, index or shard level. -// -func (f SearchableSnapshotsStats) WithLevel(v string) func(*SearchableSnapshotsStatsRequest) { - return func(r *SearchableSnapshotsStatsRequest) { - r.Level = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SearchableSnapshotsStats) WithPretty() func(*SearchableSnapshotsStatsRequest) { - return func(r *SearchableSnapshotsStatsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SearchableSnapshotsStats) WithHuman() func(*SearchableSnapshotsStatsRequest) { - return func(r *SearchableSnapshotsStatsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SearchableSnapshotsStats) WithErrorTrace() func(*SearchableSnapshotsStatsRequest) { - return func(r *SearchableSnapshotsStatsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SearchableSnapshotsStats) WithFilterPath(v ...string) func(*SearchableSnapshotsStatsRequest) { - return func(r *SearchableSnapshotsStatsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SearchableSnapshotsStats) WithHeader(h map[string]string) func(*SearchableSnapshotsStatsRequest) { - return func(r *SearchableSnapshotsStatsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SearchableSnapshotsStats) WithOpaqueID(s string) func(*SearchableSnapshotsStatsRequest) { - return func(r *SearchableSnapshotsStatsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.authenticate.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.authenticate.go deleted file mode 100644 index 89753a6d5..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.authenticate.go +++ /dev/null @@ -1,196 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newSecurityAuthenticateFunc(t Transport) SecurityAuthenticate { - return func(o ...func(*SecurityAuthenticateRequest)) (*Response, error) { - var r = SecurityAuthenticateRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SecurityAuthenticate - Enables authentication as a user and retrieve information about the authenticated user. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-authenticate.html. -// -type SecurityAuthenticate func(o ...func(*SecurityAuthenticateRequest)) (*Response, error) - -// SecurityAuthenticateRequest configures the Security Authenticate API request. -// -type SecurityAuthenticateRequest struct { - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SecurityAuthenticateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(len("/_security/_authenticate")) - path.WriteString("/_security/_authenticate") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SecurityAuthenticate) WithContext(v context.Context) func(*SecurityAuthenticateRequest) { - return func(r *SecurityAuthenticateRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SecurityAuthenticate) WithPretty() func(*SecurityAuthenticateRequest) { - return func(r *SecurityAuthenticateRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SecurityAuthenticate) WithHuman() func(*SecurityAuthenticateRequest) { - return func(r *SecurityAuthenticateRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SecurityAuthenticate) WithErrorTrace() func(*SecurityAuthenticateRequest) { - return func(r *SecurityAuthenticateRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SecurityAuthenticate) WithFilterPath(v ...string) func(*SecurityAuthenticateRequest) { - return func(r *SecurityAuthenticateRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SecurityAuthenticate) WithHeader(h map[string]string) func(*SecurityAuthenticateRequest) { - return func(r *SecurityAuthenticateRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SecurityAuthenticate) WithOpaqueID(s string) func(*SecurityAuthenticateRequest) { - return func(r *SecurityAuthenticateRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.change_password.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.change_password.go deleted file mode 100644 index 527cb0d51..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.change_password.go +++ /dev/null @@ -1,236 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" -) - -func newSecurityChangePasswordFunc(t Transport) SecurityChangePassword { - return func(body io.Reader, o ...func(*SecurityChangePasswordRequest)) (*Response, error) { - var r = SecurityChangePasswordRequest{Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SecurityChangePassword - Changes the passwords of users in the native realm and built-in users. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-change-password.html. -// -type SecurityChangePassword func(body io.Reader, o ...func(*SecurityChangePasswordRequest)) (*Response, error) - -// SecurityChangePasswordRequest configures the Security Change Password API request. -// -type SecurityChangePasswordRequest struct { - Body io.Reader - - Username string - - Refresh string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SecurityChangePasswordRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - path.Grow(1 + len("_security") + 1 + len("user") + 1 + len(r.Username) + 1 + len("_password")) - path.WriteString("/") - path.WriteString("_security") - path.WriteString("/") - path.WriteString("user") - if r.Username != "" { - path.WriteString("/") - path.WriteString(r.Username) - } - path.WriteString("/") - path.WriteString("_password") - - params = make(map[string]string) - - if r.Refresh != "" { - params["refresh"] = r.Refresh - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SecurityChangePassword) WithContext(v context.Context) func(*SecurityChangePasswordRequest) { - return func(r *SecurityChangePasswordRequest) { - r.ctx = v - } -} - -// WithUsername - the username of the user to change the password for. -// -func (f SecurityChangePassword) WithUsername(v string) func(*SecurityChangePasswordRequest) { - return func(r *SecurityChangePasswordRequest) { - r.Username = v - } -} - -// WithRefresh - if `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes.. -// -func (f SecurityChangePassword) WithRefresh(v string) func(*SecurityChangePasswordRequest) { - return func(r *SecurityChangePasswordRequest) { - r.Refresh = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SecurityChangePassword) WithPretty() func(*SecurityChangePasswordRequest) { - return func(r *SecurityChangePasswordRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SecurityChangePassword) WithHuman() func(*SecurityChangePasswordRequest) { - return func(r *SecurityChangePasswordRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SecurityChangePassword) WithErrorTrace() func(*SecurityChangePasswordRequest) { - return func(r *SecurityChangePasswordRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SecurityChangePassword) WithFilterPath(v ...string) func(*SecurityChangePasswordRequest) { - return func(r *SecurityChangePasswordRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SecurityChangePassword) WithHeader(h map[string]string) func(*SecurityChangePasswordRequest) { - return func(r *SecurityChangePasswordRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SecurityChangePassword) WithOpaqueID(s string) func(*SecurityChangePasswordRequest) { - return func(r *SecurityChangePasswordRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.clear_api_key_cache.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.clear_api_key_cache.go deleted file mode 100644 index 7d6a66e0f..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.clear_api_key_cache.go +++ /dev/null @@ -1,205 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newSecurityClearAPIKeyCacheFunc(t Transport) SecurityClearAPIKeyCache { - return func(ids []string, o ...func(*SecurityClearAPIKeyCacheRequest)) (*Response, error) { - var r = SecurityClearAPIKeyCacheRequest{Ids: ids} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SecurityClearAPIKeyCache - Clear a subset or all entries from the API key cache. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-clear-api-key-cache.html. -// -type SecurityClearAPIKeyCache func(ids []string, o ...func(*SecurityClearAPIKeyCacheRequest)) (*Response, error) - -// SecurityClearAPIKeyCacheRequest configures the Security ClearAPI Key Cache API request. -// -type SecurityClearAPIKeyCacheRequest struct { - Ids []string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SecurityClearAPIKeyCacheRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_security") + 1 + len("api_key") + 1 + len(strings.Join(r.Ids, ",")) + 1 + len("_clear_cache")) - path.WriteString("/") - path.WriteString("_security") - path.WriteString("/") - path.WriteString("api_key") - path.WriteString("/") - path.WriteString(strings.Join(r.Ids, ",")) - path.WriteString("/") - path.WriteString("_clear_cache") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SecurityClearAPIKeyCache) WithContext(v context.Context) func(*SecurityClearAPIKeyCacheRequest) { - return func(r *SecurityClearAPIKeyCacheRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SecurityClearAPIKeyCache) WithPretty() func(*SecurityClearAPIKeyCacheRequest) { - return func(r *SecurityClearAPIKeyCacheRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SecurityClearAPIKeyCache) WithHuman() func(*SecurityClearAPIKeyCacheRequest) { - return func(r *SecurityClearAPIKeyCacheRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SecurityClearAPIKeyCache) WithErrorTrace() func(*SecurityClearAPIKeyCacheRequest) { - return func(r *SecurityClearAPIKeyCacheRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SecurityClearAPIKeyCache) WithFilterPath(v ...string) func(*SecurityClearAPIKeyCacheRequest) { - return func(r *SecurityClearAPIKeyCacheRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SecurityClearAPIKeyCache) WithHeader(h map[string]string) func(*SecurityClearAPIKeyCacheRequest) { - return func(r *SecurityClearAPIKeyCacheRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SecurityClearAPIKeyCache) WithOpaqueID(s string) func(*SecurityClearAPIKeyCacheRequest) { - return func(r *SecurityClearAPIKeyCacheRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.clear_cached_privileges.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.clear_cached_privileges.go deleted file mode 100644 index f553ffaef..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.clear_cached_privileges.go +++ /dev/null @@ -1,205 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newSecurityClearCachedPrivilegesFunc(t Transport) SecurityClearCachedPrivileges { - return func(application []string, o ...func(*SecurityClearCachedPrivilegesRequest)) (*Response, error) { - var r = SecurityClearCachedPrivilegesRequest{Application: application} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SecurityClearCachedPrivileges - Evicts application privileges from the native application privileges cache. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-clear-privilege-cache.html. -// -type SecurityClearCachedPrivileges func(application []string, o ...func(*SecurityClearCachedPrivilegesRequest)) (*Response, error) - -// SecurityClearCachedPrivilegesRequest configures the Security Clear Cached Privileges API request. -// -type SecurityClearCachedPrivilegesRequest struct { - Application []string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SecurityClearCachedPrivilegesRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_security") + 1 + len("privilege") + 1 + len(strings.Join(r.Application, ",")) + 1 + len("_clear_cache")) - path.WriteString("/") - path.WriteString("_security") - path.WriteString("/") - path.WriteString("privilege") - path.WriteString("/") - path.WriteString(strings.Join(r.Application, ",")) - path.WriteString("/") - path.WriteString("_clear_cache") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SecurityClearCachedPrivileges) WithContext(v context.Context) func(*SecurityClearCachedPrivilegesRequest) { - return func(r *SecurityClearCachedPrivilegesRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SecurityClearCachedPrivileges) WithPretty() func(*SecurityClearCachedPrivilegesRequest) { - return func(r *SecurityClearCachedPrivilegesRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SecurityClearCachedPrivileges) WithHuman() func(*SecurityClearCachedPrivilegesRequest) { - return func(r *SecurityClearCachedPrivilegesRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SecurityClearCachedPrivileges) WithErrorTrace() func(*SecurityClearCachedPrivilegesRequest) { - return func(r *SecurityClearCachedPrivilegesRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SecurityClearCachedPrivileges) WithFilterPath(v ...string) func(*SecurityClearCachedPrivilegesRequest) { - return func(r *SecurityClearCachedPrivilegesRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SecurityClearCachedPrivileges) WithHeader(h map[string]string) func(*SecurityClearCachedPrivilegesRequest) { - return func(r *SecurityClearCachedPrivilegesRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SecurityClearCachedPrivileges) WithOpaqueID(s string) func(*SecurityClearCachedPrivilegesRequest) { - return func(r *SecurityClearCachedPrivilegesRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.clear_cached_realms.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.clear_cached_realms.go deleted file mode 100644 index 12efad325..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.clear_cached_realms.go +++ /dev/null @@ -1,219 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newSecurityClearCachedRealmsFunc(t Transport) SecurityClearCachedRealms { - return func(realms []string, o ...func(*SecurityClearCachedRealmsRequest)) (*Response, error) { - var r = SecurityClearCachedRealmsRequest{Realms: realms} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SecurityClearCachedRealms - Evicts users from the user cache. Can completely clear the cache or evict specific users. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-clear-cache.html. -// -type SecurityClearCachedRealms func(realms []string, o ...func(*SecurityClearCachedRealmsRequest)) (*Response, error) - -// SecurityClearCachedRealmsRequest configures the Security Clear Cached Realms API request. -// -type SecurityClearCachedRealmsRequest struct { - Realms []string - - Usernames []string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SecurityClearCachedRealmsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_security") + 1 + len("realm") + 1 + len(strings.Join(r.Realms, ",")) + 1 + len("_clear_cache")) - path.WriteString("/") - path.WriteString("_security") - path.WriteString("/") - path.WriteString("realm") - path.WriteString("/") - path.WriteString(strings.Join(r.Realms, ",")) - path.WriteString("/") - path.WriteString("_clear_cache") - - params = make(map[string]string) - - if len(r.Usernames) > 0 { - params["usernames"] = strings.Join(r.Usernames, ",") - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SecurityClearCachedRealms) WithContext(v context.Context) func(*SecurityClearCachedRealmsRequest) { - return func(r *SecurityClearCachedRealmsRequest) { - r.ctx = v - } -} - -// WithUsernames - comma-separated list of usernames to clear from the cache. -// -func (f SecurityClearCachedRealms) WithUsernames(v ...string) func(*SecurityClearCachedRealmsRequest) { - return func(r *SecurityClearCachedRealmsRequest) { - r.Usernames = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SecurityClearCachedRealms) WithPretty() func(*SecurityClearCachedRealmsRequest) { - return func(r *SecurityClearCachedRealmsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SecurityClearCachedRealms) WithHuman() func(*SecurityClearCachedRealmsRequest) { - return func(r *SecurityClearCachedRealmsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SecurityClearCachedRealms) WithErrorTrace() func(*SecurityClearCachedRealmsRequest) { - return func(r *SecurityClearCachedRealmsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SecurityClearCachedRealms) WithFilterPath(v ...string) func(*SecurityClearCachedRealmsRequest) { - return func(r *SecurityClearCachedRealmsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SecurityClearCachedRealms) WithHeader(h map[string]string) func(*SecurityClearCachedRealmsRequest) { - return func(r *SecurityClearCachedRealmsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SecurityClearCachedRealms) WithOpaqueID(s string) func(*SecurityClearCachedRealmsRequest) { - return func(r *SecurityClearCachedRealmsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.clear_cached_roles.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.clear_cached_roles.go deleted file mode 100644 index d78ca9499..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.clear_cached_roles.go +++ /dev/null @@ -1,205 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newSecurityClearCachedRolesFunc(t Transport) SecurityClearCachedRoles { - return func(name []string, o ...func(*SecurityClearCachedRolesRequest)) (*Response, error) { - var r = SecurityClearCachedRolesRequest{Name: name} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SecurityClearCachedRoles - Evicts roles from the native role cache. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-clear-role-cache.html. -// -type SecurityClearCachedRoles func(name []string, o ...func(*SecurityClearCachedRolesRequest)) (*Response, error) - -// SecurityClearCachedRolesRequest configures the Security Clear Cached Roles API request. -// -type SecurityClearCachedRolesRequest struct { - Name []string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SecurityClearCachedRolesRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_security") + 1 + len("role") + 1 + len(strings.Join(r.Name, ",")) + 1 + len("_clear_cache")) - path.WriteString("/") - path.WriteString("_security") - path.WriteString("/") - path.WriteString("role") - path.WriteString("/") - path.WriteString(strings.Join(r.Name, ",")) - path.WriteString("/") - path.WriteString("_clear_cache") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SecurityClearCachedRoles) WithContext(v context.Context) func(*SecurityClearCachedRolesRequest) { - return func(r *SecurityClearCachedRolesRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SecurityClearCachedRoles) WithPretty() func(*SecurityClearCachedRolesRequest) { - return func(r *SecurityClearCachedRolesRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SecurityClearCachedRoles) WithHuman() func(*SecurityClearCachedRolesRequest) { - return func(r *SecurityClearCachedRolesRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SecurityClearCachedRoles) WithErrorTrace() func(*SecurityClearCachedRolesRequest) { - return func(r *SecurityClearCachedRolesRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SecurityClearCachedRoles) WithFilterPath(v ...string) func(*SecurityClearCachedRolesRequest) { - return func(r *SecurityClearCachedRolesRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SecurityClearCachedRoles) WithHeader(h map[string]string) func(*SecurityClearCachedRolesRequest) { - return func(r *SecurityClearCachedRolesRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SecurityClearCachedRoles) WithOpaqueID(s string) func(*SecurityClearCachedRolesRequest) { - return func(r *SecurityClearCachedRolesRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.clear_cached_service_tokens.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.clear_cached_service_tokens.go deleted file mode 100644 index 641cf2b22..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.clear_cached_service_tokens.go +++ /dev/null @@ -1,217 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newSecurityClearCachedServiceTokensFunc(t Transport) SecurityClearCachedServiceTokens { - return func(name []string, service string, namespace string, o ...func(*SecurityClearCachedServiceTokensRequest)) (*Response, error) { - var r = SecurityClearCachedServiceTokensRequest{Name: name, Namespace: namespace, Service: service} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SecurityClearCachedServiceTokens - Evicts tokens from the service account token caches. -// -// This API is beta. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-clear-service-token-caches.html. -// -type SecurityClearCachedServiceTokens func(name []string, namespace string, service string, o ...func(*SecurityClearCachedServiceTokensRequest)) (*Response, error) - -// SecurityClearCachedServiceTokensRequest configures the Security Clear Cached Service Tokens API request. -// -type SecurityClearCachedServiceTokensRequest struct { - Name []string - Namespace string - Service string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SecurityClearCachedServiceTokensRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_security") + 1 + len("service") + 1 + len(r.Namespace) + 1 + len(r.Service) + 1 + len("credential") + 1 + len("token") + 1 + len(strings.Join(r.Name, ",")) + 1 + len("_clear_cache")) - path.WriteString("/") - path.WriteString("_security") - path.WriteString("/") - path.WriteString("service") - path.WriteString("/") - path.WriteString(r.Namespace) - path.WriteString("/") - path.WriteString(r.Service) - path.WriteString("/") - path.WriteString("credential") - path.WriteString("/") - path.WriteString("token") - path.WriteString("/") - path.WriteString(strings.Join(r.Name, ",")) - path.WriteString("/") - path.WriteString("_clear_cache") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SecurityClearCachedServiceTokens) WithContext(v context.Context) func(*SecurityClearCachedServiceTokensRequest) { - return func(r *SecurityClearCachedServiceTokensRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SecurityClearCachedServiceTokens) WithPretty() func(*SecurityClearCachedServiceTokensRequest) { - return func(r *SecurityClearCachedServiceTokensRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SecurityClearCachedServiceTokens) WithHuman() func(*SecurityClearCachedServiceTokensRequest) { - return func(r *SecurityClearCachedServiceTokensRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SecurityClearCachedServiceTokens) WithErrorTrace() func(*SecurityClearCachedServiceTokensRequest) { - return func(r *SecurityClearCachedServiceTokensRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SecurityClearCachedServiceTokens) WithFilterPath(v ...string) func(*SecurityClearCachedServiceTokensRequest) { - return func(r *SecurityClearCachedServiceTokensRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SecurityClearCachedServiceTokens) WithHeader(h map[string]string) func(*SecurityClearCachedServiceTokensRequest) { - return func(r *SecurityClearCachedServiceTokensRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SecurityClearCachedServiceTokens) WithOpaqueID(s string) func(*SecurityClearCachedServiceTokensRequest) { - return func(r *SecurityClearCachedServiceTokensRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.create_api_key.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.create_api_key.go deleted file mode 100644 index 7764de202..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.create_api_key.go +++ /dev/null @@ -1,217 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" -) - -func newSecurityCreateAPIKeyFunc(t Transport) SecurityCreateAPIKey { - return func(body io.Reader, o ...func(*SecurityCreateAPIKeyRequest)) (*Response, error) { - var r = SecurityCreateAPIKeyRequest{Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SecurityCreateAPIKey - Creates an API key for access without requiring basic authentication. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-create-api-key.html. -// -type SecurityCreateAPIKey func(body io.Reader, o ...func(*SecurityCreateAPIKeyRequest)) (*Response, error) - -// SecurityCreateAPIKeyRequest configures the Security CreateAPI Key API request. -// -type SecurityCreateAPIKeyRequest struct { - Body io.Reader - - Refresh string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SecurityCreateAPIKeyRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - path.Grow(len("/_security/api_key")) - path.WriteString("/_security/api_key") - - params = make(map[string]string) - - if r.Refresh != "" { - params["refresh"] = r.Refresh - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SecurityCreateAPIKey) WithContext(v context.Context) func(*SecurityCreateAPIKeyRequest) { - return func(r *SecurityCreateAPIKeyRequest) { - r.ctx = v - } -} - -// WithRefresh - if `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes.. -// -func (f SecurityCreateAPIKey) WithRefresh(v string) func(*SecurityCreateAPIKeyRequest) { - return func(r *SecurityCreateAPIKeyRequest) { - r.Refresh = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SecurityCreateAPIKey) WithPretty() func(*SecurityCreateAPIKeyRequest) { - return func(r *SecurityCreateAPIKeyRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SecurityCreateAPIKey) WithHuman() func(*SecurityCreateAPIKeyRequest) { - return func(r *SecurityCreateAPIKeyRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SecurityCreateAPIKey) WithErrorTrace() func(*SecurityCreateAPIKeyRequest) { - return func(r *SecurityCreateAPIKeyRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SecurityCreateAPIKey) WithFilterPath(v ...string) func(*SecurityCreateAPIKeyRequest) { - return func(r *SecurityCreateAPIKeyRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SecurityCreateAPIKey) WithHeader(h map[string]string) func(*SecurityCreateAPIKeyRequest) { - return func(r *SecurityCreateAPIKeyRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SecurityCreateAPIKey) WithOpaqueID(s string) func(*SecurityCreateAPIKeyRequest) { - return func(r *SecurityCreateAPIKeyRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.create_service_token.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.create_service_token.go deleted file mode 100644 index 98afa44c2..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.create_service_token.go +++ /dev/null @@ -1,239 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newSecurityCreateServiceTokenFunc(t Transport) SecurityCreateServiceToken { - return func(namespace string, service string, o ...func(*SecurityCreateServiceTokenRequest)) (*Response, error) { - var r = SecurityCreateServiceTokenRequest{Namespace: namespace, Service: service} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SecurityCreateServiceToken - Creates a service account token for access without requiring basic authentication. -// -// This API is beta. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-create-service-token.html. -// -type SecurityCreateServiceToken func(namespace string, service string, o ...func(*SecurityCreateServiceTokenRequest)) (*Response, error) - -// SecurityCreateServiceTokenRequest configures the Security Create Service Token API request. -// -type SecurityCreateServiceTokenRequest struct { - Name string - Namespace string - Service string - - Refresh string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SecurityCreateServiceTokenRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - path.Grow(1 + len("_security") + 1 + len("service") + 1 + len(r.Namespace) + 1 + len(r.Service) + 1 + len("credential") + 1 + len("token") + 1 + len(r.Name)) - path.WriteString("/") - path.WriteString("_security") - path.WriteString("/") - path.WriteString("service") - path.WriteString("/") - path.WriteString(r.Namespace) - path.WriteString("/") - path.WriteString(r.Service) - path.WriteString("/") - path.WriteString("credential") - path.WriteString("/") - path.WriteString("token") - if r.Name != "" { - path.WriteString("/") - path.WriteString(r.Name) - } - - params = make(map[string]string) - - if r.Refresh != "" { - params["refresh"] = r.Refresh - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SecurityCreateServiceToken) WithContext(v context.Context) func(*SecurityCreateServiceTokenRequest) { - return func(r *SecurityCreateServiceTokenRequest) { - r.ctx = v - } -} - -// WithName - an identifier for the token name. -// -func (f SecurityCreateServiceToken) WithName(v string) func(*SecurityCreateServiceTokenRequest) { - return func(r *SecurityCreateServiceTokenRequest) { - r.Name = v - } -} - -// WithRefresh - if `true` then refresh the affected shards to make this operation visible to search, if `wait_for` (the default) then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes.. -// -func (f SecurityCreateServiceToken) WithRefresh(v string) func(*SecurityCreateServiceTokenRequest) { - return func(r *SecurityCreateServiceTokenRequest) { - r.Refresh = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SecurityCreateServiceToken) WithPretty() func(*SecurityCreateServiceTokenRequest) { - return func(r *SecurityCreateServiceTokenRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SecurityCreateServiceToken) WithHuman() func(*SecurityCreateServiceTokenRequest) { - return func(r *SecurityCreateServiceTokenRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SecurityCreateServiceToken) WithErrorTrace() func(*SecurityCreateServiceTokenRequest) { - return func(r *SecurityCreateServiceTokenRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SecurityCreateServiceToken) WithFilterPath(v ...string) func(*SecurityCreateServiceTokenRequest) { - return func(r *SecurityCreateServiceTokenRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SecurityCreateServiceToken) WithHeader(h map[string]string) func(*SecurityCreateServiceTokenRequest) { - return func(r *SecurityCreateServiceTokenRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SecurityCreateServiceToken) WithOpaqueID(s string) func(*SecurityCreateServiceTokenRequest) { - return func(r *SecurityCreateServiceTokenRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.delete_privileges.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.delete_privileges.go deleted file mode 100644 index 430545e53..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.delete_privileges.go +++ /dev/null @@ -1,220 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newSecurityDeletePrivilegesFunc(t Transport) SecurityDeletePrivileges { - return func(name string, application string, o ...func(*SecurityDeletePrivilegesRequest)) (*Response, error) { - var r = SecurityDeletePrivilegesRequest{Name: name, Application: application} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SecurityDeletePrivileges - Removes application privileges. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-delete-privilege.html. -// -type SecurityDeletePrivileges func(name string, application string, o ...func(*SecurityDeletePrivilegesRequest)) (*Response, error) - -// SecurityDeletePrivilegesRequest configures the Security Delete Privileges API request. -// -type SecurityDeletePrivilegesRequest struct { - Application string - Name string - - Refresh string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SecurityDeletePrivilegesRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "DELETE" - - path.Grow(1 + len("_security") + 1 + len("privilege") + 1 + len(r.Application) + 1 + len(r.Name)) - path.WriteString("/") - path.WriteString("_security") - path.WriteString("/") - path.WriteString("privilege") - path.WriteString("/") - path.WriteString(r.Application) - path.WriteString("/") - path.WriteString(r.Name) - - params = make(map[string]string) - - if r.Refresh != "" { - params["refresh"] = r.Refresh - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SecurityDeletePrivileges) WithContext(v context.Context) func(*SecurityDeletePrivilegesRequest) { - return func(r *SecurityDeletePrivilegesRequest) { - r.ctx = v - } -} - -// WithRefresh - if `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes.. -// -func (f SecurityDeletePrivileges) WithRefresh(v string) func(*SecurityDeletePrivilegesRequest) { - return func(r *SecurityDeletePrivilegesRequest) { - r.Refresh = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SecurityDeletePrivileges) WithPretty() func(*SecurityDeletePrivilegesRequest) { - return func(r *SecurityDeletePrivilegesRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SecurityDeletePrivileges) WithHuman() func(*SecurityDeletePrivilegesRequest) { - return func(r *SecurityDeletePrivilegesRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SecurityDeletePrivileges) WithErrorTrace() func(*SecurityDeletePrivilegesRequest) { - return func(r *SecurityDeletePrivilegesRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SecurityDeletePrivileges) WithFilterPath(v ...string) func(*SecurityDeletePrivilegesRequest) { - return func(r *SecurityDeletePrivilegesRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SecurityDeletePrivileges) WithHeader(h map[string]string) func(*SecurityDeletePrivilegesRequest) { - return func(r *SecurityDeletePrivilegesRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SecurityDeletePrivileges) WithOpaqueID(s string) func(*SecurityDeletePrivilegesRequest) { - return func(r *SecurityDeletePrivilegesRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.delete_role.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.delete_role.go deleted file mode 100644 index 9c8c40fbf..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.delete_role.go +++ /dev/null @@ -1,217 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newSecurityDeleteRoleFunc(t Transport) SecurityDeleteRole { - return func(name string, o ...func(*SecurityDeleteRoleRequest)) (*Response, error) { - var r = SecurityDeleteRoleRequest{Name: name} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SecurityDeleteRole - Removes roles in the native realm. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-delete-role.html. -// -type SecurityDeleteRole func(name string, o ...func(*SecurityDeleteRoleRequest)) (*Response, error) - -// SecurityDeleteRoleRequest configures the Security Delete Role API request. -// -type SecurityDeleteRoleRequest struct { - Name string - - Refresh string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SecurityDeleteRoleRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "DELETE" - - path.Grow(1 + len("_security") + 1 + len("role") + 1 + len(r.Name)) - path.WriteString("/") - path.WriteString("_security") - path.WriteString("/") - path.WriteString("role") - path.WriteString("/") - path.WriteString(r.Name) - - params = make(map[string]string) - - if r.Refresh != "" { - params["refresh"] = r.Refresh - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SecurityDeleteRole) WithContext(v context.Context) func(*SecurityDeleteRoleRequest) { - return func(r *SecurityDeleteRoleRequest) { - r.ctx = v - } -} - -// WithRefresh - if `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes.. -// -func (f SecurityDeleteRole) WithRefresh(v string) func(*SecurityDeleteRoleRequest) { - return func(r *SecurityDeleteRoleRequest) { - r.Refresh = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SecurityDeleteRole) WithPretty() func(*SecurityDeleteRoleRequest) { - return func(r *SecurityDeleteRoleRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SecurityDeleteRole) WithHuman() func(*SecurityDeleteRoleRequest) { - return func(r *SecurityDeleteRoleRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SecurityDeleteRole) WithErrorTrace() func(*SecurityDeleteRoleRequest) { - return func(r *SecurityDeleteRoleRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SecurityDeleteRole) WithFilterPath(v ...string) func(*SecurityDeleteRoleRequest) { - return func(r *SecurityDeleteRoleRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SecurityDeleteRole) WithHeader(h map[string]string) func(*SecurityDeleteRoleRequest) { - return func(r *SecurityDeleteRoleRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SecurityDeleteRole) WithOpaqueID(s string) func(*SecurityDeleteRoleRequest) { - return func(r *SecurityDeleteRoleRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.delete_role_mapping.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.delete_role_mapping.go deleted file mode 100644 index d377a0ec0..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.delete_role_mapping.go +++ /dev/null @@ -1,217 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newSecurityDeleteRoleMappingFunc(t Transport) SecurityDeleteRoleMapping { - return func(name string, o ...func(*SecurityDeleteRoleMappingRequest)) (*Response, error) { - var r = SecurityDeleteRoleMappingRequest{Name: name} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SecurityDeleteRoleMapping - Removes role mappings. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-delete-role-mapping.html. -// -type SecurityDeleteRoleMapping func(name string, o ...func(*SecurityDeleteRoleMappingRequest)) (*Response, error) - -// SecurityDeleteRoleMappingRequest configures the Security Delete Role Mapping API request. -// -type SecurityDeleteRoleMappingRequest struct { - Name string - - Refresh string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SecurityDeleteRoleMappingRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "DELETE" - - path.Grow(1 + len("_security") + 1 + len("role_mapping") + 1 + len(r.Name)) - path.WriteString("/") - path.WriteString("_security") - path.WriteString("/") - path.WriteString("role_mapping") - path.WriteString("/") - path.WriteString(r.Name) - - params = make(map[string]string) - - if r.Refresh != "" { - params["refresh"] = r.Refresh - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SecurityDeleteRoleMapping) WithContext(v context.Context) func(*SecurityDeleteRoleMappingRequest) { - return func(r *SecurityDeleteRoleMappingRequest) { - r.ctx = v - } -} - -// WithRefresh - if `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes.. -// -func (f SecurityDeleteRoleMapping) WithRefresh(v string) func(*SecurityDeleteRoleMappingRequest) { - return func(r *SecurityDeleteRoleMappingRequest) { - r.Refresh = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SecurityDeleteRoleMapping) WithPretty() func(*SecurityDeleteRoleMappingRequest) { - return func(r *SecurityDeleteRoleMappingRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SecurityDeleteRoleMapping) WithHuman() func(*SecurityDeleteRoleMappingRequest) { - return func(r *SecurityDeleteRoleMappingRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SecurityDeleteRoleMapping) WithErrorTrace() func(*SecurityDeleteRoleMappingRequest) { - return func(r *SecurityDeleteRoleMappingRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SecurityDeleteRoleMapping) WithFilterPath(v ...string) func(*SecurityDeleteRoleMappingRequest) { - return func(r *SecurityDeleteRoleMappingRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SecurityDeleteRoleMapping) WithHeader(h map[string]string) func(*SecurityDeleteRoleMappingRequest) { - return func(r *SecurityDeleteRoleMappingRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SecurityDeleteRoleMapping) WithOpaqueID(s string) func(*SecurityDeleteRoleMappingRequest) { - return func(r *SecurityDeleteRoleMappingRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.delete_service_token.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.delete_service_token.go deleted file mode 100644 index 9b7c2351f..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.delete_service_token.go +++ /dev/null @@ -1,229 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newSecurityDeleteServiceTokenFunc(t Transport) SecurityDeleteServiceToken { - return func(name string, namespace string, service string, o ...func(*SecurityDeleteServiceTokenRequest)) (*Response, error) { - var r = SecurityDeleteServiceTokenRequest{Name: name, Service: service, Namespace: namespace} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SecurityDeleteServiceToken - Deletes a service account token. -// -// This API is beta. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-delete-service-token.html. -// -type SecurityDeleteServiceToken func(name string, namespace string, service string, o ...func(*SecurityDeleteServiceTokenRequest)) (*Response, error) - -// SecurityDeleteServiceTokenRequest configures the Security Delete Service Token API request. -// -type SecurityDeleteServiceTokenRequest struct { - Name string - Namespace string - Service string - - Refresh string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SecurityDeleteServiceTokenRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "DELETE" - - path.Grow(1 + len("_security") + 1 + len("service") + 1 + len(r.Namespace) + 1 + len(r.Service) + 1 + len("credential") + 1 + len("token") + 1 + len(r.Name)) - path.WriteString("/") - path.WriteString("_security") - path.WriteString("/") - path.WriteString("service") - path.WriteString("/") - path.WriteString(r.Namespace) - path.WriteString("/") - path.WriteString(r.Service) - path.WriteString("/") - path.WriteString("credential") - path.WriteString("/") - path.WriteString("token") - path.WriteString("/") - path.WriteString(r.Name) - - params = make(map[string]string) - - if r.Refresh != "" { - params["refresh"] = r.Refresh - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SecurityDeleteServiceToken) WithContext(v context.Context) func(*SecurityDeleteServiceTokenRequest) { - return func(r *SecurityDeleteServiceTokenRequest) { - r.ctx = v - } -} - -// WithRefresh - if `true` then refresh the affected shards to make this operation visible to search, if `wait_for` (the default) then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes.. -// -func (f SecurityDeleteServiceToken) WithRefresh(v string) func(*SecurityDeleteServiceTokenRequest) { - return func(r *SecurityDeleteServiceTokenRequest) { - r.Refresh = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SecurityDeleteServiceToken) WithPretty() func(*SecurityDeleteServiceTokenRequest) { - return func(r *SecurityDeleteServiceTokenRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SecurityDeleteServiceToken) WithHuman() func(*SecurityDeleteServiceTokenRequest) { - return func(r *SecurityDeleteServiceTokenRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SecurityDeleteServiceToken) WithErrorTrace() func(*SecurityDeleteServiceTokenRequest) { - return func(r *SecurityDeleteServiceTokenRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SecurityDeleteServiceToken) WithFilterPath(v ...string) func(*SecurityDeleteServiceTokenRequest) { - return func(r *SecurityDeleteServiceTokenRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SecurityDeleteServiceToken) WithHeader(h map[string]string) func(*SecurityDeleteServiceTokenRequest) { - return func(r *SecurityDeleteServiceTokenRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SecurityDeleteServiceToken) WithOpaqueID(s string) func(*SecurityDeleteServiceTokenRequest) { - return func(r *SecurityDeleteServiceTokenRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.delete_user.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.delete_user.go deleted file mode 100644 index abcf7206e..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.delete_user.go +++ /dev/null @@ -1,217 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newSecurityDeleteUserFunc(t Transport) SecurityDeleteUser { - return func(username string, o ...func(*SecurityDeleteUserRequest)) (*Response, error) { - var r = SecurityDeleteUserRequest{Username: username} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SecurityDeleteUser - Deletes users from the native realm. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-delete-user.html. -// -type SecurityDeleteUser func(username string, o ...func(*SecurityDeleteUserRequest)) (*Response, error) - -// SecurityDeleteUserRequest configures the Security Delete User API request. -// -type SecurityDeleteUserRequest struct { - Username string - - Refresh string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SecurityDeleteUserRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "DELETE" - - path.Grow(1 + len("_security") + 1 + len("user") + 1 + len(r.Username)) - path.WriteString("/") - path.WriteString("_security") - path.WriteString("/") - path.WriteString("user") - path.WriteString("/") - path.WriteString(r.Username) - - params = make(map[string]string) - - if r.Refresh != "" { - params["refresh"] = r.Refresh - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SecurityDeleteUser) WithContext(v context.Context) func(*SecurityDeleteUserRequest) { - return func(r *SecurityDeleteUserRequest) { - r.ctx = v - } -} - -// WithRefresh - if `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes.. -// -func (f SecurityDeleteUser) WithRefresh(v string) func(*SecurityDeleteUserRequest) { - return func(r *SecurityDeleteUserRequest) { - r.Refresh = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SecurityDeleteUser) WithPretty() func(*SecurityDeleteUserRequest) { - return func(r *SecurityDeleteUserRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SecurityDeleteUser) WithHuman() func(*SecurityDeleteUserRequest) { - return func(r *SecurityDeleteUserRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SecurityDeleteUser) WithErrorTrace() func(*SecurityDeleteUserRequest) { - return func(r *SecurityDeleteUserRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SecurityDeleteUser) WithFilterPath(v ...string) func(*SecurityDeleteUserRequest) { - return func(r *SecurityDeleteUserRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SecurityDeleteUser) WithHeader(h map[string]string) func(*SecurityDeleteUserRequest) { - return func(r *SecurityDeleteUserRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SecurityDeleteUser) WithOpaqueID(s string) func(*SecurityDeleteUserRequest) { - return func(r *SecurityDeleteUserRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.disable_user.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.disable_user.go deleted file mode 100644 index 51024dc05..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.disable_user.go +++ /dev/null @@ -1,219 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newSecurityDisableUserFunc(t Transport) SecurityDisableUser { - return func(username string, o ...func(*SecurityDisableUserRequest)) (*Response, error) { - var r = SecurityDisableUserRequest{Username: username} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SecurityDisableUser - Disables users in the native realm. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-disable-user.html. -// -type SecurityDisableUser func(username string, o ...func(*SecurityDisableUserRequest)) (*Response, error) - -// SecurityDisableUserRequest configures the Security Disable User API request. -// -type SecurityDisableUserRequest struct { - Username string - - Refresh string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SecurityDisableUserRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - path.Grow(1 + len("_security") + 1 + len("user") + 1 + len(r.Username) + 1 + len("_disable")) - path.WriteString("/") - path.WriteString("_security") - path.WriteString("/") - path.WriteString("user") - path.WriteString("/") - path.WriteString(r.Username) - path.WriteString("/") - path.WriteString("_disable") - - params = make(map[string]string) - - if r.Refresh != "" { - params["refresh"] = r.Refresh - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SecurityDisableUser) WithContext(v context.Context) func(*SecurityDisableUserRequest) { - return func(r *SecurityDisableUserRequest) { - r.ctx = v - } -} - -// WithRefresh - if `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes.. -// -func (f SecurityDisableUser) WithRefresh(v string) func(*SecurityDisableUserRequest) { - return func(r *SecurityDisableUserRequest) { - r.Refresh = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SecurityDisableUser) WithPretty() func(*SecurityDisableUserRequest) { - return func(r *SecurityDisableUserRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SecurityDisableUser) WithHuman() func(*SecurityDisableUserRequest) { - return func(r *SecurityDisableUserRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SecurityDisableUser) WithErrorTrace() func(*SecurityDisableUserRequest) { - return func(r *SecurityDisableUserRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SecurityDisableUser) WithFilterPath(v ...string) func(*SecurityDisableUserRequest) { - return func(r *SecurityDisableUserRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SecurityDisableUser) WithHeader(h map[string]string) func(*SecurityDisableUserRequest) { - return func(r *SecurityDisableUserRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SecurityDisableUser) WithOpaqueID(s string) func(*SecurityDisableUserRequest) { - return func(r *SecurityDisableUserRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.enable_user.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.enable_user.go deleted file mode 100644 index f3987dada..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.enable_user.go +++ /dev/null @@ -1,219 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newSecurityEnableUserFunc(t Transport) SecurityEnableUser { - return func(username string, o ...func(*SecurityEnableUserRequest)) (*Response, error) { - var r = SecurityEnableUserRequest{Username: username} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SecurityEnableUser - Enables users in the native realm. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-enable-user.html. -// -type SecurityEnableUser func(username string, o ...func(*SecurityEnableUserRequest)) (*Response, error) - -// SecurityEnableUserRequest configures the Security Enable User API request. -// -type SecurityEnableUserRequest struct { - Username string - - Refresh string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SecurityEnableUserRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - path.Grow(1 + len("_security") + 1 + len("user") + 1 + len(r.Username) + 1 + len("_enable")) - path.WriteString("/") - path.WriteString("_security") - path.WriteString("/") - path.WriteString("user") - path.WriteString("/") - path.WriteString(r.Username) - path.WriteString("/") - path.WriteString("_enable") - - params = make(map[string]string) - - if r.Refresh != "" { - params["refresh"] = r.Refresh - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SecurityEnableUser) WithContext(v context.Context) func(*SecurityEnableUserRequest) { - return func(r *SecurityEnableUserRequest) { - r.ctx = v - } -} - -// WithRefresh - if `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes.. -// -func (f SecurityEnableUser) WithRefresh(v string) func(*SecurityEnableUserRequest) { - return func(r *SecurityEnableUserRequest) { - r.Refresh = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SecurityEnableUser) WithPretty() func(*SecurityEnableUserRequest) { - return func(r *SecurityEnableUserRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SecurityEnableUser) WithHuman() func(*SecurityEnableUserRequest) { - return func(r *SecurityEnableUserRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SecurityEnableUser) WithErrorTrace() func(*SecurityEnableUserRequest) { - return func(r *SecurityEnableUserRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SecurityEnableUser) WithFilterPath(v ...string) func(*SecurityEnableUserRequest) { - return func(r *SecurityEnableUserRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SecurityEnableUser) WithHeader(h map[string]string) func(*SecurityEnableUserRequest) { - return func(r *SecurityEnableUserRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SecurityEnableUser) WithOpaqueID(s string) func(*SecurityEnableUserRequest) { - return func(r *SecurityEnableUserRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.get_api_key.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.get_api_key.go deleted file mode 100644 index 868be1ff1..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.get_api_key.go +++ /dev/null @@ -1,263 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newSecurityGetAPIKeyFunc(t Transport) SecurityGetAPIKey { - return func(o ...func(*SecurityGetAPIKeyRequest)) (*Response, error) { - var r = SecurityGetAPIKeyRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SecurityGetAPIKey - Retrieves information for one or more API keys. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-api-key.html. -// -type SecurityGetAPIKey func(o ...func(*SecurityGetAPIKeyRequest)) (*Response, error) - -// SecurityGetAPIKeyRequest configures the Security GetAPI Key API request. -// -type SecurityGetAPIKeyRequest struct { - ID string - Name string - Owner *bool - RealmName string - Username string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SecurityGetAPIKeyRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(len("/_security/api_key")) - path.WriteString("/_security/api_key") - - params = make(map[string]string) - - if r.ID != "" { - params["id"] = r.ID - } - - if r.Name != "" { - params["name"] = r.Name - } - - if r.Owner != nil { - params["owner"] = strconv.FormatBool(*r.Owner) - } - - if r.RealmName != "" { - params["realm_name"] = r.RealmName - } - - if r.Username != "" { - params["username"] = r.Username - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SecurityGetAPIKey) WithContext(v context.Context) func(*SecurityGetAPIKeyRequest) { - return func(r *SecurityGetAPIKeyRequest) { - r.ctx = v - } -} - -// WithID - api key ID of the api key to be retrieved. -// -func (f SecurityGetAPIKey) WithID(v string) func(*SecurityGetAPIKeyRequest) { - return func(r *SecurityGetAPIKeyRequest) { - r.ID = v - } -} - -// WithName - api key name of the api key to be retrieved. -// -func (f SecurityGetAPIKey) WithName(v string) func(*SecurityGetAPIKeyRequest) { - return func(r *SecurityGetAPIKeyRequest) { - r.Name = v - } -} - -// WithOwner - flag to query api keys owned by the currently authenticated user. -// -func (f SecurityGetAPIKey) WithOwner(v bool) func(*SecurityGetAPIKeyRequest) { - return func(r *SecurityGetAPIKeyRequest) { - r.Owner = &v - } -} - -// WithRealmName - realm name of the user who created this api key to be retrieved. -// -func (f SecurityGetAPIKey) WithRealmName(v string) func(*SecurityGetAPIKeyRequest) { - return func(r *SecurityGetAPIKeyRequest) { - r.RealmName = v - } -} - -// WithUsername - user name of the user who created this api key to be retrieved. -// -func (f SecurityGetAPIKey) WithUsername(v string) func(*SecurityGetAPIKeyRequest) { - return func(r *SecurityGetAPIKeyRequest) { - r.Username = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SecurityGetAPIKey) WithPretty() func(*SecurityGetAPIKeyRequest) { - return func(r *SecurityGetAPIKeyRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SecurityGetAPIKey) WithHuman() func(*SecurityGetAPIKeyRequest) { - return func(r *SecurityGetAPIKeyRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SecurityGetAPIKey) WithErrorTrace() func(*SecurityGetAPIKeyRequest) { - return func(r *SecurityGetAPIKeyRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SecurityGetAPIKey) WithFilterPath(v ...string) func(*SecurityGetAPIKeyRequest) { - return func(r *SecurityGetAPIKeyRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SecurityGetAPIKey) WithHeader(h map[string]string) func(*SecurityGetAPIKeyRequest) { - return func(r *SecurityGetAPIKeyRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SecurityGetAPIKey) WithOpaqueID(s string) func(*SecurityGetAPIKeyRequest) { - return func(r *SecurityGetAPIKeyRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.get_builtin_privileges.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.get_builtin_privileges.go deleted file mode 100644 index a1e284a83..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.get_builtin_privileges.go +++ /dev/null @@ -1,196 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newSecurityGetBuiltinPrivilegesFunc(t Transport) SecurityGetBuiltinPrivileges { - return func(o ...func(*SecurityGetBuiltinPrivilegesRequest)) (*Response, error) { - var r = SecurityGetBuiltinPrivilegesRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SecurityGetBuiltinPrivileges - Retrieves the list of cluster privileges and index privileges that are available in this version of Elasticsearch. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-builtin-privileges.html. -// -type SecurityGetBuiltinPrivileges func(o ...func(*SecurityGetBuiltinPrivilegesRequest)) (*Response, error) - -// SecurityGetBuiltinPrivilegesRequest configures the Security Get Builtin Privileges API request. -// -type SecurityGetBuiltinPrivilegesRequest struct { - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SecurityGetBuiltinPrivilegesRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(len("/_security/privilege/_builtin")) - path.WriteString("/_security/privilege/_builtin") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SecurityGetBuiltinPrivileges) WithContext(v context.Context) func(*SecurityGetBuiltinPrivilegesRequest) { - return func(r *SecurityGetBuiltinPrivilegesRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SecurityGetBuiltinPrivileges) WithPretty() func(*SecurityGetBuiltinPrivilegesRequest) { - return func(r *SecurityGetBuiltinPrivilegesRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SecurityGetBuiltinPrivileges) WithHuman() func(*SecurityGetBuiltinPrivilegesRequest) { - return func(r *SecurityGetBuiltinPrivilegesRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SecurityGetBuiltinPrivileges) WithErrorTrace() func(*SecurityGetBuiltinPrivilegesRequest) { - return func(r *SecurityGetBuiltinPrivilegesRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SecurityGetBuiltinPrivileges) WithFilterPath(v ...string) func(*SecurityGetBuiltinPrivilegesRequest) { - return func(r *SecurityGetBuiltinPrivilegesRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SecurityGetBuiltinPrivileges) WithHeader(h map[string]string) func(*SecurityGetBuiltinPrivilegesRequest) { - return func(r *SecurityGetBuiltinPrivilegesRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SecurityGetBuiltinPrivileges) WithOpaqueID(s string) func(*SecurityGetBuiltinPrivilegesRequest) { - return func(r *SecurityGetBuiltinPrivilegesRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.get_privileges.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.get_privileges.go deleted file mode 100644 index fb50a5b1e..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.get_privileges.go +++ /dev/null @@ -1,226 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newSecurityGetPrivilegesFunc(t Transport) SecurityGetPrivileges { - return func(o ...func(*SecurityGetPrivilegesRequest)) (*Response, error) { - var r = SecurityGetPrivilegesRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SecurityGetPrivileges - Retrieves application privileges. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-privileges.html. -// -type SecurityGetPrivileges func(o ...func(*SecurityGetPrivilegesRequest)) (*Response, error) - -// SecurityGetPrivilegesRequest configures the Security Get Privileges API request. -// -type SecurityGetPrivilegesRequest struct { - Application string - Name string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SecurityGetPrivilegesRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_security") + 1 + len("privilege") + 1 + len(r.Application) + 1 + len(r.Name)) - path.WriteString("/") - path.WriteString("_security") - path.WriteString("/") - path.WriteString("privilege") - if r.Application != "" { - path.WriteString("/") - path.WriteString(r.Application) - } - if r.Name != "" { - path.WriteString("/") - path.WriteString(r.Name) - } - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SecurityGetPrivileges) WithContext(v context.Context) func(*SecurityGetPrivilegesRequest) { - return func(r *SecurityGetPrivilegesRequest) { - r.ctx = v - } -} - -// WithApplication - application name. -// -func (f SecurityGetPrivileges) WithApplication(v string) func(*SecurityGetPrivilegesRequest) { - return func(r *SecurityGetPrivilegesRequest) { - r.Application = v - } -} - -// WithName - privilege name. -// -func (f SecurityGetPrivileges) WithName(v string) func(*SecurityGetPrivilegesRequest) { - return func(r *SecurityGetPrivilegesRequest) { - r.Name = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SecurityGetPrivileges) WithPretty() func(*SecurityGetPrivilegesRequest) { - return func(r *SecurityGetPrivilegesRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SecurityGetPrivileges) WithHuman() func(*SecurityGetPrivilegesRequest) { - return func(r *SecurityGetPrivilegesRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SecurityGetPrivileges) WithErrorTrace() func(*SecurityGetPrivilegesRequest) { - return func(r *SecurityGetPrivilegesRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SecurityGetPrivileges) WithFilterPath(v ...string) func(*SecurityGetPrivilegesRequest) { - return func(r *SecurityGetPrivilegesRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SecurityGetPrivileges) WithHeader(h map[string]string) func(*SecurityGetPrivilegesRequest) { - return func(r *SecurityGetPrivilegesRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SecurityGetPrivileges) WithOpaqueID(s string) func(*SecurityGetPrivilegesRequest) { - return func(r *SecurityGetPrivilegesRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.get_role.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.get_role.go deleted file mode 100644 index 10a7fdadd..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.get_role.go +++ /dev/null @@ -1,213 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newSecurityGetRoleFunc(t Transport) SecurityGetRole { - return func(o ...func(*SecurityGetRoleRequest)) (*Response, error) { - var r = SecurityGetRoleRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SecurityGetRole - Retrieves roles in the native realm. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-role.html. -// -type SecurityGetRole func(o ...func(*SecurityGetRoleRequest)) (*Response, error) - -// SecurityGetRoleRequest configures the Security Get Role API request. -// -type SecurityGetRoleRequest struct { - Name []string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SecurityGetRoleRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_security") + 1 + len("role") + 1 + len(strings.Join(r.Name, ","))) - path.WriteString("/") - path.WriteString("_security") - path.WriteString("/") - path.WriteString("role") - if len(r.Name) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Name, ",")) - } - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SecurityGetRole) WithContext(v context.Context) func(*SecurityGetRoleRequest) { - return func(r *SecurityGetRoleRequest) { - r.ctx = v - } -} - -// WithName - a list of role names. -// -func (f SecurityGetRole) WithName(v ...string) func(*SecurityGetRoleRequest) { - return func(r *SecurityGetRoleRequest) { - r.Name = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SecurityGetRole) WithPretty() func(*SecurityGetRoleRequest) { - return func(r *SecurityGetRoleRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SecurityGetRole) WithHuman() func(*SecurityGetRoleRequest) { - return func(r *SecurityGetRoleRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SecurityGetRole) WithErrorTrace() func(*SecurityGetRoleRequest) { - return func(r *SecurityGetRoleRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SecurityGetRole) WithFilterPath(v ...string) func(*SecurityGetRoleRequest) { - return func(r *SecurityGetRoleRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SecurityGetRole) WithHeader(h map[string]string) func(*SecurityGetRoleRequest) { - return func(r *SecurityGetRoleRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SecurityGetRole) WithOpaqueID(s string) func(*SecurityGetRoleRequest) { - return func(r *SecurityGetRoleRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.get_role_mapping.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.get_role_mapping.go deleted file mode 100644 index 4de72a5af..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.get_role_mapping.go +++ /dev/null @@ -1,213 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newSecurityGetRoleMappingFunc(t Transport) SecurityGetRoleMapping { - return func(o ...func(*SecurityGetRoleMappingRequest)) (*Response, error) { - var r = SecurityGetRoleMappingRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SecurityGetRoleMapping - Retrieves role mappings. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-role-mapping.html. -// -type SecurityGetRoleMapping func(o ...func(*SecurityGetRoleMappingRequest)) (*Response, error) - -// SecurityGetRoleMappingRequest configures the Security Get Role Mapping API request. -// -type SecurityGetRoleMappingRequest struct { - Name []string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SecurityGetRoleMappingRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_security") + 1 + len("role_mapping") + 1 + len(strings.Join(r.Name, ","))) - path.WriteString("/") - path.WriteString("_security") - path.WriteString("/") - path.WriteString("role_mapping") - if len(r.Name) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Name, ",")) - } - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SecurityGetRoleMapping) WithContext(v context.Context) func(*SecurityGetRoleMappingRequest) { - return func(r *SecurityGetRoleMappingRequest) { - r.ctx = v - } -} - -// WithName - a list of role-mapping names. -// -func (f SecurityGetRoleMapping) WithName(v ...string) func(*SecurityGetRoleMappingRequest) { - return func(r *SecurityGetRoleMappingRequest) { - r.Name = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SecurityGetRoleMapping) WithPretty() func(*SecurityGetRoleMappingRequest) { - return func(r *SecurityGetRoleMappingRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SecurityGetRoleMapping) WithHuman() func(*SecurityGetRoleMappingRequest) { - return func(r *SecurityGetRoleMappingRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SecurityGetRoleMapping) WithErrorTrace() func(*SecurityGetRoleMappingRequest) { - return func(r *SecurityGetRoleMappingRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SecurityGetRoleMapping) WithFilterPath(v ...string) func(*SecurityGetRoleMappingRequest) { - return func(r *SecurityGetRoleMappingRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SecurityGetRoleMapping) WithHeader(h map[string]string) func(*SecurityGetRoleMappingRequest) { - return func(r *SecurityGetRoleMappingRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SecurityGetRoleMapping) WithOpaqueID(s string) func(*SecurityGetRoleMappingRequest) { - return func(r *SecurityGetRoleMappingRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.get_service_accounts.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.get_service_accounts.go deleted file mode 100644 index bb0bd0e2c..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.get_service_accounts.go +++ /dev/null @@ -1,228 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newSecurityGetServiceAccountsFunc(t Transport) SecurityGetServiceAccounts { - return func(o ...func(*SecurityGetServiceAccountsRequest)) (*Response, error) { - var r = SecurityGetServiceAccountsRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SecurityGetServiceAccounts - Retrieves information about service accounts. -// -// This API is beta. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-service-accounts.html. -// -type SecurityGetServiceAccounts func(o ...func(*SecurityGetServiceAccountsRequest)) (*Response, error) - -// SecurityGetServiceAccountsRequest configures the Security Get Service Accounts API request. -// -type SecurityGetServiceAccountsRequest struct { - Namespace string - Service string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SecurityGetServiceAccountsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_security") + 1 + len("service") + 1 + len(r.Namespace) + 1 + len(r.Service)) - path.WriteString("/") - path.WriteString("_security") - path.WriteString("/") - path.WriteString("service") - if r.Namespace != "" { - path.WriteString("/") - path.WriteString(r.Namespace) - } - if r.Service != "" { - path.WriteString("/") - path.WriteString(r.Service) - } - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SecurityGetServiceAccounts) WithContext(v context.Context) func(*SecurityGetServiceAccountsRequest) { - return func(r *SecurityGetServiceAccountsRequest) { - r.ctx = v - } -} - -// WithNamespace - an identifier for the namespace. -// -func (f SecurityGetServiceAccounts) WithNamespace(v string) func(*SecurityGetServiceAccountsRequest) { - return func(r *SecurityGetServiceAccountsRequest) { - r.Namespace = v - } -} - -// WithService - an identifier for the service name. -// -func (f SecurityGetServiceAccounts) WithService(v string) func(*SecurityGetServiceAccountsRequest) { - return func(r *SecurityGetServiceAccountsRequest) { - r.Service = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SecurityGetServiceAccounts) WithPretty() func(*SecurityGetServiceAccountsRequest) { - return func(r *SecurityGetServiceAccountsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SecurityGetServiceAccounts) WithHuman() func(*SecurityGetServiceAccountsRequest) { - return func(r *SecurityGetServiceAccountsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SecurityGetServiceAccounts) WithErrorTrace() func(*SecurityGetServiceAccountsRequest) { - return func(r *SecurityGetServiceAccountsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SecurityGetServiceAccounts) WithFilterPath(v ...string) func(*SecurityGetServiceAccountsRequest) { - return func(r *SecurityGetServiceAccountsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SecurityGetServiceAccounts) WithHeader(h map[string]string) func(*SecurityGetServiceAccountsRequest) { - return func(r *SecurityGetServiceAccountsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SecurityGetServiceAccounts) WithOpaqueID(s string) func(*SecurityGetServiceAccountsRequest) { - return func(r *SecurityGetServiceAccountsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.get_service_credentials.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.get_service_credentials.go deleted file mode 100644 index de2ba3710..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.get_service_credentials.go +++ /dev/null @@ -1,210 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newSecurityGetServiceCredentialsFunc(t Transport) SecurityGetServiceCredentials { - return func(namespace string, service string, o ...func(*SecurityGetServiceCredentialsRequest)) (*Response, error) { - var r = SecurityGetServiceCredentialsRequest{Namespace: namespace, Service: service} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SecurityGetServiceCredentials - Retrieves information of all service credentials for a service account. -// -// This API is beta. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-service-credentials.html. -// -type SecurityGetServiceCredentials func(namespace string, service string, o ...func(*SecurityGetServiceCredentialsRequest)) (*Response, error) - -// SecurityGetServiceCredentialsRequest configures the Security Get Service Credentials API request. -// -type SecurityGetServiceCredentialsRequest struct { - Namespace string - Service string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SecurityGetServiceCredentialsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_security") + 1 + len("service") + 1 + len(r.Namespace) + 1 + len(r.Service) + 1 + len("credential")) - path.WriteString("/") - path.WriteString("_security") - path.WriteString("/") - path.WriteString("service") - path.WriteString("/") - path.WriteString(r.Namespace) - path.WriteString("/") - path.WriteString(r.Service) - path.WriteString("/") - path.WriteString("credential") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SecurityGetServiceCredentials) WithContext(v context.Context) func(*SecurityGetServiceCredentialsRequest) { - return func(r *SecurityGetServiceCredentialsRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SecurityGetServiceCredentials) WithPretty() func(*SecurityGetServiceCredentialsRequest) { - return func(r *SecurityGetServiceCredentialsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SecurityGetServiceCredentials) WithHuman() func(*SecurityGetServiceCredentialsRequest) { - return func(r *SecurityGetServiceCredentialsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SecurityGetServiceCredentials) WithErrorTrace() func(*SecurityGetServiceCredentialsRequest) { - return func(r *SecurityGetServiceCredentialsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SecurityGetServiceCredentials) WithFilterPath(v ...string) func(*SecurityGetServiceCredentialsRequest) { - return func(r *SecurityGetServiceCredentialsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SecurityGetServiceCredentials) WithHeader(h map[string]string) func(*SecurityGetServiceCredentialsRequest) { - return func(r *SecurityGetServiceCredentialsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SecurityGetServiceCredentials) WithOpaqueID(s string) func(*SecurityGetServiceCredentialsRequest) { - return func(r *SecurityGetServiceCredentialsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.get_token.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.get_token.go deleted file mode 100644 index 45da47dda..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.get_token.go +++ /dev/null @@ -1,203 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" -) - -func newSecurityGetTokenFunc(t Transport) SecurityGetToken { - return func(body io.Reader, o ...func(*SecurityGetTokenRequest)) (*Response, error) { - var r = SecurityGetTokenRequest{Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SecurityGetToken - Creates a bearer token for access without requiring basic authentication. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-token.html. -// -type SecurityGetToken func(body io.Reader, o ...func(*SecurityGetTokenRequest)) (*Response, error) - -// SecurityGetTokenRequest configures the Security Get Token API request. -// -type SecurityGetTokenRequest struct { - Body io.Reader - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SecurityGetTokenRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(len("/_security/oauth2/token")) - path.WriteString("/_security/oauth2/token") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SecurityGetToken) WithContext(v context.Context) func(*SecurityGetTokenRequest) { - return func(r *SecurityGetTokenRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SecurityGetToken) WithPretty() func(*SecurityGetTokenRequest) { - return func(r *SecurityGetTokenRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SecurityGetToken) WithHuman() func(*SecurityGetTokenRequest) { - return func(r *SecurityGetTokenRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SecurityGetToken) WithErrorTrace() func(*SecurityGetTokenRequest) { - return func(r *SecurityGetTokenRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SecurityGetToken) WithFilterPath(v ...string) func(*SecurityGetTokenRequest) { - return func(r *SecurityGetTokenRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SecurityGetToken) WithHeader(h map[string]string) func(*SecurityGetTokenRequest) { - return func(r *SecurityGetTokenRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SecurityGetToken) WithOpaqueID(s string) func(*SecurityGetTokenRequest) { - return func(r *SecurityGetTokenRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.get_user.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.get_user.go deleted file mode 100644 index 08bd5f9d6..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.get_user.go +++ /dev/null @@ -1,213 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newSecurityGetUserFunc(t Transport) SecurityGetUser { - return func(o ...func(*SecurityGetUserRequest)) (*Response, error) { - var r = SecurityGetUserRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SecurityGetUser - Retrieves information about users in the native realm and built-in users. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-user.html. -// -type SecurityGetUser func(o ...func(*SecurityGetUserRequest)) (*Response, error) - -// SecurityGetUserRequest configures the Security Get User API request. -// -type SecurityGetUserRequest struct { - Username []string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SecurityGetUserRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_security") + 1 + len("user") + 1 + len(strings.Join(r.Username, ","))) - path.WriteString("/") - path.WriteString("_security") - path.WriteString("/") - path.WriteString("user") - if len(r.Username) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Username, ",")) - } - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SecurityGetUser) WithContext(v context.Context) func(*SecurityGetUserRequest) { - return func(r *SecurityGetUserRequest) { - r.ctx = v - } -} - -// WithUsername - a list of usernames. -// -func (f SecurityGetUser) WithUsername(v ...string) func(*SecurityGetUserRequest) { - return func(r *SecurityGetUserRequest) { - r.Username = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SecurityGetUser) WithPretty() func(*SecurityGetUserRequest) { - return func(r *SecurityGetUserRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SecurityGetUser) WithHuman() func(*SecurityGetUserRequest) { - return func(r *SecurityGetUserRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SecurityGetUser) WithErrorTrace() func(*SecurityGetUserRequest) { - return func(r *SecurityGetUserRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SecurityGetUser) WithFilterPath(v ...string) func(*SecurityGetUserRequest) { - return func(r *SecurityGetUserRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SecurityGetUser) WithHeader(h map[string]string) func(*SecurityGetUserRequest) { - return func(r *SecurityGetUserRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SecurityGetUser) WithOpaqueID(s string) func(*SecurityGetUserRequest) { - return func(r *SecurityGetUserRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.get_user_privileges.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.get_user_privileges.go deleted file mode 100644 index 01648dc19..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.get_user_privileges.go +++ /dev/null @@ -1,196 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newSecurityGetUserPrivilegesFunc(t Transport) SecurityGetUserPrivileges { - return func(o ...func(*SecurityGetUserPrivilegesRequest)) (*Response, error) { - var r = SecurityGetUserPrivilegesRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SecurityGetUserPrivileges - Retrieves application privileges. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-privileges.html. -// -type SecurityGetUserPrivileges func(o ...func(*SecurityGetUserPrivilegesRequest)) (*Response, error) - -// SecurityGetUserPrivilegesRequest configures the Security Get User Privileges API request. -// -type SecurityGetUserPrivilegesRequest struct { - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SecurityGetUserPrivilegesRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(len("/_security/user/_privileges")) - path.WriteString("/_security/user/_privileges") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SecurityGetUserPrivileges) WithContext(v context.Context) func(*SecurityGetUserPrivilegesRequest) { - return func(r *SecurityGetUserPrivilegesRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SecurityGetUserPrivileges) WithPretty() func(*SecurityGetUserPrivilegesRequest) { - return func(r *SecurityGetUserPrivilegesRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SecurityGetUserPrivileges) WithHuman() func(*SecurityGetUserPrivilegesRequest) { - return func(r *SecurityGetUserPrivilegesRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SecurityGetUserPrivileges) WithErrorTrace() func(*SecurityGetUserPrivilegesRequest) { - return func(r *SecurityGetUserPrivilegesRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SecurityGetUserPrivileges) WithFilterPath(v ...string) func(*SecurityGetUserPrivilegesRequest) { - return func(r *SecurityGetUserPrivilegesRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SecurityGetUserPrivileges) WithHeader(h map[string]string) func(*SecurityGetUserPrivilegesRequest) { - return func(r *SecurityGetUserPrivilegesRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SecurityGetUserPrivileges) WithOpaqueID(s string) func(*SecurityGetUserPrivilegesRequest) { - return func(r *SecurityGetUserPrivilegesRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.grant_api_key.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.grant_api_key.go deleted file mode 100644 index f8dd87679..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.grant_api_key.go +++ /dev/null @@ -1,217 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" -) - -func newSecurityGrantAPIKeyFunc(t Transport) SecurityGrantAPIKey { - return func(body io.Reader, o ...func(*SecurityGrantAPIKeyRequest)) (*Response, error) { - var r = SecurityGrantAPIKeyRequest{Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SecurityGrantAPIKey - Creates an API key on behalf of another user. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-grant-api-key.html. -// -type SecurityGrantAPIKey func(body io.Reader, o ...func(*SecurityGrantAPIKeyRequest)) (*Response, error) - -// SecurityGrantAPIKeyRequest configures the Security GrantAPI Key API request. -// -type SecurityGrantAPIKeyRequest struct { - Body io.Reader - - Refresh string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SecurityGrantAPIKeyRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(len("/_security/api_key/grant")) - path.WriteString("/_security/api_key/grant") - - params = make(map[string]string) - - if r.Refresh != "" { - params["refresh"] = r.Refresh - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SecurityGrantAPIKey) WithContext(v context.Context) func(*SecurityGrantAPIKeyRequest) { - return func(r *SecurityGrantAPIKeyRequest) { - r.ctx = v - } -} - -// WithRefresh - if `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes.. -// -func (f SecurityGrantAPIKey) WithRefresh(v string) func(*SecurityGrantAPIKeyRequest) { - return func(r *SecurityGrantAPIKeyRequest) { - r.Refresh = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SecurityGrantAPIKey) WithPretty() func(*SecurityGrantAPIKeyRequest) { - return func(r *SecurityGrantAPIKeyRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SecurityGrantAPIKey) WithHuman() func(*SecurityGrantAPIKeyRequest) { - return func(r *SecurityGrantAPIKeyRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SecurityGrantAPIKey) WithErrorTrace() func(*SecurityGrantAPIKeyRequest) { - return func(r *SecurityGrantAPIKeyRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SecurityGrantAPIKey) WithFilterPath(v ...string) func(*SecurityGrantAPIKeyRequest) { - return func(r *SecurityGrantAPIKeyRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SecurityGrantAPIKey) WithHeader(h map[string]string) func(*SecurityGrantAPIKeyRequest) { - return func(r *SecurityGrantAPIKeyRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SecurityGrantAPIKey) WithOpaqueID(s string) func(*SecurityGrantAPIKeyRequest) { - return func(r *SecurityGrantAPIKeyRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.has_privileges.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.has_privileges.go deleted file mode 100644 index 169b5a159..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.has_privileges.go +++ /dev/null @@ -1,222 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" -) - -func newSecurityHasPrivilegesFunc(t Transport) SecurityHasPrivileges { - return func(body io.Reader, o ...func(*SecurityHasPrivilegesRequest)) (*Response, error) { - var r = SecurityHasPrivilegesRequest{Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SecurityHasPrivileges - Determines whether the specified user has a specified list of privileges. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-has-privileges.html. -// -type SecurityHasPrivileges func(body io.Reader, o ...func(*SecurityHasPrivilegesRequest)) (*Response, error) - -// SecurityHasPrivilegesRequest configures the Security Has Privileges API request. -// -type SecurityHasPrivilegesRequest struct { - Body io.Reader - - User string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SecurityHasPrivilegesRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_security") + 1 + len("user") + 1 + len(r.User) + 1 + len("_has_privileges")) - path.WriteString("/") - path.WriteString("_security") - path.WriteString("/") - path.WriteString("user") - if r.User != "" { - path.WriteString("/") - path.WriteString(r.User) - } - path.WriteString("/") - path.WriteString("_has_privileges") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SecurityHasPrivileges) WithContext(v context.Context) func(*SecurityHasPrivilegesRequest) { - return func(r *SecurityHasPrivilegesRequest) { - r.ctx = v - } -} - -// WithUser - username. -// -func (f SecurityHasPrivileges) WithUser(v string) func(*SecurityHasPrivilegesRequest) { - return func(r *SecurityHasPrivilegesRequest) { - r.User = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SecurityHasPrivileges) WithPretty() func(*SecurityHasPrivilegesRequest) { - return func(r *SecurityHasPrivilegesRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SecurityHasPrivileges) WithHuman() func(*SecurityHasPrivilegesRequest) { - return func(r *SecurityHasPrivilegesRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SecurityHasPrivileges) WithErrorTrace() func(*SecurityHasPrivilegesRequest) { - return func(r *SecurityHasPrivilegesRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SecurityHasPrivileges) WithFilterPath(v ...string) func(*SecurityHasPrivilegesRequest) { - return func(r *SecurityHasPrivilegesRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SecurityHasPrivileges) WithHeader(h map[string]string) func(*SecurityHasPrivilegesRequest) { - return func(r *SecurityHasPrivilegesRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SecurityHasPrivileges) WithOpaqueID(s string) func(*SecurityHasPrivilegesRequest) { - return func(r *SecurityHasPrivilegesRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.invalidate_api_key.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.invalidate_api_key.go deleted file mode 100644 index 1136d95b8..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.invalidate_api_key.go +++ /dev/null @@ -1,203 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" -) - -func newSecurityInvalidateAPIKeyFunc(t Transport) SecurityInvalidateAPIKey { - return func(body io.Reader, o ...func(*SecurityInvalidateAPIKeyRequest)) (*Response, error) { - var r = SecurityInvalidateAPIKeyRequest{Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SecurityInvalidateAPIKey - Invalidates one or more API keys. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-invalidate-api-key.html. -// -type SecurityInvalidateAPIKey func(body io.Reader, o ...func(*SecurityInvalidateAPIKeyRequest)) (*Response, error) - -// SecurityInvalidateAPIKeyRequest configures the Security InvalidateAPI Key API request. -// -type SecurityInvalidateAPIKeyRequest struct { - Body io.Reader - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SecurityInvalidateAPIKeyRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "DELETE" - - path.Grow(len("/_security/api_key")) - path.WriteString("/_security/api_key") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SecurityInvalidateAPIKey) WithContext(v context.Context) func(*SecurityInvalidateAPIKeyRequest) { - return func(r *SecurityInvalidateAPIKeyRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SecurityInvalidateAPIKey) WithPretty() func(*SecurityInvalidateAPIKeyRequest) { - return func(r *SecurityInvalidateAPIKeyRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SecurityInvalidateAPIKey) WithHuman() func(*SecurityInvalidateAPIKeyRequest) { - return func(r *SecurityInvalidateAPIKeyRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SecurityInvalidateAPIKey) WithErrorTrace() func(*SecurityInvalidateAPIKeyRequest) { - return func(r *SecurityInvalidateAPIKeyRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SecurityInvalidateAPIKey) WithFilterPath(v ...string) func(*SecurityInvalidateAPIKeyRequest) { - return func(r *SecurityInvalidateAPIKeyRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SecurityInvalidateAPIKey) WithHeader(h map[string]string) func(*SecurityInvalidateAPIKeyRequest) { - return func(r *SecurityInvalidateAPIKeyRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SecurityInvalidateAPIKey) WithOpaqueID(s string) func(*SecurityInvalidateAPIKeyRequest) { - return func(r *SecurityInvalidateAPIKeyRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.invalidate_token.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.invalidate_token.go deleted file mode 100644 index de132d01f..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.invalidate_token.go +++ /dev/null @@ -1,203 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" -) - -func newSecurityInvalidateTokenFunc(t Transport) SecurityInvalidateToken { - return func(body io.Reader, o ...func(*SecurityInvalidateTokenRequest)) (*Response, error) { - var r = SecurityInvalidateTokenRequest{Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SecurityInvalidateToken - Invalidates one or more access tokens or refresh tokens. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-invalidate-token.html. -// -type SecurityInvalidateToken func(body io.Reader, o ...func(*SecurityInvalidateTokenRequest)) (*Response, error) - -// SecurityInvalidateTokenRequest configures the Security Invalidate Token API request. -// -type SecurityInvalidateTokenRequest struct { - Body io.Reader - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SecurityInvalidateTokenRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "DELETE" - - path.Grow(len("/_security/oauth2/token")) - path.WriteString("/_security/oauth2/token") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SecurityInvalidateToken) WithContext(v context.Context) func(*SecurityInvalidateTokenRequest) { - return func(r *SecurityInvalidateTokenRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SecurityInvalidateToken) WithPretty() func(*SecurityInvalidateTokenRequest) { - return func(r *SecurityInvalidateTokenRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SecurityInvalidateToken) WithHuman() func(*SecurityInvalidateTokenRequest) { - return func(r *SecurityInvalidateTokenRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SecurityInvalidateToken) WithErrorTrace() func(*SecurityInvalidateTokenRequest) { - return func(r *SecurityInvalidateTokenRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SecurityInvalidateToken) WithFilterPath(v ...string) func(*SecurityInvalidateTokenRequest) { - return func(r *SecurityInvalidateTokenRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SecurityInvalidateToken) WithHeader(h map[string]string) func(*SecurityInvalidateTokenRequest) { - return func(r *SecurityInvalidateTokenRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SecurityInvalidateToken) WithOpaqueID(s string) func(*SecurityInvalidateTokenRequest) { - return func(r *SecurityInvalidateTokenRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.put_privileges.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.put_privileges.go deleted file mode 100644 index ea6994a8d..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.put_privileges.go +++ /dev/null @@ -1,217 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" -) - -func newSecurityPutPrivilegesFunc(t Transport) SecurityPutPrivileges { - return func(body io.Reader, o ...func(*SecurityPutPrivilegesRequest)) (*Response, error) { - var r = SecurityPutPrivilegesRequest{Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SecurityPutPrivileges - Adds or updates application privileges. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put-privileges.html. -// -type SecurityPutPrivileges func(body io.Reader, o ...func(*SecurityPutPrivilegesRequest)) (*Response, error) - -// SecurityPutPrivilegesRequest configures the Security Put Privileges API request. -// -type SecurityPutPrivilegesRequest struct { - Body io.Reader - - Refresh string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SecurityPutPrivilegesRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - path.Grow(len("/_security/privilege/")) - path.WriteString("/_security/privilege/") - - params = make(map[string]string) - - if r.Refresh != "" { - params["refresh"] = r.Refresh - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SecurityPutPrivileges) WithContext(v context.Context) func(*SecurityPutPrivilegesRequest) { - return func(r *SecurityPutPrivilegesRequest) { - r.ctx = v - } -} - -// WithRefresh - if `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes.. -// -func (f SecurityPutPrivileges) WithRefresh(v string) func(*SecurityPutPrivilegesRequest) { - return func(r *SecurityPutPrivilegesRequest) { - r.Refresh = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SecurityPutPrivileges) WithPretty() func(*SecurityPutPrivilegesRequest) { - return func(r *SecurityPutPrivilegesRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SecurityPutPrivileges) WithHuman() func(*SecurityPutPrivilegesRequest) { - return func(r *SecurityPutPrivilegesRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SecurityPutPrivileges) WithErrorTrace() func(*SecurityPutPrivilegesRequest) { - return func(r *SecurityPutPrivilegesRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SecurityPutPrivileges) WithFilterPath(v ...string) func(*SecurityPutPrivilegesRequest) { - return func(r *SecurityPutPrivilegesRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SecurityPutPrivileges) WithHeader(h map[string]string) func(*SecurityPutPrivilegesRequest) { - return func(r *SecurityPutPrivilegesRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SecurityPutPrivileges) WithOpaqueID(s string) func(*SecurityPutPrivilegesRequest) { - return func(r *SecurityPutPrivilegesRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.put_role.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.put_role.go deleted file mode 100644 index c58808709..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.put_role.go +++ /dev/null @@ -1,224 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" -) - -func newSecurityPutRoleFunc(t Transport) SecurityPutRole { - return func(name string, body io.Reader, o ...func(*SecurityPutRoleRequest)) (*Response, error) { - var r = SecurityPutRoleRequest{Name: name, Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SecurityPutRole - Adds and updates roles in the native realm. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put-role.html. -// -type SecurityPutRole func(name string, body io.Reader, o ...func(*SecurityPutRoleRequest)) (*Response, error) - -// SecurityPutRoleRequest configures the Security Put Role API request. -// -type SecurityPutRoleRequest struct { - Body io.Reader - - Name string - - Refresh string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SecurityPutRoleRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - path.Grow(1 + len("_security") + 1 + len("role") + 1 + len(r.Name)) - path.WriteString("/") - path.WriteString("_security") - path.WriteString("/") - path.WriteString("role") - path.WriteString("/") - path.WriteString(r.Name) - - params = make(map[string]string) - - if r.Refresh != "" { - params["refresh"] = r.Refresh - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SecurityPutRole) WithContext(v context.Context) func(*SecurityPutRoleRequest) { - return func(r *SecurityPutRoleRequest) { - r.ctx = v - } -} - -// WithRefresh - if `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes.. -// -func (f SecurityPutRole) WithRefresh(v string) func(*SecurityPutRoleRequest) { - return func(r *SecurityPutRoleRequest) { - r.Refresh = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SecurityPutRole) WithPretty() func(*SecurityPutRoleRequest) { - return func(r *SecurityPutRoleRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SecurityPutRole) WithHuman() func(*SecurityPutRoleRequest) { - return func(r *SecurityPutRoleRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SecurityPutRole) WithErrorTrace() func(*SecurityPutRoleRequest) { - return func(r *SecurityPutRoleRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SecurityPutRole) WithFilterPath(v ...string) func(*SecurityPutRoleRequest) { - return func(r *SecurityPutRoleRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SecurityPutRole) WithHeader(h map[string]string) func(*SecurityPutRoleRequest) { - return func(r *SecurityPutRoleRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SecurityPutRole) WithOpaqueID(s string) func(*SecurityPutRoleRequest) { - return func(r *SecurityPutRoleRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.put_role_mapping.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.put_role_mapping.go deleted file mode 100644 index fa6da98ed..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.put_role_mapping.go +++ /dev/null @@ -1,224 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" -) - -func newSecurityPutRoleMappingFunc(t Transport) SecurityPutRoleMapping { - return func(name string, body io.Reader, o ...func(*SecurityPutRoleMappingRequest)) (*Response, error) { - var r = SecurityPutRoleMappingRequest{Name: name, Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SecurityPutRoleMapping - Creates and updates role mappings. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put-role-mapping.html. -// -type SecurityPutRoleMapping func(name string, body io.Reader, o ...func(*SecurityPutRoleMappingRequest)) (*Response, error) - -// SecurityPutRoleMappingRequest configures the Security Put Role Mapping API request. -// -type SecurityPutRoleMappingRequest struct { - Body io.Reader - - Name string - - Refresh string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SecurityPutRoleMappingRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - path.Grow(1 + len("_security") + 1 + len("role_mapping") + 1 + len(r.Name)) - path.WriteString("/") - path.WriteString("_security") - path.WriteString("/") - path.WriteString("role_mapping") - path.WriteString("/") - path.WriteString(r.Name) - - params = make(map[string]string) - - if r.Refresh != "" { - params["refresh"] = r.Refresh - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SecurityPutRoleMapping) WithContext(v context.Context) func(*SecurityPutRoleMappingRequest) { - return func(r *SecurityPutRoleMappingRequest) { - r.ctx = v - } -} - -// WithRefresh - if `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes.. -// -func (f SecurityPutRoleMapping) WithRefresh(v string) func(*SecurityPutRoleMappingRequest) { - return func(r *SecurityPutRoleMappingRequest) { - r.Refresh = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SecurityPutRoleMapping) WithPretty() func(*SecurityPutRoleMappingRequest) { - return func(r *SecurityPutRoleMappingRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SecurityPutRoleMapping) WithHuman() func(*SecurityPutRoleMappingRequest) { - return func(r *SecurityPutRoleMappingRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SecurityPutRoleMapping) WithErrorTrace() func(*SecurityPutRoleMappingRequest) { - return func(r *SecurityPutRoleMappingRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SecurityPutRoleMapping) WithFilterPath(v ...string) func(*SecurityPutRoleMappingRequest) { - return func(r *SecurityPutRoleMappingRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SecurityPutRoleMapping) WithHeader(h map[string]string) func(*SecurityPutRoleMappingRequest) { - return func(r *SecurityPutRoleMappingRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SecurityPutRoleMapping) WithOpaqueID(s string) func(*SecurityPutRoleMappingRequest) { - return func(r *SecurityPutRoleMappingRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.put_user.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.put_user.go deleted file mode 100644 index 6573a0c9c..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.security.put_user.go +++ /dev/null @@ -1,224 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" -) - -func newSecurityPutUserFunc(t Transport) SecurityPutUser { - return func(username string, body io.Reader, o ...func(*SecurityPutUserRequest)) (*Response, error) { - var r = SecurityPutUserRequest{Username: username, Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SecurityPutUser - Adds and updates users in the native realm. These users are commonly referred to as native users. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put-user.html. -// -type SecurityPutUser func(username string, body io.Reader, o ...func(*SecurityPutUserRequest)) (*Response, error) - -// SecurityPutUserRequest configures the Security Put User API request. -// -type SecurityPutUserRequest struct { - Body io.Reader - - Username string - - Refresh string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SecurityPutUserRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - path.Grow(1 + len("_security") + 1 + len("user") + 1 + len(r.Username)) - path.WriteString("/") - path.WriteString("_security") - path.WriteString("/") - path.WriteString("user") - path.WriteString("/") - path.WriteString(r.Username) - - params = make(map[string]string) - - if r.Refresh != "" { - params["refresh"] = r.Refresh - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SecurityPutUser) WithContext(v context.Context) func(*SecurityPutUserRequest) { - return func(r *SecurityPutUserRequest) { - r.ctx = v - } -} - -// WithRefresh - if `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes.. -// -func (f SecurityPutUser) WithRefresh(v string) func(*SecurityPutUserRequest) { - return func(r *SecurityPutUserRequest) { - r.Refresh = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SecurityPutUser) WithPretty() func(*SecurityPutUserRequest) { - return func(r *SecurityPutUserRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SecurityPutUser) WithHuman() func(*SecurityPutUserRequest) { - return func(r *SecurityPutUserRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SecurityPutUser) WithErrorTrace() func(*SecurityPutUserRequest) { - return func(r *SecurityPutUserRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SecurityPutUser) WithFilterPath(v ...string) func(*SecurityPutUserRequest) { - return func(r *SecurityPutUserRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SecurityPutUser) WithHeader(h map[string]string) func(*SecurityPutUserRequest) { - return func(r *SecurityPutUserRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SecurityPutUser) WithOpaqueID(s string) func(*SecurityPutUserRequest) { - return func(r *SecurityPutUserRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.slm.delete_lifecycle.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.slm.delete_lifecycle.go deleted file mode 100644 index 3995541b8..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.slm.delete_lifecycle.go +++ /dev/null @@ -1,203 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newSlmDeleteLifecycleFunc(t Transport) SlmDeleteLifecycle { - return func(policy_id string, o ...func(*SlmDeleteLifecycleRequest)) (*Response, error) { - var r = SlmDeleteLifecycleRequest{PolicyID: policy_id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SlmDeleteLifecycle - Deletes an existing snapshot lifecycle policy. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-delete-policy.html. -// -type SlmDeleteLifecycle func(policy_id string, o ...func(*SlmDeleteLifecycleRequest)) (*Response, error) - -// SlmDeleteLifecycleRequest configures the Slm Delete Lifecycle API request. -// -type SlmDeleteLifecycleRequest struct { - PolicyID string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SlmDeleteLifecycleRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "DELETE" - - path.Grow(1 + len("_slm") + 1 + len("policy") + 1 + len(r.PolicyID)) - path.WriteString("/") - path.WriteString("_slm") - path.WriteString("/") - path.WriteString("policy") - path.WriteString("/") - path.WriteString(r.PolicyID) - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SlmDeleteLifecycle) WithContext(v context.Context) func(*SlmDeleteLifecycleRequest) { - return func(r *SlmDeleteLifecycleRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SlmDeleteLifecycle) WithPretty() func(*SlmDeleteLifecycleRequest) { - return func(r *SlmDeleteLifecycleRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SlmDeleteLifecycle) WithHuman() func(*SlmDeleteLifecycleRequest) { - return func(r *SlmDeleteLifecycleRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SlmDeleteLifecycle) WithErrorTrace() func(*SlmDeleteLifecycleRequest) { - return func(r *SlmDeleteLifecycleRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SlmDeleteLifecycle) WithFilterPath(v ...string) func(*SlmDeleteLifecycleRequest) { - return func(r *SlmDeleteLifecycleRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SlmDeleteLifecycle) WithHeader(h map[string]string) func(*SlmDeleteLifecycleRequest) { - return func(r *SlmDeleteLifecycleRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SlmDeleteLifecycle) WithOpaqueID(s string) func(*SlmDeleteLifecycleRequest) { - return func(r *SlmDeleteLifecycleRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.slm.execute_lifecycle.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.slm.execute_lifecycle.go deleted file mode 100644 index 13b3cc7e3..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.slm.execute_lifecycle.go +++ /dev/null @@ -1,205 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newSlmExecuteLifecycleFunc(t Transport) SlmExecuteLifecycle { - return func(policy_id string, o ...func(*SlmExecuteLifecycleRequest)) (*Response, error) { - var r = SlmExecuteLifecycleRequest{PolicyID: policy_id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SlmExecuteLifecycle - Immediately creates a snapshot according to the lifecycle policy, without waiting for the scheduled time. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-execute-lifecycle.html. -// -type SlmExecuteLifecycle func(policy_id string, o ...func(*SlmExecuteLifecycleRequest)) (*Response, error) - -// SlmExecuteLifecycleRequest configures the Slm Execute Lifecycle API request. -// -type SlmExecuteLifecycleRequest struct { - PolicyID string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SlmExecuteLifecycleRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - path.Grow(1 + len("_slm") + 1 + len("policy") + 1 + len(r.PolicyID) + 1 + len("_execute")) - path.WriteString("/") - path.WriteString("_slm") - path.WriteString("/") - path.WriteString("policy") - path.WriteString("/") - path.WriteString(r.PolicyID) - path.WriteString("/") - path.WriteString("_execute") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SlmExecuteLifecycle) WithContext(v context.Context) func(*SlmExecuteLifecycleRequest) { - return func(r *SlmExecuteLifecycleRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SlmExecuteLifecycle) WithPretty() func(*SlmExecuteLifecycleRequest) { - return func(r *SlmExecuteLifecycleRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SlmExecuteLifecycle) WithHuman() func(*SlmExecuteLifecycleRequest) { - return func(r *SlmExecuteLifecycleRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SlmExecuteLifecycle) WithErrorTrace() func(*SlmExecuteLifecycleRequest) { - return func(r *SlmExecuteLifecycleRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SlmExecuteLifecycle) WithFilterPath(v ...string) func(*SlmExecuteLifecycleRequest) { - return func(r *SlmExecuteLifecycleRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SlmExecuteLifecycle) WithHeader(h map[string]string) func(*SlmExecuteLifecycleRequest) { - return func(r *SlmExecuteLifecycleRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SlmExecuteLifecycle) WithOpaqueID(s string) func(*SlmExecuteLifecycleRequest) { - return func(r *SlmExecuteLifecycleRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.slm.execute_retention.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.slm.execute_retention.go deleted file mode 100644 index 811c0fe37..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.slm.execute_retention.go +++ /dev/null @@ -1,196 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newSlmExecuteRetentionFunc(t Transport) SlmExecuteRetention { - return func(o ...func(*SlmExecuteRetentionRequest)) (*Response, error) { - var r = SlmExecuteRetentionRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SlmExecuteRetention - Deletes any snapshots that are expired according to the policy's retention rules. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-execute-retention.html. -// -type SlmExecuteRetention func(o ...func(*SlmExecuteRetentionRequest)) (*Response, error) - -// SlmExecuteRetentionRequest configures the Slm Execute Retention API request. -// -type SlmExecuteRetentionRequest struct { - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SlmExecuteRetentionRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(len("/_slm/_execute_retention")) - path.WriteString("/_slm/_execute_retention") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SlmExecuteRetention) WithContext(v context.Context) func(*SlmExecuteRetentionRequest) { - return func(r *SlmExecuteRetentionRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SlmExecuteRetention) WithPretty() func(*SlmExecuteRetentionRequest) { - return func(r *SlmExecuteRetentionRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SlmExecuteRetention) WithHuman() func(*SlmExecuteRetentionRequest) { - return func(r *SlmExecuteRetentionRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SlmExecuteRetention) WithErrorTrace() func(*SlmExecuteRetentionRequest) { - return func(r *SlmExecuteRetentionRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SlmExecuteRetention) WithFilterPath(v ...string) func(*SlmExecuteRetentionRequest) { - return func(r *SlmExecuteRetentionRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SlmExecuteRetention) WithHeader(h map[string]string) func(*SlmExecuteRetentionRequest) { - return func(r *SlmExecuteRetentionRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SlmExecuteRetention) WithOpaqueID(s string) func(*SlmExecuteRetentionRequest) { - return func(r *SlmExecuteRetentionRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.slm.get_lifecycle.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.slm.get_lifecycle.go deleted file mode 100644 index 5ce27c9d9..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.slm.get_lifecycle.go +++ /dev/null @@ -1,213 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newSlmGetLifecycleFunc(t Transport) SlmGetLifecycle { - return func(o ...func(*SlmGetLifecycleRequest)) (*Response, error) { - var r = SlmGetLifecycleRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SlmGetLifecycle - Retrieves one or more snapshot lifecycle policy definitions and information about the latest snapshot attempts. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-get-policy.html. -// -type SlmGetLifecycle func(o ...func(*SlmGetLifecycleRequest)) (*Response, error) - -// SlmGetLifecycleRequest configures the Slm Get Lifecycle API request. -// -type SlmGetLifecycleRequest struct { - PolicyID []string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SlmGetLifecycleRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_slm") + 1 + len("policy") + 1 + len(strings.Join(r.PolicyID, ","))) - path.WriteString("/") - path.WriteString("_slm") - path.WriteString("/") - path.WriteString("policy") - if len(r.PolicyID) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.PolicyID, ",")) - } - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SlmGetLifecycle) WithContext(v context.Context) func(*SlmGetLifecycleRequest) { - return func(r *SlmGetLifecycleRequest) { - r.ctx = v - } -} - -// WithPolicyID - comma-separated list of snapshot lifecycle policies to retrieve. -// -func (f SlmGetLifecycle) WithPolicyID(v ...string) func(*SlmGetLifecycleRequest) { - return func(r *SlmGetLifecycleRequest) { - r.PolicyID = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SlmGetLifecycle) WithPretty() func(*SlmGetLifecycleRequest) { - return func(r *SlmGetLifecycleRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SlmGetLifecycle) WithHuman() func(*SlmGetLifecycleRequest) { - return func(r *SlmGetLifecycleRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SlmGetLifecycle) WithErrorTrace() func(*SlmGetLifecycleRequest) { - return func(r *SlmGetLifecycleRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SlmGetLifecycle) WithFilterPath(v ...string) func(*SlmGetLifecycleRequest) { - return func(r *SlmGetLifecycleRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SlmGetLifecycle) WithHeader(h map[string]string) func(*SlmGetLifecycleRequest) { - return func(r *SlmGetLifecycleRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SlmGetLifecycle) WithOpaqueID(s string) func(*SlmGetLifecycleRequest) { - return func(r *SlmGetLifecycleRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.slm.get_stats.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.slm.get_stats.go deleted file mode 100644 index 5076199ef..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.slm.get_stats.go +++ /dev/null @@ -1,196 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newSlmGetStatsFunc(t Transport) SlmGetStats { - return func(o ...func(*SlmGetStatsRequest)) (*Response, error) { - var r = SlmGetStatsRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SlmGetStats - Returns global and policy-level statistics about actions taken by snapshot lifecycle management. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/slm-api-get-stats.html. -// -type SlmGetStats func(o ...func(*SlmGetStatsRequest)) (*Response, error) - -// SlmGetStatsRequest configures the Slm Get Stats API request. -// -type SlmGetStatsRequest struct { - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SlmGetStatsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(len("/_slm/stats")) - path.WriteString("/_slm/stats") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SlmGetStats) WithContext(v context.Context) func(*SlmGetStatsRequest) { - return func(r *SlmGetStatsRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SlmGetStats) WithPretty() func(*SlmGetStatsRequest) { - return func(r *SlmGetStatsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SlmGetStats) WithHuman() func(*SlmGetStatsRequest) { - return func(r *SlmGetStatsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SlmGetStats) WithErrorTrace() func(*SlmGetStatsRequest) { - return func(r *SlmGetStatsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SlmGetStats) WithFilterPath(v ...string) func(*SlmGetStatsRequest) { - return func(r *SlmGetStatsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SlmGetStats) WithHeader(h map[string]string) func(*SlmGetStatsRequest) { - return func(r *SlmGetStatsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SlmGetStats) WithOpaqueID(s string) func(*SlmGetStatsRequest) { - return func(r *SlmGetStatsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.slm.get_status.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.slm.get_status.go deleted file mode 100644 index 325ab6677..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.slm.get_status.go +++ /dev/null @@ -1,196 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newSlmGetStatusFunc(t Transport) SlmGetStatus { - return func(o ...func(*SlmGetStatusRequest)) (*Response, error) { - var r = SlmGetStatusRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SlmGetStatus - Retrieves the status of snapshot lifecycle management (SLM). -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-get-status.html. -// -type SlmGetStatus func(o ...func(*SlmGetStatusRequest)) (*Response, error) - -// SlmGetStatusRequest configures the Slm Get Status API request. -// -type SlmGetStatusRequest struct { - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SlmGetStatusRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(len("/_slm/status")) - path.WriteString("/_slm/status") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SlmGetStatus) WithContext(v context.Context) func(*SlmGetStatusRequest) { - return func(r *SlmGetStatusRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SlmGetStatus) WithPretty() func(*SlmGetStatusRequest) { - return func(r *SlmGetStatusRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SlmGetStatus) WithHuman() func(*SlmGetStatusRequest) { - return func(r *SlmGetStatusRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SlmGetStatus) WithErrorTrace() func(*SlmGetStatusRequest) { - return func(r *SlmGetStatusRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SlmGetStatus) WithFilterPath(v ...string) func(*SlmGetStatusRequest) { - return func(r *SlmGetStatusRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SlmGetStatus) WithHeader(h map[string]string) func(*SlmGetStatusRequest) { - return func(r *SlmGetStatusRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SlmGetStatus) WithOpaqueID(s string) func(*SlmGetStatusRequest) { - return func(r *SlmGetStatusRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.slm.put_lifecycle.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.slm.put_lifecycle.go deleted file mode 100644 index 2ab2df362..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.slm.put_lifecycle.go +++ /dev/null @@ -1,218 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" -) - -func newSlmPutLifecycleFunc(t Transport) SlmPutLifecycle { - return func(policy_id string, o ...func(*SlmPutLifecycleRequest)) (*Response, error) { - var r = SlmPutLifecycleRequest{PolicyID: policy_id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SlmPutLifecycle - Creates or updates a snapshot lifecycle policy. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-put-policy.html. -// -type SlmPutLifecycle func(policy_id string, o ...func(*SlmPutLifecycleRequest)) (*Response, error) - -// SlmPutLifecycleRequest configures the Slm Put Lifecycle API request. -// -type SlmPutLifecycleRequest struct { - Body io.Reader - - PolicyID string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SlmPutLifecycleRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - path.Grow(1 + len("_slm") + 1 + len("policy") + 1 + len(r.PolicyID)) - path.WriteString("/") - path.WriteString("_slm") - path.WriteString("/") - path.WriteString("policy") - path.WriteString("/") - path.WriteString(r.PolicyID) - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SlmPutLifecycle) WithContext(v context.Context) func(*SlmPutLifecycleRequest) { - return func(r *SlmPutLifecycleRequest) { - r.ctx = v - } -} - -// WithBody - The snapshot lifecycle policy definition to register. -// -func (f SlmPutLifecycle) WithBody(v io.Reader) func(*SlmPutLifecycleRequest) { - return func(r *SlmPutLifecycleRequest) { - r.Body = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SlmPutLifecycle) WithPretty() func(*SlmPutLifecycleRequest) { - return func(r *SlmPutLifecycleRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SlmPutLifecycle) WithHuman() func(*SlmPutLifecycleRequest) { - return func(r *SlmPutLifecycleRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SlmPutLifecycle) WithErrorTrace() func(*SlmPutLifecycleRequest) { - return func(r *SlmPutLifecycleRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SlmPutLifecycle) WithFilterPath(v ...string) func(*SlmPutLifecycleRequest) { - return func(r *SlmPutLifecycleRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SlmPutLifecycle) WithHeader(h map[string]string) func(*SlmPutLifecycleRequest) { - return func(r *SlmPutLifecycleRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SlmPutLifecycle) WithOpaqueID(s string) func(*SlmPutLifecycleRequest) { - return func(r *SlmPutLifecycleRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.slm.start.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.slm.start.go deleted file mode 100644 index 572648841..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.slm.start.go +++ /dev/null @@ -1,196 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newSlmStartFunc(t Transport) SlmStart { - return func(o ...func(*SlmStartRequest)) (*Response, error) { - var r = SlmStartRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SlmStart - Turns on snapshot lifecycle management (SLM). -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-start.html. -// -type SlmStart func(o ...func(*SlmStartRequest)) (*Response, error) - -// SlmStartRequest configures the Slm Start API request. -// -type SlmStartRequest struct { - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SlmStartRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(len("/_slm/start")) - path.WriteString("/_slm/start") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SlmStart) WithContext(v context.Context) func(*SlmStartRequest) { - return func(r *SlmStartRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SlmStart) WithPretty() func(*SlmStartRequest) { - return func(r *SlmStartRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SlmStart) WithHuman() func(*SlmStartRequest) { - return func(r *SlmStartRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SlmStart) WithErrorTrace() func(*SlmStartRequest) { - return func(r *SlmStartRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SlmStart) WithFilterPath(v ...string) func(*SlmStartRequest) { - return func(r *SlmStartRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SlmStart) WithHeader(h map[string]string) func(*SlmStartRequest) { - return func(r *SlmStartRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SlmStart) WithOpaqueID(s string) func(*SlmStartRequest) { - return func(r *SlmStartRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.slm.stop.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.slm.stop.go deleted file mode 100644 index 240ed9016..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.slm.stop.go +++ /dev/null @@ -1,196 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newSlmStopFunc(t Transport) SlmStop { - return func(o ...func(*SlmStopRequest)) (*Response, error) { - var r = SlmStopRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SlmStop - Turns off snapshot lifecycle management (SLM). -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-stop.html. -// -type SlmStop func(o ...func(*SlmStopRequest)) (*Response, error) - -// SlmStopRequest configures the Slm Stop API request. -// -type SlmStopRequest struct { - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SlmStopRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(len("/_slm/stop")) - path.WriteString("/_slm/stop") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SlmStop) WithContext(v context.Context) func(*SlmStopRequest) { - return func(r *SlmStopRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SlmStop) WithPretty() func(*SlmStopRequest) { - return func(r *SlmStopRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SlmStop) WithHuman() func(*SlmStopRequest) { - return func(r *SlmStopRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SlmStop) WithErrorTrace() func(*SlmStopRequest) { - return func(r *SlmStopRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SlmStop) WithFilterPath(v ...string) func(*SlmStopRequest) { - return func(r *SlmStopRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SlmStop) WithHeader(h map[string]string) func(*SlmStopRequest) { - return func(r *SlmStopRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SlmStop) WithOpaqueID(s string) func(*SlmStopRequest) { - return func(r *SlmStopRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.sql.clear_cursor.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.sql.clear_cursor.go deleted file mode 100644 index fe2b997c3..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.sql.clear_cursor.go +++ /dev/null @@ -1,203 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" -) - -func newSQLClearCursorFunc(t Transport) SQLClearCursor { - return func(body io.Reader, o ...func(*SQLClearCursorRequest)) (*Response, error) { - var r = SQLClearCursorRequest{Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SQLClearCursor - Clears the SQL cursor -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/sql-pagination.html. -// -type SQLClearCursor func(body io.Reader, o ...func(*SQLClearCursorRequest)) (*Response, error) - -// SQLClearCursorRequest configures the SQL Clear Cursor API request. -// -type SQLClearCursorRequest struct { - Body io.Reader - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SQLClearCursorRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(len("/_sql/close")) - path.WriteString("/_sql/close") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SQLClearCursor) WithContext(v context.Context) func(*SQLClearCursorRequest) { - return func(r *SQLClearCursorRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SQLClearCursor) WithPretty() func(*SQLClearCursorRequest) { - return func(r *SQLClearCursorRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SQLClearCursor) WithHuman() func(*SQLClearCursorRequest) { - return func(r *SQLClearCursorRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SQLClearCursor) WithErrorTrace() func(*SQLClearCursorRequest) { - return func(r *SQLClearCursorRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SQLClearCursor) WithFilterPath(v ...string) func(*SQLClearCursorRequest) { - return func(r *SQLClearCursorRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SQLClearCursor) WithHeader(h map[string]string) func(*SQLClearCursorRequest) { - return func(r *SQLClearCursorRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SQLClearCursor) WithOpaqueID(s string) func(*SQLClearCursorRequest) { - return func(r *SQLClearCursorRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.sql.query.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.sql.query.go deleted file mode 100644 index ea891b7d8..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.sql.query.go +++ /dev/null @@ -1,217 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" -) - -func newSQLQueryFunc(t Transport) SQLQuery { - return func(body io.Reader, o ...func(*SQLQueryRequest)) (*Response, error) { - var r = SQLQueryRequest{Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SQLQuery - Executes a SQL request -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/sql-rest-overview.html. -// -type SQLQuery func(body io.Reader, o ...func(*SQLQueryRequest)) (*Response, error) - -// SQLQueryRequest configures the SQL Query API request. -// -type SQLQueryRequest struct { - Body io.Reader - - Format string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SQLQueryRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(len("/_sql")) - path.WriteString("/_sql") - - params = make(map[string]string) - - if r.Format != "" { - params["format"] = r.Format - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SQLQuery) WithContext(v context.Context) func(*SQLQueryRequest) { - return func(r *SQLQueryRequest) { - r.ctx = v - } -} - -// WithFormat - a short version of the accept header, e.g. json, yaml. -// -func (f SQLQuery) WithFormat(v string) func(*SQLQueryRequest) { - return func(r *SQLQueryRequest) { - r.Format = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SQLQuery) WithPretty() func(*SQLQueryRequest) { - return func(r *SQLQueryRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SQLQuery) WithHuman() func(*SQLQueryRequest) { - return func(r *SQLQueryRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SQLQuery) WithErrorTrace() func(*SQLQueryRequest) { - return func(r *SQLQueryRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SQLQuery) WithFilterPath(v ...string) func(*SQLQueryRequest) { - return func(r *SQLQueryRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SQLQuery) WithHeader(h map[string]string) func(*SQLQueryRequest) { - return func(r *SQLQueryRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SQLQuery) WithOpaqueID(s string) func(*SQLQueryRequest) { - return func(r *SQLQueryRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.sql.translate.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.sql.translate.go deleted file mode 100644 index b709d5ae0..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.sql.translate.go +++ /dev/null @@ -1,203 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" -) - -func newSQLTranslateFunc(t Transport) SQLTranslate { - return func(body io.Reader, o ...func(*SQLTranslateRequest)) (*Response, error) { - var r = SQLTranslateRequest{Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SQLTranslate - Translates SQL into Elasticsearch queries -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/sql-translate.html. -// -type SQLTranslate func(body io.Reader, o ...func(*SQLTranslateRequest)) (*Response, error) - -// SQLTranslateRequest configures the SQL Translate API request. -// -type SQLTranslateRequest struct { - Body io.Reader - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SQLTranslateRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(len("/_sql/translate")) - path.WriteString("/_sql/translate") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SQLTranslate) WithContext(v context.Context) func(*SQLTranslateRequest) { - return func(r *SQLTranslateRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SQLTranslate) WithPretty() func(*SQLTranslateRequest) { - return func(r *SQLTranslateRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SQLTranslate) WithHuman() func(*SQLTranslateRequest) { - return func(r *SQLTranslateRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SQLTranslate) WithErrorTrace() func(*SQLTranslateRequest) { - return func(r *SQLTranslateRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SQLTranslate) WithFilterPath(v ...string) func(*SQLTranslateRequest) { - return func(r *SQLTranslateRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SQLTranslate) WithHeader(h map[string]string) func(*SQLTranslateRequest) { - return func(r *SQLTranslateRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SQLTranslate) WithOpaqueID(s string) func(*SQLTranslateRequest) { - return func(r *SQLTranslateRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ssl.certificates.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ssl.certificates.go deleted file mode 100644 index fb054f230..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.ssl.certificates.go +++ /dev/null @@ -1,196 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newSSLCertificatesFunc(t Transport) SSLCertificates { - return func(o ...func(*SSLCertificatesRequest)) (*Response, error) { - var r = SSLCertificatesRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// SSLCertificates - Retrieves information about the X.509 certificates used to encrypt communications in the cluster. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-ssl.html. -// -type SSLCertificates func(o ...func(*SSLCertificatesRequest)) (*Response, error) - -// SSLCertificatesRequest configures the SSL Certificates API request. -// -type SSLCertificatesRequest struct { - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r SSLCertificatesRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(len("/_ssl/certificates")) - path.WriteString("/_ssl/certificates") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f SSLCertificates) WithContext(v context.Context) func(*SSLCertificatesRequest) { - return func(r *SSLCertificatesRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f SSLCertificates) WithPretty() func(*SSLCertificatesRequest) { - return func(r *SSLCertificatesRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f SSLCertificates) WithHuman() func(*SSLCertificatesRequest) { - return func(r *SSLCertificatesRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f SSLCertificates) WithErrorTrace() func(*SSLCertificatesRequest) { - return func(r *SSLCertificatesRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f SSLCertificates) WithFilterPath(v ...string) func(*SSLCertificatesRequest) { - return func(r *SSLCertificatesRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f SSLCertificates) WithHeader(h map[string]string) func(*SSLCertificatesRequest) { - return func(r *SSLCertificatesRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f SSLCertificates) WithOpaqueID(s string) func(*SSLCertificatesRequest) { - return func(r *SSLCertificatesRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.text_structure.find_structure.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.text_structure.find_structure.go deleted file mode 100644 index d808d19ce..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.text_structure.find_structure.go +++ /dev/null @@ -1,388 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" - "time" -) - -func newTextStructureFindStructureFunc(t Transport) TextStructureFindStructure { - return func(body io.Reader, o ...func(*TextStructureFindStructureRequest)) (*Response, error) { - var r = TextStructureFindStructureRequest{Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// TextStructureFindStructure - Finds the structure of a text file. The text file must contain data that is suitable to be ingested into Elasticsearch. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/find-structure.html. -// -type TextStructureFindStructure func(body io.Reader, o ...func(*TextStructureFindStructureRequest)) (*Response, error) - -// TextStructureFindStructureRequest configures the Text Structure Find Structure API request. -// -type TextStructureFindStructureRequest struct { - Body io.Reader - - Charset string - ColumnNames []string - Delimiter string - Explain *bool - Format string - GrokPattern string - HasHeaderRow *bool - LineMergeSizeLimit *int - LinesToSample *int - Quote string - ShouldTrimFields *bool - Timeout time.Duration - TimestampField string - TimestampFormat string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r TextStructureFindStructureRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(len("/_text_structure/find_structure")) - path.WriteString("/_text_structure/find_structure") - - params = make(map[string]string) - - if r.Charset != "" { - params["charset"] = r.Charset - } - - if len(r.ColumnNames) > 0 { - params["column_names"] = strings.Join(r.ColumnNames, ",") - } - - if r.Delimiter != "" { - params["delimiter"] = r.Delimiter - } - - if r.Explain != nil { - params["explain"] = strconv.FormatBool(*r.Explain) - } - - if r.Format != "" { - params["format"] = r.Format - } - - if r.GrokPattern != "" { - params["grok_pattern"] = r.GrokPattern - } - - if r.HasHeaderRow != nil { - params["has_header_row"] = strconv.FormatBool(*r.HasHeaderRow) - } - - if r.LineMergeSizeLimit != nil { - params["line_merge_size_limit"] = strconv.FormatInt(int64(*r.LineMergeSizeLimit), 10) - } - - if r.LinesToSample != nil { - params["lines_to_sample"] = strconv.FormatInt(int64(*r.LinesToSample), 10) - } - - if r.Quote != "" { - params["quote"] = r.Quote - } - - if r.ShouldTrimFields != nil { - params["should_trim_fields"] = strconv.FormatBool(*r.ShouldTrimFields) - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.TimestampField != "" { - params["timestamp_field"] = r.TimestampField - } - - if r.TimestampFormat != "" { - params["timestamp_format"] = r.TimestampFormat - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f TextStructureFindStructure) WithContext(v context.Context) func(*TextStructureFindStructureRequest) { - return func(r *TextStructureFindStructureRequest) { - r.ctx = v - } -} - -// WithCharset - optional parameter to specify the character set of the file. -// -func (f TextStructureFindStructure) WithCharset(v string) func(*TextStructureFindStructureRequest) { - return func(r *TextStructureFindStructureRequest) { - r.Charset = v - } -} - -// WithColumnNames - optional parameter containing a comma separated list of the column names for a delimited file. -// -func (f TextStructureFindStructure) WithColumnNames(v ...string) func(*TextStructureFindStructureRequest) { - return func(r *TextStructureFindStructureRequest) { - r.ColumnNames = v - } -} - -// WithDelimiter - optional parameter to specify the delimiter character for a delimited file - must be a single character. -// -func (f TextStructureFindStructure) WithDelimiter(v string) func(*TextStructureFindStructureRequest) { - return func(r *TextStructureFindStructureRequest) { - r.Delimiter = v - } -} - -// WithExplain - whether to include a commentary on how the structure was derived. -// -func (f TextStructureFindStructure) WithExplain(v bool) func(*TextStructureFindStructureRequest) { - return func(r *TextStructureFindStructureRequest) { - r.Explain = &v - } -} - -// WithFormat - optional parameter to specify the high level file format. -// -func (f TextStructureFindStructure) WithFormat(v string) func(*TextStructureFindStructureRequest) { - return func(r *TextStructureFindStructureRequest) { - r.Format = v - } -} - -// WithGrokPattern - optional parameter to specify the grok pattern that should be used to extract fields from messages in a semi-structured text file. -// -func (f TextStructureFindStructure) WithGrokPattern(v string) func(*TextStructureFindStructureRequest) { - return func(r *TextStructureFindStructureRequest) { - r.GrokPattern = v - } -} - -// WithHasHeaderRow - optional parameter to specify whether a delimited file includes the column names in its first row. -// -func (f TextStructureFindStructure) WithHasHeaderRow(v bool) func(*TextStructureFindStructureRequest) { - return func(r *TextStructureFindStructureRequest) { - r.HasHeaderRow = &v - } -} - -// WithLineMergeSizeLimit - maximum number of characters permitted in a single message when lines are merged to create messages.. -// -func (f TextStructureFindStructure) WithLineMergeSizeLimit(v int) func(*TextStructureFindStructureRequest) { - return func(r *TextStructureFindStructureRequest) { - r.LineMergeSizeLimit = &v - } -} - -// WithLinesToSample - how many lines of the file should be included in the analysis. -// -func (f TextStructureFindStructure) WithLinesToSample(v int) func(*TextStructureFindStructureRequest) { - return func(r *TextStructureFindStructureRequest) { - r.LinesToSample = &v - } -} - -// WithQuote - optional parameter to specify the quote character for a delimited file - must be a single character. -// -func (f TextStructureFindStructure) WithQuote(v string) func(*TextStructureFindStructureRequest) { - return func(r *TextStructureFindStructureRequest) { - r.Quote = v - } -} - -// WithShouldTrimFields - optional parameter to specify whether the values between delimiters in a delimited file should have whitespace trimmed from them. -// -func (f TextStructureFindStructure) WithShouldTrimFields(v bool) func(*TextStructureFindStructureRequest) { - return func(r *TextStructureFindStructureRequest) { - r.ShouldTrimFields = &v - } -} - -// WithTimeout - timeout after which the analysis will be aborted. -// -func (f TextStructureFindStructure) WithTimeout(v time.Duration) func(*TextStructureFindStructureRequest) { - return func(r *TextStructureFindStructureRequest) { - r.Timeout = v - } -} - -// WithTimestampField - optional parameter to specify the timestamp field in the file. -// -func (f TextStructureFindStructure) WithTimestampField(v string) func(*TextStructureFindStructureRequest) { - return func(r *TextStructureFindStructureRequest) { - r.TimestampField = v - } -} - -// WithTimestampFormat - optional parameter to specify the timestamp format in the file - may be either a joda or java time format. -// -func (f TextStructureFindStructure) WithTimestampFormat(v string) func(*TextStructureFindStructureRequest) { - return func(r *TextStructureFindStructureRequest) { - r.TimestampFormat = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f TextStructureFindStructure) WithPretty() func(*TextStructureFindStructureRequest) { - return func(r *TextStructureFindStructureRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f TextStructureFindStructure) WithHuman() func(*TextStructureFindStructureRequest) { - return func(r *TextStructureFindStructureRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f TextStructureFindStructure) WithErrorTrace() func(*TextStructureFindStructureRequest) { - return func(r *TextStructureFindStructureRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f TextStructureFindStructure) WithFilterPath(v ...string) func(*TextStructureFindStructureRequest) { - return func(r *TextStructureFindStructureRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f TextStructureFindStructure) WithHeader(h map[string]string) func(*TextStructureFindStructureRequest) { - return func(r *TextStructureFindStructureRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f TextStructureFindStructure) WithOpaqueID(s string) func(*TextStructureFindStructureRequest) { - return func(r *TextStructureFindStructureRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.transform.delete_transform.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.transform.delete_transform.go deleted file mode 100644 index aa40a43a9..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.transform.delete_transform.go +++ /dev/null @@ -1,216 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newTransformDeleteTransformFunc(t Transport) TransformDeleteTransform { - return func(transform_id string, o ...func(*TransformDeleteTransformRequest)) (*Response, error) { - var r = TransformDeleteTransformRequest{TransformID: transform_id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// TransformDeleteTransform - Deletes an existing transform. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-transform.html. -// -type TransformDeleteTransform func(transform_id string, o ...func(*TransformDeleteTransformRequest)) (*Response, error) - -// TransformDeleteTransformRequest configures the Transform Delete Transform API request. -// -type TransformDeleteTransformRequest struct { - TransformID string - - Force *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r TransformDeleteTransformRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "DELETE" - - path.Grow(1 + len("_transform") + 1 + len(r.TransformID)) - path.WriteString("/") - path.WriteString("_transform") - path.WriteString("/") - path.WriteString(r.TransformID) - - params = make(map[string]string) - - if r.Force != nil { - params["force"] = strconv.FormatBool(*r.Force) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f TransformDeleteTransform) WithContext(v context.Context) func(*TransformDeleteTransformRequest) { - return func(r *TransformDeleteTransformRequest) { - r.ctx = v - } -} - -// WithForce - when `true`, the transform is deleted regardless of its current state. the default value is `false`, meaning that the transform must be `stopped` before it can be deleted.. -// -func (f TransformDeleteTransform) WithForce(v bool) func(*TransformDeleteTransformRequest) { - return func(r *TransformDeleteTransformRequest) { - r.Force = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f TransformDeleteTransform) WithPretty() func(*TransformDeleteTransformRequest) { - return func(r *TransformDeleteTransformRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f TransformDeleteTransform) WithHuman() func(*TransformDeleteTransformRequest) { - return func(r *TransformDeleteTransformRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f TransformDeleteTransform) WithErrorTrace() func(*TransformDeleteTransformRequest) { - return func(r *TransformDeleteTransformRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f TransformDeleteTransform) WithFilterPath(v ...string) func(*TransformDeleteTransformRequest) { - return func(r *TransformDeleteTransformRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f TransformDeleteTransform) WithHeader(h map[string]string) func(*TransformDeleteTransformRequest) { - return func(r *TransformDeleteTransformRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f TransformDeleteTransform) WithOpaqueID(s string) func(*TransformDeleteTransformRequest) { - return func(r *TransformDeleteTransformRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.transform.get_transform.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.transform.get_transform.go deleted file mode 100644 index c70f2c8f6..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.transform.get_transform.go +++ /dev/null @@ -1,265 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newTransformGetTransformFunc(t Transport) TransformGetTransform { - return func(o ...func(*TransformGetTransformRequest)) (*Response, error) { - var r = TransformGetTransformRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// TransformGetTransform - Retrieves configuration information for transforms. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/get-transform.html. -// -type TransformGetTransform func(o ...func(*TransformGetTransformRequest)) (*Response, error) - -// TransformGetTransformRequest configures the Transform Get Transform API request. -// -type TransformGetTransformRequest struct { - TransformID string - - AllowNoMatch *bool - ExcludeGenerated *bool - From *int - Size *int - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r TransformGetTransformRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_transform") + 1 + len(r.TransformID)) - path.WriteString("/") - path.WriteString("_transform") - if r.TransformID != "" { - path.WriteString("/") - path.WriteString(r.TransformID) - } - - params = make(map[string]string) - - if r.AllowNoMatch != nil { - params["allow_no_match"] = strconv.FormatBool(*r.AllowNoMatch) - } - - if r.ExcludeGenerated != nil { - params["exclude_generated"] = strconv.FormatBool(*r.ExcludeGenerated) - } - - if r.From != nil { - params["from"] = strconv.FormatInt(int64(*r.From), 10) - } - - if r.Size != nil { - params["size"] = strconv.FormatInt(int64(*r.Size), 10) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f TransformGetTransform) WithContext(v context.Context) func(*TransformGetTransformRequest) { - return func(r *TransformGetTransformRequest) { - r.ctx = v - } -} - -// WithTransformID - the ID or comma delimited list of ID expressions of the transforms to get, '_all' or '*' implies get all transforms. -// -func (f TransformGetTransform) WithTransformID(v string) func(*TransformGetTransformRequest) { - return func(r *TransformGetTransformRequest) { - r.TransformID = v - } -} - -// WithAllowNoMatch - whether to ignore if a wildcard expression matches no transforms. (this includes `_all` string or when no transforms have been specified). -// -func (f TransformGetTransform) WithAllowNoMatch(v bool) func(*TransformGetTransformRequest) { - return func(r *TransformGetTransformRequest) { - r.AllowNoMatch = &v - } -} - -// WithExcludeGenerated - omits fields that are illegal to set on transform put. -// -func (f TransformGetTransform) WithExcludeGenerated(v bool) func(*TransformGetTransformRequest) { - return func(r *TransformGetTransformRequest) { - r.ExcludeGenerated = &v - } -} - -// WithFrom - skips a number of transform configs, defaults to 0. -// -func (f TransformGetTransform) WithFrom(v int) func(*TransformGetTransformRequest) { - return func(r *TransformGetTransformRequest) { - r.From = &v - } -} - -// WithSize - specifies a max number of transforms to get, defaults to 100. -// -func (f TransformGetTransform) WithSize(v int) func(*TransformGetTransformRequest) { - return func(r *TransformGetTransformRequest) { - r.Size = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f TransformGetTransform) WithPretty() func(*TransformGetTransformRequest) { - return func(r *TransformGetTransformRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f TransformGetTransform) WithHuman() func(*TransformGetTransformRequest) { - return func(r *TransformGetTransformRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f TransformGetTransform) WithErrorTrace() func(*TransformGetTransformRequest) { - return func(r *TransformGetTransformRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f TransformGetTransform) WithFilterPath(v ...string) func(*TransformGetTransformRequest) { - return func(r *TransformGetTransformRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f TransformGetTransform) WithHeader(h map[string]string) func(*TransformGetTransformRequest) { - return func(r *TransformGetTransformRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f TransformGetTransform) WithOpaqueID(s string) func(*TransformGetTransformRequest) { - return func(r *TransformGetTransformRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.transform.get_transform_stats.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.transform.get_transform_stats.go deleted file mode 100644 index 32cfc69b4..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.transform.get_transform_stats.go +++ /dev/null @@ -1,244 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newTransformGetTransformStatsFunc(t Transport) TransformGetTransformStats { - return func(transform_id string, o ...func(*TransformGetTransformStatsRequest)) (*Response, error) { - var r = TransformGetTransformStatsRequest{TransformID: transform_id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// TransformGetTransformStats - Retrieves usage information for transforms. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/get-transform-stats.html. -// -type TransformGetTransformStats func(transform_id string, o ...func(*TransformGetTransformStatsRequest)) (*Response, error) - -// TransformGetTransformStatsRequest configures the Transform Get Transform Stats API request. -// -type TransformGetTransformStatsRequest struct { - TransformID string - - AllowNoMatch *bool - From *int - Size *int - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r TransformGetTransformStatsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_transform") + 1 + len(r.TransformID) + 1 + len("_stats")) - path.WriteString("/") - path.WriteString("_transform") - path.WriteString("/") - path.WriteString(r.TransformID) - path.WriteString("/") - path.WriteString("_stats") - - params = make(map[string]string) - - if r.AllowNoMatch != nil { - params["allow_no_match"] = strconv.FormatBool(*r.AllowNoMatch) - } - - if r.From != nil { - params["from"] = strconv.FormatInt(int64(*r.From), 10) - } - - if r.Size != nil { - params["size"] = strconv.FormatInt(int64(*r.Size), 10) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f TransformGetTransformStats) WithContext(v context.Context) func(*TransformGetTransformStatsRequest) { - return func(r *TransformGetTransformStatsRequest) { - r.ctx = v - } -} - -// WithAllowNoMatch - whether to ignore if a wildcard expression matches no transforms. (this includes `_all` string or when no transforms have been specified). -// -func (f TransformGetTransformStats) WithAllowNoMatch(v bool) func(*TransformGetTransformStatsRequest) { - return func(r *TransformGetTransformStatsRequest) { - r.AllowNoMatch = &v - } -} - -// WithFrom - skips a number of transform stats, defaults to 0. -// -func (f TransformGetTransformStats) WithFrom(v int) func(*TransformGetTransformStatsRequest) { - return func(r *TransformGetTransformStatsRequest) { - r.From = &v - } -} - -// WithSize - specifies a max number of transform stats to get, defaults to 100. -// -func (f TransformGetTransformStats) WithSize(v int) func(*TransformGetTransformStatsRequest) { - return func(r *TransformGetTransformStatsRequest) { - r.Size = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f TransformGetTransformStats) WithPretty() func(*TransformGetTransformStatsRequest) { - return func(r *TransformGetTransformStatsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f TransformGetTransformStats) WithHuman() func(*TransformGetTransformStatsRequest) { - return func(r *TransformGetTransformStatsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f TransformGetTransformStats) WithErrorTrace() func(*TransformGetTransformStatsRequest) { - return func(r *TransformGetTransformStatsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f TransformGetTransformStats) WithFilterPath(v ...string) func(*TransformGetTransformStatsRequest) { - return func(r *TransformGetTransformStatsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f TransformGetTransformStats) WithHeader(h map[string]string) func(*TransformGetTransformStatsRequest) { - return func(r *TransformGetTransformStatsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f TransformGetTransformStats) WithOpaqueID(s string) func(*TransformGetTransformStatsRequest) { - return func(r *TransformGetTransformStatsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.transform.preview_transform.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.transform.preview_transform.go deleted file mode 100644 index 2703be785..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.transform.preview_transform.go +++ /dev/null @@ -1,203 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" -) - -func newTransformPreviewTransformFunc(t Transport) TransformPreviewTransform { - return func(body io.Reader, o ...func(*TransformPreviewTransformRequest)) (*Response, error) { - var r = TransformPreviewTransformRequest{Body: body} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// TransformPreviewTransform - Previews a transform. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/preview-transform.html. -// -type TransformPreviewTransform func(body io.Reader, o ...func(*TransformPreviewTransformRequest)) (*Response, error) - -// TransformPreviewTransformRequest configures the Transform Preview Transform API request. -// -type TransformPreviewTransformRequest struct { - Body io.Reader - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r TransformPreviewTransformRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(len("/_transform/_preview")) - path.WriteString("/_transform/_preview") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f TransformPreviewTransform) WithContext(v context.Context) func(*TransformPreviewTransformRequest) { - return func(r *TransformPreviewTransformRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f TransformPreviewTransform) WithPretty() func(*TransformPreviewTransformRequest) { - return func(r *TransformPreviewTransformRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f TransformPreviewTransform) WithHuman() func(*TransformPreviewTransformRequest) { - return func(r *TransformPreviewTransformRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f TransformPreviewTransform) WithErrorTrace() func(*TransformPreviewTransformRequest) { - return func(r *TransformPreviewTransformRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f TransformPreviewTransform) WithFilterPath(v ...string) func(*TransformPreviewTransformRequest) { - return func(r *TransformPreviewTransformRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f TransformPreviewTransform) WithHeader(h map[string]string) func(*TransformPreviewTransformRequest) { - return func(r *TransformPreviewTransformRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f TransformPreviewTransform) WithOpaqueID(s string) func(*TransformPreviewTransformRequest) { - return func(r *TransformPreviewTransformRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.transform.put_transform.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.transform.put_transform.go deleted file mode 100644 index c811aacaa..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.transform.put_transform.go +++ /dev/null @@ -1,223 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" -) - -func newTransformPutTransformFunc(t Transport) TransformPutTransform { - return func(body io.Reader, transform_id string, o ...func(*TransformPutTransformRequest)) (*Response, error) { - var r = TransformPutTransformRequest{Body: body, TransformID: transform_id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// TransformPutTransform - Instantiates a transform. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/put-transform.html. -// -type TransformPutTransform func(body io.Reader, transform_id string, o ...func(*TransformPutTransformRequest)) (*Response, error) - -// TransformPutTransformRequest configures the Transform Put Transform API request. -// -type TransformPutTransformRequest struct { - Body io.Reader - - TransformID string - - DeferValidation *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r TransformPutTransformRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - path.Grow(1 + len("_transform") + 1 + len(r.TransformID)) - path.WriteString("/") - path.WriteString("_transform") - path.WriteString("/") - path.WriteString(r.TransformID) - - params = make(map[string]string) - - if r.DeferValidation != nil { - params["defer_validation"] = strconv.FormatBool(*r.DeferValidation) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f TransformPutTransform) WithContext(v context.Context) func(*TransformPutTransformRequest) { - return func(r *TransformPutTransformRequest) { - r.ctx = v - } -} - -// WithDeferValidation - if validations should be deferred until transform starts, defaults to false.. -// -func (f TransformPutTransform) WithDeferValidation(v bool) func(*TransformPutTransformRequest) { - return func(r *TransformPutTransformRequest) { - r.DeferValidation = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f TransformPutTransform) WithPretty() func(*TransformPutTransformRequest) { - return func(r *TransformPutTransformRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f TransformPutTransform) WithHuman() func(*TransformPutTransformRequest) { - return func(r *TransformPutTransformRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f TransformPutTransform) WithErrorTrace() func(*TransformPutTransformRequest) { - return func(r *TransformPutTransformRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f TransformPutTransform) WithFilterPath(v ...string) func(*TransformPutTransformRequest) { - return func(r *TransformPutTransformRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f TransformPutTransform) WithHeader(h map[string]string) func(*TransformPutTransformRequest) { - return func(r *TransformPutTransformRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f TransformPutTransform) WithOpaqueID(s string) func(*TransformPutTransformRequest) { - return func(r *TransformPutTransformRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.transform.start_transform.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.transform.start_transform.go deleted file mode 100644 index 0753476d1..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.transform.start_transform.go +++ /dev/null @@ -1,218 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" - "time" -) - -func newTransformStartTransformFunc(t Transport) TransformStartTransform { - return func(transform_id string, o ...func(*TransformStartTransformRequest)) (*Response, error) { - var r = TransformStartTransformRequest{TransformID: transform_id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// TransformStartTransform - Starts one or more transforms. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/start-transform.html. -// -type TransformStartTransform func(transform_id string, o ...func(*TransformStartTransformRequest)) (*Response, error) - -// TransformStartTransformRequest configures the Transform Start Transform API request. -// -type TransformStartTransformRequest struct { - TransformID string - - Timeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r TransformStartTransformRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_transform") + 1 + len(r.TransformID) + 1 + len("_start")) - path.WriteString("/") - path.WriteString("_transform") - path.WriteString("/") - path.WriteString(r.TransformID) - path.WriteString("/") - path.WriteString("_start") - - params = make(map[string]string) - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f TransformStartTransform) WithContext(v context.Context) func(*TransformStartTransformRequest) { - return func(r *TransformStartTransformRequest) { - r.ctx = v - } -} - -// WithTimeout - controls the time to wait for the transform to start. -// -func (f TransformStartTransform) WithTimeout(v time.Duration) func(*TransformStartTransformRequest) { - return func(r *TransformStartTransformRequest) { - r.Timeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f TransformStartTransform) WithPretty() func(*TransformStartTransformRequest) { - return func(r *TransformStartTransformRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f TransformStartTransform) WithHuman() func(*TransformStartTransformRequest) { - return func(r *TransformStartTransformRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f TransformStartTransform) WithErrorTrace() func(*TransformStartTransformRequest) { - return func(r *TransformStartTransformRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f TransformStartTransform) WithFilterPath(v ...string) func(*TransformStartTransformRequest) { - return func(r *TransformStartTransformRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f TransformStartTransform) WithHeader(h map[string]string) func(*TransformStartTransformRequest) { - return func(r *TransformStartTransformRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f TransformStartTransform) WithOpaqueID(s string) func(*TransformStartTransformRequest) { - return func(r *TransformStartTransformRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.transform.stop_transform.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.transform.stop_transform.go deleted file mode 100644 index e5a2bc4af..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.transform.stop_transform.go +++ /dev/null @@ -1,271 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" - "time" -) - -func newTransformStopTransformFunc(t Transport) TransformStopTransform { - return func(transform_id string, o ...func(*TransformStopTransformRequest)) (*Response, error) { - var r = TransformStopTransformRequest{TransformID: transform_id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// TransformStopTransform - Stops one or more transforms. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/stop-transform.html. -// -type TransformStopTransform func(transform_id string, o ...func(*TransformStopTransformRequest)) (*Response, error) - -// TransformStopTransformRequest configures the Transform Stop Transform API request. -// -type TransformStopTransformRequest struct { - TransformID string - - AllowNoMatch *bool - Force *bool - Timeout time.Duration - WaitForCheckpoint *bool - WaitForCompletion *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r TransformStopTransformRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_transform") + 1 + len(r.TransformID) + 1 + len("_stop")) - path.WriteString("/") - path.WriteString("_transform") - path.WriteString("/") - path.WriteString(r.TransformID) - path.WriteString("/") - path.WriteString("_stop") - - params = make(map[string]string) - - if r.AllowNoMatch != nil { - params["allow_no_match"] = strconv.FormatBool(*r.AllowNoMatch) - } - - if r.Force != nil { - params["force"] = strconv.FormatBool(*r.Force) - } - - if r.Timeout != 0 { - params["timeout"] = formatDuration(r.Timeout) - } - - if r.WaitForCheckpoint != nil { - params["wait_for_checkpoint"] = strconv.FormatBool(*r.WaitForCheckpoint) - } - - if r.WaitForCompletion != nil { - params["wait_for_completion"] = strconv.FormatBool(*r.WaitForCompletion) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f TransformStopTransform) WithContext(v context.Context) func(*TransformStopTransformRequest) { - return func(r *TransformStopTransformRequest) { - r.ctx = v - } -} - -// WithAllowNoMatch - whether to ignore if a wildcard expression matches no transforms. (this includes `_all` string or when no transforms have been specified). -// -func (f TransformStopTransform) WithAllowNoMatch(v bool) func(*TransformStopTransformRequest) { - return func(r *TransformStopTransformRequest) { - r.AllowNoMatch = &v - } -} - -// WithForce - whether to force stop a failed transform or not. default to false. -// -func (f TransformStopTransform) WithForce(v bool) func(*TransformStopTransformRequest) { - return func(r *TransformStopTransformRequest) { - r.Force = &v - } -} - -// WithTimeout - controls the time to wait until the transform has stopped. default to 30 seconds. -// -func (f TransformStopTransform) WithTimeout(v time.Duration) func(*TransformStopTransformRequest) { - return func(r *TransformStopTransformRequest) { - r.Timeout = v - } -} - -// WithWaitForCheckpoint - whether to wait for the transform to reach a checkpoint before stopping. default to false. -// -func (f TransformStopTransform) WithWaitForCheckpoint(v bool) func(*TransformStopTransformRequest) { - return func(r *TransformStopTransformRequest) { - r.WaitForCheckpoint = &v - } -} - -// WithWaitForCompletion - whether to wait for the transform to fully stop before returning or not. default to false. -// -func (f TransformStopTransform) WithWaitForCompletion(v bool) func(*TransformStopTransformRequest) { - return func(r *TransformStopTransformRequest) { - r.WaitForCompletion = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f TransformStopTransform) WithPretty() func(*TransformStopTransformRequest) { - return func(r *TransformStopTransformRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f TransformStopTransform) WithHuman() func(*TransformStopTransformRequest) { - return func(r *TransformStopTransformRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f TransformStopTransform) WithErrorTrace() func(*TransformStopTransformRequest) { - return func(r *TransformStopTransformRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f TransformStopTransform) WithFilterPath(v ...string) func(*TransformStopTransformRequest) { - return func(r *TransformStopTransformRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f TransformStopTransform) WithHeader(h map[string]string) func(*TransformStopTransformRequest) { - return func(r *TransformStopTransformRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f TransformStopTransform) WithOpaqueID(s string) func(*TransformStopTransformRequest) { - return func(r *TransformStopTransformRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.transform.update_transform.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.transform.update_transform.go deleted file mode 100644 index 9ef3f63eb..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.transform.update_transform.go +++ /dev/null @@ -1,225 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" -) - -func newTransformUpdateTransformFunc(t Transport) TransformUpdateTransform { - return func(body io.Reader, transform_id string, o ...func(*TransformUpdateTransformRequest)) (*Response, error) { - var r = TransformUpdateTransformRequest{Body: body, TransformID: transform_id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// TransformUpdateTransform - Updates certain properties of a transform. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/update-transform.html. -// -type TransformUpdateTransform func(body io.Reader, transform_id string, o ...func(*TransformUpdateTransformRequest)) (*Response, error) - -// TransformUpdateTransformRequest configures the Transform Update Transform API request. -// -type TransformUpdateTransformRequest struct { - Body io.Reader - - TransformID string - - DeferValidation *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r TransformUpdateTransformRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(1 + len("_transform") + 1 + len(r.TransformID) + 1 + len("_update")) - path.WriteString("/") - path.WriteString("_transform") - path.WriteString("/") - path.WriteString(r.TransformID) - path.WriteString("/") - path.WriteString("_update") - - params = make(map[string]string) - - if r.DeferValidation != nil { - params["defer_validation"] = strconv.FormatBool(*r.DeferValidation) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f TransformUpdateTransform) WithContext(v context.Context) func(*TransformUpdateTransformRequest) { - return func(r *TransformUpdateTransformRequest) { - r.ctx = v - } -} - -// WithDeferValidation - if validations should be deferred until transform starts, defaults to false.. -// -func (f TransformUpdateTransform) WithDeferValidation(v bool) func(*TransformUpdateTransformRequest) { - return func(r *TransformUpdateTransformRequest) { - r.DeferValidation = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f TransformUpdateTransform) WithPretty() func(*TransformUpdateTransformRequest) { - return func(r *TransformUpdateTransformRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f TransformUpdateTransform) WithHuman() func(*TransformUpdateTransformRequest) { - return func(r *TransformUpdateTransformRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f TransformUpdateTransform) WithErrorTrace() func(*TransformUpdateTransformRequest) { - return func(r *TransformUpdateTransformRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f TransformUpdateTransform) WithFilterPath(v ...string) func(*TransformUpdateTransformRequest) { - return func(r *TransformUpdateTransformRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f TransformUpdateTransform) WithHeader(h map[string]string) func(*TransformUpdateTransformRequest) { - return func(r *TransformUpdateTransformRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f TransformUpdateTransform) WithOpaqueID(s string) func(*TransformUpdateTransformRequest) { - return func(r *TransformUpdateTransformRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.watcher.ack_watch.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.watcher.ack_watch.go deleted file mode 100644 index 0d265bc02..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.watcher.ack_watch.go +++ /dev/null @@ -1,218 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newWatcherAckWatchFunc(t Transport) WatcherAckWatch { - return func(watch_id string, o ...func(*WatcherAckWatchRequest)) (*Response, error) { - var r = WatcherAckWatchRequest{WatchID: watch_id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// WatcherAckWatch - Acknowledges a watch, manually throttling the execution of the watch's actions. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-ack-watch.html. -// -type WatcherAckWatch func(watch_id string, o ...func(*WatcherAckWatchRequest)) (*Response, error) - -// WatcherAckWatchRequest configures the Watcher Ack Watch API request. -// -type WatcherAckWatchRequest struct { - ActionID []string - WatchID string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r WatcherAckWatchRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - path.Grow(1 + len("_watcher") + 1 + len("watch") + 1 + len(r.WatchID) + 1 + len("_ack") + 1 + len(strings.Join(r.ActionID, ","))) - path.WriteString("/") - path.WriteString("_watcher") - path.WriteString("/") - path.WriteString("watch") - path.WriteString("/") - path.WriteString(r.WatchID) - path.WriteString("/") - path.WriteString("_ack") - if len(r.ActionID) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.ActionID, ",")) - } - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f WatcherAckWatch) WithContext(v context.Context) func(*WatcherAckWatchRequest) { - return func(r *WatcherAckWatchRequest) { - r.ctx = v - } -} - -// WithActionID - a list of the action ids to be acked. -// -func (f WatcherAckWatch) WithActionID(v ...string) func(*WatcherAckWatchRequest) { - return func(r *WatcherAckWatchRequest) { - r.ActionID = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f WatcherAckWatch) WithPretty() func(*WatcherAckWatchRequest) { - return func(r *WatcherAckWatchRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f WatcherAckWatch) WithHuman() func(*WatcherAckWatchRequest) { - return func(r *WatcherAckWatchRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f WatcherAckWatch) WithErrorTrace() func(*WatcherAckWatchRequest) { - return func(r *WatcherAckWatchRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f WatcherAckWatch) WithFilterPath(v ...string) func(*WatcherAckWatchRequest) { - return func(r *WatcherAckWatchRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f WatcherAckWatch) WithHeader(h map[string]string) func(*WatcherAckWatchRequest) { - return func(r *WatcherAckWatchRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f WatcherAckWatch) WithOpaqueID(s string) func(*WatcherAckWatchRequest) { - return func(r *WatcherAckWatchRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.watcher.activate_watch.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.watcher.activate_watch.go deleted file mode 100644 index 872416d39..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.watcher.activate_watch.go +++ /dev/null @@ -1,205 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newWatcherActivateWatchFunc(t Transport) WatcherActivateWatch { - return func(watch_id string, o ...func(*WatcherActivateWatchRequest)) (*Response, error) { - var r = WatcherActivateWatchRequest{WatchID: watch_id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// WatcherActivateWatch - Activates a currently inactive watch. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-activate-watch.html. -// -type WatcherActivateWatch func(watch_id string, o ...func(*WatcherActivateWatchRequest)) (*Response, error) - -// WatcherActivateWatchRequest configures the Watcher Activate Watch API request. -// -type WatcherActivateWatchRequest struct { - WatchID string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r WatcherActivateWatchRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - path.Grow(1 + len("_watcher") + 1 + len("watch") + 1 + len(r.WatchID) + 1 + len("_activate")) - path.WriteString("/") - path.WriteString("_watcher") - path.WriteString("/") - path.WriteString("watch") - path.WriteString("/") - path.WriteString(r.WatchID) - path.WriteString("/") - path.WriteString("_activate") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f WatcherActivateWatch) WithContext(v context.Context) func(*WatcherActivateWatchRequest) { - return func(r *WatcherActivateWatchRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f WatcherActivateWatch) WithPretty() func(*WatcherActivateWatchRequest) { - return func(r *WatcherActivateWatchRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f WatcherActivateWatch) WithHuman() func(*WatcherActivateWatchRequest) { - return func(r *WatcherActivateWatchRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f WatcherActivateWatch) WithErrorTrace() func(*WatcherActivateWatchRequest) { - return func(r *WatcherActivateWatchRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f WatcherActivateWatch) WithFilterPath(v ...string) func(*WatcherActivateWatchRequest) { - return func(r *WatcherActivateWatchRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f WatcherActivateWatch) WithHeader(h map[string]string) func(*WatcherActivateWatchRequest) { - return func(r *WatcherActivateWatchRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f WatcherActivateWatch) WithOpaqueID(s string) func(*WatcherActivateWatchRequest) { - return func(r *WatcherActivateWatchRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.watcher.deactivate_watch.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.watcher.deactivate_watch.go deleted file mode 100644 index 1e1642dba..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.watcher.deactivate_watch.go +++ /dev/null @@ -1,205 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newWatcherDeactivateWatchFunc(t Transport) WatcherDeactivateWatch { - return func(watch_id string, o ...func(*WatcherDeactivateWatchRequest)) (*Response, error) { - var r = WatcherDeactivateWatchRequest{WatchID: watch_id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// WatcherDeactivateWatch - Deactivates a currently active watch. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-deactivate-watch.html. -// -type WatcherDeactivateWatch func(watch_id string, o ...func(*WatcherDeactivateWatchRequest)) (*Response, error) - -// WatcherDeactivateWatchRequest configures the Watcher Deactivate Watch API request. -// -type WatcherDeactivateWatchRequest struct { - WatchID string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r WatcherDeactivateWatchRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - path.Grow(1 + len("_watcher") + 1 + len("watch") + 1 + len(r.WatchID) + 1 + len("_deactivate")) - path.WriteString("/") - path.WriteString("_watcher") - path.WriteString("/") - path.WriteString("watch") - path.WriteString("/") - path.WriteString(r.WatchID) - path.WriteString("/") - path.WriteString("_deactivate") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f WatcherDeactivateWatch) WithContext(v context.Context) func(*WatcherDeactivateWatchRequest) { - return func(r *WatcherDeactivateWatchRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f WatcherDeactivateWatch) WithPretty() func(*WatcherDeactivateWatchRequest) { - return func(r *WatcherDeactivateWatchRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f WatcherDeactivateWatch) WithHuman() func(*WatcherDeactivateWatchRequest) { - return func(r *WatcherDeactivateWatchRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f WatcherDeactivateWatch) WithErrorTrace() func(*WatcherDeactivateWatchRequest) { - return func(r *WatcherDeactivateWatchRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f WatcherDeactivateWatch) WithFilterPath(v ...string) func(*WatcherDeactivateWatchRequest) { - return func(r *WatcherDeactivateWatchRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f WatcherDeactivateWatch) WithHeader(h map[string]string) func(*WatcherDeactivateWatchRequest) { - return func(r *WatcherDeactivateWatchRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f WatcherDeactivateWatch) WithOpaqueID(s string) func(*WatcherDeactivateWatchRequest) { - return func(r *WatcherDeactivateWatchRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.watcher.delete_watch.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.watcher.delete_watch.go deleted file mode 100644 index be21755f8..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.watcher.delete_watch.go +++ /dev/null @@ -1,203 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newWatcherDeleteWatchFunc(t Transport) WatcherDeleteWatch { - return func(id string, o ...func(*WatcherDeleteWatchRequest)) (*Response, error) { - var r = WatcherDeleteWatchRequest{WatchID: id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// WatcherDeleteWatch - Removes a watch from Watcher. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-delete-watch.html. -// -type WatcherDeleteWatch func(id string, o ...func(*WatcherDeleteWatchRequest)) (*Response, error) - -// WatcherDeleteWatchRequest configures the Watcher Delete Watch API request. -// -type WatcherDeleteWatchRequest struct { - WatchID string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r WatcherDeleteWatchRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "DELETE" - - path.Grow(1 + len("_watcher") + 1 + len("watch") + 1 + len(r.WatchID)) - path.WriteString("/") - path.WriteString("_watcher") - path.WriteString("/") - path.WriteString("watch") - path.WriteString("/") - path.WriteString(r.WatchID) - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f WatcherDeleteWatch) WithContext(v context.Context) func(*WatcherDeleteWatchRequest) { - return func(r *WatcherDeleteWatchRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f WatcherDeleteWatch) WithPretty() func(*WatcherDeleteWatchRequest) { - return func(r *WatcherDeleteWatchRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f WatcherDeleteWatch) WithHuman() func(*WatcherDeleteWatchRequest) { - return func(r *WatcherDeleteWatchRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f WatcherDeleteWatch) WithErrorTrace() func(*WatcherDeleteWatchRequest) { - return func(r *WatcherDeleteWatchRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f WatcherDeleteWatch) WithFilterPath(v ...string) func(*WatcherDeleteWatchRequest) { - return func(r *WatcherDeleteWatchRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f WatcherDeleteWatch) WithHeader(h map[string]string) func(*WatcherDeleteWatchRequest) { - return func(r *WatcherDeleteWatchRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f WatcherDeleteWatch) WithOpaqueID(s string) func(*WatcherDeleteWatchRequest) { - return func(r *WatcherDeleteWatchRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.watcher.execute_watch.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.watcher.execute_watch.go deleted file mode 100644 index bd512f71a..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.watcher.execute_watch.go +++ /dev/null @@ -1,245 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" -) - -func newWatcherExecuteWatchFunc(t Transport) WatcherExecuteWatch { - return func(o ...func(*WatcherExecuteWatchRequest)) (*Response, error) { - var r = WatcherExecuteWatchRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// WatcherExecuteWatch - Forces the execution of a stored watch. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-execute-watch.html. -// -type WatcherExecuteWatch func(o ...func(*WatcherExecuteWatchRequest)) (*Response, error) - -// WatcherExecuteWatchRequest configures the Watcher Execute Watch API request. -// -type WatcherExecuteWatchRequest struct { - WatchID string - - Body io.Reader - - Debug *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r WatcherExecuteWatchRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - path.Grow(1 + len("_watcher") + 1 + len("watch") + 1 + len(r.WatchID) + 1 + len("_execute")) - path.WriteString("/") - path.WriteString("_watcher") - path.WriteString("/") - path.WriteString("watch") - if r.WatchID != "" { - path.WriteString("/") - path.WriteString(r.WatchID) - } - path.WriteString("/") - path.WriteString("_execute") - - params = make(map[string]string) - - if r.Debug != nil { - params["debug"] = strconv.FormatBool(*r.Debug) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f WatcherExecuteWatch) WithContext(v context.Context) func(*WatcherExecuteWatchRequest) { - return func(r *WatcherExecuteWatchRequest) { - r.ctx = v - } -} - -// WithBody - Execution control. -// -func (f WatcherExecuteWatch) WithBody(v io.Reader) func(*WatcherExecuteWatchRequest) { - return func(r *WatcherExecuteWatchRequest) { - r.Body = v - } -} - -// WithWatchID - watch ID. -// -func (f WatcherExecuteWatch) WithWatchID(v string) func(*WatcherExecuteWatchRequest) { - return func(r *WatcherExecuteWatchRequest) { - r.WatchID = v - } -} - -// WithDebug - indicates whether the watch should execute in debug mode. -// -func (f WatcherExecuteWatch) WithDebug(v bool) func(*WatcherExecuteWatchRequest) { - return func(r *WatcherExecuteWatchRequest) { - r.Debug = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f WatcherExecuteWatch) WithPretty() func(*WatcherExecuteWatchRequest) { - return func(r *WatcherExecuteWatchRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f WatcherExecuteWatch) WithHuman() func(*WatcherExecuteWatchRequest) { - return func(r *WatcherExecuteWatchRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f WatcherExecuteWatch) WithErrorTrace() func(*WatcherExecuteWatchRequest) { - return func(r *WatcherExecuteWatchRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f WatcherExecuteWatch) WithFilterPath(v ...string) func(*WatcherExecuteWatchRequest) { - return func(r *WatcherExecuteWatchRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f WatcherExecuteWatch) WithHeader(h map[string]string) func(*WatcherExecuteWatchRequest) { - return func(r *WatcherExecuteWatchRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f WatcherExecuteWatch) WithOpaqueID(s string) func(*WatcherExecuteWatchRequest) { - return func(r *WatcherExecuteWatchRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.watcher.get_watch.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.watcher.get_watch.go deleted file mode 100644 index c602f1535..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.watcher.get_watch.go +++ /dev/null @@ -1,203 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newWatcherGetWatchFunc(t Transport) WatcherGetWatch { - return func(id string, o ...func(*WatcherGetWatchRequest)) (*Response, error) { - var r = WatcherGetWatchRequest{WatchID: id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// WatcherGetWatch - Retrieves a watch by its ID. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-get-watch.html. -// -type WatcherGetWatch func(id string, o ...func(*WatcherGetWatchRequest)) (*Response, error) - -// WatcherGetWatchRequest configures the Watcher Get Watch API request. -// -type WatcherGetWatchRequest struct { - WatchID string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r WatcherGetWatchRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_watcher") + 1 + len("watch") + 1 + len(r.WatchID)) - path.WriteString("/") - path.WriteString("_watcher") - path.WriteString("/") - path.WriteString("watch") - path.WriteString("/") - path.WriteString(r.WatchID) - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f WatcherGetWatch) WithContext(v context.Context) func(*WatcherGetWatchRequest) { - return func(r *WatcherGetWatchRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f WatcherGetWatch) WithPretty() func(*WatcherGetWatchRequest) { - return func(r *WatcherGetWatchRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f WatcherGetWatch) WithHuman() func(*WatcherGetWatchRequest) { - return func(r *WatcherGetWatchRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f WatcherGetWatch) WithErrorTrace() func(*WatcherGetWatchRequest) { - return func(r *WatcherGetWatchRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f WatcherGetWatch) WithFilterPath(v ...string) func(*WatcherGetWatchRequest) { - return func(r *WatcherGetWatchRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f WatcherGetWatch) WithHeader(h map[string]string) func(*WatcherGetWatchRequest) { - return func(r *WatcherGetWatchRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f WatcherGetWatch) WithOpaqueID(s string) func(*WatcherGetWatchRequest) { - return func(r *WatcherGetWatchRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.watcher.put_watch.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.watcher.put_watch.go deleted file mode 100644 index c31c96082..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.watcher.put_watch.go +++ /dev/null @@ -1,272 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strconv" - "strings" -) - -func newWatcherPutWatchFunc(t Transport) WatcherPutWatch { - return func(id string, o ...func(*WatcherPutWatchRequest)) (*Response, error) { - var r = WatcherPutWatchRequest{WatchID: id} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// WatcherPutWatch - Creates a new watch, or updates an existing one. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-put-watch.html. -// -type WatcherPutWatch func(id string, o ...func(*WatcherPutWatchRequest)) (*Response, error) - -// WatcherPutWatchRequest configures the Watcher Put Watch API request. -// -type WatcherPutWatchRequest struct { - WatchID string - - Body io.Reader - - Active *bool - IfPrimaryTerm *int - IfSeqNo *int - Version *int - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r WatcherPutWatchRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "PUT" - - path.Grow(1 + len("_watcher") + 1 + len("watch") + 1 + len(r.WatchID)) - path.WriteString("/") - path.WriteString("_watcher") - path.WriteString("/") - path.WriteString("watch") - path.WriteString("/") - path.WriteString(r.WatchID) - - params = make(map[string]string) - - if r.Active != nil { - params["active"] = strconv.FormatBool(*r.Active) - } - - if r.IfPrimaryTerm != nil { - params["if_primary_term"] = strconv.FormatInt(int64(*r.IfPrimaryTerm), 10) - } - - if r.IfSeqNo != nil { - params["if_seq_no"] = strconv.FormatInt(int64(*r.IfSeqNo), 10) - } - - if r.Version != nil { - params["version"] = strconv.FormatInt(int64(*r.Version), 10) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f WatcherPutWatch) WithContext(v context.Context) func(*WatcherPutWatchRequest) { - return func(r *WatcherPutWatchRequest) { - r.ctx = v - } -} - -// WithBody - The watch. -// -func (f WatcherPutWatch) WithBody(v io.Reader) func(*WatcherPutWatchRequest) { - return func(r *WatcherPutWatchRequest) { - r.Body = v - } -} - -// WithActive - specify whether the watch is in/active by default. -// -func (f WatcherPutWatch) WithActive(v bool) func(*WatcherPutWatchRequest) { - return func(r *WatcherPutWatchRequest) { - r.Active = &v - } -} - -// WithIfPrimaryTerm - only update the watch if the last operation that has changed the watch has the specified primary term. -// -func (f WatcherPutWatch) WithIfPrimaryTerm(v int) func(*WatcherPutWatchRequest) { - return func(r *WatcherPutWatchRequest) { - r.IfPrimaryTerm = &v - } -} - -// WithIfSeqNo - only update the watch if the last operation that has changed the watch has the specified sequence number. -// -func (f WatcherPutWatch) WithIfSeqNo(v int) func(*WatcherPutWatchRequest) { - return func(r *WatcherPutWatchRequest) { - r.IfSeqNo = &v - } -} - -// WithVersion - explicit version number for concurrency control. -// -func (f WatcherPutWatch) WithVersion(v int) func(*WatcherPutWatchRequest) { - return func(r *WatcherPutWatchRequest) { - r.Version = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f WatcherPutWatch) WithPretty() func(*WatcherPutWatchRequest) { - return func(r *WatcherPutWatchRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f WatcherPutWatch) WithHuman() func(*WatcherPutWatchRequest) { - return func(r *WatcherPutWatchRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f WatcherPutWatch) WithErrorTrace() func(*WatcherPutWatchRequest) { - return func(r *WatcherPutWatchRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f WatcherPutWatch) WithFilterPath(v ...string) func(*WatcherPutWatchRequest) { - return func(r *WatcherPutWatchRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f WatcherPutWatch) WithHeader(h map[string]string) func(*WatcherPutWatchRequest) { - return func(r *WatcherPutWatchRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f WatcherPutWatch) WithOpaqueID(s string) func(*WatcherPutWatchRequest) { - return func(r *WatcherPutWatchRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.watcher.query_watches.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.watcher.query_watches.go deleted file mode 100644 index 81f50267b..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.watcher.query_watches.go +++ /dev/null @@ -1,211 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "io" - "net/http" - "strings" -) - -func newWatcherQueryWatchesFunc(t Transport) WatcherQueryWatches { - return func(o ...func(*WatcherQueryWatchesRequest)) (*Response, error) { - var r = WatcherQueryWatchesRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// WatcherQueryWatches - Retrieves stored watches. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-query-watches.html. -// -type WatcherQueryWatches func(o ...func(*WatcherQueryWatchesRequest)) (*Response, error) - -// WatcherQueryWatchesRequest configures the Watcher Query Watches API request. -// -type WatcherQueryWatchesRequest struct { - Body io.Reader - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r WatcherQueryWatchesRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(len("/_watcher/_query/watches")) - path.WriteString("/_watcher/_query/watches") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), r.Body) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if r.Body != nil { - req.Header[headerContentType] = headerContentTypeJSON - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f WatcherQueryWatches) WithContext(v context.Context) func(*WatcherQueryWatchesRequest) { - return func(r *WatcherQueryWatchesRequest) { - r.ctx = v - } -} - -// WithBody - From, size, query, sort and search_after. -// -func (f WatcherQueryWatches) WithBody(v io.Reader) func(*WatcherQueryWatchesRequest) { - return func(r *WatcherQueryWatchesRequest) { - r.Body = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f WatcherQueryWatches) WithPretty() func(*WatcherQueryWatchesRequest) { - return func(r *WatcherQueryWatchesRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f WatcherQueryWatches) WithHuman() func(*WatcherQueryWatchesRequest) { - return func(r *WatcherQueryWatchesRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f WatcherQueryWatches) WithErrorTrace() func(*WatcherQueryWatchesRequest) { - return func(r *WatcherQueryWatchesRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f WatcherQueryWatches) WithFilterPath(v ...string) func(*WatcherQueryWatchesRequest) { - return func(r *WatcherQueryWatchesRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f WatcherQueryWatches) WithHeader(h map[string]string) func(*WatcherQueryWatchesRequest) { - return func(r *WatcherQueryWatchesRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f WatcherQueryWatches) WithOpaqueID(s string) func(*WatcherQueryWatchesRequest) { - return func(r *WatcherQueryWatchesRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.watcher.start.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.watcher.start.go deleted file mode 100644 index 78b0f646e..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.watcher.start.go +++ /dev/null @@ -1,196 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newWatcherStartFunc(t Transport) WatcherStart { - return func(o ...func(*WatcherStartRequest)) (*Response, error) { - var r = WatcherStartRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// WatcherStart - Starts Watcher if it is not already running. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-start.html. -// -type WatcherStart func(o ...func(*WatcherStartRequest)) (*Response, error) - -// WatcherStartRequest configures the Watcher Start API request. -// -type WatcherStartRequest struct { - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r WatcherStartRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(len("/_watcher/_start")) - path.WriteString("/_watcher/_start") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f WatcherStart) WithContext(v context.Context) func(*WatcherStartRequest) { - return func(r *WatcherStartRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f WatcherStart) WithPretty() func(*WatcherStartRequest) { - return func(r *WatcherStartRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f WatcherStart) WithHuman() func(*WatcherStartRequest) { - return func(r *WatcherStartRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f WatcherStart) WithErrorTrace() func(*WatcherStartRequest) { - return func(r *WatcherStartRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f WatcherStart) WithFilterPath(v ...string) func(*WatcherStartRequest) { - return func(r *WatcherStartRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f WatcherStart) WithHeader(h map[string]string) func(*WatcherStartRequest) { - return func(r *WatcherStartRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f WatcherStart) WithOpaqueID(s string) func(*WatcherStartRequest) { - return func(r *WatcherStartRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.watcher.stats.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.watcher.stats.go deleted file mode 100644 index 9bae053c8..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.watcher.stats.go +++ /dev/null @@ -1,232 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newWatcherStatsFunc(t Transport) WatcherStats { - return func(o ...func(*WatcherStatsRequest)) (*Response, error) { - var r = WatcherStatsRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// WatcherStats - Retrieves the current Watcher metrics. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-stats.html. -// -type WatcherStats func(o ...func(*WatcherStatsRequest)) (*Response, error) - -// WatcherStatsRequest configures the Watcher Stats API request. -// -type WatcherStatsRequest struct { - Metric []string - - EmitStacktraces *bool - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r WatcherStatsRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(1 + len("_watcher") + 1 + len("stats") + 1 + len(strings.Join(r.Metric, ","))) - path.WriteString("/") - path.WriteString("_watcher") - path.WriteString("/") - path.WriteString("stats") - if len(r.Metric) > 0 { - path.WriteString("/") - path.WriteString(strings.Join(r.Metric, ",")) - } - - params = make(map[string]string) - - if r.EmitStacktraces != nil { - params["emit_stacktraces"] = strconv.FormatBool(*r.EmitStacktraces) - } - - if len(r.Metric) > 0 { - params["metric"] = strings.Join(r.Metric, ",") - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f WatcherStats) WithContext(v context.Context) func(*WatcherStatsRequest) { - return func(r *WatcherStatsRequest) { - r.ctx = v - } -} - -// WithMetric - controls what additional stat metrics should be include in the response. -// -func (f WatcherStats) WithMetric(v ...string) func(*WatcherStatsRequest) { - return func(r *WatcherStatsRequest) { - r.Metric = v - } -} - -// WithEmitStacktraces - emits stack traces of currently running watches. -// -func (f WatcherStats) WithEmitStacktraces(v bool) func(*WatcherStatsRequest) { - return func(r *WatcherStatsRequest) { - r.EmitStacktraces = &v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f WatcherStats) WithPretty() func(*WatcherStatsRequest) { - return func(r *WatcherStatsRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f WatcherStats) WithHuman() func(*WatcherStatsRequest) { - return func(r *WatcherStatsRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f WatcherStats) WithErrorTrace() func(*WatcherStatsRequest) { - return func(r *WatcherStatsRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f WatcherStats) WithFilterPath(v ...string) func(*WatcherStatsRequest) { - return func(r *WatcherStatsRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f WatcherStats) WithHeader(h map[string]string) func(*WatcherStatsRequest) { - return func(r *WatcherStatsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f WatcherStats) WithOpaqueID(s string) func(*WatcherStatsRequest) { - return func(r *WatcherStatsRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.watcher.stop.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.watcher.stop.go deleted file mode 100644 index a34b7f8fa..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.watcher.stop.go +++ /dev/null @@ -1,196 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" -) - -func newWatcherStopFunc(t Transport) WatcherStop { - return func(o ...func(*WatcherStopRequest)) (*Response, error) { - var r = WatcherStopRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// WatcherStop - Stops Watcher if it is running. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-stop.html. -// -type WatcherStop func(o ...func(*WatcherStopRequest)) (*Response, error) - -// WatcherStopRequest configures the Watcher Stop API request. -// -type WatcherStopRequest struct { - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r WatcherStopRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "POST" - - path.Grow(len("/_watcher/_stop")) - path.WriteString("/_watcher/_stop") - - params = make(map[string]string) - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f WatcherStop) WithContext(v context.Context) func(*WatcherStopRequest) { - return func(r *WatcherStopRequest) { - r.ctx = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f WatcherStop) WithPretty() func(*WatcherStopRequest) { - return func(r *WatcherStopRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f WatcherStop) WithHuman() func(*WatcherStopRequest) { - return func(r *WatcherStopRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f WatcherStop) WithErrorTrace() func(*WatcherStopRequest) { - return func(r *WatcherStopRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f WatcherStop) WithFilterPath(v ...string) func(*WatcherStopRequest) { - return func(r *WatcherStopRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f WatcherStop) WithHeader(h map[string]string) func(*WatcherStopRequest) { - return func(r *WatcherStopRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f WatcherStop) WithOpaqueID(s string) func(*WatcherStopRequest) { - return func(r *WatcherStopRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.xpack.info.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.xpack.info.go deleted file mode 100644 index 09c7c1afe..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.xpack.info.go +++ /dev/null @@ -1,224 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strconv" - "strings" -) - -func newXPackInfoFunc(t Transport) XPackInfo { - return func(o ...func(*XPackInfoRequest)) (*Response, error) { - var r = XPackInfoRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// XPackInfo - Retrieves information about the installed X-Pack features. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/info-api.html. -// -type XPackInfo func(o ...func(*XPackInfoRequest)) (*Response, error) - -// XPackInfoRequest configures the X Pack Info API request. -// -type XPackInfoRequest struct { - AcceptEnterprise *bool - Categories []string - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r XPackInfoRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(len("/_xpack")) - path.WriteString("/_xpack") - - params = make(map[string]string) - - if r.AcceptEnterprise != nil { - params["accept_enterprise"] = strconv.FormatBool(*r.AcceptEnterprise) - } - - if len(r.Categories) > 0 { - params["categories"] = strings.Join(r.Categories, ",") - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f XPackInfo) WithContext(v context.Context) func(*XPackInfoRequest) { - return func(r *XPackInfoRequest) { - r.ctx = v - } -} - -// WithAcceptEnterprise - if an enterprise license is installed, return the type and mode as 'enterprise' (default: false). -// -func (f XPackInfo) WithAcceptEnterprise(v bool) func(*XPackInfoRequest) { - return func(r *XPackInfoRequest) { - r.AcceptEnterprise = &v - } -} - -// WithCategories - comma-separated list of info categories. can be any of: build, license, features. -// -func (f XPackInfo) WithCategories(v ...string) func(*XPackInfoRequest) { - return func(r *XPackInfoRequest) { - r.Categories = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f XPackInfo) WithPretty() func(*XPackInfoRequest) { - return func(r *XPackInfoRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f XPackInfo) WithHuman() func(*XPackInfoRequest) { - return func(r *XPackInfoRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f XPackInfo) WithErrorTrace() func(*XPackInfoRequest) { - return func(r *XPackInfoRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f XPackInfo) WithFilterPath(v ...string) func(*XPackInfoRequest) { - return func(r *XPackInfoRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f XPackInfo) WithHeader(h map[string]string) func(*XPackInfoRequest) { - return func(r *XPackInfoRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f XPackInfo) WithOpaqueID(s string) func(*XPackInfoRequest) { - return func(r *XPackInfoRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.xpack.usage.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.xpack.usage.go deleted file mode 100644 index d6fec7ee2..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.xpack.usage.go +++ /dev/null @@ -1,211 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// -// Code generated from specification version 7.13.1: DO NOT EDIT - -package esapi - -import ( - "context" - "net/http" - "strings" - "time" -) - -func newXPackUsageFunc(t Transport) XPackUsage { - return func(o ...func(*XPackUsageRequest)) (*Response, error) { - var r = XPackUsageRequest{} - for _, f := range o { - f(&r) - } - return r.Do(r.ctx, t) - } -} - -// ----- API Definition ------------------------------------------------------- - -// XPackUsage - Retrieves usage information about the installed X-Pack features. -// -// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/usage-api.html. -// -type XPackUsage func(o ...func(*XPackUsageRequest)) (*Response, error) - -// XPackUsageRequest configures the X Pack Usage API request. -// -type XPackUsageRequest struct { - MasterTimeout time.Duration - - Pretty bool - Human bool - ErrorTrace bool - FilterPath []string - - Header http.Header - - ctx context.Context -} - -// Do executes the request and returns response or error. -// -func (r XPackUsageRequest) Do(ctx context.Context, transport Transport) (*Response, error) { - var ( - method string - path strings.Builder - params map[string]string - ) - - method = "GET" - - path.Grow(len("/_xpack/usage")) - path.WriteString("/_xpack/usage") - - params = make(map[string]string) - - if r.MasterTimeout != 0 { - params["master_timeout"] = formatDuration(r.MasterTimeout) - } - - if r.Pretty { - params["pretty"] = "true" - } - - if r.Human { - params["human"] = "true" - } - - if r.ErrorTrace { - params["error_trace"] = "true" - } - - if len(r.FilterPath) > 0 { - params["filter_path"] = strings.Join(r.FilterPath, ",") - } - - req, err := newRequest(method, path.String(), nil) - if err != nil { - return nil, err - } - - if len(params) > 0 { - q := req.URL.Query() - for k, v := range params { - q.Set(k, v) - } - req.URL.RawQuery = q.Encode() - } - - if len(r.Header) > 0 { - if len(req.Header) == 0 { - req.Header = r.Header - } else { - for k, vv := range r.Header { - for _, v := range vv { - req.Header.Add(k, v) - } - } - } - } - - if ctx != nil { - req = req.WithContext(ctx) - } - - res, err := transport.Perform(req) - if err != nil { - return nil, err - } - - response := Response{ - StatusCode: res.StatusCode, - Body: res.Body, - Header: res.Header, - } - - return &response, nil -} - -// WithContext sets the request context. -// -func (f XPackUsage) WithContext(v context.Context) func(*XPackUsageRequest) { - return func(r *XPackUsageRequest) { - r.ctx = v - } -} - -// WithMasterTimeout - specify timeout for watch write operation. -// -func (f XPackUsage) WithMasterTimeout(v time.Duration) func(*XPackUsageRequest) { - return func(r *XPackUsageRequest) { - r.MasterTimeout = v - } -} - -// WithPretty makes the response body pretty-printed. -// -func (f XPackUsage) WithPretty() func(*XPackUsageRequest) { - return func(r *XPackUsageRequest) { - r.Pretty = true - } -} - -// WithHuman makes statistical values human-readable. -// -func (f XPackUsage) WithHuman() func(*XPackUsageRequest) { - return func(r *XPackUsageRequest) { - r.Human = true - } -} - -// WithErrorTrace includes the stack trace for errors in the response body. -// -func (f XPackUsage) WithErrorTrace() func(*XPackUsageRequest) { - return func(r *XPackUsageRequest) { - r.ErrorTrace = true - } -} - -// WithFilterPath filters the properties of the response body. -// -func (f XPackUsage) WithFilterPath(v ...string) func(*XPackUsageRequest) { - return func(r *XPackUsageRequest) { - r.FilterPath = v - } -} - -// WithHeader adds the headers to the HTTP request. -// -func (f XPackUsage) WithHeader(h map[string]string) func(*XPackUsageRequest) { - return func(r *XPackUsageRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - for k, v := range h { - r.Header.Add(k, v) - } - } -} - -// WithOpaqueID adds the X-Opaque-Id header to the HTTP request. -// -func (f XPackUsage) WithOpaqueID(s string) func(*XPackUsageRequest) { - return func(r *XPackUsageRequest) { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set("X-Opaque-Id", s) - } -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/doc.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/doc.go deleted file mode 100644 index 404d6bca9..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/doc.go +++ /dev/null @@ -1,112 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -/* -Package esapi provides the Go API for Elasticsearch. - -It is automatically included in the client provided by the -github.com/elastic/go-elasticsearch package: - - es, _ := elasticsearch.NewDefaultClient() - res, _ := es.Info() - log.Println(res) - -For each Elasticsearch API, such as "Index", the package exports two corresponding types: -a function and a struct. - -The function type allows you to call the Elasticsearch API as a method on the client, -passing the parameters as arguments: - - res, err := es.Index( - "test", // Index name - strings.NewReader(`{"title" : "Test"}`), // Document body - es.Index.WithDocumentID("1"), // Document ID - es.Index.WithRefresh("true"), // Refresh - ) - if err != nil { - log.Fatalf("ERROR: %s", err) - } - defer res.Body.Close() - - log.Println(res) - - // => [201 Created] {"_index":"test","_type":"_doc","_id":"1" ... - -The struct type allows for a more hands-on approach, where you create a new struct, with the -request configuration as fields, and call the Do() method -with a context and the client as arguments: - - req := esapi.IndexRequest{ - Index: "test", // Index name - Body: strings.NewReader(`{"title" : "Test"}`), // Document body - DocumentID: "1", // Document ID - Refresh: "true", // Refresh - } - - res, err := req.Do(context.Background(), es) - if err != nil { - log.Fatalf("Error getting response: %s", err) - } - defer res.Body.Close() - - log.Println(res) - - // => [200 OK] {"_index":"test","_type":"_doc","_id":"1","_version":2 ... - -The function type is a wrapper around the struct, and allows -to configure and perform the request in a more expressive way. -It has a minor overhead compared to using a struct directly; -refer to the esapi_benchmark_test.go suite for concrete numbers. - -See the documentation for each API function or struct at -https://godoc.org/github.com/elastic/go-elasticsearch, -or locally by: - - go doc github.com/elastic/go-elasticsearch/v7/esapi Index - go doc github.com/elastic/go-elasticsearch/v7/esapi IndexRequest - -Response - -The esapi.Response type is a lightweight wrapper around http.Response. - -The res.Body field is an io.ReadCloser, leaving the JSON parsing to the -calling code, in the interest of performance and flexibility -(eg. to allow using a custom JSON parser). - -It is imperative to close the response body for a non-nil response. - -The Response type implements a couple of convenience methods for accessing -the status, checking an error status code or printing -the response body for debugging purposes. - -Additional Information - -See the Elasticsearch documentation at -https://www.elastic.co/guide/en/elasticsearch/reference/master/api-conventions.html for detailed information -about the API endpoints and parameters. - -The Go API is generated from the Elasticsearch JSON specification at -https://github.com/elastic/elasticsearch/tree/master/rest-api-spec/src/main/resources/rest-api-spec/api -by the internal package available at -https://github.com/elastic/go-elasticsearch/tree/master/internal/cmd/generate/commands/gensource. - -The API is tested by integration tests common to all Elasticsearch official clients, generated from the -source at https://github.com/elastic/elasticsearch/tree/master/rest-api-spec/src/main/resources/rest-api-spec/test. -The generator is provided by the internal package available at internal/cmd/generate/commands/gentests. - -*/ -package esapi diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/esapi.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/esapi.go deleted file mode 100644 index 2efb1c2f9..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/esapi.go +++ /dev/null @@ -1,62 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -package esapi - -import ( - "net/http" - "strconv" - "time" - - "github.com/elastic/go-elasticsearch/v7/internal/version" -) - -// Version returns the package version as a string. -// -const Version = version.Client - -// Transport defines the interface for an API client. -// -type Transport interface { - Perform(*http.Request) (*http.Response, error) -} - -// BoolPtr returns a pointer to v. -// -// It is used as a convenience function for converting a bool value -// into a pointer when passing the value to a function or struct field -// which expects a pointer. -// -func BoolPtr(v bool) *bool { return &v } - -// IntPtr returns a pointer to v. -// -// It is used as a convenience function for converting an int value -// into a pointer when passing the value to a function or struct field -// which expects a pointer. -// -func IntPtr(v int) *int { return &v } - -// formatDuration converts duration to a string in the format -// accepted by Elasticsearch. -// -func formatDuration(d time.Duration) string { - if d < time.Millisecond { - return strconv.FormatInt(int64(d), 10) + "nanos" - } - return strconv.FormatInt(int64(d)/int64(time.Millisecond), 10) + "ms" -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/esapi.request.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/esapi.request.go deleted file mode 100644 index 234983615..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/esapi.request.go +++ /dev/null @@ -1,44 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -package esapi - -import ( - "context" - "io" - "net/http" -) - -const ( - headerContentType = "Content-Type" -) - -var ( - headerContentTypeJSON = []string{"application/json"} -) - -// Request defines the API request. -// -type Request interface { - Do(ctx context.Context, transport Transport) (*Response, error) -} - -// newRequest creates an HTTP request. -// -func newRequest(method, path string, body io.Reader) (*http.Request, error) { - return http.NewRequest(method, path, body) -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/esapi.response.go b/vendor/github.com/elastic/go-elasticsearch/v7/esapi/esapi.response.go deleted file mode 100644 index a657b5ee9..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esapi/esapi.response.go +++ /dev/null @@ -1,105 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -package esapi - -import ( - "bytes" - "fmt" - "io" - "io/ioutil" - "net/http" - "strconv" - "strings" -) - -// Response represents the API response. -// -type Response struct { - StatusCode int - Header http.Header - Body io.ReadCloser -} - -// String returns the response as a string. -// -// The intended usage is for testing or debugging only. -// -func (r *Response) String() string { - var ( - out = new(bytes.Buffer) - b1 = bytes.NewBuffer([]byte{}) - b2 = bytes.NewBuffer([]byte{}) - tr io.Reader - ) - - if r != nil && r.Body != nil { - tr = io.TeeReader(r.Body, b1) - defer r.Body.Close() - - if _, err := io.Copy(b2, tr); err != nil { - out.WriteString(fmt.Sprintf("", err)) - return out.String() - } - defer func() { r.Body = ioutil.NopCloser(b1) }() - } - - if r != nil { - out.WriteString(fmt.Sprintf("[%d %s]", r.StatusCode, http.StatusText(r.StatusCode))) - if r.StatusCode > 0 { - out.WriteRune(' ') - } - } else { - out.WriteString("[0 ]") - } - - if r != nil && r.Body != nil { - out.ReadFrom(b2) // errcheck exclude (*bytes.Buffer).ReadFrom - } - - return out.String() -} - -// Status returns the response status as a string. -// -func (r *Response) Status() string { - var b strings.Builder - if r != nil { - b.WriteString(strconv.Itoa(r.StatusCode)) - b.WriteString(" ") - b.WriteString(http.StatusText(r.StatusCode)) - } - return b.String() -} - -// IsError returns true when the response status indicates failure. -// -func (r *Response) IsError() bool { - return r.StatusCode > 299 -} - -// Warnings returns the deprecation warnings from response headers. -// -func (r *Response) Warnings() []string { - return r.Header["Warning"] -} - -// HasWarnings returns true when the response headers contain deprecation warnings. -// -func (r *Response) HasWarnings() bool { - return len(r.Warnings()) > 0 -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/estransport/connection.go b/vendor/github.com/elastic/go-elasticsearch/v7/estransport/connection.go deleted file mode 100644 index 53eb081b5..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/estransport/connection.go +++ /dev/null @@ -1,329 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -package estransport - -import ( - "errors" - "fmt" - "math" - "net/url" - "sort" - "sync" - "time" -) - -var ( - defaultResurrectTimeoutInitial = 60 * time.Second - defaultResurrectTimeoutFactorCutoff = 5 -) - -// Selector defines the interface for selecting connections from the pool. -// -type Selector interface { - Select([]*Connection) (*Connection, error) -} - -// ConnectionPool defines the interface for the connection pool. -// -type ConnectionPool interface { - Next() (*Connection, error) // Next returns the next available connection. - OnSuccess(*Connection) error // OnSuccess reports that the connection was successful. - OnFailure(*Connection) error // OnFailure reports that the connection failed. - URLs() []*url.URL // URLs returns the list of URLs of available connections. -} - -// Connection represents a connection to a node. -// -type Connection struct { - sync.Mutex - - URL *url.URL - IsDead bool - DeadSince time.Time - Failures int - - ID string - Name string - Roles []string - Attributes map[string]interface{} -} - -type singleConnectionPool struct { - connection *Connection - - metrics *metrics -} - -type statusConnectionPool struct { - sync.Mutex - - live []*Connection // List of live connections - dead []*Connection // List of dead connections - selector Selector - - metrics *metrics -} - -type roundRobinSelector struct { - sync.Mutex - - curr int // Index of the current connection -} - -// NewConnectionPool creates and returns a default connection pool. -// -func NewConnectionPool(conns []*Connection, selector Selector) (ConnectionPool, error) { - if len(conns) == 1 { - return &singleConnectionPool{connection: conns[0]}, nil - } - if selector == nil { - selector = &roundRobinSelector{curr: -1} - } - return &statusConnectionPool{live: conns, selector: selector}, nil -} - -// Next returns the connection from pool. -// -func (cp *singleConnectionPool) Next() (*Connection, error) { - return cp.connection, nil -} - -// OnSuccess is a no-op for single connection pool. -func (cp *singleConnectionPool) OnSuccess(c *Connection) error { return nil } - -// OnFailure is a no-op for single connection pool. -func (cp *singleConnectionPool) OnFailure(c *Connection) error { return nil } - -// URLs returns the list of URLs of available connections. -func (cp *singleConnectionPool) URLs() []*url.URL { return []*url.URL{cp.connection.URL} } - -func (cp *singleConnectionPool) connections() []*Connection { return []*Connection{cp.connection} } - -// Next returns a connection from pool, or an error. -// -func (cp *statusConnectionPool) Next() (*Connection, error) { - cp.Lock() - defer cp.Unlock() - - // Return next live connection - if len(cp.live) > 0 { - return cp.selector.Select(cp.live) - } else if len(cp.dead) > 0 { - // No live connection is available, resurrect one of the dead ones. - c := cp.dead[len(cp.dead)-1] - cp.dead = cp.dead[:len(cp.dead)-1] - c.Lock() - defer c.Unlock() - cp.resurrect(c, false) - return c, nil - } - return nil, errors.New("no connection available") -} - -// OnSuccess marks the connection as successful. -// -func (cp *statusConnectionPool) OnSuccess(c *Connection) error { - c.Lock() - defer c.Unlock() - - // Short-circuit for live connection - if !c.IsDead { - return nil - } - - c.markAsHealthy() - - cp.Lock() - defer cp.Unlock() - return cp.resurrect(c, true) -} - -// OnFailure marks the connection as failed. -// -func (cp *statusConnectionPool) OnFailure(c *Connection) error { - cp.Lock() - defer cp.Unlock() - - c.Lock() - - if c.IsDead { - if debugLogger != nil { - debugLogger.Logf("Already removed %s\n", c.URL) - } - c.Unlock() - return nil - } - - if debugLogger != nil { - debugLogger.Logf("Removing %s...\n", c.URL) - } - c.markAsDead() - cp.scheduleResurrect(c) - c.Unlock() - - // Push item to dead list and sort slice by number of failures - cp.dead = append(cp.dead, c) - sort.Slice(cp.dead, func(i, j int) bool { - c1 := cp.dead[i] - c2 := cp.dead[j] - c1.Lock() - c2.Lock() - defer c1.Unlock() - defer c2.Unlock() - - res := c1.Failures > c2.Failures - return res - }) - - // Check if connection exists in the list, return error if not. - index := -1 - for i, conn := range cp.live { - if conn == c { - index = i - } - } - if index < 0 { - return errors.New("connection not in live list") - } - - // Remove item; https://github.com/golang/go/wiki/SliceTricks - copy(cp.live[index:], cp.live[index+1:]) - cp.live = cp.live[:len(cp.live)-1] - - return nil -} - -// URLs returns the list of URLs of available connections. -// -func (cp *statusConnectionPool) URLs() []*url.URL { - var urls []*url.URL - - cp.Lock() - defer cp.Unlock() - - for _, c := range cp.live { - urls = append(urls, c.URL) - } - - return urls -} - -func (cp *statusConnectionPool) connections() []*Connection { - var conns []*Connection - conns = append(conns, cp.live...) - conns = append(conns, cp.dead...) - return conns -} - -// resurrect adds the connection to the list of available connections. -// When removeDead is true, it also removes it from the dead list. -// The calling code is responsible for locking. -// -func (cp *statusConnectionPool) resurrect(c *Connection, removeDead bool) error { - if debugLogger != nil { - debugLogger.Logf("Resurrecting %s\n", c.URL) - } - - c.markAsLive() - cp.live = append(cp.live, c) - - if removeDead { - index := -1 - for i, conn := range cp.dead { - if conn == c { - index = i - } - } - if index >= 0 { - // Remove item; https://github.com/golang/go/wiki/SliceTricks - copy(cp.dead[index:], cp.dead[index+1:]) - cp.dead = cp.dead[:len(cp.dead)-1] - } - } - - return nil -} - -// scheduleResurrect schedules the connection to be resurrected. -// -func (cp *statusConnectionPool) scheduleResurrect(c *Connection) { - factor := math.Min(float64(c.Failures-1), float64(defaultResurrectTimeoutFactorCutoff)) - timeout := time.Duration(defaultResurrectTimeoutInitial.Seconds() * math.Exp2(factor) * float64(time.Second)) - if debugLogger != nil { - debugLogger.Logf("Resurrect %s (failures=%d, factor=%1.1f, timeout=%s) in %s\n", c.URL, c.Failures, factor, timeout, c.DeadSince.Add(timeout).Sub(time.Now().UTC()).Truncate(time.Second)) - } - - time.AfterFunc(timeout, func() { - cp.Lock() - defer cp.Unlock() - - c.Lock() - defer c.Unlock() - - if !c.IsDead { - if debugLogger != nil { - debugLogger.Logf("Already resurrected %s\n", c.URL) - } - return - } - - cp.resurrect(c, true) - }) -} - -// Select returns the connection in a round-robin fashion. -// -func (s *roundRobinSelector) Select(conns []*Connection) (*Connection, error) { - s.Lock() - defer s.Unlock() - - s.curr = (s.curr + 1) % len(conns) - return conns[s.curr], nil -} - -// markAsDead marks the connection as dead. -// -func (c *Connection) markAsDead() { - c.IsDead = true - if c.DeadSince.IsZero() { - c.DeadSince = time.Now().UTC() - } - c.Failures++ -} - -// markAsLive marks the connection as alive. -// -func (c *Connection) markAsLive() { - c.IsDead = false -} - -// markAsHealthy marks the connection as healthy. -// -func (c *Connection) markAsHealthy() { - c.IsDead = false - c.DeadSince = time.Time{} - c.Failures = 0 -} - -// String returns a readable connection representation. -// -func (c *Connection) String() string { - c.Lock() - defer c.Unlock() - return fmt.Sprintf("<%s> dead=%v failures=%d", c.URL, c.IsDead, c.Failures) -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/estransport/discovery.go b/vendor/github.com/elastic/go-elasticsearch/v7/estransport/discovery.go deleted file mode 100644 index ccbb586a3..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/estransport/discovery.go +++ /dev/null @@ -1,218 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -package estransport - -import ( - "encoding/json" - "fmt" - "io/ioutil" - "net/http" - "net/url" - "sort" - "strings" - "sync" - "time" -) - -// Discoverable defines the interface for transports supporting node discovery. -// -type Discoverable interface { - DiscoverNodes() error -} - -// nodeInfo represents the information about node in a cluster. -// -// See: https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-nodes-info.html -// -type nodeInfo struct { - ID string - Name string - URL *url.URL - Roles []string `json:"roles"` - Attributes map[string]interface{} - HTTP struct { - PublishAddress string `json:"publish_address"` - } -} - -// DiscoverNodes reloads the client connections by fetching information from the cluster. -// -func (c *Client) DiscoverNodes() error { - var conns []*Connection - - nodes, err := c.getNodesInfo() - if err != nil { - if debugLogger != nil { - debugLogger.Logf("Error getting nodes info: %s\n", err) - } - return fmt.Errorf("discovery: get nodes: %s", err) - } - - for _, node := range nodes { - var ( - isMasterOnlyNode bool - ) - - roles := append(node.Roles[:0:0], node.Roles...) - sort.Strings(roles) - - if len(roles) == 1 && roles[0] == "master" { - isMasterOnlyNode = true - } - - if debugLogger != nil { - var skip string - if isMasterOnlyNode { - skip = "; [SKIP]" - } - debugLogger.Logf("Discovered node [%s]; %s; roles=%s%s\n", node.Name, node.URL, node.Roles, skip) - } - - // Skip master only nodes - // TODO(karmi): Move logic to Selector? - if isMasterOnlyNode { - continue - } - - conns = append(conns, &Connection{ - URL: node.URL, - ID: node.ID, - Name: node.Name, - Roles: node.Roles, - Attributes: node.Attributes, - }) - } - - c.Lock() - defer c.Unlock() - - if lockable, ok := c.pool.(sync.Locker); ok { - lockable.Lock() - defer lockable.Unlock() - } - - if c.poolFunc != nil { - c.pool = c.poolFunc(conns, c.selector) - } else { - // TODO(karmi): Replace only live connections, leave dead scheduled for resurrect? - c.pool, err = NewConnectionPool(conns, c.selector) - if err != nil { - return err - } - } - - return nil -} - -func (c *Client) getNodesInfo() ([]nodeInfo, error) { - var ( - out []nodeInfo - scheme = c.urls[0].Scheme - ) - - req, err := http.NewRequest("GET", "/_nodes/http", nil) - if err != nil { - return out, err - } - - c.Lock() - conn, err := c.pool.Next() - c.Unlock() - // TODO(karmi): If no connection is returned, fallback to original URLs - if err != nil { - return out, err - } - - c.setReqURL(conn.URL, req) - c.setReqAuth(conn.URL, req) - c.setReqUserAgent(req) - - if c.disableMetaHeader == false { - c.setMetaHeader(req) - } - - res, err := c.transport.RoundTrip(req) - if err != nil { - return out, err - } - defer res.Body.Close() - - if res.StatusCode > 200 { - body, _ := ioutil.ReadAll(res.Body) - return out, fmt.Errorf("server error: %s: %s", res.Status, body) - } - - var env map[string]json.RawMessage - if err := json.NewDecoder(res.Body).Decode(&env); err != nil { - return out, err - } - - var nodes map[string]nodeInfo - if err := json.Unmarshal(env["nodes"], &nodes); err != nil { - return out, err - } - - for id, node := range nodes { - node.ID = id - u, err := c.getNodeURL(node, scheme) - if err != nil { - return out, err - } - node.URL = u - out = append(out, node) - } - - return out, nil -} - -func (c *Client) getNodeURL(node nodeInfo, scheme string) (*url.URL, error) { - var ( - host string - port string - - addrs = strings.Split(node.HTTP.PublishAddress, "/") - ports = strings.Split(node.HTTP.PublishAddress, ":") - ) - - if len(addrs) > 1 { - host = addrs[0] - } else { - host = strings.Split(addrs[0], ":")[0] - } - port = ports[len(ports)-1] - - u := &url.URL{ - Scheme: scheme, - Host: host + ":" + port, - } - - return u, nil -} - -func (c *Client) scheduleDiscoverNodes(d time.Duration) { - go c.DiscoverNodes() - - c.Lock() - defer c.Unlock() - if c.discoverNodesTimer != nil { - c.discoverNodesTimer.Stop() - } - c.discoverNodesTimer = time.AfterFunc(c.discoverNodesInterval, func() { - c.scheduleDiscoverNodes(c.discoverNodesInterval) - }) -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/estransport/doc.go b/vendor/github.com/elastic/go-elasticsearch/v7/estransport/doc.go deleted file mode 100644 index 567310743..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/estransport/doc.go +++ /dev/null @@ -1,51 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -/* -Package estransport provides the transport layer for the Elasticsearch client. - -It is automatically included in the client provided by the github.com/elastic/go-elasticsearch package -and is not intended for direct use: to configure the client, use the elasticsearch.Config struct. - -The default HTTP transport of the client is http.Transport; use the Transport option to customize it; -see the _examples/coniguration.go and _examples/customization.go files in this repository for information. - -The package will automatically retry requests on network-related errors, and on specific -response status codes (by default 502, 503, 504). Use the RetryOnStatus option to customize the list. -The transport will not retry a timeout network error, unless enabled by setting EnableRetryOnTimeout to true. - -Use the MaxRetries option to configure the number of retries, and set DisableRetry to true -to disable the retry behaviour altogether. - -By default, the retry will be performed without any delay; to configure a backoff interval, -implement the RetryBackoff option function; see an example in the package unit tests for information. - -When multiple addresses are passed in configuration, the package will use them in a round-robin fashion, -and will keep track of live and dead nodes. The status of dead nodes is checked periodically. - -To customize the node selection behaviour, provide a Selector implementation in the configuration. -To replace the connection pool entirely, provide a custom ConnectionPool implementation via -the ConnectionPoolFunc option. - -The package defines the Logger interface for logging information about request and response. -It comes with several bundled loggers for logging in text and JSON. - -Use the EnableDebugLogger option to enable the debugging logger for connection management. - -Use the EnableMetrics option to enable metric collection and export. -*/ -package estransport diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/estransport/estransport.go b/vendor/github.com/elastic/go-elasticsearch/v7/estransport/estransport.go deleted file mode 100644 index 3070dcbd5..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/estransport/estransport.go +++ /dev/null @@ -1,512 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -package estransport - -import ( - "bytes" - "crypto/x509" - "errors" - "fmt" - "io" - "io/ioutil" - "net" - "net/http" - "net/url" - "os" - "regexp" - "runtime" - "strconv" - "strings" - "sync" - "time" - - "github.com/elastic/go-elasticsearch/v7/internal/version" -) - -const ( - // Version returns the package version as a string. - Version = version.Client - - // esCompatHeader defines the env var for Compatibility header. - esCompatHeader = "ELASTIC_CLIENT_APIVERSIONING" -) - -var ( - userAgent string - metaHeader string - compatibilityHeader bool - reGoVersion = regexp.MustCompile(`go(\d+\.\d+\..+)`) - - defaultMaxRetries = 3 - defaultRetryOnStatus = [...]int{502, 503, 504} -) - -func init() { - userAgent = initUserAgent() - metaHeader = initMetaHeader() - - compatHeaderEnv := os.Getenv(esCompatHeader) - compatibilityHeader, _ = strconv.ParseBool(compatHeaderEnv) -} - -// Interface defines the interface for HTTP client. -// -type Interface interface { - Perform(*http.Request) (*http.Response, error) -} - -// Config represents the configuration of HTTP client. -// -type Config struct { - URLs []*url.URL - Username string - Password string - APIKey string - ServiceToken string - - Header http.Header - CACert []byte - - RetryOnStatus []int - DisableRetry bool - EnableRetryOnTimeout bool - MaxRetries int - RetryBackoff func(attempt int) time.Duration - - EnableMetrics bool - EnableDebugLogger bool - - DisableMetaHeader bool - - DiscoverNodesInterval time.Duration - - Transport http.RoundTripper - Logger Logger - Selector Selector - - ConnectionPoolFunc func([]*Connection, Selector) ConnectionPool -} - -// Client represents the HTTP client. -// -type Client struct { - sync.Mutex - - urls []*url.URL - username string - password string - apikey string - servicetoken string - header http.Header - - retryOnStatus []int - disableRetry bool - enableRetryOnTimeout bool - disableMetaHeader bool - maxRetries int - retryBackoff func(attempt int) time.Duration - discoverNodesInterval time.Duration - discoverNodesTimer *time.Timer - - metrics *metrics - - transport http.RoundTripper - logger Logger - selector Selector - pool ConnectionPool - poolFunc func([]*Connection, Selector) ConnectionPool -} - -// New creates new transport client. -// -// http.DefaultTransport will be used if no transport is passed in the configuration. -// -func New(cfg Config) (*Client, error) { - if cfg.Transport == nil { - cfg.Transport = http.DefaultTransport - } - - if cfg.CACert != nil { - httpTransport, ok := cfg.Transport.(*http.Transport) - if !ok { - return nil, fmt.Errorf("unable to set CA certificate for transport of type %T", cfg.Transport) - } - - httpTransport = httpTransport.Clone() - httpTransport.TLSClientConfig.RootCAs = x509.NewCertPool() - - if ok := httpTransport.TLSClientConfig.RootCAs.AppendCertsFromPEM(cfg.CACert); !ok { - return nil, errors.New("unable to add CA certificate") - } - - cfg.Transport = httpTransport - } - - if len(cfg.RetryOnStatus) == 0 { - cfg.RetryOnStatus = defaultRetryOnStatus[:] - } - - if cfg.MaxRetries == 0 { - cfg.MaxRetries = defaultMaxRetries - } - - var conns []*Connection - for _, u := range cfg.URLs { - conns = append(conns, &Connection{URL: u}) - } - - client := Client{ - urls: cfg.URLs, - username: cfg.Username, - password: cfg.Password, - apikey: cfg.APIKey, - servicetoken: cfg.ServiceToken, - header: cfg.Header, - - retryOnStatus: cfg.RetryOnStatus, - disableRetry: cfg.DisableRetry, - enableRetryOnTimeout: cfg.EnableRetryOnTimeout, - disableMetaHeader: cfg.DisableMetaHeader, - maxRetries: cfg.MaxRetries, - retryBackoff: cfg.RetryBackoff, - discoverNodesInterval: cfg.DiscoverNodesInterval, - - transport: cfg.Transport, - logger: cfg.Logger, - selector: cfg.Selector, - poolFunc: cfg.ConnectionPoolFunc, - } - - if client.poolFunc != nil { - client.pool = client.poolFunc(conns, client.selector) - } else { - client.pool, _ = NewConnectionPool(conns, client.selector) - } - - if cfg.EnableDebugLogger { - debugLogger = &debuggingLogger{Output: os.Stdout} - } - - if cfg.EnableMetrics { - client.metrics = &metrics{responses: make(map[int]int)} - // TODO(karmi): Type assertion to interface - if pool, ok := client.pool.(*singleConnectionPool); ok { - pool.metrics = client.metrics - } - if pool, ok := client.pool.(*statusConnectionPool); ok { - pool.metrics = client.metrics - } - } - - if client.discoverNodesInterval > 0 { - time.AfterFunc(client.discoverNodesInterval, func() { - client.scheduleDiscoverNodes(client.discoverNodesInterval) - }) - } - - return &client, nil -} - -// Perform executes the request and returns a response or error. -// -func (c *Client) Perform(req *http.Request) (*http.Response, error) { - var ( - res *http.Response - err error - ) - - // Compatibility Header - if compatibilityHeader { - if req.Body != nil { - req.Header.Set("Content-Type", "application/vnd.elasticsearch+json;compatible-with=7") - } - req.Header.Set("Accept", "application/vnd.elasticsearch+json;compatible-with=7") - } - - // Record metrics, when enabled - if c.metrics != nil { - c.metrics.Lock() - c.metrics.requests++ - c.metrics.Unlock() - } - - // Update request - c.setReqUserAgent(req) - c.setReqGlobalHeader(req) - c.setMetaHeader(req) - - if req.Body != nil && req.Body != http.NoBody && req.GetBody == nil { - if !c.disableRetry || (c.logger != nil && c.logger.RequestBodyEnabled()) { - var buf bytes.Buffer - buf.ReadFrom(req.Body) - req.GetBody = func() (io.ReadCloser, error) { - r := buf - return ioutil.NopCloser(&r), nil - } - if req.Body, err = req.GetBody(); err != nil { - return nil, fmt.Errorf("cannot get request body: %s", err) - } - } - } - - for i := 0; i <= c.maxRetries; i++ { - var ( - conn *Connection - shouldRetry bool - shouldCloseBody bool - ) - - // Get connection from the pool - c.Lock() - conn, err = c.pool.Next() - c.Unlock() - if err != nil { - if c.logger != nil { - c.logRoundTrip(req, nil, err, time.Time{}, time.Duration(0)) - } - return nil, fmt.Errorf("cannot get connection: %s", err) - } - - // Update request - c.setReqURL(conn.URL, req) - c.setReqAuth(conn.URL, req) - - if !c.disableRetry && i > 0 && req.Body != nil && req.Body != http.NoBody { - body, err := req.GetBody() - if err != nil { - return nil, fmt.Errorf("cannot get request body: %s", err) - } - req.Body = body - } - - // Set up time measures and execute the request - start := time.Now().UTC() - res, err = c.transport.RoundTrip(req) - dur := time.Since(start) - - // Log request and response - if c.logger != nil { - if c.logger.RequestBodyEnabled() && req.Body != nil && req.Body != http.NoBody { - req.Body, _ = req.GetBody() - } - c.logRoundTrip(req, res, err, start, dur) - } - - if err != nil { - // Record metrics, when enabled - if c.metrics != nil { - c.metrics.Lock() - c.metrics.failures++ - c.metrics.Unlock() - } - - // Report the connection as unsuccessful - c.Lock() - c.pool.OnFailure(conn) - c.Unlock() - - // Retry on EOF errors - if err == io.EOF { - shouldRetry = true - } - - // Retry on network errors, but not on timeout errors, unless configured - if err, ok := err.(net.Error); ok { - if (!err.Timeout() || c.enableRetryOnTimeout) && !c.disableRetry { - shouldRetry = true - } - } - } else { - // Report the connection as succesfull - c.Lock() - c.pool.OnSuccess(conn) - c.Unlock() - } - - if res != nil && c.metrics != nil { - c.metrics.Lock() - c.metrics.responses[res.StatusCode]++ - c.metrics.Unlock() - } - - // Retry on configured response statuses - if res != nil && !c.disableRetry { - for _, code := range c.retryOnStatus { - if res.StatusCode == code { - shouldRetry = true - shouldCloseBody = true - } - } - } - - // Break if retry should not be performed - if !shouldRetry { - break - } - - // Drain and close body when retrying after response - if shouldCloseBody && i < c.maxRetries { - if res.Body != nil { - io.Copy(ioutil.Discard, res.Body) - res.Body.Close() - } - } - - // Delay the retry if a backoff function is configured - if c.retryBackoff != nil { - time.Sleep(c.retryBackoff(i + 1)) - } - } - - // TODO(karmi): Wrap error - return res, err -} - -// URLs returns a list of transport URLs. -// -// -func (c *Client) URLs() []*url.URL { - return c.pool.URLs() -} - -func (c *Client) setReqURL(u *url.URL, req *http.Request) *http.Request { - req.URL.Scheme = u.Scheme - req.URL.Host = u.Host - - if u.Path != "" { - var b strings.Builder - b.Grow(len(u.Path) + len(req.URL.Path)) - b.WriteString(u.Path) - b.WriteString(req.URL.Path) - req.URL.Path = b.String() - } - - return req -} - -func (c *Client) setReqAuth(u *url.URL, req *http.Request) *http.Request { - if _, ok := req.Header["Authorization"]; !ok { - if u.User != nil { - password, _ := u.User.Password() - req.SetBasicAuth(u.User.Username(), password) - return req - } - - if c.apikey != "" { - var b bytes.Buffer - b.Grow(len("APIKey ") + len(c.apikey)) - b.WriteString("APIKey ") - b.WriteString(c.apikey) - req.Header.Set("Authorization", b.String()) - return req - } - - if c.servicetoken != "" { - var b bytes.Buffer - b.Grow(len("Bearer ") + len(c.servicetoken)) - b.WriteString("Bearer ") - b.WriteString(c.servicetoken) - req.Header.Set("Authorization", b.String()) - return req - } - - if c.username != "" && c.password != "" { - req.SetBasicAuth(c.username, c.password) - return req - } - } - - return req -} - -func (c *Client) setReqUserAgent(req *http.Request) *http.Request { - req.Header.Set("User-Agent", userAgent) - return req -} - -func (c *Client) setReqGlobalHeader(req *http.Request) *http.Request { - if len(c.header) > 0 { - for k, v := range c.header { - if req.Header.Get(k) != k { - for _, vv := range v { - req.Header.Add(k, vv) - } - } - } - } - return req -} - -func (c *Client) setMetaHeader(req *http.Request) *http.Request { - if c.disableMetaHeader { - req.Header.Del(HeaderClientMeta) - return req - } - - existingMetaHeader := req.Header.Get(HeaderClientMeta) - if existingMetaHeader != "" { - req.Header.Set(HeaderClientMeta, strings.Join([]string{metaHeader, existingMetaHeader}, ",")) - } else { - req.Header.Add(HeaderClientMeta, metaHeader) - } - return req -} - -func (c *Client) logRoundTrip( - req *http.Request, - res *http.Response, - err error, - start time.Time, - dur time.Duration, -) { - var dupRes http.Response - if res != nil { - dupRes = *res - } - if c.logger.ResponseBodyEnabled() { - if res != nil && res.Body != nil && res.Body != http.NoBody { - b1, b2, _ := duplicateBody(res.Body) - dupRes.Body = b1 - res.Body = b2 - } - } - c.logger.LogRoundTrip(req, &dupRes, err, start, dur) // errcheck exclude -} - -func initUserAgent() string { - var b strings.Builder - - b.WriteString("go-elasticsearch") - b.WriteRune('/') - b.WriteString(Version) - b.WriteRune(' ') - b.WriteRune('(') - b.WriteString(runtime.GOOS) - b.WriteRune(' ') - b.WriteString(runtime.GOARCH) - b.WriteString("; ") - b.WriteString("Go ") - if v := reGoVersion.ReplaceAllString(runtime.Version(), "$1"); v != "" { - b.WriteString(v) - } else { - b.WriteString(runtime.Version()) - } - b.WriteRune(')') - - return b.String() -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/estransport/logger.go b/vendor/github.com/elastic/go-elasticsearch/v7/estransport/logger.go deleted file mode 100644 index fb368c30a..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/estransport/logger.go +++ /dev/null @@ -1,454 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -package estransport - -import ( - "bufio" - "bytes" - "encoding/json" - "fmt" - "io" - "io/ioutil" - "net/http" - "net/url" - "strconv" - "strings" - "time" -) - -var debugLogger DebuggingLogger - -// Logger defines an interface for logging request and response. -// -type Logger interface { - // LogRoundTrip should not modify the request or response, except for consuming and closing the body. - // Implementations have to check for nil values in request and response. - LogRoundTrip(*http.Request, *http.Response, error, time.Time, time.Duration) error - // RequestBodyEnabled makes the client pass a copy of request body to the logger. - RequestBodyEnabled() bool - // ResponseBodyEnabled makes the client pass a copy of response body to the logger. - ResponseBodyEnabled() bool -} - -// DebuggingLogger defines the interface for a debugging logger. -// -type DebuggingLogger interface { - Log(a ...interface{}) error - Logf(format string, a ...interface{}) error -} - -// TextLogger prints the log message in plain text. -// -type TextLogger struct { - Output io.Writer - EnableRequestBody bool - EnableResponseBody bool -} - -// ColorLogger prints the log message in a terminal-optimized plain text. -// -type ColorLogger struct { - Output io.Writer - EnableRequestBody bool - EnableResponseBody bool -} - -// CurlLogger prints the log message as a runnable curl command. -// -type CurlLogger struct { - Output io.Writer - EnableRequestBody bool - EnableResponseBody bool -} - -// JSONLogger prints the log message as JSON. -// -type JSONLogger struct { - Output io.Writer - EnableRequestBody bool - EnableResponseBody bool -} - -// debuggingLogger prints debug messages as plain text. -// -type debuggingLogger struct { - Output io.Writer -} - -// LogRoundTrip prints the information about request and response. -// -func (l *TextLogger) LogRoundTrip(req *http.Request, res *http.Response, err error, start time.Time, dur time.Duration) error { - fmt.Fprintf(l.Output, "%s %s %s [status:%d request:%s]\n", - start.Format(time.RFC3339), - req.Method, - req.URL.String(), - resStatusCode(res), - dur.Truncate(time.Millisecond), - ) - if l.RequestBodyEnabled() && req != nil && req.Body != nil && req.Body != http.NoBody { - var buf bytes.Buffer - if req.GetBody != nil { - b, _ := req.GetBody() - buf.ReadFrom(b) - } else { - buf.ReadFrom(req.Body) - } - logBodyAsText(l.Output, &buf, ">") - } - if l.ResponseBodyEnabled() && res != nil && res.Body != nil && res.Body != http.NoBody { - defer res.Body.Close() - var buf bytes.Buffer - buf.ReadFrom(res.Body) - logBodyAsText(l.Output, &buf, "<") - } - if err != nil { - fmt.Fprintf(l.Output, "! ERROR: %v\n", err) - } - return nil -} - -// RequestBodyEnabled returns true when the request body should be logged. -func (l *TextLogger) RequestBodyEnabled() bool { return l.EnableRequestBody } - -// ResponseBodyEnabled returns true when the response body should be logged. -func (l *TextLogger) ResponseBodyEnabled() bool { return l.EnableResponseBody } - -// LogRoundTrip prints the information about request and response. -// -func (l *ColorLogger) LogRoundTrip(req *http.Request, res *http.Response, err error, start time.Time, dur time.Duration) error { - query, _ := url.QueryUnescape(req.URL.RawQuery) - if query != "" { - query = "?" + query - } - - var ( - status string - color string - ) - - status = res.Status - switch { - case res.StatusCode > 0 && res.StatusCode < 300: - color = "\x1b[32m" - case res.StatusCode > 299 && res.StatusCode < 500: - color = "\x1b[33m" - case res.StatusCode > 499: - color = "\x1b[31m" - default: - status = "ERROR" - color = "\x1b[31;4m" - } - - fmt.Fprintf(l.Output, "%6s \x1b[1;4m%s://%s%s\x1b[0m%s %s%s\x1b[0m \x1b[2m%s\x1b[0m\n", - req.Method, - req.URL.Scheme, - req.URL.Host, - req.URL.Path, - query, - color, - status, - dur.Truncate(time.Millisecond), - ) - - if l.RequestBodyEnabled() && req != nil && req.Body != nil && req.Body != http.NoBody { - var buf bytes.Buffer - if req.GetBody != nil { - b, _ := req.GetBody() - buf.ReadFrom(b) - } else { - buf.ReadFrom(req.Body) - } - fmt.Fprint(l.Output, "\x1b[2m") - logBodyAsText(l.Output, &buf, " »") - fmt.Fprint(l.Output, "\x1b[0m") - } - - if l.ResponseBodyEnabled() && res != nil && res.Body != nil && res.Body != http.NoBody { - defer res.Body.Close() - var buf bytes.Buffer - buf.ReadFrom(res.Body) - fmt.Fprint(l.Output, "\x1b[2m") - logBodyAsText(l.Output, &buf, " «") - fmt.Fprint(l.Output, "\x1b[0m") - } - - if err != nil { - fmt.Fprintf(l.Output, "\x1b[31;1m» ERROR \x1b[31m%v\x1b[0m\n", err) - } - - if l.RequestBodyEnabled() || l.ResponseBodyEnabled() { - fmt.Fprintf(l.Output, "\x1b[2m%s\x1b[0m\n", strings.Repeat("─", 80)) - } - return nil -} - -// RequestBodyEnabled returns true when the request body should be logged. -func (l *ColorLogger) RequestBodyEnabled() bool { return l.EnableRequestBody } - -// ResponseBodyEnabled returns true when the response body should be logged. -func (l *ColorLogger) ResponseBodyEnabled() bool { return l.EnableResponseBody } - -// LogRoundTrip prints the information about request and response. -// -func (l *CurlLogger) LogRoundTrip(req *http.Request, res *http.Response, err error, start time.Time, dur time.Duration) error { - var b bytes.Buffer - - var query string - qvalues := url.Values{} - for k, v := range req.URL.Query() { - if k == "pretty" { - continue - } - for _, qv := range v { - qvalues.Add(k, qv) - } - } - if len(qvalues) > 0 { - query = qvalues.Encode() - } - - b.WriteString(`curl`) - if req.Method == "HEAD" { - b.WriteString(" --head") - } else { - fmt.Fprintf(&b, " -X %s", req.Method) - } - - if len(req.Header) > 0 { - for k, vv := range req.Header { - if k == "Authorization" || k == "User-Agent" { - continue - } - v := strings.Join(vv, ",") - b.WriteString(fmt.Sprintf(" -H '%s: %s'", k, v)) - } - } - - b.WriteString(" 'http://localhost:9200") - b.WriteString(req.URL.Path) - b.WriteString("?pretty") - if query != "" { - fmt.Fprintf(&b, "&%s", query) - } - b.WriteString("'") - - if req != nil && req.Body != nil && req.Body != http.NoBody { - var buf bytes.Buffer - if req.GetBody != nil { - b, _ := req.GetBody() - buf.ReadFrom(b) - } else { - buf.ReadFrom(req.Body) - } - - b.Grow(buf.Len()) - b.WriteString(" -d \\\n'") - json.Indent(&b, buf.Bytes(), "", " ") - b.WriteString("'") - } - - b.WriteRune('\n') - - var status string - status = res.Status - - fmt.Fprintf(&b, "# => %s [%s] %s\n", start.UTC().Format(time.RFC3339), status, dur.Truncate(time.Millisecond)) - if l.ResponseBodyEnabled() && res != nil && res.Body != nil && res.Body != http.NoBody { - var buf bytes.Buffer - buf.ReadFrom(res.Body) - - b.Grow(buf.Len()) - b.WriteString("# ") - json.Indent(&b, buf.Bytes(), "# ", " ") - } - - b.WriteString("\n") - if l.ResponseBodyEnabled() && res != nil && res.Body != nil && res.Body != http.NoBody { - b.WriteString("\n") - } - - b.WriteTo(l.Output) - - return nil -} - -// RequestBodyEnabled returns true when the request body should be logged. -func (l *CurlLogger) RequestBodyEnabled() bool { return l.EnableRequestBody } - -// ResponseBodyEnabled returns true when the response body should be logged. -func (l *CurlLogger) ResponseBodyEnabled() bool { return l.EnableResponseBody } - -// LogRoundTrip prints the information about request and response. -// -func (l *JSONLogger) LogRoundTrip(req *http.Request, res *http.Response, err error, start time.Time, dur time.Duration) error { - // https://github.com/elastic/ecs/blob/master/schemas/http.yml - // - // TODO(karmi): Research performance optimization of using sync.Pool - - bsize := 200 - var b = bytes.NewBuffer(make([]byte, 0, bsize)) - var v = make([]byte, 0, bsize) - - appendTime := func(t time.Time) { - v = v[:0] - v = t.AppendFormat(v, time.RFC3339) - b.Write(v) - } - - appendQuote := func(s string) { - v = v[:0] - v = strconv.AppendQuote(v, s) - b.Write(v) - } - - appendInt := func(i int64) { - v = v[:0] - v = strconv.AppendInt(v, i, 10) - b.Write(v) - } - - port := req.URL.Port() - - b.WriteRune('{') - // -- Timestamp - b.WriteString(`"@timestamp":"`) - appendTime(start.UTC()) - b.WriteRune('"') - // -- Event - b.WriteString(`,"event":{`) - b.WriteString(`"duration":`) - appendInt(dur.Nanoseconds()) - b.WriteRune('}') - // -- URL - b.WriteString(`,"url":{`) - b.WriteString(`"scheme":`) - appendQuote(req.URL.Scheme) - b.WriteString(`,"domain":`) - appendQuote(req.URL.Hostname()) - if port != "" { - b.WriteString(`,"port":`) - b.WriteString(port) - } - b.WriteString(`,"path":`) - appendQuote(req.URL.Path) - b.WriteString(`,"query":`) - appendQuote(req.URL.RawQuery) - b.WriteRune('}') // Close "url" - // -- HTTP - b.WriteString(`,"http":`) - // ---- Request - b.WriteString(`{"request":{`) - b.WriteString(`"method":`) - appendQuote(req.Method) - if l.RequestBodyEnabled() && req != nil && req.Body != nil && req.Body != http.NoBody { - var buf bytes.Buffer - if req.GetBody != nil { - b, _ := req.GetBody() - buf.ReadFrom(b) - } else { - buf.ReadFrom(req.Body) - } - - b.Grow(buf.Len() + 8) - b.WriteString(`,"body":`) - appendQuote(buf.String()) - } - b.WriteRune('}') // Close "http.request" - // ---- Response - b.WriteString(`,"response":{`) - b.WriteString(`"status_code":`) - appendInt(int64(resStatusCode(res))) - if l.ResponseBodyEnabled() && res != nil && res.Body != nil && res.Body != http.NoBody { - defer res.Body.Close() - var buf bytes.Buffer - buf.ReadFrom(res.Body) - - b.Grow(buf.Len() + 8) - b.WriteString(`,"body":`) - appendQuote(buf.String()) - } - b.WriteRune('}') // Close "http.response" - b.WriteRune('}') // Close "http" - // -- Error - if err != nil { - b.WriteString(`,"error":{"message":`) - appendQuote(err.Error()) - b.WriteRune('}') // Close "error" - } - b.WriteRune('}') - b.WriteRune('\n') - b.WriteTo(l.Output) - - return nil -} - -// RequestBodyEnabled returns true when the request body should be logged. -func (l *JSONLogger) RequestBodyEnabled() bool { return l.EnableRequestBody } - -// ResponseBodyEnabled returns true when the response body should be logged. -func (l *JSONLogger) ResponseBodyEnabled() bool { return l.EnableResponseBody } - -// Log prints the arguments to output in default format. -// -func (l *debuggingLogger) Log(a ...interface{}) error { - _, err := fmt.Fprint(l.Output, a...) - return err -} - -// Logf prints formats the arguments and prints them to output. -// -func (l *debuggingLogger) Logf(format string, a ...interface{}) error { - _, err := fmt.Fprintf(l.Output, format, a...) - return err -} - -func logBodyAsText(dst io.Writer, body io.Reader, prefix string) { - scanner := bufio.NewScanner(body) - for scanner.Scan() { - s := scanner.Text() - if s != "" { - fmt.Fprintf(dst, "%s %s\n", prefix, s) - } - } -} - -func duplicateBody(body io.ReadCloser) (io.ReadCloser, io.ReadCloser, error) { - var ( - b1 bytes.Buffer - b2 bytes.Buffer - tr = io.TeeReader(body, &b2) - ) - _, err := b1.ReadFrom(tr) - if err != nil { - return ioutil.NopCloser(io.MultiReader(&b1, errorReader{err: err})), ioutil.NopCloser(io.MultiReader(&b2, errorReader{err: err})), err - } - defer func() { body.Close() }() - - return ioutil.NopCloser(&b1), ioutil.NopCloser(&b2), nil -} - -func resStatusCode(res *http.Response) int { - if res == nil { - return -1 - } - return res.StatusCode -} - -type errorReader struct{ err error } - -func (r errorReader) Read(p []byte) (int, error) { return 0, r.err } diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/estransport/metaheader.go b/vendor/github.com/elastic/go-elasticsearch/v7/estransport/metaheader.go deleted file mode 100644 index 190c5a0f3..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/estransport/metaheader.go +++ /dev/null @@ -1,81 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -package estransport - -import ( - "regexp" - "runtime" - "strings" -) - -// HeaderClientMeta Key for the HTTP Header related to telemetry data sent with -// each request to Elasticsearch. -const HeaderClientMeta = "x-elastic-client-meta" - -var metaReVersion = regexp.MustCompile("([0-9.]+)(.*)") - -func initMetaHeader() string { - var b strings.Builder - var strippedGoVersion string - var strippedEsVersion string - - strippedEsVersion = buildStrippedVersion(Version) - strippedGoVersion = buildStrippedVersion(runtime.Version()) - - var duos = [][]string{ - { - "es", - strippedEsVersion, - }, - { - "go", - strippedGoVersion, - }, - { - "t", - strippedEsVersion, - }, - { - "hc", - strippedGoVersion, - }, - } - - var arr []string - for _, duo := range duos { - arr = append(arr, strings.Join(duo, "=")) - } - b.WriteString(strings.Join(arr, ",")) - - return b.String() -} - -func buildStrippedVersion(version string) string { - v := metaReVersion.FindStringSubmatch(version) - - if len(v) == 3 && !strings.Contains(version, "devel") { - switch { - case v[2] != "": - return v[1] + "p" - default: - return v[1] - } - } - - return "0.0p" -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/estransport/metrics.go b/vendor/github.com/elastic/go-elasticsearch/v7/estransport/metrics.go deleted file mode 100644 index 591c26254..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/estransport/metrics.go +++ /dev/null @@ -1,194 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -package estransport - -import ( - "errors" - "fmt" - "strconv" - "strings" - "sync" - "time" -) - -// Measurable defines the interface for transports supporting metrics. -// -type Measurable interface { - Metrics() (Metrics, error) -} - -// connectionable defines the interface for transports returning a list of connections. -// -type connectionable interface { - connections() []*Connection -} - -// Metrics represents the transport metrics. -// -type Metrics struct { - Requests int `json:"requests"` - Failures int `json:"failures"` - Responses map[int]int `json:"responses"` - - Connections []fmt.Stringer `json:"connections"` -} - -// ConnectionMetric represents metric information for a connection. -// -type ConnectionMetric struct { - URL string `json:"url"` - Failures int `json:"failures,omitempty"` - IsDead bool `json:"dead,omitempty"` - DeadSince *time.Time `json:"dead_since,omitempty"` - - Meta struct { - ID string `json:"id"` - Name string `json:"name"` - Roles []string `json:"roles"` - } `json:"meta"` -} - -// metrics represents the inner state of metrics. -// -type metrics struct { - sync.RWMutex - - requests int - failures int - responses map[int]int - - connections []*Connection -} - -// Metrics returns the transport metrics. -// -func (c *Client) Metrics() (Metrics, error) { - if c.metrics == nil { - return Metrics{}, errors.New("transport metrics not enabled") - } - c.metrics.RLock() - defer c.metrics.RUnlock() - - if lockable, ok := c.pool.(sync.Locker); ok { - lockable.Lock() - defer lockable.Unlock() - } - - m := Metrics{ - Requests: c.metrics.requests, - Failures: c.metrics.failures, - Responses: c.metrics.responses, - } - - if pool, ok := c.pool.(connectionable); ok { - for _, c := range pool.connections() { - c.Lock() - - cm := ConnectionMetric{ - URL: c.URL.String(), - IsDead: c.IsDead, - Failures: c.Failures, - } - - if !c.DeadSince.IsZero() { - cm.DeadSince = &c.DeadSince - } - - if c.ID != "" { - cm.Meta.ID = c.ID - } - - if c.Name != "" { - cm.Meta.Name = c.Name - } - - if len(c.Roles) > 0 { - cm.Meta.Roles = c.Roles - } - - m.Connections = append(m.Connections, cm) - c.Unlock() - } - } - - return m, nil -} - -// String returns the metrics as a string. -// -func (m Metrics) String() string { - var ( - i int - b strings.Builder - ) - b.WriteString("{") - - b.WriteString("Requests:") - b.WriteString(strconv.Itoa(m.Requests)) - - b.WriteString(" Failures:") - b.WriteString(strconv.Itoa(m.Failures)) - - if len(m.Responses) > 0 { - b.WriteString(" Responses: ") - b.WriteString("[") - - for code, num := range m.Responses { - b.WriteString(strconv.Itoa(code)) - b.WriteString(":") - b.WriteString(strconv.Itoa(num)) - if i+1 < len(m.Responses) { - b.WriteString(", ") - } - i++ - } - b.WriteString("]") - } - - b.WriteString(" Connections: [") - for i, c := range m.Connections { - b.WriteString(c.String()) - if i+1 < len(m.Connections) { - b.WriteString(", ") - } - i++ - } - b.WriteString("]") - - b.WriteString("}") - return b.String() -} - -// String returns the connection information as a string. -// -func (cm ConnectionMetric) String() string { - var b strings.Builder - b.WriteString("{") - b.WriteString(cm.URL) - if cm.IsDead { - fmt.Fprintf(&b, " dead=%v", cm.IsDead) - } - if cm.Failures > 0 { - fmt.Fprintf(&b, " failures=%d", cm.Failures) - } - if cm.DeadSince != nil { - fmt.Fprintf(&b, " dead_since=%s", cm.DeadSince.Local().Format(time.Stamp)) - } - b.WriteString("}") - return b.String() -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esutil/bulk_indexer.go b/vendor/github.com/elastic/go-elasticsearch/v7/esutil/bulk_indexer.go deleted file mode 100644 index d26dd7ac9..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esutil/bulk_indexer.go +++ /dev/null @@ -1,592 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -package esutil - -import ( - "bytes" - "context" - "encoding/json" - "fmt" - "io" - "io/ioutil" - "net/http" - "runtime" - "strconv" - "sync" - "sync/atomic" - "time" - - "github.com/elastic/go-elasticsearch/v7" - "github.com/elastic/go-elasticsearch/v7/esapi" - "github.com/elastic/go-elasticsearch/v7/estransport" -) - -// BulkIndexer represents a parallel, asynchronous, efficient indexer for Elasticsearch. -// -type BulkIndexer interface { - // Add adds an item to the indexer. It returns an error when the item cannot be added. - // Use the OnSuccess and OnFailure callbacks to get the operation result for the item. - // - // You must call the Close() method after you're done adding items. - // - // It is safe for concurrent use. When it's called from goroutines, - // they must finish before the call to Close, eg. using sync.WaitGroup. - Add(context.Context, BulkIndexerItem) error - - // Close waits until all added items are flushed and closes the indexer. - Close(context.Context) error - - // Stats returns indexer statistics. - Stats() BulkIndexerStats -} - -// BulkIndexerConfig represents configuration of the indexer. -// -type BulkIndexerConfig struct { - NumWorkers int // The number of workers. Defaults to runtime.NumCPU(). - FlushBytes int // The flush threshold in bytes. Defaults to 5MB. - FlushInterval time.Duration // The flush threshold as duration. Defaults to 30sec. - - Client *elasticsearch.Client // The Elasticsearch client. - Decoder BulkResponseJSONDecoder // A custom JSON decoder. - DebugLogger BulkIndexerDebugLogger // An optional logger for debugging. - - OnError func(context.Context, error) // Called for indexer errors. - OnFlushStart func(context.Context) context.Context // Called when the flush starts. - OnFlushEnd func(context.Context) // Called when the flush ends. - - // Parameters of the Bulk API. - Index string - ErrorTrace bool - FilterPath []string - Header http.Header - Human bool - Pipeline string - Pretty bool - Refresh string - Routing string - Source []string - SourceExcludes []string - SourceIncludes []string - Timeout time.Duration - WaitForActiveShards string -} - -// BulkIndexerStats represents the indexer statistics. -// -type BulkIndexerStats struct { - NumAdded uint64 - NumFlushed uint64 - NumFailed uint64 - NumIndexed uint64 - NumCreated uint64 - NumUpdated uint64 - NumDeleted uint64 - NumRequests uint64 -} - -// BulkIndexerItem represents an indexer item. -// -type BulkIndexerItem struct { - Index string - Action string - DocumentID string - Body io.Reader - RetryOnConflict *int - - OnSuccess func(context.Context, BulkIndexerItem, BulkIndexerResponseItem) // Per item - OnFailure func(context.Context, BulkIndexerItem, BulkIndexerResponseItem, error) // Per item -} - -// BulkIndexerResponse represents the Elasticsearch response. -// -type BulkIndexerResponse struct { - Took int `json:"took"` - HasErrors bool `json:"errors"` - Items []map[string]BulkIndexerResponseItem `json:"items,omitempty"` -} - -// BulkIndexerResponseItem represents the Elasticsearch response item. -// -type BulkIndexerResponseItem struct { - Index string `json:"_index"` - DocumentID string `json:"_id"` - Version int64 `json:"_version"` - Result string `json:"result"` - Status int `json:"status"` - SeqNo int64 `json:"_seq_no"` - PrimTerm int64 `json:"_primary_term"` - - Shards struct { - Total int `json:"total"` - Successful int `json:"successful"` - Failed int `json:"failed"` - } `json:"_shards"` - - Error struct { - Type string `json:"type"` - Reason string `json:"reason"` - Cause struct { - Type string `json:"type"` - Reason string `json:"reason"` - } `json:"caused_by"` - } `json:"error,omitempty"` -} - -// BulkResponseJSONDecoder defines the interface for custom JSON decoders. -// -type BulkResponseJSONDecoder interface { - UnmarshalFromReader(io.Reader, *BulkIndexerResponse) error -} - -// BulkIndexerDebugLogger defines the interface for a debugging logger. -// -type BulkIndexerDebugLogger interface { - Printf(string, ...interface{}) -} - -type bulkIndexer struct { - wg sync.WaitGroup - queue chan BulkIndexerItem - workers []*worker - ticker *time.Ticker - done chan bool - stats *bulkIndexerStats - - config BulkIndexerConfig -} - -type bulkIndexerStats struct { - numAdded uint64 - numFlushed uint64 - numFailed uint64 - numIndexed uint64 - numCreated uint64 - numUpdated uint64 - numDeleted uint64 - numRequests uint64 -} - -// NewBulkIndexer creates a new bulk indexer. -// -func NewBulkIndexer(cfg BulkIndexerConfig) (BulkIndexer, error) { - if cfg.Client == nil { - cfg.Client, _ = elasticsearch.NewDefaultClient() - } - - if cfg.Decoder == nil { - cfg.Decoder = defaultJSONDecoder{} - } - - if cfg.NumWorkers == 0 { - cfg.NumWorkers = runtime.NumCPU() - } - - if cfg.FlushBytes == 0 { - cfg.FlushBytes = 5e+6 - } - - if cfg.FlushInterval == 0 { - cfg.FlushInterval = 30 * time.Second - } - - bi := bulkIndexer{ - config: cfg, - done: make(chan bool), - stats: &bulkIndexerStats{}, - } - - bi.init() - - return &bi, nil -} - -// Add adds an item to the indexer. -// -// Adding an item after a call to Close() will panic. -// -func (bi *bulkIndexer) Add(ctx context.Context, item BulkIndexerItem) error { - atomic.AddUint64(&bi.stats.numAdded, 1) - - select { - case <-ctx.Done(): - if bi.config.OnError != nil { - bi.config.OnError(ctx, ctx.Err()) - } - return ctx.Err() - case bi.queue <- item: - } - - return nil -} - -// Close stops the periodic flush, closes the indexer queue channel, -// notifies the done channel and calls flush on all writers. -// -func (bi *bulkIndexer) Close(ctx context.Context) error { - bi.ticker.Stop() - close(bi.queue) - bi.done <- true - - select { - case <-ctx.Done(): - if bi.config.OnError != nil { - bi.config.OnError(ctx, ctx.Err()) - } - return ctx.Err() - default: - bi.wg.Wait() - } - - for _, w := range bi.workers { - w.mu.Lock() - if w.buf.Len() > 0 { - if err := w.flush(ctx); err != nil { - w.mu.Unlock() - if bi.config.OnError != nil { - bi.config.OnError(ctx, err) - } - continue - } - } - w.mu.Unlock() - } - return nil -} - -// Stats returns indexer statistics. -// -func (bi *bulkIndexer) Stats() BulkIndexerStats { - return BulkIndexerStats{ - NumAdded: atomic.LoadUint64(&bi.stats.numAdded), - NumFlushed: atomic.LoadUint64(&bi.stats.numFlushed), - NumFailed: atomic.LoadUint64(&bi.stats.numFailed), - NumIndexed: atomic.LoadUint64(&bi.stats.numIndexed), - NumCreated: atomic.LoadUint64(&bi.stats.numCreated), - NumUpdated: atomic.LoadUint64(&bi.stats.numUpdated), - NumDeleted: atomic.LoadUint64(&bi.stats.numDeleted), - NumRequests: atomic.LoadUint64(&bi.stats.numRequests), - } -} - -// init initializes the bulk indexer. -// -func (bi *bulkIndexer) init() { - bi.queue = make(chan BulkIndexerItem, bi.config.NumWorkers) - - for i := 1; i <= bi.config.NumWorkers; i++ { - w := worker{ - id: i, - ch: bi.queue, - bi: bi, - buf: bytes.NewBuffer(make([]byte, 0, bi.config.FlushBytes)), - aux: make([]byte, 0, 512)} - w.run() - bi.workers = append(bi.workers, &w) - } - bi.wg.Add(bi.config.NumWorkers) - - bi.ticker = time.NewTicker(bi.config.FlushInterval) - go func() { - ctx := context.Background() - for { - select { - case <-bi.done: - return - case <-bi.ticker.C: - if bi.config.DebugLogger != nil { - bi.config.DebugLogger.Printf("[indexer] Auto-flushing workers after %s\n", bi.config.FlushInterval) - } - for _, w := range bi.workers { - w.mu.Lock() - if w.buf.Len() > 0 { - if err := w.flush(ctx); err != nil { - w.mu.Unlock() - if bi.config.OnError != nil { - bi.config.OnError(ctx, err) - } - continue - } - } - w.mu.Unlock() - } - } - } - }() -} - -// worker represents an indexer worker. -// -type worker struct { - id int - ch <-chan BulkIndexerItem - mu sync.Mutex - bi *bulkIndexer - buf *bytes.Buffer - aux []byte - items []BulkIndexerItem -} - -// run launches the worker in a goroutine. -// -func (w *worker) run() { - go func() { - ctx := context.Background() - - if w.bi.config.DebugLogger != nil { - w.bi.config.DebugLogger.Printf("[worker-%03d] Started\n", w.id) - } - defer w.bi.wg.Done() - - for item := range w.ch { - w.mu.Lock() - - if w.bi.config.DebugLogger != nil { - w.bi.config.DebugLogger.Printf("[worker-%03d] Received item [%s:%s]\n", w.id, item.Action, item.DocumentID) - } - - if err := w.writeMeta(item); err != nil { - if item.OnFailure != nil { - item.OnFailure(ctx, item, BulkIndexerResponseItem{}, err) - } - atomic.AddUint64(&w.bi.stats.numFailed, 1) - w.mu.Unlock() - continue - } - - if err := w.writeBody(&item); err != nil { - if item.OnFailure != nil { - item.OnFailure(ctx, item, BulkIndexerResponseItem{}, err) - } - atomic.AddUint64(&w.bi.stats.numFailed, 1) - w.mu.Unlock() - continue - } - - w.items = append(w.items, item) - if w.buf.Len() >= w.bi.config.FlushBytes { - if err := w.flush(ctx); err != nil { - w.mu.Unlock() - if w.bi.config.OnError != nil { - w.bi.config.OnError(ctx, err) - } - continue - } - } - w.mu.Unlock() - } - }() -} - -// writeMeta formats and writes the item metadata to the buffer; it must be called under a lock. -// -func (w *worker) writeMeta(item BulkIndexerItem) error { - w.buf.WriteRune('{') - w.aux = strconv.AppendQuote(w.aux, item.Action) - w.buf.Write(w.aux) - w.aux = w.aux[:0] - w.buf.WriteRune(':') - w.buf.WriteRune('{') - if item.DocumentID != "" { - w.buf.WriteString(`"_id":`) - w.aux = strconv.AppendQuote(w.aux, item.DocumentID) - w.buf.Write(w.aux) - w.aux = w.aux[:0] - } - if item.Index != "" { - if item.DocumentID != "" { - w.buf.WriteRune(',') - } - w.buf.WriteString(`"_index":`) - w.aux = strconv.AppendQuote(w.aux, item.Index) - w.buf.Write(w.aux) - w.aux = w.aux[:0] - } - w.buf.WriteRune('}') - w.buf.WriteRune('}') - w.buf.WriteRune('\n') - return nil -} - -// writeBody writes the item body to the buffer; it must be called under a lock. -// -func (w *worker) writeBody(item *BulkIndexerItem) error { - if item.Body != nil { - - var getBody func() io.Reader - - if item.OnSuccess != nil || item.OnFailure != nil { - var buf bytes.Buffer - buf.ReadFrom(item.Body) - getBody = func() io.Reader { - r := buf - return ioutil.NopCloser(&r) - } - item.Body = getBody() - } - - if _, err := w.buf.ReadFrom(item.Body); err != nil { - if w.bi.config.OnError != nil { - w.bi.config.OnError(context.Background(), err) - } - return err - } - w.buf.WriteRune('\n') - - if getBody != nil && (item.OnSuccess != nil || item.OnFailure != nil) { - item.Body = getBody() - } - } - return nil -} - -// flush writes out the worker buffer; it must be called under a lock. -// -func (w *worker) flush(ctx context.Context) error { - if w.bi.config.OnFlushStart != nil { - ctx = w.bi.config.OnFlushStart(ctx) - } - - if w.bi.config.OnFlushEnd != nil { - defer func() { w.bi.config.OnFlushEnd(ctx) }() - } - - if w.buf.Len() < 1 { - if w.bi.config.DebugLogger != nil { - w.bi.config.DebugLogger.Printf("[worker-%03d] Flush: Buffer empty\n", w.id) - } - return nil - } - - var ( - err error - blk BulkIndexerResponse - ) - - defer func() { - w.items = w.items[:0] - w.buf.Reset() - }() - - if w.bi.config.DebugLogger != nil { - w.bi.config.DebugLogger.Printf("[worker-%03d] Flush: %s\n", w.id, w.buf.String()) - } - - atomic.AddUint64(&w.bi.stats.numRequests, 1) - req := esapi.BulkRequest{ - Index: w.bi.config.Index, - Body: w.buf, - - Pipeline: w.bi.config.Pipeline, - Refresh: w.bi.config.Refresh, - Routing: w.bi.config.Routing, - Source: w.bi.config.Source, - SourceExcludes: w.bi.config.SourceExcludes, - SourceIncludes: w.bi.config.SourceIncludes, - Timeout: w.bi.config.Timeout, - WaitForActiveShards: w.bi.config.WaitForActiveShards, - - Pretty: w.bi.config.Pretty, - Human: w.bi.config.Human, - ErrorTrace: w.bi.config.ErrorTrace, - FilterPath: w.bi.config.FilterPath, - Header: w.bi.config.Header, - } - - // Add Header and MetaHeader to config if not already set - if req.Header == nil { - req.Header = http.Header{} - } - req.Header.Set(estransport.HeaderClientMeta, "h=bp") - - res, err := req.Do(ctx, w.bi.config.Client) - if err != nil { - atomic.AddUint64(&w.bi.stats.numFailed, uint64(len(w.items))) - if w.bi.config.OnError != nil { - w.bi.config.OnError(ctx, fmt.Errorf("flush: %s", err)) - } - return fmt.Errorf("flush: %s", err) - } - if res.Body != nil { - defer res.Body.Close() - } - if res.IsError() { - atomic.AddUint64(&w.bi.stats.numFailed, uint64(len(w.items))) - // TODO(karmi): Wrap error (include response struct) - if w.bi.config.OnError != nil { - w.bi.config.OnError(ctx, fmt.Errorf("flush: %s", err)) - } - return fmt.Errorf("flush: %s", res.String()) - } - - if err := w.bi.config.Decoder.UnmarshalFromReader(res.Body, &blk); err != nil { - // TODO(karmi): Wrap error (include response struct) - if w.bi.config.OnError != nil { - w.bi.config.OnError(ctx, fmt.Errorf("flush: %s", err)) - } - return fmt.Errorf("flush: error parsing response body: %s", err) - } - - for i, blkItem := range blk.Items { - var ( - item BulkIndexerItem - info BulkIndexerResponseItem - op string - ) - - item = w.items[i] - // The Elasticsearch bulk response contains an array of maps like this: - // [ { "index": { ... } }, { "create": { ... } }, ... ] - // We range over the map, to set the first key and value as "op" and "info". - for k, v := range blkItem { - op = k - info = v - } - if info.Error.Type != "" || info.Status > 201 { - atomic.AddUint64(&w.bi.stats.numFailed, 1) - if item.OnFailure != nil { - item.OnFailure(ctx, item, info, nil) - } - } else { - atomic.AddUint64(&w.bi.stats.numFlushed, 1) - - switch op { - case "index": - atomic.AddUint64(&w.bi.stats.numIndexed, 1) - case "create": - atomic.AddUint64(&w.bi.stats.numCreated, 1) - case "delete": - atomic.AddUint64(&w.bi.stats.numDeleted, 1) - case "update": - atomic.AddUint64(&w.bi.stats.numUpdated, 1) - } - - if item.OnSuccess != nil { - item.OnSuccess(ctx, item, info) - } - } - } - - return err -} - -type defaultJSONDecoder struct{} - -func (d defaultJSONDecoder) UnmarshalFromReader(r io.Reader, blk *BulkIndexerResponse) error { - return json.NewDecoder(r).Decode(blk) -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esutil/doc.go b/vendor/github.com/elastic/go-elasticsearch/v7/esutil/doc.go deleted file mode 100644 index 494a019e8..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esutil/doc.go +++ /dev/null @@ -1,22 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -/* -Package esutil provides helper utilities to the Go client for Elasticsearch. - -*/ -package esutil diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/esutil/json_reader.go b/vendor/github.com/elastic/go-elasticsearch/v7/esutil/json_reader.go deleted file mode 100644 index 36673a4ca..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/esutil/json_reader.go +++ /dev/null @@ -1,95 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -package esutil - -import ( - "bytes" - "encoding/json" - "io" -) - -// NewJSONReader encodes v into JSON and returns it as an io.Reader. -// -func NewJSONReader(v interface{}) io.Reader { - return &JSONReader{val: v, buf: nil} -} - -// JSONEncoder defines the interface for custom JSON encoders. -// -type JSONEncoder interface { - EncodeJSON(io.Writer) error -} - -// JSONReader represents a reader which takes an interface value, -// encodes it into JSON, and wraps it in an io.Reader. -// -type JSONReader struct { - val interface{} - buf interface { - io.ReadWriter - io.WriterTo - } -} - -// Read implements the io.Reader interface. -// -func (r *JSONReader) Read(p []byte) (int, error) { - if r.buf == nil { - r.buf = new(bytes.Buffer) - if err := r.encode(r.buf); err != nil { - return 0, err - } - } - - return r.buf.Read(p) -} - -// WriteTo implements the io.WriterTo interface. -// -func (r *JSONReader) WriteTo(w io.Writer) (int64, error) { - cw := countingWriter{Writer: w} - err := r.encode(&cw) - return int64(cw.n), err -} - -func (r *JSONReader) encode(w io.Writer) error { - var err error - - if e, ok := r.val.(JSONEncoder); ok { - err = e.EncodeJSON(w) - if err != nil { - return err - } - return nil - } - - return json.NewEncoder(w).Encode(r.val) -} - -type countingWriter struct { - io.Writer - n int -} - -func (cw *countingWriter) Write(p []byte) (int, error) { - n, err := cw.Writer.Write(p) - if n > 0 { - cw.n += n - } - return n, err -} diff --git a/vendor/github.com/elastic/go-elasticsearch/v7/internal/version/version.go b/vendor/github.com/elastic/go-elasticsearch/v7/internal/version/version.go deleted file mode 100644 index 61244a970..000000000 --- a/vendor/github.com/elastic/go-elasticsearch/v7/internal/version/version.go +++ /dev/null @@ -1,22 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -package version - -// Client returns the client version as a string. -// -const Client = "7.13.1" diff --git a/vendor/github.com/emicklei/go-restful/v3/.gitignore b/vendor/github.com/emicklei/go-restful/v3/.gitignore deleted file mode 100644 index 446be09b4..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/.gitignore +++ /dev/null @@ -1,71 +0,0 @@ -# Compiled Object files, Static and Dynamic libs (Shared Objects) -*.o -*.a -*.so - -# Folders -_obj -_test - -# Architecture specific extensions/prefixes -*.[568vq] -[568vq].out - -*.cgo1.go -*.cgo2.c -_cgo_defun.c -_cgo_gotypes.go -_cgo_export.* - -_testmain.go - -*.exe - -restful.html - -*.out - -tmp.prof - -go-restful.test - -examples/restful-basic-authentication - -examples/restful-encoding-filter - -examples/restful-filters - -examples/restful-hello-world - -examples/restful-resource-functions - -examples/restful-serve-static - -examples/restful-user-service - -*.DS_Store -examples/restful-user-resource - -examples/restful-multi-containers - -examples/restful-form-handling - -examples/restful-CORS-filter - -examples/restful-options-filter - -examples/restful-curly-router - -examples/restful-cpuprofiler-service - -examples/restful-pre-post-filters - -curly.prof - -examples/restful-NCSA-logging - -examples/restful-html-template - -s.html -restful-path-tail -.idea diff --git a/vendor/github.com/emicklei/go-restful/v3/.goconvey b/vendor/github.com/emicklei/go-restful/v3/.goconvey deleted file mode 100644 index 8485e986e..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/.goconvey +++ /dev/null @@ -1 +0,0 @@ -ignore \ No newline at end of file diff --git a/vendor/github.com/emicklei/go-restful/v3/.travis.yml b/vendor/github.com/emicklei/go-restful/v3/.travis.yml deleted file mode 100644 index 3a0bf5ff1..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/.travis.yml +++ /dev/null @@ -1,13 +0,0 @@ -language: go - -go: - - 1.x - -before_install: - - go test -v - -script: - - go test -race -coverprofile=coverage.txt -covermode=atomic - -after_success: - - bash <(curl -s https://codecov.io/bash) \ No newline at end of file diff --git a/vendor/github.com/emicklei/go-restful/v3/CHANGES.md b/vendor/github.com/emicklei/go-restful/v3/CHANGES.md deleted file mode 100644 index 38169cfd6..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/CHANGES.md +++ /dev/null @@ -1,372 +0,0 @@ -# Change history of go-restful - -## [v3.8.0] - 20221-06-06 - -- use exact matching of allowed domain entries, issue #489 (#493) - - this changes fixes [security] Authorization Bypass Through User-Controlled Key - by changing the behaviour of the AllowedDomains setting in the CORS filter. - To support the previous behaviour, the CORS filter type now has a AllowedDomainFunc - callback mechanism which is called when a simple domain match fails. -- add test and fix for POST without body and Content-type, issue #492 (#496) -- [Minor] Bad practice to have a mix of Receiver types. (#491) - -## [v3.7.2] - 2021-11-24 - -- restored FilterChain (#482 by SVilgelm) - - -## [v3.7.1] - 2021-10-04 - -- fix problem with contentEncodingEnabled setting (#479) - -## [v3.7.0] - 2021-09-24 - -- feat(parameter): adds additional openapi mappings (#478) - -## [v3.6.0] - 2021-09-18 - -- add support for vendor extensions (#477 thx erraggy) - -## [v3.5.2] - 2021-07-14 - -- fix removing absent route from webservice (#472) - -## [v3.5.1] - 2021-04-12 - -- fix handling no match access selected path -- remove obsolete field - -## [v3.5.0] - 2021-04-10 - -- add check for wildcard (#463) in CORS -- add access to Route from Request, issue #459 (#462) - -## [v3.4.0] - 2020-11-10 - -- Added OPTIONS to WebService - -## [v3.3.2] - 2020-01-23 - -- Fixed duplicate compression in dispatch. #449 - - -## [v3.3.1] - 2020-08-31 - -- Added check on writer to prevent compression of response twice. #447 - -## [v3.3.0] - 2020-08-19 - -- Enable content encoding on Handle and ServeHTTP (#446) -- List available representations in 406 body (#437) -- Convert to string using rune() (#443) - -## [v3.2.0] - 2020-06-21 - -- 405 Method Not Allowed must have Allow header (#436) (thx Bracken ) -- add field allowedMethodsWithoutContentType (#424) - -## [v3.1.0] - -- support describing response headers (#426) -- fix openapi examples (#425) - -v3.0.0 - -- fix: use request/response resulting from filter chain -- add Go module - Module consumer should use github.com/emicklei/go-restful/v3 as import path - -v2.10.0 - -- support for Custom Verbs (thanks Vinci Xu <277040271@qq.com>) -- fixed static example (thanks Arthur ) -- simplify code (thanks Christian Muehlhaeuser ) -- added JWT HMAC with SHA-512 authentication code example (thanks Amim Knabben ) - -v2.9.6 - -- small optimization in filter code - -v2.11.1 - -- fix WriteError return value (#415) - -v2.11.0 - -- allow prefix and suffix in path variable expression (#414) - -v2.9.6 - -- support google custome verb (#413) - -v2.9.5 - -- fix panic in Response.WriteError if err == nil - -v2.9.4 - -- fix issue #400 , parsing mime type quality -- Route Builder added option for contentEncodingEnabled (#398) - -v2.9.3 - -- Avoid return of 415 Unsupported Media Type when request body is empty (#396) - -v2.9.2 - -- Reduce allocations in per-request methods to improve performance (#395) - -v2.9.1 - -- Fix issue with default responses and invalid status code 0. (#393) - -v2.9.0 - -- add per Route content encoding setting (overrides container setting) - -v2.8.0 - -- add Request.QueryParameters() -- add json-iterator (via build tag) -- disable vgo module (until log is moved) - -v2.7.1 - -- add vgo module - -v2.6.1 - -- add JSONNewDecoderFunc to allow custom JSON Decoder usage (go 1.10+) - -v2.6.0 - -- Make JSR 311 routing and path param processing consistent -- Adding description to RouteBuilder.Reads() -- Update example for Swagger12 and OpenAPI - -2017-09-13 - -- added route condition functions using `.If(func)` in route building. - -2017-02-16 - -- solved issue #304, make operation names unique - -2017-01-30 - - [IMPORTANT] For swagger users, change your import statement to: - swagger "github.com/emicklei/go-restful-swagger12" - -- moved swagger 1.2 code to go-restful-swagger12 -- created TAG 2.0.0 - -2017-01-27 - -- remove defer request body close -- expose Dispatch for testing filters and Routefunctions -- swagger response model cannot be array -- created TAG 1.0.0 - -2016-12-22 - -- (API change) Remove code related to caching request content. Removes SetCacheReadEntity(doCache bool) - -2016-11-26 - -- Default change! now use CurlyRouter (was RouterJSR311) -- Default change! no more caching of request content -- Default change! do not recover from panics - -2016-09-22 - -- fix the DefaultRequestContentType feature - -2016-02-14 - -- take the qualify factor of the Accept header mediatype into account when deciding the contentype of the response -- add constructors for custom entity accessors for xml and json - -2015-09-27 - -- rename new WriteStatusAnd... to WriteHeaderAnd... for consistency - -2015-09-25 - -- fixed problem with changing Header after WriteHeader (issue 235) - -2015-09-14 - -- changed behavior of WriteHeader (immediate write) and WriteEntity (no status write) -- added support for custom EntityReaderWriters. - -2015-08-06 - -- add support for reading entities from compressed request content -- use sync.Pool for compressors of http response and request body -- add Description to Parameter for documentation in Swagger UI - -2015-03-20 - -- add configurable logging - -2015-03-18 - -- if not specified, the Operation is derived from the Route function - -2015-03-17 - -- expose Parameter creation functions -- make trace logger an interface -- fix OPTIONSFilter -- customize rendering of ServiceError -- JSR311 router now handles wildcards -- add Notes to Route - -2014-11-27 - -- (api add) PrettyPrint per response. (as proposed in #167) - -2014-11-12 - -- (api add) ApiVersion(.) for documentation in Swagger UI - -2014-11-10 - -- (api change) struct fields tagged with "description" show up in Swagger UI - -2014-10-31 - -- (api change) ReturnsError -> Returns -- (api add) RouteBuilder.Do(aBuilder) for DRY use of RouteBuilder -- fix swagger nested structs -- sort Swagger response messages by code - -2014-10-23 - -- (api add) ReturnsError allows you to document Http codes in swagger -- fixed problem with greedy CurlyRouter -- (api add) Access-Control-Max-Age in CORS -- add tracing functionality (injectable) for debugging purposes -- support JSON parse 64bit int -- fix empty parameters for swagger -- WebServicesUrl is now optional for swagger -- fixed duplicate AccessControlAllowOrigin in CORS -- (api change) expose ServeMux in container -- (api add) added AllowedDomains in CORS -- (api add) ParameterNamed for detailed documentation - -2014-04-16 - -- (api add) expose constructor of Request for testing. - -2014-06-27 - -- (api add) ParameterNamed gives access to a Parameter definition and its data (for further specification). -- (api add) SetCacheReadEntity allow scontrol over whether or not the request body is being cached (default true for compatibility reasons). - -2014-07-03 - -- (api add) CORS can be configured with a list of allowed domains - -2014-03-12 - -- (api add) Route path parameters can use wildcard or regular expressions. (requires CurlyRouter) - -2014-02-26 - -- (api add) Request now provides information about the matched Route, see method SelectedRoutePath - -2014-02-17 - -- (api change) renamed parameter constants (go-lint checks) - -2014-01-10 - -- (api add) support for CloseNotify, see http://golang.org/pkg/net/http/#CloseNotifier - -2014-01-07 - -- (api change) Write* methods in Response now return the error or nil. -- added example of serving HTML from a Go template. -- fixed comparing Allowed headers in CORS (is now case-insensitive) - -2013-11-13 - -- (api add) Response knows how many bytes are written to the response body. - -2013-10-29 - -- (api add) RecoverHandler(handler RecoverHandleFunction) to change how panic recovery is handled. Default behavior is to log and return a stacktrace. This may be a security issue as it exposes sourcecode information. - -2013-10-04 - -- (api add) Response knows what HTTP status has been written -- (api add) Request can have attributes (map of string->interface, also called request-scoped variables - -2013-09-12 - -- (api change) Router interface simplified -- Implemented CurlyRouter, a Router that does not use|allow regular expressions in paths - -2013-08-05 - - add OPTIONS support - - add CORS support - -2013-08-27 - -- fixed some reported issues (see github) -- (api change) deprecated use of WriteError; use WriteErrorString instead - -2014-04-15 - -- (fix) v1.0.1 tag: fix Issue 111: WriteErrorString - -2013-08-08 - -- (api add) Added implementation Container: a WebServices collection with its own http.ServeMux allowing multiple endpoints per program. Existing uses of go-restful will register their services to the DefaultContainer. -- (api add) the swagger package has be extended to have a UI per container. -- if panic is detected then a small stack trace is printed (thanks to runner-mei) -- (api add) WriteErrorString to Response - -Important API changes: - -- (api remove) package variable DoNotRecover no longer works ; use restful.DefaultContainer.DoNotRecover(true) instead. -- (api remove) package variable EnableContentEncoding no longer works ; use restful.DefaultContainer.EnableContentEncoding(true) instead. - - -2013-07-06 - -- (api add) Added support for response encoding (gzip and deflate(zlib)). This feature is disabled on default (for backwards compatibility). Use restful.EnableContentEncoding = true in your initialization to enable this feature. - -2013-06-19 - -- (improve) DoNotRecover option, moved request body closer, improved ReadEntity - -2013-06-03 - -- (api change) removed Dispatcher interface, hide PathExpression -- changed receiver names of type functions to be more idiomatic Go - -2013-06-02 - -- (optimize) Cache the RegExp compilation of Paths. - -2013-05-22 - -- (api add) Added support for request/response filter functions - -2013-05-18 - - -- (api add) Added feature to change the default Http Request Dispatch function (travis cline) -- (api change) Moved Swagger Webservice to swagger package (see example restful-user) - -[2012-11-14 .. 2013-05-18> - -- See https://github.com/emicklei/go-restful/commits - -2012-11-14 - -- Initial commit - - diff --git a/vendor/github.com/emicklei/go-restful/v3/LICENSE b/vendor/github.com/emicklei/go-restful/v3/LICENSE deleted file mode 100644 index ece7ec61e..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 2012,2013 Ernest Micklei - -MIT License - -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. \ No newline at end of file diff --git a/vendor/github.com/emicklei/go-restful/v3/Makefile b/vendor/github.com/emicklei/go-restful/v3/Makefile deleted file mode 100644 index 16d0b80bb..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -all: test - -test: - go vet . - go test -cover -v . - -ex: - find ./examples -type f -name "*.go" | xargs -I {} go build -o /tmp/ignore {} \ No newline at end of file diff --git a/vendor/github.com/emicklei/go-restful/v3/README.md b/vendor/github.com/emicklei/go-restful/v3/README.md deleted file mode 100644 index 23166d3b4..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/README.md +++ /dev/null @@ -1,110 +0,0 @@ -go-restful -========== -package for building REST-style Web Services using Google Go - -[![Build Status](https://travis-ci.org/emicklei/go-restful.png)](https://travis-ci.org/emicklei/go-restful) -[![Go Report Card](https://goreportcard.com/badge/github.com/emicklei/go-restful)](https://goreportcard.com/report/github.com/emicklei/go-restful) -[![GoDoc](https://godoc.org/github.com/emicklei/go-restful?status.svg)](https://pkg.go.dev/github.com/emicklei/go-restful) -[![codecov](https://codecov.io/gh/emicklei/go-restful/branch/master/graph/badge.svg)](https://codecov.io/gh/emicklei/go-restful) - -- [Code examples use v3](https://github.com/emicklei/go-restful/tree/v3/examples) - -REST asks developers to use HTTP methods explicitly and in a way that's consistent with the protocol definition. This basic REST design principle establishes a one-to-one mapping between create, read, update, and delete (CRUD) operations and HTTP methods. According to this mapping: - -- GET = Retrieve a representation of a resource -- POST = Create if you are sending content to the server to create a subordinate of the specified resource collection, using some server-side algorithm. -- PUT = Create if you are sending the full content of the specified resource (URI). -- PUT = Update if you are updating the full content of the specified resource. -- DELETE = Delete if you are requesting the server to delete the resource -- PATCH = Update partial content of a resource -- OPTIONS = Get information about the communication options for the request URI - -### Usage - -#### Without Go Modules - -All versions up to `v2.*.*` (on the master) are not supporting Go modules. - -``` -import ( - restful "github.com/emicklei/go-restful" -) -``` - -#### Using Go Modules - -As of version `v3.0.0` (on the v3 branch), this package supports Go modules. - -``` -import ( - restful "github.com/emicklei/go-restful/v3" -) -``` - -### Example - -```Go -ws := new(restful.WebService) -ws. - Path("/users"). - Consumes(restful.MIME_XML, restful.MIME_JSON). - Produces(restful.MIME_JSON, restful.MIME_XML) - -ws.Route(ws.GET("/{user-id}").To(u.findUser). - Doc("get a user"). - Param(ws.PathParameter("user-id", "identifier of the user").DataType("string")). - Writes(User{})) -... - -func (u UserResource) findUser(request *restful.Request, response *restful.Response) { - id := request.PathParameter("user-id") - ... -} -``` - -[Full API of a UserResource](https://github.com/emicklei/go-restful/blob/v3/examples/user-resource/restful-user-resource.go) - -### Features - -- Routes for request → function mapping with path parameter (e.g. {id} but also prefix_{var} and {var}_suffix) support -- Configurable router: - - (default) Fast routing algorithm that allows static elements, [google custom method](https://cloud.google.com/apis/design/custom_methods), regular expressions and dynamic parameters in the URL path (e.g. /resource/name:customVerb, /meetings/{id} or /static/{subpath:*}) - - Routing algorithm after [JSR311](http://jsr311.java.net/nonav/releases/1.1/spec/spec.html) that is implemented using (but does **not** accept) regular expressions -- Request API for reading structs from JSON/XML and accessing parameters (path,query,header) -- Response API for writing structs to JSON/XML and setting headers -- Customizable encoding using EntityReaderWriter registration -- Filters for intercepting the request → response flow on Service or Route level -- Request-scoped variables using attributes -- Containers for WebServices on different HTTP endpoints -- Content encoding (gzip,deflate) of request and response payloads -- Automatic responses on OPTIONS (using a filter) -- Automatic CORS request handling (using a filter) -- API declaration for Swagger UI ([go-restful-openapi](https://github.com/emicklei/go-restful-openapi), see [go-restful-swagger12](https://github.com/emicklei/go-restful-swagger12)) -- Panic recovery to produce HTTP 500, customizable using RecoverHandler(...) -- Route errors produce HTTP 404/405/406/415 errors, customizable using ServiceErrorHandler(...) -- Configurable (trace) logging -- Customizable gzip/deflate readers and writers using CompressorProvider registration - -## How to customize -There are several hooks to customize the behavior of the go-restful package. - -- Router algorithm -- Panic recovery -- JSON decoder -- Trace logging -- Compression -- Encoders for other serializers -- Use [jsoniter](https://github.com/json-iterator/go) by build this package using a tag, e.g. `go build -tags=jsoniter .` - -## Resources - -- [Example programs](./examples) -- [Example posted on blog](http://ernestmicklei.com/2012/11/go-restful-first-working-example/) -- [Design explained on blog](http://ernestmicklei.com/2012/11/go-restful-api-design/) -- [sourcegraph](https://sourcegraph.com/github.com/emicklei/go-restful) -- [showcase: Zazkia - tcp proxy for testing resiliency](https://github.com/emicklei/zazkia) -- [showcase: Mora - MongoDB REST Api server](https://github.com/emicklei/mora) - -Type ```git shortlog -s``` for a full list of contributors. - -© 2012 - 2022, http://ernestmicklei.com. MIT License. Contributions are welcome. diff --git a/vendor/github.com/emicklei/go-restful/v3/SECURITY.md b/vendor/github.com/emicklei/go-restful/v3/SECURITY.md deleted file mode 100644 index 810d3b510..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/SECURITY.md +++ /dev/null @@ -1,13 +0,0 @@ -# Security Policy - -## Supported Versions - -| Version | Supported | -| ------- | ------------------ | -| v3.7.x | :white_check_mark: | -| < v3.0.1 | :x: | - -## Reporting a Vulnerability - -Create an Issue and put the label `[security]` in the title of the issue. -Valid reported security issues are expected to be solved within a week. diff --git a/vendor/github.com/emicklei/go-restful/v3/Srcfile b/vendor/github.com/emicklei/go-restful/v3/Srcfile deleted file mode 100644 index 16fd18689..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/Srcfile +++ /dev/null @@ -1 +0,0 @@ -{"SkipDirs": ["examples"]} diff --git a/vendor/github.com/emicklei/go-restful/v3/bench_test.sh b/vendor/github.com/emicklei/go-restful/v3/bench_test.sh deleted file mode 100644 index 47ffbe4ac..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/bench_test.sh +++ /dev/null @@ -1,10 +0,0 @@ -#go test -run=none -file bench_test.go -test.bench . -cpuprofile=bench_test.out - -go test -c -./go-restful.test -test.run=none -test.cpuprofile=tmp.prof -test.bench=BenchmarkMany -./go-restful.test -test.run=none -test.cpuprofile=curly.prof -test.bench=BenchmarkManyCurly - -#go tool pprof go-restful.test tmp.prof -go tool pprof go-restful.test curly.prof - - diff --git a/vendor/github.com/emicklei/go-restful/v3/compress.go b/vendor/github.com/emicklei/go-restful/v3/compress.go deleted file mode 100644 index 1ff239f99..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/compress.go +++ /dev/null @@ -1,127 +0,0 @@ -package restful - -// Copyright 2013 Ernest Micklei. All rights reserved. -// Use of this source code is governed by a license -// that can be found in the LICENSE file. - -import ( - "bufio" - "compress/gzip" - "compress/zlib" - "errors" - "io" - "net" - "net/http" - "strings" -) - -// OBSOLETE : use restful.DefaultContainer.EnableContentEncoding(true) to change this setting. -var EnableContentEncoding = false - -// CompressingResponseWriter is a http.ResponseWriter that can perform content encoding (gzip and zlib) -type CompressingResponseWriter struct { - writer http.ResponseWriter - compressor io.WriteCloser - encoding string -} - -// Header is part of http.ResponseWriter interface -func (c *CompressingResponseWriter) Header() http.Header { - return c.writer.Header() -} - -// WriteHeader is part of http.ResponseWriter interface -func (c *CompressingResponseWriter) WriteHeader(status int) { - c.writer.WriteHeader(status) -} - -// Write is part of http.ResponseWriter interface -// It is passed through the compressor -func (c *CompressingResponseWriter) Write(bytes []byte) (int, error) { - if c.isCompressorClosed() { - return -1, errors.New("Compressing error: tried to write data using closed compressor") - } - return c.compressor.Write(bytes) -} - -// CloseNotify is part of http.CloseNotifier interface -func (c *CompressingResponseWriter) CloseNotify() <-chan bool { - return c.writer.(http.CloseNotifier).CloseNotify() -} - -// Close the underlying compressor -func (c *CompressingResponseWriter) Close() error { - if c.isCompressorClosed() { - return errors.New("Compressing error: tried to close already closed compressor") - } - - c.compressor.Close() - if ENCODING_GZIP == c.encoding { - currentCompressorProvider.ReleaseGzipWriter(c.compressor.(*gzip.Writer)) - } - if ENCODING_DEFLATE == c.encoding { - currentCompressorProvider.ReleaseZlibWriter(c.compressor.(*zlib.Writer)) - } - // gc hint needed? - c.compressor = nil - return nil -} - -func (c *CompressingResponseWriter) isCompressorClosed() bool { - return nil == c.compressor -} - -// Hijack implements the Hijacker interface -// This is especially useful when combining Container.EnabledContentEncoding -// in combination with websockets (for instance gorilla/websocket) -func (c *CompressingResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) { - hijacker, ok := c.writer.(http.Hijacker) - if !ok { - return nil, nil, errors.New("ResponseWriter doesn't support Hijacker interface") - } - return hijacker.Hijack() -} - -// WantsCompressedResponse reads the Accept-Encoding header to see if and which encoding is requested. -// It also inspects the httpWriter whether its content-encoding is already set (non-empty). -func wantsCompressedResponse(httpRequest *http.Request, httpWriter http.ResponseWriter) (bool, string) { - if contentEncoding := httpWriter.Header().Get(HEADER_ContentEncoding); contentEncoding != "" { - return false, "" - } - header := httpRequest.Header.Get(HEADER_AcceptEncoding) - gi := strings.Index(header, ENCODING_GZIP) - zi := strings.Index(header, ENCODING_DEFLATE) - // use in order of appearance - if gi == -1 { - return zi != -1, ENCODING_DEFLATE - } else if zi == -1 { - return gi != -1, ENCODING_GZIP - } else { - if gi < zi { - return true, ENCODING_GZIP - } - return true, ENCODING_DEFLATE - } -} - -// NewCompressingResponseWriter create a CompressingResponseWriter for a known encoding = {gzip,deflate} -func NewCompressingResponseWriter(httpWriter http.ResponseWriter, encoding string) (*CompressingResponseWriter, error) { - httpWriter.Header().Set(HEADER_ContentEncoding, encoding) - c := new(CompressingResponseWriter) - c.writer = httpWriter - var err error - if ENCODING_GZIP == encoding { - w := currentCompressorProvider.AcquireGzipWriter() - w.Reset(httpWriter) - c.compressor = w - c.encoding = ENCODING_GZIP - } else if ENCODING_DEFLATE == encoding { - w := currentCompressorProvider.AcquireZlibWriter() - w.Reset(httpWriter) - c.compressor = w - c.encoding = ENCODING_DEFLATE - } else { - return nil, errors.New("Unknown encoding:" + encoding) - } - return c, err -} diff --git a/vendor/github.com/emicklei/go-restful/v3/compressor_cache.go b/vendor/github.com/emicklei/go-restful/v3/compressor_cache.go deleted file mode 100644 index ee426010a..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/compressor_cache.go +++ /dev/null @@ -1,103 +0,0 @@ -package restful - -// Copyright 2015 Ernest Micklei. All rights reserved. -// Use of this source code is governed by a license -// that can be found in the LICENSE file. - -import ( - "compress/gzip" - "compress/zlib" -) - -// BoundedCachedCompressors is a CompressorProvider that uses a cache with a fixed amount -// of writers and readers (resources). -// If a new resource is acquired and all are in use, it will return a new unmanaged resource. -type BoundedCachedCompressors struct { - gzipWriters chan *gzip.Writer - gzipReaders chan *gzip.Reader - zlibWriters chan *zlib.Writer - writersCapacity int - readersCapacity int -} - -// NewBoundedCachedCompressors returns a new, with filled cache, BoundedCachedCompressors. -func NewBoundedCachedCompressors(writersCapacity, readersCapacity int) *BoundedCachedCompressors { - b := &BoundedCachedCompressors{ - gzipWriters: make(chan *gzip.Writer, writersCapacity), - gzipReaders: make(chan *gzip.Reader, readersCapacity), - zlibWriters: make(chan *zlib.Writer, writersCapacity), - writersCapacity: writersCapacity, - readersCapacity: readersCapacity, - } - for ix := 0; ix < writersCapacity; ix++ { - b.gzipWriters <- newGzipWriter() - b.zlibWriters <- newZlibWriter() - } - for ix := 0; ix < readersCapacity; ix++ { - b.gzipReaders <- newGzipReader() - } - return b -} - -// AcquireGzipWriter returns an resettable *gzip.Writer. Needs to be released. -func (b *BoundedCachedCompressors) AcquireGzipWriter() *gzip.Writer { - var writer *gzip.Writer - select { - case writer, _ = <-b.gzipWriters: - default: - // return a new unmanaged one - writer = newGzipWriter() - } - return writer -} - -// ReleaseGzipWriter accepts a writer (does not have to be one that was cached) -// only when the cache has room for it. It will ignore it otherwise. -func (b *BoundedCachedCompressors) ReleaseGzipWriter(w *gzip.Writer) { - // forget the unmanaged ones - if len(b.gzipWriters) < b.writersCapacity { - b.gzipWriters <- w - } -} - -// AcquireGzipReader returns a *gzip.Reader. Needs to be released. -func (b *BoundedCachedCompressors) AcquireGzipReader() *gzip.Reader { - var reader *gzip.Reader - select { - case reader, _ = <-b.gzipReaders: - default: - // return a new unmanaged one - reader = newGzipReader() - } - return reader -} - -// ReleaseGzipReader accepts a reader (does not have to be one that was cached) -// only when the cache has room for it. It will ignore it otherwise. -func (b *BoundedCachedCompressors) ReleaseGzipReader(r *gzip.Reader) { - // forget the unmanaged ones - if len(b.gzipReaders) < b.readersCapacity { - b.gzipReaders <- r - } -} - -// AcquireZlibWriter returns an resettable *zlib.Writer. Needs to be released. -func (b *BoundedCachedCompressors) AcquireZlibWriter() *zlib.Writer { - var writer *zlib.Writer - select { - case writer, _ = <-b.zlibWriters: - default: - // return a new unmanaged one - writer = newZlibWriter() - } - return writer -} - -// ReleaseZlibWriter accepts a writer (does not have to be one that was cached) -// only when the cache has room for it. It will ignore it otherwise. -func (b *BoundedCachedCompressors) ReleaseZlibWriter(w *zlib.Writer) { - // forget the unmanaged ones - if len(b.zlibWriters) < b.writersCapacity { - b.zlibWriters <- w - } -} diff --git a/vendor/github.com/emicklei/go-restful/v3/compressor_pools.go b/vendor/github.com/emicklei/go-restful/v3/compressor_pools.go deleted file mode 100644 index d866ce64b..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/compressor_pools.go +++ /dev/null @@ -1,91 +0,0 @@ -package restful - -// Copyright 2015 Ernest Micklei. All rights reserved. -// Use of this source code is governed by a license -// that can be found in the LICENSE file. - -import ( - "bytes" - "compress/gzip" - "compress/zlib" - "sync" -) - -// SyncPoolCompessors is a CompressorProvider that use the standard sync.Pool. -type SyncPoolCompessors struct { - GzipWriterPool *sync.Pool - GzipReaderPool *sync.Pool - ZlibWriterPool *sync.Pool -} - -// NewSyncPoolCompessors returns a new ("empty") SyncPoolCompessors. -func NewSyncPoolCompessors() *SyncPoolCompessors { - return &SyncPoolCompessors{ - GzipWriterPool: &sync.Pool{ - New: func() interface{} { return newGzipWriter() }, - }, - GzipReaderPool: &sync.Pool{ - New: func() interface{} { return newGzipReader() }, - }, - ZlibWriterPool: &sync.Pool{ - New: func() interface{} { return newZlibWriter() }, - }, - } -} - -func (s *SyncPoolCompessors) AcquireGzipWriter() *gzip.Writer { - return s.GzipWriterPool.Get().(*gzip.Writer) -} - -func (s *SyncPoolCompessors) ReleaseGzipWriter(w *gzip.Writer) { - s.GzipWriterPool.Put(w) -} - -func (s *SyncPoolCompessors) AcquireGzipReader() *gzip.Reader { - return s.GzipReaderPool.Get().(*gzip.Reader) -} - -func (s *SyncPoolCompessors) ReleaseGzipReader(r *gzip.Reader) { - s.GzipReaderPool.Put(r) -} - -func (s *SyncPoolCompessors) AcquireZlibWriter() *zlib.Writer { - return s.ZlibWriterPool.Get().(*zlib.Writer) -} - -func (s *SyncPoolCompessors) ReleaseZlibWriter(w *zlib.Writer) { - s.ZlibWriterPool.Put(w) -} - -func newGzipWriter() *gzip.Writer { - // create with an empty bytes writer; it will be replaced before using the gzipWriter - writer, err := gzip.NewWriterLevel(new(bytes.Buffer), gzip.BestSpeed) - if err != nil { - panic(err.Error()) - } - return writer -} - -func newGzipReader() *gzip.Reader { - // create with an empty reader (but with GZIP header); it will be replaced before using the gzipReader - // we can safely use currentCompressProvider because it is set on package initialization. - w := currentCompressorProvider.AcquireGzipWriter() - defer currentCompressorProvider.ReleaseGzipWriter(w) - b := new(bytes.Buffer) - w.Reset(b) - w.Flush() - w.Close() - reader, err := gzip.NewReader(bytes.NewReader(b.Bytes())) - if err != nil { - panic(err.Error()) - } - return reader -} - -func newZlibWriter() *zlib.Writer { - writer, err := zlib.NewWriterLevel(new(bytes.Buffer), gzip.BestSpeed) - if err != nil { - panic(err.Error()) - } - return writer -} diff --git a/vendor/github.com/emicklei/go-restful/v3/compressors.go b/vendor/github.com/emicklei/go-restful/v3/compressors.go deleted file mode 100644 index 9db4a8c8e..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/compressors.go +++ /dev/null @@ -1,54 +0,0 @@ -package restful - -// Copyright 2015 Ernest Micklei. All rights reserved. -// Use of this source code is governed by a license -// that can be found in the LICENSE file. - -import ( - "compress/gzip" - "compress/zlib" -) - -// CompressorProvider describes a component that can provider compressors for the std methods. -type CompressorProvider interface { - // Returns a *gzip.Writer which needs to be released later. - // Before using it, call Reset(). - AcquireGzipWriter() *gzip.Writer - - // Releases an acquired *gzip.Writer. - ReleaseGzipWriter(w *gzip.Writer) - - // Returns a *gzip.Reader which needs to be released later. - AcquireGzipReader() *gzip.Reader - - // Releases an acquired *gzip.Reader. - ReleaseGzipReader(w *gzip.Reader) - - // Returns a *zlib.Writer which needs to be released later. - // Before using it, call Reset(). - AcquireZlibWriter() *zlib.Writer - - // Releases an acquired *zlib.Writer. - ReleaseZlibWriter(w *zlib.Writer) -} - -// DefaultCompressorProvider is the actual provider of compressors (zlib or gzip). -var currentCompressorProvider CompressorProvider - -func init() { - currentCompressorProvider = NewSyncPoolCompessors() -} - -// CurrentCompressorProvider returns the current CompressorProvider. -// It is initialized using a SyncPoolCompessors. -func CurrentCompressorProvider() CompressorProvider { - return currentCompressorProvider -} - -// SetCompressorProvider sets the actual provider of compressors (zlib or gzip). -func SetCompressorProvider(p CompressorProvider) { - if p == nil { - panic("cannot set compressor provider to nil") - } - currentCompressorProvider = p -} diff --git a/vendor/github.com/emicklei/go-restful/v3/constants.go b/vendor/github.com/emicklei/go-restful/v3/constants.go deleted file mode 100644 index 203439c5e..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/constants.go +++ /dev/null @@ -1,30 +0,0 @@ -package restful - -// Copyright 2013 Ernest Micklei. All rights reserved. -// Use of this source code is governed by a license -// that can be found in the LICENSE file. - -const ( - MIME_XML = "application/xml" // Accept or Content-Type used in Consumes() and/or Produces() - MIME_JSON = "application/json" // Accept or Content-Type used in Consumes() and/or Produces() - MIME_OCTET = "application/octet-stream" // If Content-Type is not present in request, use the default - - HEADER_Allow = "Allow" - HEADER_Accept = "Accept" - HEADER_Origin = "Origin" - HEADER_ContentType = "Content-Type" - HEADER_LastModified = "Last-Modified" - HEADER_AcceptEncoding = "Accept-Encoding" - HEADER_ContentEncoding = "Content-Encoding" - HEADER_AccessControlExposeHeaders = "Access-Control-Expose-Headers" - HEADER_AccessControlRequestMethod = "Access-Control-Request-Method" - HEADER_AccessControlRequestHeaders = "Access-Control-Request-Headers" - HEADER_AccessControlAllowMethods = "Access-Control-Allow-Methods" - HEADER_AccessControlAllowOrigin = "Access-Control-Allow-Origin" - HEADER_AccessControlAllowCredentials = "Access-Control-Allow-Credentials" - HEADER_AccessControlAllowHeaders = "Access-Control-Allow-Headers" - HEADER_AccessControlMaxAge = "Access-Control-Max-Age" - - ENCODING_GZIP = "gzip" - ENCODING_DEFLATE = "deflate" -) diff --git a/vendor/github.com/emicklei/go-restful/v3/container.go b/vendor/github.com/emicklei/go-restful/v3/container.go deleted file mode 100644 index dd56246dd..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/container.go +++ /dev/null @@ -1,450 +0,0 @@ -package restful - -// Copyright 2013 Ernest Micklei. All rights reserved. -// Use of this source code is governed by a license -// that can be found in the LICENSE file. - -import ( - "bytes" - "errors" - "fmt" - "net/http" - "os" - "runtime" - "strings" - "sync" - - "github.com/emicklei/go-restful/v3/log" -) - -// Container holds a collection of WebServices and a http.ServeMux to dispatch http requests. -// The requests are further dispatched to routes of WebServices using a RouteSelector -type Container struct { - webServicesLock sync.RWMutex - webServices []*WebService - ServeMux *http.ServeMux - isRegisteredOnRoot bool - containerFilters []FilterFunction - doNotRecover bool // default is true - recoverHandleFunc RecoverHandleFunction - serviceErrorHandleFunc ServiceErrorHandleFunction - router RouteSelector // default is a CurlyRouter (RouterJSR311 is a slower alternative) - contentEncodingEnabled bool // default is false -} - -// NewContainer creates a new Container using a new ServeMux and default router (CurlyRouter) -func NewContainer() *Container { - return &Container{ - webServices: []*WebService{}, - ServeMux: http.NewServeMux(), - isRegisteredOnRoot: false, - containerFilters: []FilterFunction{}, - doNotRecover: true, - recoverHandleFunc: logStackOnRecover, - serviceErrorHandleFunc: writeServiceError, - router: CurlyRouter{}, - contentEncodingEnabled: false} -} - -// RecoverHandleFunction declares functions that can be used to handle a panic situation. -// The first argument is what recover() returns. The second must be used to communicate an error response. -type RecoverHandleFunction func(interface{}, http.ResponseWriter) - -// RecoverHandler changes the default function (logStackOnRecover) to be called -// when a panic is detected. DoNotRecover must be have its default value (=false). -func (c *Container) RecoverHandler(handler RecoverHandleFunction) { - c.recoverHandleFunc = handler -} - -// ServiceErrorHandleFunction declares functions that can be used to handle a service error situation. -// The first argument is the service error, the second is the request that resulted in the error and -// the third must be used to communicate an error response. -type ServiceErrorHandleFunction func(ServiceError, *Request, *Response) - -// ServiceErrorHandler changes the default function (writeServiceError) to be called -// when a ServiceError is detected. -func (c *Container) ServiceErrorHandler(handler ServiceErrorHandleFunction) { - c.serviceErrorHandleFunc = handler -} - -// DoNotRecover controls whether panics will be caught to return HTTP 500. -// If set to true, Route functions are responsible for handling any error situation. -// Default value is true. -func (c *Container) DoNotRecover(doNot bool) { - c.doNotRecover = doNot -} - -// Router changes the default Router (currently CurlyRouter) -func (c *Container) Router(aRouter RouteSelector) { - c.router = aRouter -} - -// EnableContentEncoding (default=false) allows for GZIP or DEFLATE encoding of responses. -func (c *Container) EnableContentEncoding(enabled bool) { - c.contentEncodingEnabled = enabled -} - -// Add a WebService to the Container. It will detect duplicate root paths and exit in that case. -func (c *Container) Add(service *WebService) *Container { - c.webServicesLock.Lock() - defer c.webServicesLock.Unlock() - - // if rootPath was not set then lazy initialize it - if len(service.rootPath) == 0 { - service.Path("/") - } - - // cannot have duplicate root paths - for _, each := range c.webServices { - if each.RootPath() == service.RootPath() { - log.Printf("WebService with duplicate root path detected:['%v']", each) - os.Exit(1) - } - } - - // If not registered on root then add specific mapping - if !c.isRegisteredOnRoot { - c.isRegisteredOnRoot = c.addHandler(service, c.ServeMux) - } - c.webServices = append(c.webServices, service) - return c -} - -// addHandler may set a new HandleFunc for the serveMux -// this function must run inside the critical region protected by the webServicesLock. -// returns true if the function was registered on root ("/") -func (c *Container) addHandler(service *WebService, serveMux *http.ServeMux) bool { - pattern := fixedPrefixPath(service.RootPath()) - // check if root path registration is needed - if "/" == pattern || "" == pattern { - serveMux.HandleFunc("/", c.dispatch) - return true - } - // detect if registration already exists - alreadyMapped := false - for _, each := range c.webServices { - if each.RootPath() == service.RootPath() { - alreadyMapped = true - break - } - } - if !alreadyMapped { - serveMux.HandleFunc(pattern, c.dispatch) - if !strings.HasSuffix(pattern, "/") { - serveMux.HandleFunc(pattern+"/", c.dispatch) - } - } - return false -} - -func (c *Container) Remove(ws *WebService) error { - if c.ServeMux == http.DefaultServeMux { - errMsg := fmt.Sprintf("cannot remove a WebService from a Container using the DefaultServeMux: ['%v']", ws) - log.Print(errMsg) - return errors.New(errMsg) - } - c.webServicesLock.Lock() - defer c.webServicesLock.Unlock() - // build a new ServeMux and re-register all WebServices - newServeMux := http.NewServeMux() - newServices := []*WebService{} - newIsRegisteredOnRoot := false - for _, each := range c.webServices { - if each.rootPath != ws.rootPath { - // If not registered on root then add specific mapping - if !newIsRegisteredOnRoot { - newIsRegisteredOnRoot = c.addHandler(each, newServeMux) - } - newServices = append(newServices, each) - } - } - c.webServices, c.ServeMux, c.isRegisteredOnRoot = newServices, newServeMux, newIsRegisteredOnRoot - return nil -} - -// logStackOnRecover is the default RecoverHandleFunction and is called -// when DoNotRecover is false and the recoverHandleFunc is not set for the container. -// Default implementation logs the stacktrace and writes the stacktrace on the response. -// This may be a security issue as it exposes sourcecode information. -func logStackOnRecover(panicReason interface{}, httpWriter http.ResponseWriter) { - var buffer bytes.Buffer - buffer.WriteString(fmt.Sprintf("recover from panic situation: - %v\r\n", panicReason)) - for i := 2; ; i += 1 { - _, file, line, ok := runtime.Caller(i) - if !ok { - break - } - buffer.WriteString(fmt.Sprintf(" %s:%d\r\n", file, line)) - } - log.Print(buffer.String()) - httpWriter.WriteHeader(http.StatusInternalServerError) - httpWriter.Write(buffer.Bytes()) -} - -// writeServiceError is the default ServiceErrorHandleFunction and is called -// when a ServiceError is returned during route selection. Default implementation -// calls resp.WriteErrorString(err.Code, err.Message) -func writeServiceError(err ServiceError, req *Request, resp *Response) { - for header, values := range err.Header { - for _, value := range values { - resp.Header().Add(header, value) - } - } - resp.WriteErrorString(err.Code, err.Message) -} - -// Dispatch the incoming Http Request to a matching WebService. -func (c *Container) Dispatch(httpWriter http.ResponseWriter, httpRequest *http.Request) { - if httpWriter == nil { - panic("httpWriter cannot be nil") - } - if httpRequest == nil { - panic("httpRequest cannot be nil") - } - c.dispatch(httpWriter, httpRequest) -} - -// Dispatch the incoming Http Request to a matching WebService. -func (c *Container) dispatch(httpWriter http.ResponseWriter, httpRequest *http.Request) { - // so we can assign a compressing one later - writer := httpWriter - - // CompressingResponseWriter should be closed after all operations are done - defer func() { - if compressWriter, ok := writer.(*CompressingResponseWriter); ok { - compressWriter.Close() - } - }() - - // Instal panic recovery unless told otherwise - if !c.doNotRecover { // catch all for 500 response - defer func() { - if r := recover(); r != nil { - c.recoverHandleFunc(r, writer) - return - } - }() - } - - // Find best match Route ; err is non nil if no match was found - var webService *WebService - var route *Route - var err error - func() { - c.webServicesLock.RLock() - defer c.webServicesLock.RUnlock() - webService, route, err = c.router.SelectRoute( - c.webServices, - httpRequest) - }() - if err != nil { - // a non-200 response (may be compressed) has already been written - // run container filters anyway ; they should not touch the response... - chain := FilterChain{Filters: c.containerFilters, Target: func(req *Request, resp *Response) { - switch err.(type) { - case ServiceError: - ser := err.(ServiceError) - c.serviceErrorHandleFunc(ser, req, resp) - } - // TODO - }} - chain.ProcessFilter(NewRequest(httpRequest), NewResponse(writer)) - return - } - - // Unless httpWriter is already an CompressingResponseWriter see if we need to install one - if _, isCompressing := httpWriter.(*CompressingResponseWriter); !isCompressing { - // Detect if compression is needed - // assume without compression, test for override - contentEncodingEnabled := c.contentEncodingEnabled - if route != nil && route.contentEncodingEnabled != nil { - contentEncodingEnabled = *route.contentEncodingEnabled - } - if contentEncodingEnabled { - doCompress, encoding := wantsCompressedResponse(httpRequest, httpWriter) - if doCompress { - var err error - writer, err = NewCompressingResponseWriter(httpWriter, encoding) - if err != nil { - log.Print("unable to install compressor: ", err) - httpWriter.WriteHeader(http.StatusInternalServerError) - return - } - } - } - } - - pathProcessor, routerProcessesPath := c.router.(PathProcessor) - if !routerProcessesPath { - pathProcessor = defaultPathProcessor{} - } - pathParams := pathProcessor.ExtractParameters(route, webService, httpRequest.URL.Path) - wrappedRequest, wrappedResponse := route.wrapRequestResponse(writer, httpRequest, pathParams) - // pass through filters (if any) - if size := len(c.containerFilters) + len(webService.filters) + len(route.Filters); size > 0 { - // compose filter chain - allFilters := make([]FilterFunction, 0, size) - allFilters = append(allFilters, c.containerFilters...) - allFilters = append(allFilters, webService.filters...) - allFilters = append(allFilters, route.Filters...) - chain := FilterChain{ - Filters: allFilters, - Target: route.Function, - ParameterDocs: route.ParameterDocs, - Operation: route.Operation, - } - chain.ProcessFilter(wrappedRequest, wrappedResponse) - } else { - // no filters, handle request by route - route.Function(wrappedRequest, wrappedResponse) - } -} - -// fixedPrefixPath returns the fixed part of the partspec ; it may include template vars {} -func fixedPrefixPath(pathspec string) string { - varBegin := strings.Index(pathspec, "{") - if -1 == varBegin { - return pathspec - } - return pathspec[:varBegin] -} - -// ServeHTTP implements net/http.Handler therefore a Container can be a Handler in a http.Server -func (c *Container) ServeHTTP(httpWriter http.ResponseWriter, httpRequest *http.Request) { - // Skip, if content encoding is disabled - if !c.contentEncodingEnabled { - c.ServeMux.ServeHTTP(httpWriter, httpRequest) - return - } - // content encoding is enabled - - // Skip, if httpWriter is already an CompressingResponseWriter - if _, ok := httpWriter.(*CompressingResponseWriter); ok { - c.ServeMux.ServeHTTP(httpWriter, httpRequest) - return - } - - writer := httpWriter - // CompressingResponseWriter should be closed after all operations are done - defer func() { - if compressWriter, ok := writer.(*CompressingResponseWriter); ok { - compressWriter.Close() - } - }() - - doCompress, encoding := wantsCompressedResponse(httpRequest, httpWriter) - if doCompress { - var err error - writer, err = NewCompressingResponseWriter(httpWriter, encoding) - if err != nil { - log.Print("unable to install compressor: ", err) - httpWriter.WriteHeader(http.StatusInternalServerError) - return - } - } - - c.ServeMux.ServeHTTP(writer, httpRequest) -} - -// Handle registers the handler for the given pattern. If a handler already exists for pattern, Handle panics. -func (c *Container) Handle(pattern string, handler http.Handler) { - c.ServeMux.Handle(pattern, http.HandlerFunc(func(httpWriter http.ResponseWriter, httpRequest *http.Request) { - // Skip, if httpWriter is already an CompressingResponseWriter - if _, ok := httpWriter.(*CompressingResponseWriter); ok { - handler.ServeHTTP(httpWriter, httpRequest) - return - } - - writer := httpWriter - - // CompressingResponseWriter should be closed after all operations are done - defer func() { - if compressWriter, ok := writer.(*CompressingResponseWriter); ok { - compressWriter.Close() - } - }() - - if c.contentEncodingEnabled { - doCompress, encoding := wantsCompressedResponse(httpRequest, httpWriter) - if doCompress { - var err error - writer, err = NewCompressingResponseWriter(httpWriter, encoding) - if err != nil { - log.Print("unable to install compressor: ", err) - httpWriter.WriteHeader(http.StatusInternalServerError) - return - } - } - } - - handler.ServeHTTP(writer, httpRequest) - })) -} - -// HandleWithFilter registers the handler for the given pattern. -// Container's filter chain is applied for handler. -// If a handler already exists for pattern, HandleWithFilter panics. -func (c *Container) HandleWithFilter(pattern string, handler http.Handler) { - f := func(httpResponse http.ResponseWriter, httpRequest *http.Request) { - if len(c.containerFilters) == 0 { - handler.ServeHTTP(httpResponse, httpRequest) - return - } - - chain := FilterChain{Filters: c.containerFilters, Target: func(req *Request, resp *Response) { - handler.ServeHTTP(resp, req.Request) - }} - chain.ProcessFilter(NewRequest(httpRequest), NewResponse(httpResponse)) - } - - c.Handle(pattern, http.HandlerFunc(f)) -} - -// Filter appends a container FilterFunction. These are called before dispatching -// a http.Request to a WebService from the container -func (c *Container) Filter(filter FilterFunction) { - c.containerFilters = append(c.containerFilters, filter) -} - -// RegisteredWebServices returns the collections of added WebServices -func (c *Container) RegisteredWebServices() []*WebService { - c.webServicesLock.RLock() - defer c.webServicesLock.RUnlock() - result := make([]*WebService, len(c.webServices)) - for ix := range c.webServices { - result[ix] = c.webServices[ix] - } - return result -} - -// computeAllowedMethods returns a list of HTTP methods that are valid for a Request -func (c *Container) computeAllowedMethods(req *Request) []string { - // Go through all RegisteredWebServices() and all its Routes to collect the options - methods := []string{} - requestPath := req.Request.URL.Path - for _, ws := range c.RegisteredWebServices() { - matches := ws.pathExpr.Matcher.FindStringSubmatch(requestPath) - if matches != nil { - finalMatch := matches[len(matches)-1] - for _, rt := range ws.Routes() { - matches := rt.pathExpr.Matcher.FindStringSubmatch(finalMatch) - if matches != nil { - lastMatch := matches[len(matches)-1] - if lastMatch == "" || lastMatch == "/" { // do not include if value is neither empty nor ‘/’. - methods = append(methods, rt.Method) - } - } - } - } - } - // methods = append(methods, "OPTIONS") not sure about this - return methods -} - -// newBasicRequestResponse creates a pair of Request,Response from its http versions. -// It is basic because no parameter or (produces) content-type information is given. -func newBasicRequestResponse(httpWriter http.ResponseWriter, httpRequest *http.Request) (*Request, *Response) { - resp := NewResponse(httpWriter) - resp.requestAccept = httpRequest.Header.Get(HEADER_Accept) - return NewRequest(httpRequest), resp -} diff --git a/vendor/github.com/emicklei/go-restful/v3/cors_filter.go b/vendor/github.com/emicklei/go-restful/v3/cors_filter.go deleted file mode 100644 index 9d18dfb7b..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/cors_filter.go +++ /dev/null @@ -1,193 +0,0 @@ -package restful - -// Copyright 2013 Ernest Micklei. All rights reserved. -// Use of this source code is governed by a license -// that can be found in the LICENSE file. - -import ( - "regexp" - "strconv" - "strings" -) - -// CrossOriginResourceSharing is used to create a Container Filter that implements CORS. -// Cross-origin resource sharing (CORS) is a mechanism that allows JavaScript on a web page -// to make XMLHttpRequests to another domain, not the domain the JavaScript originated from. -// -// http://en.wikipedia.org/wiki/Cross-origin_resource_sharing -// http://enable-cors.org/server.html -// http://www.html5rocks.com/en/tutorials/cors/#toc-handling-a-not-so-simple-request -type CrossOriginResourceSharing struct { - ExposeHeaders []string // list of Header names - - // AllowedHeaders is alist of Header names. Checking is case-insensitive. - // The list may contain the special wildcard string ".*" ; all is allowed - AllowedHeaders []string - - // AllowedDomains is a list of allowed values for Http Origin. - // The list may contain the special wildcard string ".*" ; all is allowed - // If empty all are allowed. - AllowedDomains []string - - // AllowedDomainFunc is optional and is a function that will do the check - // when the origin is not part of the AllowedDomains and it does not contain the wildcard ".*". - AllowedDomainFunc func(origin string) bool - - // AllowedMethods is either empty or has a list of http methods names. Checking is case-insensitive. - AllowedMethods []string - MaxAge int // number of seconds before requiring new Options request - CookiesAllowed bool - Container *Container - - allowedOriginPatterns []*regexp.Regexp // internal field for origin regexp check. -} - -// Filter is a filter function that implements the CORS flow as documented on http://enable-cors.org/server.html -// and http://www.html5rocks.com/static/images/cors_server_flowchart.png -func (c CrossOriginResourceSharing) Filter(req *Request, resp *Response, chain *FilterChain) { - origin := req.Request.Header.Get(HEADER_Origin) - if len(origin) == 0 { - if trace { - traceLogger.Print("no Http header Origin set") - } - chain.ProcessFilter(req, resp) - return - } - if !c.isOriginAllowed(origin) { // check whether this origin is allowed - if trace { - traceLogger.Printf("HTTP Origin:%s is not part of %v, neither matches any part of %v", origin, c.AllowedDomains, c.allowedOriginPatterns) - } - chain.ProcessFilter(req, resp) - return - } - if req.Request.Method != "OPTIONS" { - c.doActualRequest(req, resp) - chain.ProcessFilter(req, resp) - return - } - if acrm := req.Request.Header.Get(HEADER_AccessControlRequestMethod); acrm != "" { - c.doPreflightRequest(req, resp) - } else { - c.doActualRequest(req, resp) - chain.ProcessFilter(req, resp) - return - } -} - -func (c CrossOriginResourceSharing) doActualRequest(req *Request, resp *Response) { - c.setOptionsHeaders(req, resp) - // continue processing the response -} - -func (c *CrossOriginResourceSharing) doPreflightRequest(req *Request, resp *Response) { - if len(c.AllowedMethods) == 0 { - if c.Container == nil { - c.AllowedMethods = DefaultContainer.computeAllowedMethods(req) - } else { - c.AllowedMethods = c.Container.computeAllowedMethods(req) - } - } - - acrm := req.Request.Header.Get(HEADER_AccessControlRequestMethod) - if !c.isValidAccessControlRequestMethod(acrm, c.AllowedMethods) { - if trace { - traceLogger.Printf("Http header %s:%s is not in %v", - HEADER_AccessControlRequestMethod, - acrm, - c.AllowedMethods) - } - return - } - acrhs := req.Request.Header.Get(HEADER_AccessControlRequestHeaders) - if len(acrhs) > 0 { - for _, each := range strings.Split(acrhs, ",") { - if !c.isValidAccessControlRequestHeader(strings.Trim(each, " ")) { - if trace { - traceLogger.Printf("Http header %s:%s is not in %v", - HEADER_AccessControlRequestHeaders, - acrhs, - c.AllowedHeaders) - } - return - } - } - } - resp.AddHeader(HEADER_AccessControlAllowMethods, strings.Join(c.AllowedMethods, ",")) - resp.AddHeader(HEADER_AccessControlAllowHeaders, acrhs) - c.setOptionsHeaders(req, resp) - - // return http 200 response, no body -} - -func (c CrossOriginResourceSharing) setOptionsHeaders(req *Request, resp *Response) { - c.checkAndSetExposeHeaders(resp) - c.setAllowOriginHeader(req, resp) - c.checkAndSetAllowCredentials(resp) - if c.MaxAge > 0 { - resp.AddHeader(HEADER_AccessControlMaxAge, strconv.Itoa(c.MaxAge)) - } -} - -func (c CrossOriginResourceSharing) isOriginAllowed(origin string) bool { - if len(origin) == 0 { - return false - } - lowerOrigin := strings.ToLower(origin) - if len(c.AllowedDomains) == 0 { - if c.AllowedDomainFunc != nil { - return c.AllowedDomainFunc(lowerOrigin) - } - return true - } - - // exact match on each allowed domain - for _, domain := range c.AllowedDomains { - if domain == ".*" || strings.ToLower(domain) == lowerOrigin { - return true - } - } - if c.AllowedDomainFunc != nil { - return c.AllowedDomainFunc(origin) - } - return false -} - -func (c CrossOriginResourceSharing) setAllowOriginHeader(req *Request, resp *Response) { - origin := req.Request.Header.Get(HEADER_Origin) - if c.isOriginAllowed(origin) { - resp.AddHeader(HEADER_AccessControlAllowOrigin, origin) - } -} - -func (c CrossOriginResourceSharing) checkAndSetExposeHeaders(resp *Response) { - if len(c.ExposeHeaders) > 0 { - resp.AddHeader(HEADER_AccessControlExposeHeaders, strings.Join(c.ExposeHeaders, ",")) - } -} - -func (c CrossOriginResourceSharing) checkAndSetAllowCredentials(resp *Response) { - if c.CookiesAllowed { - resp.AddHeader(HEADER_AccessControlAllowCredentials, "true") - } -} - -func (c CrossOriginResourceSharing) isValidAccessControlRequestMethod(method string, allowedMethods []string) bool { - for _, each := range allowedMethods { - if each == method { - return true - } - } - return false -} - -func (c CrossOriginResourceSharing) isValidAccessControlRequestHeader(header string) bool { - for _, each := range c.AllowedHeaders { - if strings.ToLower(each) == strings.ToLower(header) { - return true - } - if each == "*" { - return true - } - } - return false -} diff --git a/vendor/github.com/emicklei/go-restful/v3/coverage.sh b/vendor/github.com/emicklei/go-restful/v3/coverage.sh deleted file mode 100644 index e27dbf1a9..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/coverage.sh +++ /dev/null @@ -1,2 +0,0 @@ -go test -coverprofile=coverage.out -go tool cover -html=coverage.out \ No newline at end of file diff --git a/vendor/github.com/emicklei/go-restful/v3/curly.go b/vendor/github.com/emicklei/go-restful/v3/curly.go deleted file mode 100644 index ba1fc5d5f..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/curly.go +++ /dev/null @@ -1,173 +0,0 @@ -package restful - -// Copyright 2013 Ernest Micklei. All rights reserved. -// Use of this source code is governed by a license -// that can be found in the LICENSE file. - -import ( - "net/http" - "regexp" - "sort" - "strings" -) - -// CurlyRouter expects Routes with paths that contain zero or more parameters in curly brackets. -type CurlyRouter struct{} - -// SelectRoute is part of the Router interface and returns the best match -// for the WebService and its Route for the given Request. -func (c CurlyRouter) SelectRoute( - webServices []*WebService, - httpRequest *http.Request) (selectedService *WebService, selected *Route, err error) { - - requestTokens := tokenizePath(httpRequest.URL.Path) - - detectedService := c.detectWebService(requestTokens, webServices) - if detectedService == nil { - if trace { - traceLogger.Printf("no WebService was found to match URL path:%s\n", httpRequest.URL.Path) - } - return nil, nil, NewError(http.StatusNotFound, "404: Page Not Found") - } - candidateRoutes := c.selectRoutes(detectedService, requestTokens) - if len(candidateRoutes) == 0 { - if trace { - traceLogger.Printf("no Route in WebService with path %s was found to match URL path:%s\n", detectedService.rootPath, httpRequest.URL.Path) - } - return detectedService, nil, NewError(http.StatusNotFound, "404: Page Not Found") - } - selectedRoute, err := c.detectRoute(candidateRoutes, httpRequest) - if selectedRoute == nil { - return detectedService, nil, err - } - return detectedService, selectedRoute, nil -} - -// selectRoutes return a collection of Route from a WebService that matches the path tokens from the request. -func (c CurlyRouter) selectRoutes(ws *WebService, requestTokens []string) sortableCurlyRoutes { - candidates := make(sortableCurlyRoutes, 0, 8) - for _, each := range ws.routes { - matches, paramCount, staticCount := c.matchesRouteByPathTokens(each.pathParts, requestTokens, each.hasCustomVerb) - if matches { - candidates.add(curlyRoute{each, paramCount, staticCount}) // TODO make sure Routes() return pointers? - } - } - sort.Sort(candidates) - return candidates -} - -// matchesRouteByPathTokens computes whether it matches, howmany parameters do match and what the number of static path elements are. -func (c CurlyRouter) matchesRouteByPathTokens(routeTokens, requestTokens []string, routeHasCustomVerb bool) (matches bool, paramCount int, staticCount int) { - if len(routeTokens) < len(requestTokens) { - // proceed in matching only if last routeToken is wildcard - count := len(routeTokens) - if count == 0 || !strings.HasSuffix(routeTokens[count-1], "*}") { - return false, 0, 0 - } - // proceed - } - for i, routeToken := range routeTokens { - if i == len(requestTokens) { - // reached end of request path - return false, 0, 0 - } - requestToken := requestTokens[i] - if routeHasCustomVerb && hasCustomVerb(routeToken){ - if !isMatchCustomVerb(routeToken, requestToken) { - return false, 0, 0 - } - staticCount++ - requestToken = removeCustomVerb(requestToken) - routeToken = removeCustomVerb(routeToken) - } - - if strings.HasPrefix(routeToken, "{") { - paramCount++ - if colon := strings.Index(routeToken, ":"); colon != -1 { - // match by regex - matchesToken, matchesRemainder := c.regularMatchesPathToken(routeToken, colon, requestToken) - if !matchesToken { - return false, 0, 0 - } - if matchesRemainder { - break - } - } - } else { // no { prefix - if requestToken != routeToken { - return false, 0, 0 - } - staticCount++ - } - } - return true, paramCount, staticCount -} - -// regularMatchesPathToken tests whether the regular expression part of routeToken matches the requestToken or all remaining tokens -// format routeToken is {someVar:someExpression}, e.g. {zipcode:[\d][\d][\d][\d][A-Z][A-Z]} -func (c CurlyRouter) regularMatchesPathToken(routeToken string, colon int, requestToken string) (matchesToken bool, matchesRemainder bool) { - regPart := routeToken[colon+1 : len(routeToken)-1] - if regPart == "*" { - if trace { - traceLogger.Printf("wildcard parameter detected in route token %s that matches %s\n", routeToken, requestToken) - } - return true, true - } - matched, err := regexp.MatchString(regPart, requestToken) - return (matched && err == nil), false -} - -var jsr311Router = RouterJSR311{} - -// detectRoute selectes from a list of Route the first match by inspecting both the Accept and Content-Type -// headers of the Request. See also RouterJSR311 in jsr311.go -func (c CurlyRouter) detectRoute(candidateRoutes sortableCurlyRoutes, httpRequest *http.Request) (*Route, error) { - // tracing is done inside detectRoute - return jsr311Router.detectRoute(candidateRoutes.routes(), httpRequest) -} - -// detectWebService returns the best matching webService given the list of path tokens. -// see also computeWebserviceScore -func (c CurlyRouter) detectWebService(requestTokens []string, webServices []*WebService) *WebService { - var best *WebService - score := -1 - for _, each := range webServices { - matches, eachScore := c.computeWebserviceScore(requestTokens, each.pathExpr.tokens) - if matches && (eachScore > score) { - best = each - score = eachScore - } - } - return best -} - -// computeWebserviceScore returns whether tokens match and -// the weighted score of the longest matching consecutive tokens from the beginning. -func (c CurlyRouter) computeWebserviceScore(requestTokens []string, tokens []string) (bool, int) { - if len(tokens) > len(requestTokens) { - return false, 0 - } - score := 0 - for i := 0; i < len(tokens); i++ { - each := requestTokens[i] - other := tokens[i] - if len(each) == 0 && len(other) == 0 { - score++ - continue - } - if len(other) > 0 && strings.HasPrefix(other, "{") { - // no empty match - if len(each) == 0 { - return false, score - } - score += 1 - } else { - // not a parameter - if each != other { - return false, score - } - score += (len(tokens) - i) * 10 //fuzzy - } - } - return true, score -} diff --git a/vendor/github.com/emicklei/go-restful/v3/curly_route.go b/vendor/github.com/emicklei/go-restful/v3/curly_route.go deleted file mode 100644 index 403dd3be9..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/curly_route.go +++ /dev/null @@ -1,54 +0,0 @@ -package restful - -// Copyright 2013 Ernest Micklei. All rights reserved. -// Use of this source code is governed by a license -// that can be found in the LICENSE file. - -// curlyRoute exits for sorting Routes by the CurlyRouter based on number of parameters and number of static path elements. -type curlyRoute struct { - route Route - paramCount int - staticCount int -} - -// sortableCurlyRoutes orders by most parameters and path elements first. -type sortableCurlyRoutes []curlyRoute - -func (s *sortableCurlyRoutes) add(route curlyRoute) { - *s = append(*s, route) -} - -func (s sortableCurlyRoutes) routes() (routes []Route) { - routes = make([]Route, 0, len(s)) - for _, each := range s { - routes = append(routes, each.route) // TODO change return type - } - return routes -} - -func (s sortableCurlyRoutes) Len() int { - return len(s) -} -func (s sortableCurlyRoutes) Swap(i, j int) { - s[i], s[j] = s[j], s[i] -} -func (s sortableCurlyRoutes) Less(i, j int) bool { - a := s[j] - b := s[i] - - // primary key - if a.staticCount < b.staticCount { - return true - } - if a.staticCount > b.staticCount { - return false - } - // secundary key - if a.paramCount < b.paramCount { - return true - } - if a.paramCount > b.paramCount { - return false - } - return a.route.Path < b.route.Path -} diff --git a/vendor/github.com/emicklei/go-restful/v3/custom_verb.go b/vendor/github.com/emicklei/go-restful/v3/custom_verb.go deleted file mode 100644 index bfc17efde..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/custom_verb.go +++ /dev/null @@ -1,29 +0,0 @@ -package restful - -import ( - "fmt" - "regexp" -) - -var ( - customVerbReg = regexp.MustCompile(":([A-Za-z]+)$") -) - -func hasCustomVerb(routeToken string) bool { - return customVerbReg.MatchString(routeToken) -} - -func isMatchCustomVerb(routeToken string, pathToken string) bool { - rs := customVerbReg.FindStringSubmatch(routeToken) - if len(rs) < 2 { - return false - } - - customVerb := rs[1] - specificVerbReg := regexp.MustCompile(fmt.Sprintf(":%s$", customVerb)) - return specificVerbReg.MatchString(pathToken) -} - -func removeCustomVerb(str string) string { - return customVerbReg.ReplaceAllString(str, "") -} diff --git a/vendor/github.com/emicklei/go-restful/v3/doc.go b/vendor/github.com/emicklei/go-restful/v3/doc.go deleted file mode 100644 index 69b13057d..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/doc.go +++ /dev/null @@ -1,185 +0,0 @@ -/* -Package restful , a lean package for creating REST-style WebServices without magic. - -WebServices and Routes - -A WebService has a collection of Route objects that dispatch incoming Http Requests to a function calls. -Typically, a WebService has a root path (e.g. /users) and defines common MIME types for its routes. -WebServices must be added to a container (see below) in order to handler Http requests from a server. - -A Route is defined by a HTTP method, an URL path and (optionally) the MIME types it consumes (Content-Type) and produces (Accept). -This package has the logic to find the best matching Route and if found, call its Function. - - ws := new(restful.WebService) - ws. - Path("/users"). - Consumes(restful.MIME_JSON, restful.MIME_XML). - Produces(restful.MIME_JSON, restful.MIME_XML) - - ws.Route(ws.GET("/{user-id}").To(u.findUser)) // u is a UserResource - - ... - - // GET http://localhost:8080/users/1 - func (u UserResource) findUser(request *restful.Request, response *restful.Response) { - id := request.PathParameter("user-id") - ... - } - -The (*Request, *Response) arguments provide functions for reading information from the request and writing information back to the response. - -See the example https://github.com/emicklei/go-restful/blob/v3/examples/user-resource/restful-user-resource.go with a full implementation. - -Regular expression matching Routes - -A Route parameter can be specified using the format "uri/{var[:regexp]}" or the special version "uri/{var:*}" for matching the tail of the path. -For example, /persons/{name:[A-Z][A-Z]} can be used to restrict values for the parameter "name" to only contain capital alphabetic characters. -Regular expressions must use the standard Go syntax as described in the regexp package. (https://code.google.com/p/re2/wiki/Syntax) -This feature requires the use of a CurlyRouter. - -Containers - -A Container holds a collection of WebServices, Filters and a http.ServeMux for multiplexing http requests. -Using the statements "restful.Add(...) and restful.Filter(...)" will register WebServices and Filters to the Default Container. -The Default container of go-restful uses the http.DefaultServeMux. -You can create your own Container and create a new http.Server for that particular container. - - container := restful.NewContainer() - server := &http.Server{Addr: ":8081", Handler: container} - -Filters - -A filter dynamically intercepts requests and responses to transform or use the information contained in the requests or responses. -You can use filters to perform generic logging, measurement, authentication, redirect, set response headers etc. -In the restful package there are three hooks into the request,response flow where filters can be added. -Each filter must define a FilterFunction: - - func (req *restful.Request, resp *restful.Response, chain *restful.FilterChain) - -Use the following statement to pass the request,response pair to the next filter or RouteFunction - - chain.ProcessFilter(req, resp) - -Container Filters - -These are processed before any registered WebService. - - // install a (global) filter for the default container (processed before any webservice) - restful.Filter(globalLogging) - -WebService Filters - -These are processed before any Route of a WebService. - - // install a webservice filter (processed before any route) - ws.Filter(webserviceLogging).Filter(measureTime) - - -Route Filters - -These are processed before calling the function associated with the Route. - - // install 2 chained route filters (processed before calling findUser) - ws.Route(ws.GET("/{user-id}").Filter(routeLogging).Filter(NewCountFilter().routeCounter).To(findUser)) - -See the example https://github.com/emicklei/go-restful/blob/v3/examples/filters/restful-filters.go with full implementations. - -Response Encoding - -Two encodings are supported: gzip and deflate. To enable this for all responses: - - restful.DefaultContainer.EnableContentEncoding(true) - -If a Http request includes the Accept-Encoding header then the response content will be compressed using the specified encoding. -Alternatively, you can create a Filter that performs the encoding and install it per WebService or Route. - -See the example https://github.com/emicklei/go-restful/blob/v3/examples/encoding/restful-encoding-filter.go - -OPTIONS support - -By installing a pre-defined container filter, your Webservice(s) can respond to the OPTIONS Http request. - - Filter(OPTIONSFilter()) - -CORS - -By installing the filter of a CrossOriginResourceSharing (CORS), your WebService(s) can handle CORS requests. - - cors := CrossOriginResourceSharing{ExposeHeaders: []string{"X-My-Header"}, CookiesAllowed: false, Container: DefaultContainer} - Filter(cors.Filter) - -Error Handling - -Unexpected things happen. If a request cannot be processed because of a failure, your service needs to tell via the response what happened and why. -For this reason HTTP status codes exist and it is important to use the correct code in every exceptional situation. - - 400: Bad Request - -If path or query parameters are not valid (content or type) then use http.StatusBadRequest. - - 404: Not Found - -Despite a valid URI, the resource requested may not be available - - 500: Internal Server Error - -If the application logic could not process the request (or write the response) then use http.StatusInternalServerError. - - 405: Method Not Allowed - -The request has a valid URL but the method (GET,PUT,POST,...) is not allowed. - - 406: Not Acceptable - -The request does not have or has an unknown Accept Header set for this operation. - - 415: Unsupported Media Type - -The request does not have or has an unknown Content-Type Header set for this operation. - -ServiceError - -In addition to setting the correct (error) Http status code, you can choose to write a ServiceError message on the response. - -Performance options - -This package has several options that affect the performance of your service. It is important to understand them and how you can change it. - - restful.DefaultContainer.DoNotRecover(false) - -DoNotRecover controls whether panics will be caught to return HTTP 500. -If set to false, the container will recover from panics. -Default value is true - - restful.SetCompressorProvider(NewBoundedCachedCompressors(20, 20)) - -If content encoding is enabled then the default strategy for getting new gzip/zlib writers and readers is to use a sync.Pool. -Because writers are expensive structures, performance is even more improved when using a preloaded cache. You can also inject your own implementation. - -Trouble shooting - -This package has the means to produce detail logging of the complete Http request matching process and filter invocation. -Enabling this feature requires you to set an implementation of restful.StdLogger (e.g. log.Logger) instance such as: - - restful.TraceLogger(log.New(os.Stdout, "[restful] ", log.LstdFlags|log.Lshortfile)) - -Logging - -The restful.SetLogger() method allows you to override the logger used by the package. By default restful -uses the standard library `log` package and logs to stdout. Different logging packages are supported as -long as they conform to `StdLogger` interface defined in the `log` sub-package, writing an adapter for your -preferred package is simple. - -Resources - -[project]: https://github.com/emicklei/go-restful - -[examples]: https://github.com/emicklei/go-restful/blob/master/examples - -[design]: http://ernestmicklei.com/2012/11/11/go-restful-api-design/ - -[showcases]: https://github.com/emicklei/mora, https://github.com/emicklei/landskape - -(c) 2012-2015, http://ernestmicklei.com. MIT License -*/ -package restful diff --git a/vendor/github.com/emicklei/go-restful/v3/entity_accessors.go b/vendor/github.com/emicklei/go-restful/v3/entity_accessors.go deleted file mode 100644 index 66dfc824f..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/entity_accessors.go +++ /dev/null @@ -1,162 +0,0 @@ -package restful - -// Copyright 2015 Ernest Micklei. All rights reserved. -// Use of this source code is governed by a license -// that can be found in the LICENSE file. - -import ( - "encoding/xml" - "strings" - "sync" -) - -// EntityReaderWriter can read and write values using an encoding such as JSON,XML. -type EntityReaderWriter interface { - // Read a serialized version of the value from the request. - // The Request may have a decompressing reader. Depends on Content-Encoding. - Read(req *Request, v interface{}) error - - // Write a serialized version of the value on the response. - // The Response may have a compressing writer. Depends on Accept-Encoding. - // status should be a valid Http Status code - Write(resp *Response, status int, v interface{}) error -} - -// entityAccessRegistry is a singleton -var entityAccessRegistry = &entityReaderWriters{ - protection: new(sync.RWMutex), - accessors: map[string]EntityReaderWriter{}, -} - -// entityReaderWriters associates MIME to an EntityReaderWriter -type entityReaderWriters struct { - protection *sync.RWMutex - accessors map[string]EntityReaderWriter -} - -func init() { - RegisterEntityAccessor(MIME_JSON, NewEntityAccessorJSON(MIME_JSON)) - RegisterEntityAccessor(MIME_XML, NewEntityAccessorXML(MIME_XML)) -} - -// RegisterEntityAccessor add/overrides the ReaderWriter for encoding content with this MIME type. -func RegisterEntityAccessor(mime string, erw EntityReaderWriter) { - entityAccessRegistry.protection.Lock() - defer entityAccessRegistry.protection.Unlock() - entityAccessRegistry.accessors[mime] = erw -} - -// NewEntityAccessorJSON returns a new EntityReaderWriter for accessing JSON content. -// This package is already initialized with such an accessor using the MIME_JSON contentType. -func NewEntityAccessorJSON(contentType string) EntityReaderWriter { - return entityJSONAccess{ContentType: contentType} -} - -// NewEntityAccessorXML returns a new EntityReaderWriter for accessing XML content. -// This package is already initialized with such an accessor using the MIME_XML contentType. -func NewEntityAccessorXML(contentType string) EntityReaderWriter { - return entityXMLAccess{ContentType: contentType} -} - -// accessorAt returns the registered ReaderWriter for this MIME type. -func (r *entityReaderWriters) accessorAt(mime string) (EntityReaderWriter, bool) { - r.protection.RLock() - defer r.protection.RUnlock() - er, ok := r.accessors[mime] - if !ok { - // retry with reverse lookup - // more expensive but we are in an exceptional situation anyway - for k, v := range r.accessors { - if strings.Contains(mime, k) { - return v, true - } - } - } - return er, ok -} - -// entityXMLAccess is a EntityReaderWriter for XML encoding -type entityXMLAccess struct { - // This is used for setting the Content-Type header when writing - ContentType string -} - -// Read unmarshalls the value from XML -func (e entityXMLAccess) Read(req *Request, v interface{}) error { - return xml.NewDecoder(req.Request.Body).Decode(v) -} - -// Write marshalls the value to JSON and set the Content-Type Header. -func (e entityXMLAccess) Write(resp *Response, status int, v interface{}) error { - return writeXML(resp, status, e.ContentType, v) -} - -// writeXML marshalls the value to JSON and set the Content-Type Header. -func writeXML(resp *Response, status int, contentType string, v interface{}) error { - if v == nil { - resp.WriteHeader(status) - // do not write a nil representation - return nil - } - if resp.prettyPrint { - // pretty output must be created and written explicitly - output, err := xml.MarshalIndent(v, " ", " ") - if err != nil { - return err - } - resp.Header().Set(HEADER_ContentType, contentType) - resp.WriteHeader(status) - _, err = resp.Write([]byte(xml.Header)) - if err != nil { - return err - } - _, err = resp.Write(output) - return err - } - // not-so-pretty - resp.Header().Set(HEADER_ContentType, contentType) - resp.WriteHeader(status) - return xml.NewEncoder(resp).Encode(v) -} - -// entityJSONAccess is a EntityReaderWriter for JSON encoding -type entityJSONAccess struct { - // This is used for setting the Content-Type header when writing - ContentType string -} - -// Read unmarshalls the value from JSON -func (e entityJSONAccess) Read(req *Request, v interface{}) error { - decoder := NewDecoder(req.Request.Body) - decoder.UseNumber() - return decoder.Decode(v) -} - -// Write marshalls the value to JSON and set the Content-Type Header. -func (e entityJSONAccess) Write(resp *Response, status int, v interface{}) error { - return writeJSON(resp, status, e.ContentType, v) -} - -// write marshalls the value to JSON and set the Content-Type Header. -func writeJSON(resp *Response, status int, contentType string, v interface{}) error { - if v == nil { - resp.WriteHeader(status) - // do not write a nil representation - return nil - } - if resp.prettyPrint { - // pretty output must be created and written explicitly - output, err := MarshalIndent(v, "", " ") - if err != nil { - return err - } - resp.Header().Set(HEADER_ContentType, contentType) - resp.WriteHeader(status) - _, err = resp.Write(output) - return err - } - // not-so-pretty - resp.Header().Set(HEADER_ContentType, contentType) - resp.WriteHeader(status) - return NewEncoder(resp).Encode(v) -} diff --git a/vendor/github.com/emicklei/go-restful/v3/extensions.go b/vendor/github.com/emicklei/go-restful/v3/extensions.go deleted file mode 100644 index 5023fa049..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/extensions.go +++ /dev/null @@ -1,21 +0,0 @@ -package restful - -// Copyright 2021 Ernest Micklei. All rights reserved. -// Use of this source code is governed by a license -// that can be found in the LICENSE file. - -// ExtensionProperties provides storage of vendor extensions for entities -type ExtensionProperties struct { - // Extensions vendor extensions used to describe extra functionality - // (https://swagger.io/docs/specification/2-0/swagger-extensions/) - Extensions map[string]interface{} -} - -// AddExtension adds or updates a key=value pair to the extension map. -func (ep *ExtensionProperties) AddExtension(key string, value interface{}) { - if ep.Extensions == nil { - ep.Extensions = map[string]interface{}{key: value} - } else { - ep.Extensions[key] = value - } -} diff --git a/vendor/github.com/emicklei/go-restful/v3/filter.go b/vendor/github.com/emicklei/go-restful/v3/filter.go deleted file mode 100644 index fd88c536c..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/filter.go +++ /dev/null @@ -1,37 +0,0 @@ -package restful - -// Copyright 2013 Ernest Micklei. All rights reserved. -// Use of this source code is governed by a license -// that can be found in the LICENSE file. - -// FilterChain is a request scoped object to process one or more filters before calling the target RouteFunction. -type FilterChain struct { - Filters []FilterFunction // ordered list of FilterFunction - Index int // index into filters that is currently in progress - Target RouteFunction // function to call after passing all filters - ParameterDocs []*Parameter // the parameter docs for the route - Operation string // the name of the operation -} - -// ProcessFilter passes the request,response pair through the next of Filters. -// Each filter can decide to proceed to the next Filter or handle the Response itself. -func (f *FilterChain) ProcessFilter(request *Request, response *Response) { - if f.Index < len(f.Filters) { - f.Index++ - f.Filters[f.Index-1](request, response, f) - } else { - f.Target(request, response) - } -} - -// FilterFunction definitions must call ProcessFilter on the FilterChain to pass on the control and eventually call the RouteFunction -type FilterFunction func(*Request, *Response, *FilterChain) - -// NoBrowserCacheFilter is a filter function to set HTTP headers that disable browser caching -// See examples/restful-no-cache-filter.go for usage -func NoBrowserCacheFilter(req *Request, resp *Response, chain *FilterChain) { - resp.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate") // HTTP 1.1. - resp.Header().Set("Pragma", "no-cache") // HTTP 1.0. - resp.Header().Set("Expires", "0") // Proxies. - chain.ProcessFilter(req, resp) -} diff --git a/vendor/github.com/emicklei/go-restful/v3/json.go b/vendor/github.com/emicklei/go-restful/v3/json.go deleted file mode 100644 index 871165166..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/json.go +++ /dev/null @@ -1,11 +0,0 @@ -// +build !jsoniter - -package restful - -import "encoding/json" - -var ( - MarshalIndent = json.MarshalIndent - NewDecoder = json.NewDecoder - NewEncoder = json.NewEncoder -) diff --git a/vendor/github.com/emicklei/go-restful/v3/jsoniter.go b/vendor/github.com/emicklei/go-restful/v3/jsoniter.go deleted file mode 100644 index 11b8f8ae7..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/jsoniter.go +++ /dev/null @@ -1,12 +0,0 @@ -// +build jsoniter - -package restful - -import "github.com/json-iterator/go" - -var ( - json = jsoniter.ConfigCompatibleWithStandardLibrary - MarshalIndent = json.MarshalIndent - NewDecoder = json.NewDecoder - NewEncoder = json.NewEncoder -) diff --git a/vendor/github.com/emicklei/go-restful/v3/jsr311.go b/vendor/github.com/emicklei/go-restful/v3/jsr311.go deleted file mode 100644 index 07a0c91e9..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/jsr311.go +++ /dev/null @@ -1,326 +0,0 @@ -package restful - -// Copyright 2013 Ernest Micklei. All rights reserved. -// Use of this source code is governed by a license -// that can be found in the LICENSE file. - -import ( - "errors" - "fmt" - "net/http" - "sort" - "strings" -) - -// RouterJSR311 implements the flow for matching Requests to Routes (and consequently Resource Functions) -// as specified by the JSR311 http://jsr311.java.net/nonav/releases/1.1/spec/spec.html. -// RouterJSR311 implements the Router interface. -// Concept of locators is not implemented. -type RouterJSR311 struct{} - -// SelectRoute is part of the Router interface and returns the best match -// for the WebService and its Route for the given Request. -func (r RouterJSR311) SelectRoute( - webServices []*WebService, - httpRequest *http.Request) (selectedService *WebService, selectedRoute *Route, err error) { - - // Identify the root resource class (WebService) - dispatcher, finalMatch, err := r.detectDispatcher(httpRequest.URL.Path, webServices) - if err != nil { - return nil, nil, NewError(http.StatusNotFound, "") - } - // Obtain the set of candidate methods (Routes) - routes := r.selectRoutes(dispatcher, finalMatch) - if len(routes) == 0 { - return dispatcher, nil, NewError(http.StatusNotFound, "404: Page Not Found") - } - - // Identify the method (Route) that will handle the request - route, ok := r.detectRoute(routes, httpRequest) - return dispatcher, route, ok -} - -// ExtractParameters is used to obtain the path parameters from the route using the same matching -// engine as the JSR 311 router. -func (r RouterJSR311) ExtractParameters(route *Route, webService *WebService, urlPath string) map[string]string { - webServiceExpr := webService.pathExpr - webServiceMatches := webServiceExpr.Matcher.FindStringSubmatch(urlPath) - pathParameters := r.extractParams(webServiceExpr, webServiceMatches) - routeExpr := route.pathExpr - routeMatches := routeExpr.Matcher.FindStringSubmatch(webServiceMatches[len(webServiceMatches)-1]) - routeParams := r.extractParams(routeExpr, routeMatches) - for key, value := range routeParams { - pathParameters[key] = value - } - return pathParameters -} - -func (RouterJSR311) extractParams(pathExpr *pathExpression, matches []string) map[string]string { - params := map[string]string{} - for i := 1; i < len(matches); i++ { - if len(pathExpr.VarNames) >= i { - params[pathExpr.VarNames[i-1]] = matches[i] - } - } - return params -} - -// http://jsr311.java.net/nonav/releases/1.1/spec/spec3.html#x3-360003.7.2 -func (r RouterJSR311) detectRoute(routes []Route, httpRequest *http.Request) (*Route, error) { - candidates := make([]*Route, 0, 8) - for i, each := range routes { - ok := true - for _, fn := range each.If { - if !fn(httpRequest) { - ok = false - break - } - } - if ok { - candidates = append(candidates, &routes[i]) - } - } - if len(candidates) == 0 { - if trace { - traceLogger.Printf("no Route found (from %d) that passes conditional checks", len(routes)) - } - return nil, NewError(http.StatusNotFound, "404: Not Found") - } - - // http method - previous := candidates - candidates = candidates[:0] - for _, each := range previous { - if httpRequest.Method == each.Method { - candidates = append(candidates, each) - } - } - if len(candidates) == 0 { - if trace { - traceLogger.Printf("no Route found (in %d routes) that matches HTTP method %s\n", len(previous), httpRequest.Method) - } - allowed := []string{} - allowedLoop: - for _, candidate := range previous { - for _, method := range allowed { - if method == candidate.Method { - continue allowedLoop - } - } - allowed = append(allowed, candidate.Method) - } - header := http.Header{"Allow": []string{strings.Join(allowed, ", ")}} - return nil, NewErrorWithHeader(http.StatusMethodNotAllowed, "405: Method Not Allowed", header) - } - - // content-type - contentType := httpRequest.Header.Get(HEADER_ContentType) - previous = candidates - candidates = candidates[:0] - for _, each := range previous { - if each.matchesContentType(contentType) { - candidates = append(candidates, each) - } - } - if len(candidates) == 0 { - if trace { - traceLogger.Printf("no Route found (from %d) that matches HTTP Content-Type: %s\n", len(previous), contentType) - } - if httpRequest.ContentLength > 0 { - return nil, NewError(http.StatusUnsupportedMediaType, "415: Unsupported Media Type") - } - } - - // accept - previous = candidates - candidates = candidates[:0] - accept := httpRequest.Header.Get(HEADER_Accept) - if len(accept) == 0 { - accept = "*/*" - } - for _, each := range previous { - if each.matchesAccept(accept) { - candidates = append(candidates, each) - } - } - if len(candidates) == 0 { - if trace { - traceLogger.Printf("no Route found (from %d) that matches HTTP Accept: %s\n", len(previous), accept) - } - available := []string{} - for _, candidate := range previous { - available = append(available, candidate.Produces...) - } - // if POST,PUT,PATCH without body - method, length := httpRequest.Method, httpRequest.Header.Get("Content-Length") - if (method == http.MethodPost || - method == http.MethodPut || - method == http.MethodPatch) && length == "" { - return nil, NewError( - http.StatusUnsupportedMediaType, - fmt.Sprintf("415: Unsupported Media Type\n\nAvailable representations: %s", strings.Join(available, ", ")), - ) - } - return nil, NewError( - http.StatusNotAcceptable, - fmt.Sprintf("406: Not Acceptable\n\nAvailable representations: %s", strings.Join(available, ", ")), - ) - } - // return r.bestMatchByMedia(outputMediaOk, contentType, accept), nil - return candidates[0], nil -} - -// http://jsr311.java.net/nonav/releases/1.1/spec/spec3.html#x3-360003.7.2 -// n/m > n/* > */* -func (r RouterJSR311) bestMatchByMedia(routes []Route, contentType string, accept string) *Route { - // TODO - return &routes[0] -} - -// http://jsr311.java.net/nonav/releases/1.1/spec/spec3.html#x3-360003.7.2 (step 2) -func (r RouterJSR311) selectRoutes(dispatcher *WebService, pathRemainder string) []Route { - filtered := &sortableRouteCandidates{} - for _, each := range dispatcher.Routes() { - pathExpr := each.pathExpr - matches := pathExpr.Matcher.FindStringSubmatch(pathRemainder) - if matches != nil { - lastMatch := matches[len(matches)-1] - if len(lastMatch) == 0 || lastMatch == "/" { // do not include if value is neither empty nor ‘/’. - filtered.candidates = append(filtered.candidates, - routeCandidate{each, len(matches) - 1, pathExpr.LiteralCount, pathExpr.VarCount}) - } - } - } - if len(filtered.candidates) == 0 { - if trace { - traceLogger.Printf("WebService on path %s has no routes that match URL path remainder:%s\n", dispatcher.rootPath, pathRemainder) - } - return []Route{} - } - sort.Sort(sort.Reverse(filtered)) - - // select other routes from candidates whoes expression matches rmatch - matchingRoutes := []Route{filtered.candidates[0].route} - for c := 1; c < len(filtered.candidates); c++ { - each := filtered.candidates[c] - if each.route.pathExpr.Matcher.MatchString(pathRemainder) { - matchingRoutes = append(matchingRoutes, each.route) - } - } - return matchingRoutes -} - -// http://jsr311.java.net/nonav/releases/1.1/spec/spec3.html#x3-360003.7.2 (step 1) -func (r RouterJSR311) detectDispatcher(requestPath string, dispatchers []*WebService) (*WebService, string, error) { - filtered := &sortableDispatcherCandidates{} - for _, each := range dispatchers { - matches := each.pathExpr.Matcher.FindStringSubmatch(requestPath) - if matches != nil { - filtered.candidates = append(filtered.candidates, - dispatcherCandidate{each, matches[len(matches)-1], len(matches), each.pathExpr.LiteralCount, each.pathExpr.VarCount}) - } - } - if len(filtered.candidates) == 0 { - if trace { - traceLogger.Printf("no WebService was found to match URL path:%s\n", requestPath) - } - return nil, "", errors.New("not found") - } - sort.Sort(sort.Reverse(filtered)) - return filtered.candidates[0].dispatcher, filtered.candidates[0].finalMatch, nil -} - -// Types and functions to support the sorting of Routes - -type routeCandidate struct { - route Route - matchesCount int // the number of capturing groups - literalCount int // the number of literal characters (means those not resulting from template variable substitution) - nonDefaultCount int // the number of capturing groups with non-default regular expressions (i.e. not ‘([^ /]+?)’) -} - -func (r routeCandidate) expressionToMatch() string { - return r.route.pathExpr.Source -} - -func (r routeCandidate) String() string { - return fmt.Sprintf("(m=%d,l=%d,n=%d)", r.matchesCount, r.literalCount, r.nonDefaultCount) -} - -type sortableRouteCandidates struct { - candidates []routeCandidate -} - -func (rcs *sortableRouteCandidates) Len() int { - return len(rcs.candidates) -} -func (rcs *sortableRouteCandidates) Swap(i, j int) { - rcs.candidates[i], rcs.candidates[j] = rcs.candidates[j], rcs.candidates[i] -} -func (rcs *sortableRouteCandidates) Less(i, j int) bool { - ci := rcs.candidates[i] - cj := rcs.candidates[j] - // primary key - if ci.literalCount < cj.literalCount { - return true - } - if ci.literalCount > cj.literalCount { - return false - } - // secundary key - if ci.matchesCount < cj.matchesCount { - return true - } - if ci.matchesCount > cj.matchesCount { - return false - } - // tertiary key - if ci.nonDefaultCount < cj.nonDefaultCount { - return true - } - if ci.nonDefaultCount > cj.nonDefaultCount { - return false - } - // quaternary key ("source" is interpreted as Path) - return ci.route.Path < cj.route.Path -} - -// Types and functions to support the sorting of Dispatchers - -type dispatcherCandidate struct { - dispatcher *WebService - finalMatch string - matchesCount int // the number of capturing groups - literalCount int // the number of literal characters (means those not resulting from template variable substitution) - nonDefaultCount int // the number of capturing groups with non-default regular expressions (i.e. not ‘([^ /]+?)’) -} -type sortableDispatcherCandidates struct { - candidates []dispatcherCandidate -} - -func (dc *sortableDispatcherCandidates) Len() int { - return len(dc.candidates) -} -func (dc *sortableDispatcherCandidates) Swap(i, j int) { - dc.candidates[i], dc.candidates[j] = dc.candidates[j], dc.candidates[i] -} -func (dc *sortableDispatcherCandidates) Less(i, j int) bool { - ci := dc.candidates[i] - cj := dc.candidates[j] - // primary key - if ci.matchesCount < cj.matchesCount { - return true - } - if ci.matchesCount > cj.matchesCount { - return false - } - // secundary key - if ci.literalCount < cj.literalCount { - return true - } - if ci.literalCount > cj.literalCount { - return false - } - // tertiary key - return ci.nonDefaultCount < cj.nonDefaultCount -} diff --git a/vendor/github.com/emicklei/go-restful/v3/log/log.go b/vendor/github.com/emicklei/go-restful/v3/log/log.go deleted file mode 100644 index 6cd44c7a5..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/log/log.go +++ /dev/null @@ -1,34 +0,0 @@ -package log - -import ( - stdlog "log" - "os" -) - -// StdLogger corresponds to a minimal subset of the interface satisfied by stdlib log.Logger -type StdLogger interface { - Print(v ...interface{}) - Printf(format string, v ...interface{}) -} - -var Logger StdLogger - -func init() { - // default Logger - SetLogger(stdlog.New(os.Stderr, "[restful] ", stdlog.LstdFlags|stdlog.Lshortfile)) -} - -// SetLogger sets the logger for this package -func SetLogger(customLogger StdLogger) { - Logger = customLogger -} - -// Print delegates to the Logger -func Print(v ...interface{}) { - Logger.Print(v...) -} - -// Printf delegates to the Logger -func Printf(format string, v ...interface{}) { - Logger.Printf(format, v...) -} diff --git a/vendor/github.com/emicklei/go-restful/v3/logger.go b/vendor/github.com/emicklei/go-restful/v3/logger.go deleted file mode 100644 index 29202726f..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/logger.go +++ /dev/null @@ -1,32 +0,0 @@ -package restful - -// Copyright 2014 Ernest Micklei. All rights reserved. -// Use of this source code is governed by a license -// that can be found in the LICENSE file. -import ( - "github.com/emicklei/go-restful/v3/log" -) - -var trace bool = false -var traceLogger log.StdLogger - -func init() { - traceLogger = log.Logger // use the package logger by default -} - -// TraceLogger enables detailed logging of Http request matching and filter invocation. Default no logger is set. -// You may call EnableTracing() directly to enable trace logging to the package-wide logger. -func TraceLogger(logger log.StdLogger) { - traceLogger = logger - EnableTracing(logger != nil) -} - -// SetLogger exposes the setter for the global logger on the top-level package -func SetLogger(customLogger log.StdLogger) { - log.SetLogger(customLogger) -} - -// EnableTracing can be used to Trace logging on and off. -func EnableTracing(enabled bool) { - trace = enabled -} diff --git a/vendor/github.com/emicklei/go-restful/v3/mime.go b/vendor/github.com/emicklei/go-restful/v3/mime.go deleted file mode 100644 index 33014471b..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/mime.go +++ /dev/null @@ -1,50 +0,0 @@ -package restful - -import ( - "strconv" - "strings" -) - -type mime struct { - media string - quality float64 -} - -// insertMime adds a mime to a list and keeps it sorted by quality. -func insertMime(l []mime, e mime) []mime { - for i, each := range l { - // if current mime has lower quality then insert before - if e.quality > each.quality { - left := append([]mime{}, l[0:i]...) - return append(append(left, e), l[i:]...) - } - } - return append(l, e) -} - -const qFactorWeightingKey = "q" - -// sortedMimes returns a list of mime sorted (desc) by its specified quality. -// e.g. text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3 -func sortedMimes(accept string) (sorted []mime) { - for _, each := range strings.Split(accept, ",") { - typeAndQuality := strings.Split(strings.Trim(each, " "), ";") - if len(typeAndQuality) == 1 { - sorted = insertMime(sorted, mime{typeAndQuality[0], 1.0}) - } else { - // take factor - qAndWeight := strings.Split(typeAndQuality[1], "=") - if len(qAndWeight) == 2 && strings.Trim(qAndWeight[0], " ") == qFactorWeightingKey { - f, err := strconv.ParseFloat(qAndWeight[1], 64) - if err != nil { - traceLogger.Printf("unable to parse quality in %s, %v", each, err) - } else { - sorted = insertMime(sorted, mime{typeAndQuality[0], f}) - } - } else { - sorted = insertMime(sorted, mime{typeAndQuality[0], 1.0}) - } - } - } - return -} diff --git a/vendor/github.com/emicklei/go-restful/v3/options_filter.go b/vendor/github.com/emicklei/go-restful/v3/options_filter.go deleted file mode 100644 index 5c1b34251..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/options_filter.go +++ /dev/null @@ -1,34 +0,0 @@ -package restful - -import "strings" - -// Copyright 2013 Ernest Micklei. All rights reserved. -// Use of this source code is governed by a license -// that can be found in the LICENSE file. - -// OPTIONSFilter is a filter function that inspects the Http Request for the OPTIONS method -// and provides the response with a set of allowed methods for the request URL Path. -// As for any filter, you can also install it for a particular WebService within a Container. -// Note: this filter is not needed when using CrossOriginResourceSharing (for CORS). -func (c *Container) OPTIONSFilter(req *Request, resp *Response, chain *FilterChain) { - if "OPTIONS" != req.Request.Method { - chain.ProcessFilter(req, resp) - return - } - - archs := req.Request.Header.Get(HEADER_AccessControlRequestHeaders) - methods := strings.Join(c.computeAllowedMethods(req), ",") - origin := req.Request.Header.Get(HEADER_Origin) - - resp.AddHeader(HEADER_Allow, methods) - resp.AddHeader(HEADER_AccessControlAllowOrigin, origin) - resp.AddHeader(HEADER_AccessControlAllowHeaders, archs) - resp.AddHeader(HEADER_AccessControlAllowMethods, methods) -} - -// OPTIONSFilter is a filter function that inspects the Http Request for the OPTIONS method -// and provides the response with a set of allowed methods for the request URL Path. -// Note: this filter is not needed when using CrossOriginResourceSharing (for CORS). -func OPTIONSFilter() FilterFunction { - return DefaultContainer.OPTIONSFilter -} diff --git a/vendor/github.com/emicklei/go-restful/v3/parameter.go b/vendor/github.com/emicklei/go-restful/v3/parameter.go deleted file mode 100644 index 0e658af5f..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/parameter.go +++ /dev/null @@ -1,234 +0,0 @@ -package restful - -import "sort" - -// Copyright 2013 Ernest Micklei. All rights reserved. -// Use of this source code is governed by a license -// that can be found in the LICENSE file. - -const ( - // PathParameterKind = indicator of Request parameter type "path" - PathParameterKind = iota - - // QueryParameterKind = indicator of Request parameter type "query" - QueryParameterKind - - // BodyParameterKind = indicator of Request parameter type "body" - BodyParameterKind - - // HeaderParameterKind = indicator of Request parameter type "header" - HeaderParameterKind - - // FormParameterKind = indicator of Request parameter type "form" - FormParameterKind - - // CollectionFormatCSV comma separated values `foo,bar` - CollectionFormatCSV = CollectionFormat("csv") - - // CollectionFormatSSV space separated values `foo bar` - CollectionFormatSSV = CollectionFormat("ssv") - - // CollectionFormatTSV tab separated values `foo\tbar` - CollectionFormatTSV = CollectionFormat("tsv") - - // CollectionFormatPipes pipe separated values `foo|bar` - CollectionFormatPipes = CollectionFormat("pipes") - - // CollectionFormatMulti corresponds to multiple parameter instances instead of multiple values for a single - // instance `foo=bar&foo=baz`. This is valid only for QueryParameters and FormParameters - CollectionFormatMulti = CollectionFormat("multi") -) - -type CollectionFormat string - -func (cf CollectionFormat) String() string { - return string(cf) -} - -// Parameter is for documententing the parameter used in a Http Request -// ParameterData kinds are Path,Query and Body -type Parameter struct { - data *ParameterData -} - -// ParameterData represents the state of a Parameter. -// It is made public to make it accessible to e.g. the Swagger package. -type ParameterData struct { - ExtensionProperties - Name, Description, DataType, DataFormat string - Kind int - Required bool - // AllowableValues is deprecated. Use PossibleValues instead - AllowableValues map[string]string - PossibleValues []string - AllowMultiple bool - AllowEmptyValue bool - DefaultValue string - CollectionFormat string - Pattern string - Minimum *float64 - Maximum *float64 - MinLength *int64 - MaxLength *int64 - MinItems *int64 - MaxItems *int64 - UniqueItems bool -} - -// Data returns the state of the Parameter -func (p *Parameter) Data() ParameterData { - return *p.data -} - -// Kind returns the parameter type indicator (see const for valid values) -func (p *Parameter) Kind() int { - return p.data.Kind -} - -func (p *Parameter) bePath() *Parameter { - p.data.Kind = PathParameterKind - return p -} -func (p *Parameter) beQuery() *Parameter { - p.data.Kind = QueryParameterKind - return p -} -func (p *Parameter) beBody() *Parameter { - p.data.Kind = BodyParameterKind - return p -} - -func (p *Parameter) beHeader() *Parameter { - p.data.Kind = HeaderParameterKind - return p -} - -func (p *Parameter) beForm() *Parameter { - p.data.Kind = FormParameterKind - return p -} - -// Required sets the required field and returns the receiver -func (p *Parameter) Required(required bool) *Parameter { - p.data.Required = required - return p -} - -// AllowMultiple sets the allowMultiple field and returns the receiver -func (p *Parameter) AllowMultiple(multiple bool) *Parameter { - p.data.AllowMultiple = multiple - return p -} - -// AddExtension adds or updates a key=value pair to the extension map -func (p *Parameter) AddExtension(key string, value interface{}) *Parameter { - p.data.AddExtension(key, value) - return p -} - -// AllowEmptyValue sets the AllowEmptyValue field and returns the receiver -func (p *Parameter) AllowEmptyValue(multiple bool) *Parameter { - p.data.AllowEmptyValue = multiple - return p -} - -// AllowableValues is deprecated. Use PossibleValues instead. Both will be set. -func (p *Parameter) AllowableValues(values map[string]string) *Parameter { - p.data.AllowableValues = values - - allowableSortedKeys := make([]string, 0, len(values)) - for k := range values { - allowableSortedKeys = append(allowableSortedKeys, k) - } - sort.Strings(allowableSortedKeys) - - p.data.PossibleValues = make([]string, 0, len(values)) - for _, k := range allowableSortedKeys { - p.data.PossibleValues = append(p.data.PossibleValues, values[k]) - } - return p -} - -// PossibleValues sets the possible values field and returns the receiver -func (p *Parameter) PossibleValues(values []string) *Parameter { - p.data.PossibleValues = values - return p -} - -// DataType sets the dataType field and returns the receiver -func (p *Parameter) DataType(typeName string) *Parameter { - p.data.DataType = typeName - return p -} - -// DataFormat sets the dataFormat field for Swagger UI -func (p *Parameter) DataFormat(formatName string) *Parameter { - p.data.DataFormat = formatName - return p -} - -// DefaultValue sets the default value field and returns the receiver -func (p *Parameter) DefaultValue(stringRepresentation string) *Parameter { - p.data.DefaultValue = stringRepresentation - return p -} - -// Description sets the description value field and returns the receiver -func (p *Parameter) Description(doc string) *Parameter { - p.data.Description = doc - return p -} - -// CollectionFormat sets the collection format for an array type -func (p *Parameter) CollectionFormat(format CollectionFormat) *Parameter { - p.data.CollectionFormat = format.String() - return p -} - -// Pattern sets the pattern field and returns the receiver -func (p *Parameter) Pattern(pattern string) *Parameter { - p.data.Pattern = pattern - return p -} - -// Minimum sets the minimum field and returns the receiver -func (p *Parameter) Minimum(minimum float64) *Parameter { - p.data.Minimum = &minimum - return p -} - -// Maximum sets the maximum field and returns the receiver -func (p *Parameter) Maximum(maximum float64) *Parameter { - p.data.Maximum = &maximum - return p -} - -// MinLength sets the minLength field and returns the receiver -func (p *Parameter) MinLength(minLength int64) *Parameter { - p.data.MinLength = &minLength - return p -} - -// MaxLength sets the maxLength field and returns the receiver -func (p *Parameter) MaxLength(maxLength int64) *Parameter { - p.data.MaxLength = &maxLength - return p -} - -// MinItems sets the minItems field and returns the receiver -func (p *Parameter) MinItems(minItems int64) *Parameter { - p.data.MinItems = &minItems - return p -} - -// MaxItems sets the maxItems field and returns the receiver -func (p *Parameter) MaxItems(maxItems int64) *Parameter { - p.data.MaxItems = &maxItems - return p -} - -// UniqueItems sets the uniqueItems field and returns the receiver -func (p *Parameter) UniqueItems(uniqueItems bool) *Parameter { - p.data.UniqueItems = uniqueItems - return p -} diff --git a/vendor/github.com/emicklei/go-restful/v3/path_expression.go b/vendor/github.com/emicklei/go-restful/v3/path_expression.go deleted file mode 100644 index 95a9a2545..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/path_expression.go +++ /dev/null @@ -1,74 +0,0 @@ -package restful - -// Copyright 2013 Ernest Micklei. All rights reserved. -// Use of this source code is governed by a license -// that can be found in the LICENSE file. - -import ( - "bytes" - "fmt" - "regexp" - "strings" -) - -// PathExpression holds a compiled path expression (RegExp) needed to match against -// Http request paths and to extract path parameter values. -type pathExpression struct { - LiteralCount int // the number of literal characters (means those not resulting from template variable substitution) - VarNames []string // the names of parameters (enclosed by {}) in the path - VarCount int // the number of named parameters (enclosed by {}) in the path - Matcher *regexp.Regexp - Source string // Path as defined by the RouteBuilder - tokens []string -} - -// NewPathExpression creates a PathExpression from the input URL path. -// Returns an error if the path is invalid. -func newPathExpression(path string) (*pathExpression, error) { - expression, literalCount, varNames, varCount, tokens := templateToRegularExpression(path) - compiled, err := regexp.Compile(expression) - if err != nil { - return nil, err - } - return &pathExpression{literalCount, varNames, varCount, compiled, expression, tokens}, nil -} - -// http://jsr311.java.net/nonav/releases/1.1/spec/spec3.html#x3-370003.7.3 -func templateToRegularExpression(template string) (expression string, literalCount int, varNames []string, varCount int, tokens []string) { - var buffer bytes.Buffer - buffer.WriteString("^") - //tokens = strings.Split(template, "/") - tokens = tokenizePath(template) - for _, each := range tokens { - if each == "" { - continue - } - buffer.WriteString("/") - if strings.HasPrefix(each, "{") { - // check for regular expression in variable - colon := strings.Index(each, ":") - var varName string - if colon != -1 { - // extract expression - varName = strings.TrimSpace(each[1:colon]) - paramExpr := strings.TrimSpace(each[colon+1 : len(each)-1]) - if paramExpr == "*" { // special case - buffer.WriteString("(.*)") - } else { - buffer.WriteString(fmt.Sprintf("(%s)", paramExpr)) // between colon and closing moustache - } - } else { - // plain var - varName = strings.TrimSpace(each[1 : len(each)-1]) - buffer.WriteString("([^/]+?)") - } - varNames = append(varNames, varName) - varCount += 1 - } else { - literalCount += len(each) - encoded := each // TODO URI encode - buffer.WriteString(regexp.QuoteMeta(encoded)) - } - } - return strings.TrimRight(buffer.String(), "/") + "(/.*)?$", literalCount, varNames, varCount, tokens -} diff --git a/vendor/github.com/emicklei/go-restful/v3/path_processor.go b/vendor/github.com/emicklei/go-restful/v3/path_processor.go deleted file mode 100644 index 141573245..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/path_processor.go +++ /dev/null @@ -1,74 +0,0 @@ -package restful - -import ( - "bytes" - "strings" -) - -// Copyright 2018 Ernest Micklei. All rights reserved. -// Use of this source code is governed by a license -// that can be found in the LICENSE file. - -// PathProcessor is extra behaviour that a Router can provide to extract path parameters from the path. -// If a Router does not implement this interface then the default behaviour will be used. -type PathProcessor interface { - // ExtractParameters gets the path parameters defined in the route and webService from the urlPath - ExtractParameters(route *Route, webService *WebService, urlPath string) map[string]string -} - -type defaultPathProcessor struct{} - -// Extract the parameters from the request url path -func (d defaultPathProcessor) ExtractParameters(r *Route, _ *WebService, urlPath string) map[string]string { - urlParts := tokenizePath(urlPath) - pathParameters := map[string]string{} - for i, key := range r.pathParts { - var value string - if i >= len(urlParts) { - value = "" - } else { - value = urlParts[i] - } - if r.hasCustomVerb && hasCustomVerb(key) { - key = removeCustomVerb(key) - value = removeCustomVerb(value) - } - - if strings.Index(key, "{") > -1 { // path-parameter - if colon := strings.Index(key, ":"); colon != -1 { - // extract by regex - regPart := key[colon+1 : len(key)-1] - keyPart := key[1:colon] - if regPart == "*" { - pathParameters[keyPart] = untokenizePath(i, urlParts) - break - } else { - pathParameters[keyPart] = value - } - } else { - // without enclosing {} - startIndex := strings.Index(key, "{") - endKeyIndex := strings.Index(key, "}") - - suffixLength := len(key) - endKeyIndex - 1 - endValueIndex := len(value) - suffixLength - - pathParameters[key[startIndex+1:endKeyIndex]] = value[startIndex:endValueIndex] - } - } - } - return pathParameters -} - -// Untokenize back into an URL path using the slash separator -func untokenizePath(offset int, parts []string) string { - var buffer bytes.Buffer - for p := offset; p < len(parts); p++ { - buffer.WriteString(parts[p]) - // do not end - if p < len(parts)-1 { - buffer.WriteString("/") - } - } - return buffer.String() -} diff --git a/vendor/github.com/emicklei/go-restful/v3/request.go b/vendor/github.com/emicklei/go-restful/v3/request.go deleted file mode 100644 index 5725a0759..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/request.go +++ /dev/null @@ -1,132 +0,0 @@ -package restful - -// Copyright 2013 Ernest Micklei. All rights reserved. -// Use of this source code is governed by a license -// that can be found in the LICENSE file. - -import ( - "compress/zlib" - "net/http" -) - -var defaultRequestContentType string - -// Request is a wrapper for a http Request that provides convenience methods -type Request struct { - Request *http.Request - pathParameters map[string]string - attributes map[string]interface{} // for storing request-scoped values - selectedRoute *Route // is nil when no route was matched -} - -func NewRequest(httpRequest *http.Request) *Request { - return &Request{ - Request: httpRequest, - pathParameters: map[string]string{}, - attributes: map[string]interface{}{}, - } // empty parameters, attributes -} - -// If ContentType is missing or */* is given then fall back to this type, otherwise -// a "Unable to unmarshal content of type:" response is returned. -// Valid values are restful.MIME_JSON and restful.MIME_XML -// Example: -// restful.DefaultRequestContentType(restful.MIME_JSON) -func DefaultRequestContentType(mime string) { - defaultRequestContentType = mime -} - -// PathParameter accesses the Path parameter value by its name -func (r *Request) PathParameter(name string) string { - return r.pathParameters[name] -} - -// PathParameters accesses the Path parameter values -func (r *Request) PathParameters() map[string]string { - return r.pathParameters -} - -// QueryParameter returns the (first) Query parameter value by its name -func (r *Request) QueryParameter(name string) string { - return r.Request.FormValue(name) -} - -// QueryParameters returns the all the query parameters values by name -func (r *Request) QueryParameters(name string) []string { - return r.Request.URL.Query()[name] -} - -// BodyParameter parses the body of the request (once for typically a POST or a PUT) and returns the value of the given name or an error. -func (r *Request) BodyParameter(name string) (string, error) { - err := r.Request.ParseForm() - if err != nil { - return "", err - } - return r.Request.PostFormValue(name), nil -} - -// HeaderParameter returns the HTTP Header value of a Header name or empty if missing -func (r *Request) HeaderParameter(name string) string { - return r.Request.Header.Get(name) -} - -// ReadEntity checks the Accept header and reads the content into the entityPointer. -func (r *Request) ReadEntity(entityPointer interface{}) (err error) { - contentType := r.Request.Header.Get(HEADER_ContentType) - contentEncoding := r.Request.Header.Get(HEADER_ContentEncoding) - - // check if the request body needs decompression - if ENCODING_GZIP == contentEncoding { - gzipReader := currentCompressorProvider.AcquireGzipReader() - defer currentCompressorProvider.ReleaseGzipReader(gzipReader) - gzipReader.Reset(r.Request.Body) - r.Request.Body = gzipReader - } else if ENCODING_DEFLATE == contentEncoding { - zlibReader, err := zlib.NewReader(r.Request.Body) - if err != nil { - return err - } - r.Request.Body = zlibReader - } - - // lookup the EntityReader, use defaultRequestContentType if needed and provided - entityReader, ok := entityAccessRegistry.accessorAt(contentType) - if !ok { - if len(defaultRequestContentType) != 0 { - entityReader, ok = entityAccessRegistry.accessorAt(defaultRequestContentType) - } - if !ok { - return NewError(http.StatusBadRequest, "Unable to unmarshal content of type:"+contentType) - } - } - return entityReader.Read(r, entityPointer) -} - -// SetAttribute adds or replaces the attribute with the given value. -func (r *Request) SetAttribute(name string, value interface{}) { - r.attributes[name] = value -} - -// Attribute returns the value associated to the given name. Returns nil if absent. -func (r Request) Attribute(name string) interface{} { - return r.attributes[name] -} - -// SelectedRoutePath root path + route path that matched the request, e.g. /meetings/{id}/attendees -// If no route was matched then return an empty string. -func (r Request) SelectedRoutePath() string { - if r.selectedRoute == nil { - return "" - } - // skip creating an accessor - return r.selectedRoute.Path -} - -// SelectedRoute returns a reader to access the selected Route by the container -// Returns nil if no route was matched. -func (r Request) SelectedRoute() RouteReader { - if r.selectedRoute == nil { - return nil - } - return routeAccessor{route: r.selectedRoute} -} diff --git a/vendor/github.com/emicklei/go-restful/v3/response.go b/vendor/github.com/emicklei/go-restful/v3/response.go deleted file mode 100644 index 8f0b56aa2..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/response.go +++ /dev/null @@ -1,256 +0,0 @@ -package restful - -// Copyright 2013 Ernest Micklei. All rights reserved. -// Use of this source code is governed by a license -// that can be found in the LICENSE file. - -import ( - "bufio" - "errors" - "net" - "net/http" -) - -// DefaultResponseMimeType is DEPRECATED, use DefaultResponseContentType(mime) -var DefaultResponseMimeType string - -//PrettyPrintResponses controls the indentation feature of XML and JSON serialization -var PrettyPrintResponses = true - -// Response is a wrapper on the actual http ResponseWriter -// It provides several convenience methods to prepare and write response content. -type Response struct { - http.ResponseWriter - requestAccept string // mime-type what the Http Request says it wants to receive - routeProduces []string // mime-types what the Route says it can produce - statusCode int // HTTP status code that has been written explicitly (if zero then net/http has written 200) - contentLength int // number of bytes written for the response body - prettyPrint bool // controls the indentation feature of XML and JSON serialization. It is initialized using var PrettyPrintResponses. - err error // err property is kept when WriteError is called - hijacker http.Hijacker // if underlying ResponseWriter supports it -} - -// NewResponse creates a new response based on a http ResponseWriter. -func NewResponse(httpWriter http.ResponseWriter) *Response { - hijacker, _ := httpWriter.(http.Hijacker) - return &Response{ResponseWriter: httpWriter, routeProduces: []string{}, statusCode: http.StatusOK, prettyPrint: PrettyPrintResponses, hijacker: hijacker} -} - -// DefaultResponseContentType set a default. -// If Accept header matching fails, fall back to this type. -// Valid values are restful.MIME_JSON and restful.MIME_XML -// Example: -// restful.DefaultResponseContentType(restful.MIME_JSON) -func DefaultResponseContentType(mime string) { - DefaultResponseMimeType = mime -} - -// InternalServerError writes the StatusInternalServerError header. -// DEPRECATED, use WriteErrorString(http.StatusInternalServerError,reason) -func (r Response) InternalServerError() Response { - r.WriteHeader(http.StatusInternalServerError) - return r -} - -// Hijack implements the http.Hijacker interface. This expands -// the Response to fulfill http.Hijacker if the underlying -// http.ResponseWriter supports it. -func (r *Response) Hijack() (net.Conn, *bufio.ReadWriter, error) { - if r.hijacker == nil { - return nil, nil, errors.New("http.Hijacker not implemented by underlying http.ResponseWriter") - } - return r.hijacker.Hijack() -} - -// PrettyPrint changes whether this response must produce pretty (line-by-line, indented) JSON or XML output. -func (r *Response) PrettyPrint(bePretty bool) { - r.prettyPrint = bePretty -} - -// AddHeader is a shortcut for .Header().Add(header,value) -func (r Response) AddHeader(header string, value string) Response { - r.Header().Add(header, value) - return r -} - -// SetRequestAccepts tells the response what Mime-type(s) the HTTP request said it wants to accept. Exposed for testing. -func (r *Response) SetRequestAccepts(mime string) { - r.requestAccept = mime -} - -// EntityWriter returns the registered EntityWriter that the entity (requested resource) -// can write according to what the request wants (Accept) and what the Route can produce or what the restful defaults say. -// If called before WriteEntity and WriteHeader then a false return value can be used to write a 406: Not Acceptable. -func (r *Response) EntityWriter() (EntityReaderWriter, bool) { - sorted := sortedMimes(r.requestAccept) - for _, eachAccept := range sorted { - for _, eachProduce := range r.routeProduces { - if eachProduce == eachAccept.media { - if w, ok := entityAccessRegistry.accessorAt(eachAccept.media); ok { - return w, true - } - } - } - if eachAccept.media == "*/*" { - for _, each := range r.routeProduces { - if w, ok := entityAccessRegistry.accessorAt(each); ok { - return w, true - } - } - } - } - // if requestAccept is empty - writer, ok := entityAccessRegistry.accessorAt(r.requestAccept) - if !ok { - // if not registered then fallback to the defaults (if set) - if DefaultResponseMimeType == MIME_JSON { - return entityAccessRegistry.accessorAt(MIME_JSON) - } - if DefaultResponseMimeType == MIME_XML { - return entityAccessRegistry.accessorAt(MIME_XML) - } - // Fallback to whatever the route says it can produce. - // https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html - for _, each := range r.routeProduces { - if w, ok := entityAccessRegistry.accessorAt(each); ok { - return w, true - } - } - if trace { - traceLogger.Printf("no registered EntityReaderWriter found for %s", r.requestAccept) - } - } - return writer, ok -} - -// WriteEntity calls WriteHeaderAndEntity with Http Status OK (200) -func (r *Response) WriteEntity(value interface{}) error { - return r.WriteHeaderAndEntity(http.StatusOK, value) -} - -// WriteHeaderAndEntity marshals the value using the representation denoted by the Accept Header and the registered EntityWriters. -// If no Accept header is specified (or */*) then respond with the Content-Type as specified by the first in the Route.Produces. -// If an Accept header is specified then respond with the Content-Type as specified by the first in the Route.Produces that is matched with the Accept header. -// If the value is nil then no response is send except for the Http status. You may want to call WriteHeader(http.StatusNotFound) instead. -// If there is no writer available that can represent the value in the requested MIME type then Http Status NotAcceptable is written. -// Current implementation ignores any q-parameters in the Accept Header. -// Returns an error if the value could not be written on the response. -func (r *Response) WriteHeaderAndEntity(status int, value interface{}) error { - writer, ok := r.EntityWriter() - if !ok { - r.WriteHeader(http.StatusNotAcceptable) - return nil - } - return writer.Write(r, status, value) -} - -// WriteAsXml is a convenience method for writing a value in xml (requires Xml tags on the value) -// It uses the standard encoding/xml package for marshalling the value ; not using a registered EntityReaderWriter. -func (r *Response) WriteAsXml(value interface{}) error { - return writeXML(r, http.StatusOK, MIME_XML, value) -} - -// WriteHeaderAndXml is a convenience method for writing a status and value in xml (requires Xml tags on the value) -// It uses the standard encoding/xml package for marshalling the value ; not using a registered EntityReaderWriter. -func (r *Response) WriteHeaderAndXml(status int, value interface{}) error { - return writeXML(r, status, MIME_XML, value) -} - -// WriteAsJson is a convenience method for writing a value in json. -// It uses the standard encoding/json package for marshalling the value ; not using a registered EntityReaderWriter. -func (r *Response) WriteAsJson(value interface{}) error { - return writeJSON(r, http.StatusOK, MIME_JSON, value) -} - -// WriteJson is a convenience method for writing a value in Json with a given Content-Type. -// It uses the standard encoding/json package for marshalling the value ; not using a registered EntityReaderWriter. -func (r *Response) WriteJson(value interface{}, contentType string) error { - return writeJSON(r, http.StatusOK, contentType, value) -} - -// WriteHeaderAndJson is a convenience method for writing the status and a value in Json with a given Content-Type. -// It uses the standard encoding/json package for marshalling the value ; not using a registered EntityReaderWriter. -func (r *Response) WriteHeaderAndJson(status int, value interface{}, contentType string) error { - return writeJSON(r, status, contentType, value) -} - -// WriteError writes the http status and the error string on the response. err can be nil. -// Return an error if writing was not successful. -func (r *Response) WriteError(httpStatus int, err error) (writeErr error) { - r.err = err - if err == nil { - writeErr = r.WriteErrorString(httpStatus, "") - } else { - writeErr = r.WriteErrorString(httpStatus, err.Error()) - } - return writeErr -} - -// WriteServiceError is a convenience method for a responding with a status and a ServiceError -func (r *Response) WriteServiceError(httpStatus int, err ServiceError) error { - r.err = err - return r.WriteHeaderAndEntity(httpStatus, err) -} - -// WriteErrorString is a convenience method for an error status with the actual error -func (r *Response) WriteErrorString(httpStatus int, errorReason string) error { - if r.err == nil { - // if not called from WriteError - r.err = errors.New(errorReason) - } - r.WriteHeader(httpStatus) - if _, err := r.Write([]byte(errorReason)); err != nil { - return err - } - return nil -} - -// Flush implements http.Flusher interface, which sends any buffered data to the client. -func (r *Response) Flush() { - if f, ok := r.ResponseWriter.(http.Flusher); ok { - f.Flush() - } else if trace { - traceLogger.Printf("ResponseWriter %v doesn't support Flush", r) - } -} - -// WriteHeader is overridden to remember the Status Code that has been written. -// Changes to the Header of the response have no effect after this. -func (r *Response) WriteHeader(httpStatus int) { - r.statusCode = httpStatus - r.ResponseWriter.WriteHeader(httpStatus) -} - -// StatusCode returns the code that has been written using WriteHeader. -func (r Response) StatusCode() int { - if 0 == r.statusCode { - // no status code has been written yet; assume OK - return http.StatusOK - } - return r.statusCode -} - -// Write writes the data to the connection as part of an HTTP reply. -// Write is part of http.ResponseWriter interface. -func (r *Response) Write(bytes []byte) (int, error) { - written, err := r.ResponseWriter.Write(bytes) - r.contentLength += written - return written, err -} - -// ContentLength returns the number of bytes written for the response content. -// Note that this value is only correct if all data is written through the Response using its Write* methods. -// Data written directly using the underlying http.ResponseWriter is not accounted for. -func (r Response) ContentLength() int { - return r.contentLength -} - -// CloseNotify is part of http.CloseNotifier interface -func (r Response) CloseNotify() <-chan bool { - return r.ResponseWriter.(http.CloseNotifier).CloseNotify() -} - -// Error returns the err created by WriteError -func (r Response) Error() error { - return r.err -} diff --git a/vendor/github.com/emicklei/go-restful/v3/route.go b/vendor/github.com/emicklei/go-restful/v3/route.go deleted file mode 100644 index 193f4a6b0..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/route.go +++ /dev/null @@ -1,178 +0,0 @@ -package restful - -// Copyright 2013 Ernest Micklei. All rights reserved. -// Use of this source code is governed by a license -// that can be found in the LICENSE file. - -import ( - "net/http" - "strings" -) - -// RouteFunction declares the signature of a function that can be bound to a Route. -type RouteFunction func(*Request, *Response) - -// RouteSelectionConditionFunction declares the signature of a function that -// can be used to add extra conditional logic when selecting whether the route -// matches the HTTP request. -type RouteSelectionConditionFunction func(httpRequest *http.Request) bool - -// Route binds a HTTP Method,Path,Consumes combination to a RouteFunction. -type Route struct { - ExtensionProperties - Method string - Produces []string - Consumes []string - Path string // webservice root path + described path - Function RouteFunction - Filters []FilterFunction - If []RouteSelectionConditionFunction - - // cached values for dispatching - relativePath string - pathParts []string - pathExpr *pathExpression // cached compilation of relativePath as RegExp - - // documentation - Doc string - Notes string - Operation string - ParameterDocs []*Parameter - ResponseErrors map[int]ResponseError - DefaultResponse *ResponseError - ReadSample, WriteSample interface{} // structs that model an example request or response payload - - // Extra information used to store custom information about the route. - Metadata map[string]interface{} - - // marks a route as deprecated - Deprecated bool - - //Overrides the container.contentEncodingEnabled - contentEncodingEnabled *bool - - // indicate route path has custom verb - hasCustomVerb bool - - // if a request does not include a content-type header then - // depending on the method, it may return a 415 Unsupported Media - // Must have uppercase HTTP Method names such as GET,HEAD,OPTIONS,... - allowedMethodsWithoutContentType []string -} - -// Initialize for Route -func (r *Route) postBuild() { - r.pathParts = tokenizePath(r.Path) - r.hasCustomVerb = hasCustomVerb(r.Path) -} - -// Create Request and Response from their http versions -func (r *Route) wrapRequestResponse(httpWriter http.ResponseWriter, httpRequest *http.Request, pathParams map[string]string) (*Request, *Response) { - wrappedRequest := NewRequest(httpRequest) - wrappedRequest.pathParameters = pathParams - wrappedRequest.selectedRoute = r - wrappedResponse := NewResponse(httpWriter) - wrappedResponse.requestAccept = httpRequest.Header.Get(HEADER_Accept) - wrappedResponse.routeProduces = r.Produces - return wrappedRequest, wrappedResponse -} - -func stringTrimSpaceCutset(r rune) bool { - return r == ' ' -} - -// Return whether the mimeType matches to what this Route can produce. -func (r Route) matchesAccept(mimeTypesWithQuality string) bool { - remaining := mimeTypesWithQuality - for { - var mimeType string - if end := strings.Index(remaining, ","); end == -1 { - mimeType, remaining = remaining, "" - } else { - mimeType, remaining = remaining[:end], remaining[end+1:] - } - if quality := strings.Index(mimeType, ";"); quality != -1 { - mimeType = mimeType[:quality] - } - mimeType = strings.TrimFunc(mimeType, stringTrimSpaceCutset) - if mimeType == "*/*" { - return true - } - for _, producibleType := range r.Produces { - if producibleType == "*/*" || producibleType == mimeType { - return true - } - } - if len(remaining) == 0 { - return false - } - } -} - -// Return whether this Route can consume content with a type specified by mimeTypes (can be empty). -func (r Route) matchesContentType(mimeTypes string) bool { - - if len(r.Consumes) == 0 { - // did not specify what it can consume ; any media type (“*/*”) is assumed - return true - } - - if len(mimeTypes) == 0 { - // idempotent methods with (most-likely or guaranteed) empty content match missing Content-Type - m := r.Method - // if route specifies less or non-idempotent methods then use that - if len(r.allowedMethodsWithoutContentType) > 0 { - for _, each := range r.allowedMethodsWithoutContentType { - if m == each { - return true - } - } - } else { - if m == "GET" || m == "HEAD" || m == "OPTIONS" || m == "DELETE" || m == "TRACE" { - return true - } - } - // proceed with default - mimeTypes = MIME_OCTET - } - - remaining := mimeTypes - for { - var mimeType string - if end := strings.Index(remaining, ","); end == -1 { - mimeType, remaining = remaining, "" - } else { - mimeType, remaining = remaining[:end], remaining[end+1:] - } - if quality := strings.Index(mimeType, ";"); quality != -1 { - mimeType = mimeType[:quality] - } - mimeType = strings.TrimFunc(mimeType, stringTrimSpaceCutset) - for _, consumeableType := range r.Consumes { - if consumeableType == "*/*" || consumeableType == mimeType { - return true - } - } - if len(remaining) == 0 { - return false - } - } -} - -// Tokenize an URL path using the slash separator ; the result does not have empty tokens -func tokenizePath(path string) []string { - if "/" == path { - return nil - } - return strings.Split(strings.Trim(path, "/"), "/") -} - -// for debugging -func (r *Route) String() string { - return r.Method + " " + r.Path -} - -// EnableContentEncoding (default=false) allows for GZIP or DEFLATE encoding of responses. Overrides the container.contentEncodingEnabled value. -func (r *Route) EnableContentEncoding(enabled bool) { - r.contentEncodingEnabled = &enabled -} diff --git a/vendor/github.com/emicklei/go-restful/v3/route_builder.go b/vendor/github.com/emicklei/go-restful/v3/route_builder.go deleted file mode 100644 index 23641b6dd..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/route_builder.go +++ /dev/null @@ -1,376 +0,0 @@ -package restful - -// Copyright 2013 Ernest Micklei. All rights reserved. -// Use of this source code is governed by a license -// that can be found in the LICENSE file. - -import ( - "fmt" - "os" - "reflect" - "runtime" - "strings" - "sync/atomic" - - "github.com/emicklei/go-restful/v3/log" -) - -// RouteBuilder is a helper to construct Routes. -type RouteBuilder struct { - rootPath string - currentPath string - produces []string - consumes []string - httpMethod string // required - function RouteFunction // required - filters []FilterFunction - conditions []RouteSelectionConditionFunction - allowedMethodsWithoutContentType []string // see Route - - typeNameHandleFunc TypeNameHandleFunction // required - - // documentation - doc string - notes string - operation string - readSample, writeSample interface{} - parameters []*Parameter - errorMap map[int]ResponseError - defaultResponse *ResponseError - metadata map[string]interface{} - extensions map[string]interface{} - deprecated bool - contentEncodingEnabled *bool -} - -// Do evaluates each argument with the RouteBuilder itself. -// This allows you to follow DRY principles without breaking the fluent programming style. -// Example: -// ws.Route(ws.DELETE("/{name}").To(t.deletePerson).Do(Returns200, Returns500)) -// -// func Returns500(b *RouteBuilder) { -// b.Returns(500, "Internal Server Error", restful.ServiceError{}) -// } -func (b *RouteBuilder) Do(oneArgBlocks ...func(*RouteBuilder)) *RouteBuilder { - for _, each := range oneArgBlocks { - each(b) - } - return b -} - -// To bind the route to a function. -// If this route is matched with the incoming Http Request then call this function with the *Request,*Response pair. Required. -func (b *RouteBuilder) To(function RouteFunction) *RouteBuilder { - b.function = function - return b -} - -// Method specifies what HTTP method to match. Required. -func (b *RouteBuilder) Method(method string) *RouteBuilder { - b.httpMethod = method - return b -} - -// Produces specifies what MIME types can be produced ; the matched one will appear in the Content-Type Http header. -func (b *RouteBuilder) Produces(mimeTypes ...string) *RouteBuilder { - b.produces = mimeTypes - return b -} - -// Consumes specifies what MIME types can be consumes ; the Accept Http header must matched any of these -func (b *RouteBuilder) Consumes(mimeTypes ...string) *RouteBuilder { - b.consumes = mimeTypes - return b -} - -// Path specifies the relative (w.r.t WebService root path) URL path to match. Default is "/". -func (b *RouteBuilder) Path(subPath string) *RouteBuilder { - b.currentPath = subPath - return b -} - -// Doc tells what this route is all about. Optional. -func (b *RouteBuilder) Doc(documentation string) *RouteBuilder { - b.doc = documentation - return b -} - -// Notes is a verbose explanation of the operation behavior. Optional. -func (b *RouteBuilder) Notes(notes string) *RouteBuilder { - b.notes = notes - return b -} - -// Reads tells what resource type will be read from the request payload. Optional. -// A parameter of type "body" is added ,required is set to true and the dataType is set to the qualified name of the sample's type. -func (b *RouteBuilder) Reads(sample interface{}, optionalDescription ...string) *RouteBuilder { - fn := b.typeNameHandleFunc - if fn == nil { - fn = reflectTypeName - } - typeAsName := fn(sample) - description := "" - if len(optionalDescription) > 0 { - description = optionalDescription[0] - } - b.readSample = sample - bodyParameter := &Parameter{&ParameterData{Name: "body", Description: description}} - bodyParameter.beBody() - bodyParameter.Required(true) - bodyParameter.DataType(typeAsName) - b.Param(bodyParameter) - return b -} - -// ParameterNamed returns a Parameter already known to the RouteBuilder. Returns nil if not. -// Use this to modify or extend information for the Parameter (through its Data()). -func (b RouteBuilder) ParameterNamed(name string) (p *Parameter) { - for _, each := range b.parameters { - if each.Data().Name == name { - return each - } - } - return p -} - -// Writes tells what resource type will be written as the response payload. Optional. -func (b *RouteBuilder) Writes(sample interface{}) *RouteBuilder { - b.writeSample = sample - return b -} - -// Param allows you to document the parameters of the Route. It adds a new Parameter (does not check for duplicates). -func (b *RouteBuilder) Param(parameter *Parameter) *RouteBuilder { - if b.parameters == nil { - b.parameters = []*Parameter{} - } - b.parameters = append(b.parameters, parameter) - return b -} - -// Operation allows you to document what the actual method/function call is of the Route. -// Unless called, the operation name is derived from the RouteFunction set using To(..). -func (b *RouteBuilder) Operation(name string) *RouteBuilder { - b.operation = name - return b -} - -// ReturnsError is deprecated, use Returns instead. -func (b *RouteBuilder) ReturnsError(code int, message string, model interface{}) *RouteBuilder { - log.Print("ReturnsError is deprecated, use Returns instead.") - return b.Returns(code, message, model) -} - -// Returns allows you to document what responses (errors or regular) can be expected. -// The model parameter is optional ; either pass a struct instance or use nil if not applicable. -func (b *RouteBuilder) Returns(code int, message string, model interface{}) *RouteBuilder { - err := ResponseError{ - Code: code, - Message: message, - Model: model, - IsDefault: false, // this field is deprecated, use default response instead. - } - // lazy init because there is no NewRouteBuilder (yet) - if b.errorMap == nil { - b.errorMap = map[int]ResponseError{} - } - b.errorMap[code] = err - return b -} - -// ReturnsWithHeaders is similar to Returns, but can specify response headers -func (b *RouteBuilder) ReturnsWithHeaders(code int, message string, model interface{}, headers map[string]Header) *RouteBuilder { - b.Returns(code, message, model) - err := b.errorMap[code] - err.Headers = headers - b.errorMap[code] = err - return b -} - -// DefaultReturns is a special Returns call that sets the default of the response. -func (b *RouteBuilder) DefaultReturns(message string, model interface{}) *RouteBuilder { - b.defaultResponse = &ResponseError{ - Message: message, - Model: model, - } - return b -} - -// Metadata adds or updates a key=value pair to the metadata map. -func (b *RouteBuilder) Metadata(key string, value interface{}) *RouteBuilder { - if b.metadata == nil { - b.metadata = map[string]interface{}{} - } - b.metadata[key] = value - return b -} - -// AddExtension adds or updates a key=value pair to the extensions map. -func (b *RouteBuilder) AddExtension(key string, value interface{}) *RouteBuilder { - if b.extensions == nil { - b.extensions = map[string]interface{}{} - } - b.extensions[key] = value - return b -} - -// Deprecate sets the value of deprecated to true. Deprecated routes have a special UI treatment to warn against use -func (b *RouteBuilder) Deprecate() *RouteBuilder { - b.deprecated = true - return b -} - -// AllowedMethodsWithoutContentType overrides the default list GET,HEAD,OPTIONS,DELETE,TRACE -// If a request does not include a content-type header then -// depending on the method, it may return a 415 Unsupported Media. -// Must have uppercase HTTP Method names such as GET,HEAD,OPTIONS,... -func (b *RouteBuilder) AllowedMethodsWithoutContentType(methods []string) *RouteBuilder { - b.allowedMethodsWithoutContentType = methods - return b -} - -// ResponseError represents a response; not necessarily an error. -type ResponseError struct { - ExtensionProperties - Code int - Message string - Model interface{} - Headers map[string]Header - IsDefault bool -} - -// Header describes a header for a response of the API -// -// For more information: http://goo.gl/8us55a#headerObject -type Header struct { - *Items - Description string -} - -// Items describe swagger simple schemas for headers -type Items struct { - Type string - Format string - Items *Items - CollectionFormat string - Default interface{} -} - -func (b *RouteBuilder) servicePath(path string) *RouteBuilder { - b.rootPath = path - return b -} - -// Filter appends a FilterFunction to the end of filters for this Route to build. -func (b *RouteBuilder) Filter(filter FilterFunction) *RouteBuilder { - b.filters = append(b.filters, filter) - return b -} - -// If sets a condition function that controls matching the Route based on custom logic. -// The condition function is provided the HTTP request and should return true if the route -// should be considered. -// -// Efficiency note: the condition function is called before checking the method, produces, and -// consumes criteria, so that the correct HTTP status code can be returned. -// -// Lifecycle note: no filter functions have been called prior to calling the condition function, -// so the condition function should not depend on any context that might be set up by container -// or route filters. -func (b *RouteBuilder) If(condition RouteSelectionConditionFunction) *RouteBuilder { - b.conditions = append(b.conditions, condition) - return b -} - -// ContentEncodingEnabled allows you to override the Containers value for auto-compressing this route response. -func (b *RouteBuilder) ContentEncodingEnabled(enabled bool) *RouteBuilder { - b.contentEncodingEnabled = &enabled - return b -} - -// If no specific Route path then set to rootPath -// If no specific Produces then set to rootProduces -// If no specific Consumes then set to rootConsumes -func (b *RouteBuilder) copyDefaults(rootProduces, rootConsumes []string) { - if len(b.produces) == 0 { - b.produces = rootProduces - } - if len(b.consumes) == 0 { - b.consumes = rootConsumes - } -} - -// typeNameHandler sets the function that will convert types to strings in the parameter -// and model definitions. -func (b *RouteBuilder) typeNameHandler(handler TypeNameHandleFunction) *RouteBuilder { - b.typeNameHandleFunc = handler - return b -} - -// Build creates a new Route using the specification details collected by the RouteBuilder -func (b *RouteBuilder) Build() Route { - pathExpr, err := newPathExpression(b.currentPath) - if err != nil { - log.Printf("Invalid path:%s because:%v", b.currentPath, err) - os.Exit(1) - } - if b.function == nil { - log.Printf("No function specified for route:" + b.currentPath) - os.Exit(1) - } - operationName := b.operation - if len(operationName) == 0 && b.function != nil { - // extract from definition - operationName = nameOfFunction(b.function) - } - route := Route{ - Method: b.httpMethod, - Path: concatPath(b.rootPath, b.currentPath), - Produces: b.produces, - Consumes: b.consumes, - Function: b.function, - Filters: b.filters, - If: b.conditions, - relativePath: b.currentPath, - pathExpr: pathExpr, - Doc: b.doc, - Notes: b.notes, - Operation: operationName, - ParameterDocs: b.parameters, - ResponseErrors: b.errorMap, - DefaultResponse: b.defaultResponse, - ReadSample: b.readSample, - WriteSample: b.writeSample, - Metadata: b.metadata, - Deprecated: b.deprecated, - contentEncodingEnabled: b.contentEncodingEnabled, - allowedMethodsWithoutContentType: b.allowedMethodsWithoutContentType, - } - route.Extensions = b.extensions - route.postBuild() - return route -} - -func concatPath(path1, path2 string) string { - return strings.TrimRight(path1, "/") + "/" + strings.TrimLeft(path2, "/") -} - -var anonymousFuncCount int32 - -// nameOfFunction returns the short name of the function f for documentation. -// It uses a runtime feature for debugging ; its value may change for later Go versions. -func nameOfFunction(f interface{}) string { - fun := runtime.FuncForPC(reflect.ValueOf(f).Pointer()) - tokenized := strings.Split(fun.Name(), ".") - last := tokenized[len(tokenized)-1] - last = strings.TrimSuffix(last, ")·fm") // < Go 1.5 - last = strings.TrimSuffix(last, ")-fm") // Go 1.5 - last = strings.TrimSuffix(last, "·fm") // < Go 1.5 - last = strings.TrimSuffix(last, "-fm") // Go 1.5 - if last == "func1" { // this could mean conflicts in API docs - val := atomic.AddInt32(&anonymousFuncCount, 1) - last = "func" + fmt.Sprintf("%d", val) - atomic.StoreInt32(&anonymousFuncCount, val) - } - return last -} diff --git a/vendor/github.com/emicklei/go-restful/v3/route_reader.go b/vendor/github.com/emicklei/go-restful/v3/route_reader.go deleted file mode 100644 index c9f4ee75f..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/route_reader.go +++ /dev/null @@ -1,66 +0,0 @@ -package restful - -// Copyright 2021 Ernest Micklei. All rights reserved. -// Use of this source code is governed by a license -// that can be found in the LICENSE file. - -type RouteReader interface { - Method() string - Consumes() []string - Path() string - Doc() string - Notes() string - Operation() string - ParameterDocs() []*Parameter - // Returns a copy - Metadata() map[string]interface{} - Deprecated() bool -} - -type routeAccessor struct { - route *Route -} - -func (r routeAccessor) Method() string { - return r.route.Method -} -func (r routeAccessor) Consumes() []string { - return r.route.Consumes[:] -} -func (r routeAccessor) Path() string { - return r.route.Path -} -func (r routeAccessor) Doc() string { - return r.route.Doc -} -func (r routeAccessor) Notes() string { - return r.route.Notes -} -func (r routeAccessor) Operation() string { - return r.route.Operation -} -func (r routeAccessor) ParameterDocs() []*Parameter { - return r.route.ParameterDocs[:] -} - -// Returns a copy -func (r routeAccessor) Metadata() map[string]interface{} { - return copyMap(r.route.Metadata) -} -func (r routeAccessor) Deprecated() bool { - return r.route.Deprecated -} - -// https://stackoverflow.com/questions/23057785/how-to-copy-a-map -func copyMap(m map[string]interface{}) map[string]interface{} { - cp := make(map[string]interface{}) - for k, v := range m { - vm, ok := v.(map[string]interface{}) - if ok { - cp[k] = copyMap(vm) - } else { - cp[k] = v - } - } - return cp -} diff --git a/vendor/github.com/emicklei/go-restful/v3/router.go b/vendor/github.com/emicklei/go-restful/v3/router.go deleted file mode 100644 index 19078af1c..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/router.go +++ /dev/null @@ -1,20 +0,0 @@ -package restful - -// Copyright 2013 Ernest Micklei. All rights reserved. -// Use of this source code is governed by a license -// that can be found in the LICENSE file. - -import "net/http" - -// A RouteSelector finds the best matching Route given the input HTTP Request -// RouteSelectors can optionally also implement the PathProcessor interface to also calculate the -// path parameters after the route has been selected. -type RouteSelector interface { - - // SelectRoute finds a Route given the input HTTP Request and a list of WebServices. - // It returns a selected Route and its containing WebService or an error indicating - // a problem. - SelectRoute( - webServices []*WebService, - httpRequest *http.Request) (selectedService *WebService, selected *Route, err error) -} diff --git a/vendor/github.com/emicklei/go-restful/v3/service_error.go b/vendor/github.com/emicklei/go-restful/v3/service_error.go deleted file mode 100644 index a41575469..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/service_error.go +++ /dev/null @@ -1,32 +0,0 @@ -package restful - -// Copyright 2013 Ernest Micklei. All rights reserved. -// Use of this source code is governed by a license -// that can be found in the LICENSE file. - -import ( - "fmt" - "net/http" -) - -// ServiceError is a transport object to pass information about a non-Http error occurred in a WebService while processing a request. -type ServiceError struct { - Code int - Message string - Header http.Header -} - -// NewError returns a ServiceError using the code and reason -func NewError(code int, message string) ServiceError { - return ServiceError{Code: code, Message: message} -} - -// NewErrorWithHeader returns a ServiceError using the code, reason and header -func NewErrorWithHeader(code int, message string, header http.Header) ServiceError { - return ServiceError{Code: code, Message: message, Header: header} -} - -// Error returns a text representation of the service error -func (s ServiceError) Error() string { - return fmt.Sprintf("[ServiceError:%v] %v", s.Code, s.Message) -} diff --git a/vendor/github.com/emicklei/go-restful/v3/web_service.go b/vendor/github.com/emicklei/go-restful/v3/web_service.go deleted file mode 100644 index 0bf5d1e5f..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/web_service.go +++ /dev/null @@ -1,293 +0,0 @@ -package restful - -import ( - "errors" - "os" - "reflect" - "sync" - - "github.com/emicklei/go-restful/v3/log" -) - -// Copyright 2013 Ernest Micklei. All rights reserved. -// Use of this source code is governed by a license -// that can be found in the LICENSE file. - -// WebService holds a collection of Route values that bind a Http Method + URL Path to a function. -type WebService struct { - rootPath string - pathExpr *pathExpression // cached compilation of rootPath as RegExp - routes []Route - produces []string - consumes []string - pathParameters []*Parameter - filters []FilterFunction - documentation string - apiVersion string - - typeNameHandleFunc TypeNameHandleFunction - - dynamicRoutes bool - - // protects 'routes' if dynamic routes are enabled - routesLock sync.RWMutex -} - -func (w *WebService) SetDynamicRoutes(enable bool) { - w.dynamicRoutes = enable -} - -// TypeNameHandleFunction declares functions that can handle translating the name of a sample object -// into the restful documentation for the service. -type TypeNameHandleFunction func(sample interface{}) string - -// TypeNameHandler sets the function that will convert types to strings in the parameter -// and model definitions. If not set, the web service will invoke -// reflect.TypeOf(object).String(). -func (w *WebService) TypeNameHandler(handler TypeNameHandleFunction) *WebService { - w.typeNameHandleFunc = handler - return w -} - -// reflectTypeName is the default TypeNameHandleFunction and for a given object -// returns the name that Go identifies it with (e.g. "string" or "v1.Object") via -// the reflection API. -func reflectTypeName(sample interface{}) string { - return reflect.TypeOf(sample).String() -} - -// compilePathExpression ensures that the path is compiled into a RegEx for those routers that need it. -func (w *WebService) compilePathExpression() { - compiled, err := newPathExpression(w.rootPath) - if err != nil { - log.Printf("invalid path:%s because:%v", w.rootPath, err) - os.Exit(1) - } - w.pathExpr = compiled -} - -// ApiVersion sets the API version for documentation purposes. -func (w *WebService) ApiVersion(apiVersion string) *WebService { - w.apiVersion = apiVersion - return w -} - -// Version returns the API version for documentation purposes. -func (w *WebService) Version() string { return w.apiVersion } - -// Path specifies the root URL template path of the WebService. -// All Routes will be relative to this path. -func (w *WebService) Path(root string) *WebService { - w.rootPath = root - if len(w.rootPath) == 0 { - w.rootPath = "/" - } - w.compilePathExpression() - return w -} - -// Param adds a PathParameter to document parameters used in the root path. -func (w *WebService) Param(parameter *Parameter) *WebService { - if w.pathParameters == nil { - w.pathParameters = []*Parameter{} - } - w.pathParameters = append(w.pathParameters, parameter) - return w -} - -// PathParameter creates a new Parameter of kind Path for documentation purposes. -// It is initialized as required with string as its DataType. -func (w *WebService) PathParameter(name, description string) *Parameter { - return PathParameter(name, description) -} - -// PathParameter creates a new Parameter of kind Path for documentation purposes. -// It is initialized as required with string as its DataType. -func PathParameter(name, description string) *Parameter { - p := &Parameter{&ParameterData{Name: name, Description: description, Required: true, DataType: "string"}} - p.bePath() - return p -} - -// QueryParameter creates a new Parameter of kind Query for documentation purposes. -// It is initialized as not required with string as its DataType. -func (w *WebService) QueryParameter(name, description string) *Parameter { - return QueryParameter(name, description) -} - -// QueryParameter creates a new Parameter of kind Query for documentation purposes. -// It is initialized as not required with string as its DataType. -func QueryParameter(name, description string) *Parameter { - p := &Parameter{&ParameterData{Name: name, Description: description, Required: false, DataType: "string", CollectionFormat: CollectionFormatCSV.String()}} - p.beQuery() - return p -} - -// BodyParameter creates a new Parameter of kind Body for documentation purposes. -// It is initialized as required without a DataType. -func (w *WebService) BodyParameter(name, description string) *Parameter { - return BodyParameter(name, description) -} - -// BodyParameter creates a new Parameter of kind Body for documentation purposes. -// It is initialized as required without a DataType. -func BodyParameter(name, description string) *Parameter { - p := &Parameter{&ParameterData{Name: name, Description: description, Required: true}} - p.beBody() - return p -} - -// HeaderParameter creates a new Parameter of kind (Http) Header for documentation purposes. -// It is initialized as not required with string as its DataType. -func (w *WebService) HeaderParameter(name, description string) *Parameter { - return HeaderParameter(name, description) -} - -// HeaderParameter creates a new Parameter of kind (Http) Header for documentation purposes. -// It is initialized as not required with string as its DataType. -func HeaderParameter(name, description string) *Parameter { - p := &Parameter{&ParameterData{Name: name, Description: description, Required: false, DataType: "string"}} - p.beHeader() - return p -} - -// FormParameter creates a new Parameter of kind Form (using application/x-www-form-urlencoded) for documentation purposes. -// It is initialized as required with string as its DataType. -func (w *WebService) FormParameter(name, description string) *Parameter { - return FormParameter(name, description) -} - -// FormParameter creates a new Parameter of kind Form (using application/x-www-form-urlencoded) for documentation purposes. -// It is initialized as required with string as its DataType. -func FormParameter(name, description string) *Parameter { - p := &Parameter{&ParameterData{Name: name, Description: description, Required: false, DataType: "string"}} - p.beForm() - return p -} - -// Route creates a new Route using the RouteBuilder and add to the ordered list of Routes. -func (w *WebService) Route(builder *RouteBuilder) *WebService { - w.routesLock.Lock() - defer w.routesLock.Unlock() - builder.copyDefaults(w.produces, w.consumes) - w.routes = append(w.routes, builder.Build()) - return w -} - -// RemoveRoute removes the specified route, looks for something that matches 'path' and 'method' -func (w *WebService) RemoveRoute(path, method string) error { - if !w.dynamicRoutes { - return errors.New("dynamic routes are not enabled.") - } - w.routesLock.Lock() - defer w.routesLock.Unlock() - newRoutes := []Route{} - for _, route := range w.routes { - if route.Method == method && route.Path == path { - continue - } - newRoutes = append(newRoutes, route) - } - w.routes = newRoutes - return nil -} - -// Method creates a new RouteBuilder and initialize its http method -func (w *WebService) Method(httpMethod string) *RouteBuilder { - return new(RouteBuilder).typeNameHandler(w.typeNameHandleFunc).servicePath(w.rootPath).Method(httpMethod) -} - -// Produces specifies that this WebService can produce one or more MIME types. -// Http requests must have one of these values set for the Accept header. -func (w *WebService) Produces(contentTypes ...string) *WebService { - w.produces = contentTypes - return w -} - -// Consumes specifies that this WebService can consume one or more MIME types. -// Http requests must have one of these values set for the Content-Type header. -func (w *WebService) Consumes(accepts ...string) *WebService { - w.consumes = accepts - return w -} - -// Routes returns the Routes associated with this WebService -func (w *WebService) Routes() []Route { - if !w.dynamicRoutes { - return w.routes - } - // Make a copy of the array to prevent concurrency problems - w.routesLock.RLock() - defer w.routesLock.RUnlock() - result := make([]Route, len(w.routes)) - for ix := range w.routes { - result[ix] = w.routes[ix] - } - return result -} - -// RootPath returns the RootPath associated with this WebService. Default "/" -func (w *WebService) RootPath() string { - return w.rootPath -} - -// PathParameters return the path parameter names for (shared among its Routes) -func (w *WebService) PathParameters() []*Parameter { - return w.pathParameters -} - -// Filter adds a filter function to the chain of filters applicable to all its Routes -func (w *WebService) Filter(filter FilterFunction) *WebService { - w.filters = append(w.filters, filter) - return w -} - -// Doc is used to set the documentation of this service. -func (w *WebService) Doc(plainText string) *WebService { - w.documentation = plainText - return w -} - -// Documentation returns it. -func (w *WebService) Documentation() string { - return w.documentation -} - -/* - Convenience methods -*/ - -// HEAD is a shortcut for .Method("HEAD").Path(subPath) -func (w *WebService) HEAD(subPath string) *RouteBuilder { - return new(RouteBuilder).typeNameHandler(w.typeNameHandleFunc).servicePath(w.rootPath).Method("HEAD").Path(subPath) -} - -// GET is a shortcut for .Method("GET").Path(subPath) -func (w *WebService) GET(subPath string) *RouteBuilder { - return new(RouteBuilder).typeNameHandler(w.typeNameHandleFunc).servicePath(w.rootPath).Method("GET").Path(subPath) -} - -// POST is a shortcut for .Method("POST").Path(subPath) -func (w *WebService) POST(subPath string) *RouteBuilder { - return new(RouteBuilder).typeNameHandler(w.typeNameHandleFunc).servicePath(w.rootPath).Method("POST").Path(subPath) -} - -// PUT is a shortcut for .Method("PUT").Path(subPath) -func (w *WebService) PUT(subPath string) *RouteBuilder { - return new(RouteBuilder).typeNameHandler(w.typeNameHandleFunc).servicePath(w.rootPath).Method("PUT").Path(subPath) -} - -// PATCH is a shortcut for .Method("PATCH").Path(subPath) -func (w *WebService) PATCH(subPath string) *RouteBuilder { - return new(RouteBuilder).typeNameHandler(w.typeNameHandleFunc).servicePath(w.rootPath).Method("PATCH").Path(subPath) -} - -// DELETE is a shortcut for .Method("DELETE").Path(subPath) -func (w *WebService) DELETE(subPath string) *RouteBuilder { - return new(RouteBuilder).typeNameHandler(w.typeNameHandleFunc).servicePath(w.rootPath).Method("DELETE").Path(subPath) -} - -// OPTIONS is a shortcut for .Method("OPTIONS").Path(subPath) -func (w *WebService) OPTIONS(subPath string) *RouteBuilder { - return new(RouteBuilder).typeNameHandler(w.typeNameHandleFunc).servicePath(w.rootPath).Method("OPTIONS").Path(subPath) -} diff --git a/vendor/github.com/emicklei/go-restful/v3/web_service_container.go b/vendor/github.com/emicklei/go-restful/v3/web_service_container.go deleted file mode 100644 index c9d31b06c..000000000 --- a/vendor/github.com/emicklei/go-restful/v3/web_service_container.go +++ /dev/null @@ -1,39 +0,0 @@ -package restful - -// Copyright 2013 Ernest Micklei. All rights reserved. -// Use of this source code is governed by a license -// that can be found in the LICENSE file. - -import ( - "net/http" -) - -// DefaultContainer is a restful.Container that uses http.DefaultServeMux -var DefaultContainer *Container - -func init() { - DefaultContainer = NewContainer() - DefaultContainer.ServeMux = http.DefaultServeMux -} - -// If set the true then panics will not be caught to return HTTP 500. -// In that case, Route functions are responsible for handling any error situation. -// Default value is false = recover from panics. This has performance implications. -// OBSOLETE ; use restful.DefaultContainer.DoNotRecover(true) -var DoNotRecover = false - -// Add registers a new WebService add it to the DefaultContainer. -func Add(service *WebService) { - DefaultContainer.Add(service) -} - -// Filter appends a container FilterFunction from the DefaultContainer. -// These are called before dispatching a http.Request to a WebService. -func Filter(filter FilterFunction) { - DefaultContainer.Filter(filter) -} - -// RegisteredWebServices returns the collections of WebServices from the DefaultContainer -func RegisteredWebServices() []*WebService { - return DefaultContainer.RegisteredWebServices() -} diff --git a/vendor/github.com/go-logr/logr/.golangci.yaml b/vendor/github.com/go-logr/logr/.golangci.yaml deleted file mode 100644 index 94ff801df..000000000 --- a/vendor/github.com/go-logr/logr/.golangci.yaml +++ /dev/null @@ -1,29 +0,0 @@ -run: - timeout: 1m - tests: true - -linters: - disable-all: true - enable: - - asciicheck - - deadcode - - errcheck - - forcetypeassert - - gocritic - - gofmt - - goimports - - gosimple - - govet - - ineffassign - - misspell - - revive - - staticcheck - - structcheck - - typecheck - - unused - - varcheck - -issues: - exclude-use-default: false - max-issues-per-linter: 0 - max-same-issues: 10 diff --git a/vendor/github.com/go-logr/logr/CHANGELOG.md b/vendor/github.com/go-logr/logr/CHANGELOG.md deleted file mode 100644 index c35696004..000000000 --- a/vendor/github.com/go-logr/logr/CHANGELOG.md +++ /dev/null @@ -1,6 +0,0 @@ -# CHANGELOG - -## v1.0.0-rc1 - -This is the first logged release. Major changes (including breaking changes) -have occurred since earlier tags. diff --git a/vendor/github.com/go-logr/logr/CONTRIBUTING.md b/vendor/github.com/go-logr/logr/CONTRIBUTING.md deleted file mode 100644 index 5d37e294c..000000000 --- a/vendor/github.com/go-logr/logr/CONTRIBUTING.md +++ /dev/null @@ -1,17 +0,0 @@ -# Contributing - -Logr is open to pull-requests, provided they fit within the intended scope of -the project. Specifically, this library aims to be VERY small and minimalist, -with no external dependencies. - -## Compatibility - -This project intends to follow [semantic versioning](http://semver.org) and -is very strict about compatibility. Any proposed changes MUST follow those -rules. - -## Performance - -As a logging library, logr must be as light-weight as possible. Any proposed -code change must include results of running the [benchmark](./benchmark) -before and after the change. diff --git a/vendor/github.com/go-logr/logr/LICENSE b/vendor/github.com/go-logr/logr/LICENSE deleted file mode 100644 index 8dada3eda..000000000 --- a/vendor/github.com/go-logr/logr/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/github.com/go-logr/logr/README.md b/vendor/github.com/go-logr/logr/README.md deleted file mode 100644 index ab5931181..000000000 --- a/vendor/github.com/go-logr/logr/README.md +++ /dev/null @@ -1,282 +0,0 @@ -# A minimal logging API for Go - -[![Go Reference](https://pkg.go.dev/badge/github.com/go-logr/logr.svg)](https://pkg.go.dev/github.com/go-logr/logr) - -logr offers an(other) opinion on how Go programs and libraries can do logging -without becoming coupled to a particular logging implementation. This is not -an implementation of logging - it is an API. In fact it is two APIs with two -different sets of users. - -The `Logger` type is intended for application and library authors. It provides -a relatively small API which can be used everywhere you want to emit logs. It -defers the actual act of writing logs (to files, to stdout, or whatever) to the -`LogSink` interface. - -The `LogSink` interface is intended for logging library implementers. It is a -pure interface which can be implemented by logging frameworks to provide the actual logging -functionality. - -This decoupling allows application and library developers to write code in -terms of `logr.Logger` (which has very low dependency fan-out) while the -implementation of logging is managed "up stack" (e.g. in or near `main()`.) -Application developers can then switch out implementations as necessary. - -Many people assert that libraries should not be logging, and as such efforts -like this are pointless. Those people are welcome to convince the authors of -the tens-of-thousands of libraries that *DO* write logs that they are all -wrong. In the meantime, logr takes a more practical approach. - -## Typical usage - -Somewhere, early in an application's life, it will make a decision about which -logging library (implementation) it actually wants to use. Something like: - -``` - func main() { - // ... other setup code ... - - // Create the "root" logger. We have chosen the "logimpl" implementation, - // which takes some initial parameters and returns a logr.Logger. - logger := logimpl.New(param1, param2) - - // ... other setup code ... -``` - -Most apps will call into other libraries, create structures to govern the flow, -etc. The `logr.Logger` object can be passed to these other libraries, stored -in structs, or even used as a package-global variable, if needed. For example: - -``` - app := createTheAppObject(logger) - app.Run() -``` - -Outside of this early setup, no other packages need to know about the choice of -implementation. They write logs in terms of the `logr.Logger` that they -received: - -``` - type appObject struct { - // ... other fields ... - logger logr.Logger - // ... other fields ... - } - - func (app *appObject) Run() { - app.logger.Info("starting up", "timestamp", time.Now()) - - // ... app code ... -``` - -## Background - -If the Go standard library had defined an interface for logging, this project -probably would not be needed. Alas, here we are. - -### Inspiration - -Before you consider this package, please read [this blog post by the -inimitable Dave Cheney][warning-makes-no-sense]. We really appreciate what -he has to say, and it largely aligns with our own experiences. - -### Differences from Dave's ideas - -The main differences are: - -1. Dave basically proposes doing away with the notion of a logging API in favor -of `fmt.Printf()`. We disagree, especially when you consider things like output -locations, timestamps, file and line decorations, and structured logging. This -package restricts the logging API to just 2 types of logs: info and error. - -Info logs are things you want to tell the user which are not errors. Error -logs are, well, errors. If your code receives an `error` from a subordinate -function call and is logging that `error` *and not returning it*, use error -logs. - -2. Verbosity-levels on info logs. This gives developers a chance to indicate -arbitrary grades of importance for info logs, without assigning names with -semantic meaning such as "warning", "trace", and "debug." Superficially this -may feel very similar, but the primary difference is the lack of semantics. -Because verbosity is a numerical value, it's safe to assume that an app running -with higher verbosity means more (and less important) logs will be generated. - -## Implementations (non-exhaustive) - -There are implementations for the following logging libraries: - -- **a function** (can bridge to non-structured libraries): [funcr](https://github.com/go-logr/logr/tree/master/funcr) -- **a testing.T** (for use in Go tests, with JSON-like output): [testr](https://github.com/go-logr/logr/tree/master/testr) -- **github.com/google/glog**: [glogr](https://github.com/go-logr/glogr) -- **k8s.io/klog** (for Kubernetes): [klogr](https://git.k8s.io/klog/klogr) -- **a testing.T** (with klog-like text output): [ktesting](https://git.k8s.io/klog/ktesting) -- **go.uber.org/zap**: [zapr](https://github.com/go-logr/zapr) -- **log** (the Go standard library logger): [stdr](https://github.com/go-logr/stdr) -- **github.com/sirupsen/logrus**: [logrusr](https://github.com/bombsimon/logrusr) -- **github.com/wojas/genericr**: [genericr](https://github.com/wojas/genericr) (makes it easy to implement your own backend) -- **logfmt** (Heroku style [logging](https://www.brandur.org/logfmt)): [logfmtr](https://github.com/iand/logfmtr) -- **github.com/rs/zerolog**: [zerologr](https://github.com/go-logr/zerologr) -- **github.com/go-kit/log**: [gokitlogr](https://github.com/tonglil/gokitlogr) (also compatible with github.com/go-kit/kit/log since v0.12.0) -- **bytes.Buffer** (writing to a buffer): [bufrlogr](https://github.com/tonglil/buflogr) (useful for ensuring values were logged, like during testing) - -## FAQ - -### Conceptual - -#### Why structured logging? - -- **Structured logs are more easily queryable**: Since you've got - key-value pairs, it's much easier to query your structured logs for - particular values by filtering on the contents of a particular key -- - think searching request logs for error codes, Kubernetes reconcilers for - the name and namespace of the reconciled object, etc. - -- **Structured logging makes it easier to have cross-referenceable logs**: - Similarly to searchability, if you maintain conventions around your - keys, it becomes easy to gather all log lines related to a particular - concept. - -- **Structured logs allow better dimensions of filtering**: if you have - structure to your logs, you've got more precise control over how much - information is logged -- you might choose in a particular configuration - to log certain keys but not others, only log lines where a certain key - matches a certain value, etc., instead of just having v-levels and names - to key off of. - -- **Structured logs better represent structured data**: sometimes, the - data that you want to log is inherently structured (think tuple-link - objects.) Structured logs allow you to preserve that structure when - outputting. - -#### Why V-levels? - -**V-levels give operators an easy way to control the chattiness of log -operations**. V-levels provide a way for a given package to distinguish -the relative importance or verbosity of a given log message. Then, if -a particular logger or package is logging too many messages, the user -of the package can simply change the v-levels for that library. - -#### Why not named levels, like Info/Warning/Error? - -Read [Dave Cheney's post][warning-makes-no-sense]. Then read [Differences -from Dave's ideas](#differences-from-daves-ideas). - -#### Why not allow format strings, too? - -**Format strings negate many of the benefits of structured logs**: - -- They're not easily searchable without resorting to fuzzy searching, - regular expressions, etc. - -- They don't store structured data well, since contents are flattened into - a string. - -- They're not cross-referenceable. - -- They don't compress easily, since the message is not constant. - -(Unless you turn positional parameters into key-value pairs with numerical -keys, at which point you've gotten key-value logging with meaningless -keys.) - -### Practical - -#### Why key-value pairs, and not a map? - -Key-value pairs are *much* easier to optimize, especially around -allocations. Zap (a structured logger that inspired logr's interface) has -[performance measurements](https://github.com/uber-go/zap#performance) -that show this quite nicely. - -While the interface ends up being a little less obvious, you get -potentially better performance, plus avoid making users type -`map[string]string{}` every time they want to log. - -#### What if my V-levels differ between libraries? - -That's fine. Control your V-levels on a per-logger basis, and use the -`WithName` method to pass different loggers to different libraries. - -Generally, you should take care to ensure that you have relatively -consistent V-levels within a given logger, however, as this makes deciding -on what verbosity of logs to request easier. - -#### But I really want to use a format string! - -That's not actually a question. Assuming your question is "how do -I convert my mental model of logging with format strings to logging with -constant messages": - -1. Figure out what the error actually is, as you'd write in a TL;DR style, - and use that as a message. - -2. For every place you'd write a format specifier, look to the word before - it, and add that as a key value pair. - -For instance, consider the following examples (all taken from spots in the -Kubernetes codebase): - -- `klog.V(4).Infof("Client is returning errors: code %v, error %v", - responseCode, err)` becomes `logger.Error(err, "client returned an - error", "code", responseCode)` - -- `klog.V(4).Infof("Got a Retry-After %ds response for attempt %d to %v", - seconds, retries, url)` becomes `logger.V(4).Info("got a retry-after - response when requesting url", "attempt", retries, "after - seconds", seconds, "url", url)` - -If you *really* must use a format string, use it in a key's value, and -call `fmt.Sprintf` yourself. For instance: `log.Printf("unable to -reflect over type %T")` becomes `logger.Info("unable to reflect over -type", "type", fmt.Sprintf("%T"))`. In general though, the cases where -this is necessary should be few and far between. - -#### How do I choose my V-levels? - -This is basically the only hard constraint: increase V-levels to denote -more verbose or more debug-y logs. - -Otherwise, you can start out with `0` as "you always want to see this", -`1` as "common logging that you might *possibly* want to turn off", and -`10` as "I would like to performance-test your log collection stack." - -Then gradually choose levels in between as you need them, working your way -down from 10 (for debug and trace style logs) and up from 1 (for chattier -info-type logs.) - -#### How do I choose my keys? - -Keys are fairly flexible, and can hold more or less any string -value. For best compatibility with implementations and consistency -with existing code in other projects, there are a few conventions you -should consider. - -- Make your keys human-readable. -- Constant keys are generally a good idea. -- Be consistent across your codebase. -- Keys should naturally match parts of the message string. -- Use lower case for simple keys and - [lowerCamelCase](https://en.wiktionary.org/wiki/lowerCamelCase) for - more complex ones. Kubernetes is one example of a project that has - [adopted that - convention](https://github.com/kubernetes/community/blob/HEAD/contributors/devel/sig-instrumentation/migration-to-structured-logging.md#name-arguments). - -While key names are mostly unrestricted (and spaces are acceptable), -it's generally a good idea to stick to printable ascii characters, or at -least match the general character set of your log lines. - -#### Why should keys be constant values? - -The point of structured logging is to make later log processing easier. Your -keys are, effectively, the schema of each log message. If you use different -keys across instances of the same log line, you will make your structured logs -much harder to use. `Sprintf()` is for values, not for keys! - -#### Why is this not a pure interface? - -The Logger type is implemented as a struct in order to allow the Go compiler to -optimize things like high-V `Info` logs that are not triggered. Not all of -these implementations are implemented yet, but this structure was suggested as -a way to ensure they *can* be implemented. All of the real work is behind the -`LogSink` interface. - -[warning-makes-no-sense]: http://dave.cheney.net/2015/11/05/lets-talk-about-logging diff --git a/vendor/github.com/go-logr/logr/discard.go b/vendor/github.com/go-logr/logr/discard.go deleted file mode 100644 index 9d92a38f1..000000000 --- a/vendor/github.com/go-logr/logr/discard.go +++ /dev/null @@ -1,54 +0,0 @@ -/* -Copyright 2020 The logr Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package logr - -// Discard returns a Logger that discards all messages logged to it. It can be -// used whenever the caller is not interested in the logs. Logger instances -// produced by this function always compare as equal. -func Discard() Logger { - return Logger{ - level: 0, - sink: discardLogSink{}, - } -} - -// discardLogSink is a LogSink that discards all messages. -type discardLogSink struct{} - -// Verify that it actually implements the interface -var _ LogSink = discardLogSink{} - -func (l discardLogSink) Init(RuntimeInfo) { -} - -func (l discardLogSink) Enabled(int) bool { - return false -} - -func (l discardLogSink) Info(int, string, ...interface{}) { -} - -func (l discardLogSink) Error(error, string, ...interface{}) { -} - -func (l discardLogSink) WithValues(...interface{}) LogSink { - return l -} - -func (l discardLogSink) WithName(string) LogSink { - return l -} diff --git a/vendor/github.com/go-logr/logr/logr.go b/vendor/github.com/go-logr/logr/logr.go deleted file mode 100644 index c3b56b3d2..000000000 --- a/vendor/github.com/go-logr/logr/logr.go +++ /dev/null @@ -1,510 +0,0 @@ -/* -Copyright 2019 The logr Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// This design derives from Dave Cheney's blog: -// http://dave.cheney.net/2015/11/05/lets-talk-about-logging - -// Package logr defines a general-purpose logging API and abstract interfaces -// to back that API. Packages in the Go ecosystem can depend on this package, -// while callers can implement logging with whatever backend is appropriate. -// -// Usage -// -// Logging is done using a Logger instance. Logger is a concrete type with -// methods, which defers the actual logging to a LogSink interface. The main -// methods of Logger are Info() and Error(). Arguments to Info() and Error() -// are key/value pairs rather than printf-style formatted strings, emphasizing -// "structured logging". -// -// With Go's standard log package, we might write: -// log.Printf("setting target value %s", targetValue) -// -// With logr's structured logging, we'd write: -// logger.Info("setting target", "value", targetValue) -// -// Errors are much the same. Instead of: -// log.Printf("failed to open the pod bay door for user %s: %v", user, err) -// -// We'd write: -// logger.Error(err, "failed to open the pod bay door", "user", user) -// -// Info() and Error() are very similar, but they are separate methods so that -// LogSink implementations can choose to do things like attach additional -// information (such as stack traces) on calls to Error(). Error() messages are -// always logged, regardless of the current verbosity. If there is no error -// instance available, passing nil is valid. -// -// Verbosity -// -// Often we want to log information only when the application in "verbose -// mode". To write log lines that are more verbose, Logger has a V() method. -// The higher the V-level of a log line, the less critical it is considered. -// Log-lines with V-levels that are not enabled (as per the LogSink) will not -// be written. Level V(0) is the default, and logger.V(0).Info() has the same -// meaning as logger.Info(). Negative V-levels have the same meaning as V(0). -// Error messages do not have a verbosity level and are always logged. -// -// Where we might have written: -// if flVerbose >= 2 { -// log.Printf("an unusual thing happened") -// } -// -// We can write: -// logger.V(2).Info("an unusual thing happened") -// -// Logger Names -// -// Logger instances can have name strings so that all messages logged through -// that instance have additional context. For example, you might want to add -// a subsystem name: -// -// logger.WithName("compactor").Info("started", "time", time.Now()) -// -// The WithName() method returns a new Logger, which can be passed to -// constructors or other functions for further use. Repeated use of WithName() -// will accumulate name "segments". These name segments will be joined in some -// way by the LogSink implementation. It is strongly recommended that name -// segments contain simple identifiers (letters, digits, and hyphen), and do -// not contain characters that could muddle the log output or confuse the -// joining operation (e.g. whitespace, commas, periods, slashes, brackets, -// quotes, etc). -// -// Saved Values -// -// Logger instances can store any number of key/value pairs, which will be -// logged alongside all messages logged through that instance. For example, -// you might want to create a Logger instance per managed object: -// -// With the standard log package, we might write: -// log.Printf("decided to set field foo to value %q for object %s/%s", -// targetValue, object.Namespace, object.Name) -// -// With logr we'd write: -// // Elsewhere: set up the logger to log the object name. -// obj.logger = mainLogger.WithValues( -// "name", obj.name, "namespace", obj.namespace) -// -// // later on... -// obj.logger.Info("setting foo", "value", targetValue) -// -// Best Practices -// -// Logger has very few hard rules, with the goal that LogSink implementations -// might have a lot of freedom to differentiate. There are, however, some -// things to consider. -// -// The log message consists of a constant message attached to the log line. -// This should generally be a simple description of what's occurring, and should -// never be a format string. Variable information can then be attached using -// named values. -// -// Keys are arbitrary strings, but should generally be constant values. Values -// may be any Go value, but how the value is formatted is determined by the -// LogSink implementation. -// -// Logger instances are meant to be passed around by value. Code that receives -// such a value can call its methods without having to check whether the -// instance is ready for use. -// -// Calling methods with the null logger (Logger{}) as instance will crash -// because it has no LogSink. Therefore this null logger should never be passed -// around. For cases where passing a logger is optional, a pointer to Logger -// should be used. -// -// Key Naming Conventions -// -// Keys are not strictly required to conform to any specification or regex, but -// it is recommended that they: -// * be human-readable and meaningful (not auto-generated or simple ordinals) -// * be constant (not dependent on input data) -// * contain only printable characters -// * not contain whitespace or punctuation -// * use lower case for simple keys and lowerCamelCase for more complex ones -// -// These guidelines help ensure that log data is processed properly regardless -// of the log implementation. For example, log implementations will try to -// output JSON data or will store data for later database (e.g. SQL) queries. -// -// While users are generally free to use key names of their choice, it's -// generally best to avoid using the following keys, as they're frequently used -// by implementations: -// * "caller": the calling information (file/line) of a particular log line -// * "error": the underlying error value in the `Error` method -// * "level": the log level -// * "logger": the name of the associated logger -// * "msg": the log message -// * "stacktrace": the stack trace associated with a particular log line or -// error (often from the `Error` message) -// * "ts": the timestamp for a log line -// -// Implementations are encouraged to make use of these keys to represent the -// above concepts, when necessary (for example, in a pure-JSON output form, it -// would be necessary to represent at least message and timestamp as ordinary -// named values). -// -// Break Glass -// -// Implementations may choose to give callers access to the underlying -// logging implementation. The recommended pattern for this is: -// // Underlier exposes access to the underlying logging implementation. -// // Since callers only have a logr.Logger, they have to know which -// // implementation is in use, so this interface is less of an abstraction -// // and more of way to test type conversion. -// type Underlier interface { -// GetUnderlying() -// } -// -// Logger grants access to the sink to enable type assertions like this: -// func DoSomethingWithImpl(log logr.Logger) { -// if underlier, ok := log.GetSink()(impl.Underlier) { -// implLogger := underlier.GetUnderlying() -// ... -// } -// } -// -// Custom `With*` functions can be implemented by copying the complete -// Logger struct and replacing the sink in the copy: -// // WithFooBar changes the foobar parameter in the log sink and returns a -// // new logger with that modified sink. It does nothing for loggers where -// // the sink doesn't support that parameter. -// func WithFoobar(log logr.Logger, foobar int) logr.Logger { -// if foobarLogSink, ok := log.GetSink()(FoobarSink); ok { -// log = log.WithSink(foobarLogSink.WithFooBar(foobar)) -// } -// return log -// } -// -// Don't use New to construct a new Logger with a LogSink retrieved from an -// existing Logger. Source code attribution might not work correctly and -// unexported fields in Logger get lost. -// -// Beware that the same LogSink instance may be shared by different logger -// instances. Calling functions that modify the LogSink will affect all of -// those. -package logr - -import ( - "context" -) - -// New returns a new Logger instance. This is primarily used by libraries -// implementing LogSink, rather than end users. -func New(sink LogSink) Logger { - logger := Logger{} - logger.setSink(sink) - sink.Init(runtimeInfo) - return logger -} - -// setSink stores the sink and updates any related fields. It mutates the -// logger and thus is only safe to use for loggers that are not currently being -// used concurrently. -func (l *Logger) setSink(sink LogSink) { - l.sink = sink -} - -// GetSink returns the stored sink. -func (l Logger) GetSink() LogSink { - return l.sink -} - -// WithSink returns a copy of the logger with the new sink. -func (l Logger) WithSink(sink LogSink) Logger { - l.setSink(sink) - return l -} - -// Logger is an interface to an abstract logging implementation. This is a -// concrete type for performance reasons, but all the real work is passed on to -// a LogSink. Implementations of LogSink should provide their own constructors -// that return Logger, not LogSink. -// -// The underlying sink can be accessed through GetSink and be modified through -// WithSink. This enables the implementation of custom extensions (see "Break -// Glass" in the package documentation). Normally the sink should be used only -// indirectly. -type Logger struct { - sink LogSink - level int -} - -// Enabled tests whether this Logger is enabled. For example, commandline -// flags might be used to set the logging verbosity and disable some info logs. -func (l Logger) Enabled() bool { - return l.sink.Enabled(l.level) -} - -// Info logs a non-error message with the given key/value pairs as context. -// -// The msg argument should be used to add some constant description to the log -// line. The key/value pairs can then be used to add additional variable -// information. The key/value pairs must alternate string keys and arbitrary -// values. -func (l Logger) Info(msg string, keysAndValues ...interface{}) { - if l.Enabled() { - if withHelper, ok := l.sink.(CallStackHelperLogSink); ok { - withHelper.GetCallStackHelper()() - } - l.sink.Info(l.level, msg, keysAndValues...) - } -} - -// Error logs an error, with the given message and key/value pairs as context. -// It functions similarly to Info, but may have unique behavior, and should be -// preferred for logging errors (see the package documentations for more -// information). The log message will always be emitted, regardless of -// verbosity level. -// -// The msg argument should be used to add context to any underlying error, -// while the err argument should be used to attach the actual error that -// triggered this log line, if present. The err parameter is optional -// and nil may be passed instead of an error instance. -func (l Logger) Error(err error, msg string, keysAndValues ...interface{}) { - if withHelper, ok := l.sink.(CallStackHelperLogSink); ok { - withHelper.GetCallStackHelper()() - } - l.sink.Error(err, msg, keysAndValues...) -} - -// V returns a new Logger instance for a specific verbosity level, relative to -// this Logger. In other words, V-levels are additive. A higher verbosity -// level means a log message is less important. Negative V-levels are treated -// as 0. -func (l Logger) V(level int) Logger { - if level < 0 { - level = 0 - } - l.level += level - return l -} - -// WithValues returns a new Logger instance with additional key/value pairs. -// See Info for documentation on how key/value pairs work. -func (l Logger) WithValues(keysAndValues ...interface{}) Logger { - l.setSink(l.sink.WithValues(keysAndValues...)) - return l -} - -// WithName returns a new Logger instance with the specified name element added -// to the Logger's name. Successive calls with WithName append additional -// suffixes to the Logger's name. It's strongly recommended that name segments -// contain only letters, digits, and hyphens (see the package documentation for -// more information). -func (l Logger) WithName(name string) Logger { - l.setSink(l.sink.WithName(name)) - return l -} - -// WithCallDepth returns a Logger instance that offsets the call stack by the -// specified number of frames when logging call site information, if possible. -// This is useful for users who have helper functions between the "real" call -// site and the actual calls to Logger methods. If depth is 0 the attribution -// should be to the direct caller of this function. If depth is 1 the -// attribution should skip 1 call frame, and so on. Successive calls to this -// are additive. -// -// If the underlying log implementation supports a WithCallDepth(int) method, -// it will be called and the result returned. If the implementation does not -// support CallDepthLogSink, the original Logger will be returned. -// -// To skip one level, WithCallStackHelper() should be used instead of -// WithCallDepth(1) because it works with implementions that support the -// CallDepthLogSink and/or CallStackHelperLogSink interfaces. -func (l Logger) WithCallDepth(depth int) Logger { - if withCallDepth, ok := l.sink.(CallDepthLogSink); ok { - l.setSink(withCallDepth.WithCallDepth(depth)) - } - return l -} - -// WithCallStackHelper returns a new Logger instance that skips the direct -// caller when logging call site information, if possible. This is useful for -// users who have helper functions between the "real" call site and the actual -// calls to Logger methods and want to support loggers which depend on marking -// each individual helper function, like loggers based on testing.T. -// -// In addition to using that new logger instance, callers also must call the -// returned function. -// -// If the underlying log implementation supports a WithCallDepth(int) method, -// WithCallDepth(1) will be called to produce a new logger. If it supports a -// WithCallStackHelper() method, that will be also called. If the -// implementation does not support either of these, the original Logger will be -// returned. -func (l Logger) WithCallStackHelper() (func(), Logger) { - var helper func() - if withCallDepth, ok := l.sink.(CallDepthLogSink); ok { - l.setSink(withCallDepth.WithCallDepth(1)) - } - if withHelper, ok := l.sink.(CallStackHelperLogSink); ok { - helper = withHelper.GetCallStackHelper() - } else { - helper = func() {} - } - return helper, l -} - -// contextKey is how we find Loggers in a context.Context. -type contextKey struct{} - -// FromContext returns a Logger from ctx or an error if no Logger is found. -func FromContext(ctx context.Context) (Logger, error) { - if v, ok := ctx.Value(contextKey{}).(Logger); ok { - return v, nil - } - - return Logger{}, notFoundError{} -} - -// notFoundError exists to carry an IsNotFound method. -type notFoundError struct{} - -func (notFoundError) Error() string { - return "no logr.Logger was present" -} - -func (notFoundError) IsNotFound() bool { - return true -} - -// FromContextOrDiscard returns a Logger from ctx. If no Logger is found, this -// returns a Logger that discards all log messages. -func FromContextOrDiscard(ctx context.Context) Logger { - if v, ok := ctx.Value(contextKey{}).(Logger); ok { - return v - } - - return Discard() -} - -// NewContext returns a new Context, derived from ctx, which carries the -// provided Logger. -func NewContext(ctx context.Context, logger Logger) context.Context { - return context.WithValue(ctx, contextKey{}, logger) -} - -// RuntimeInfo holds information that the logr "core" library knows which -// LogSinks might want to know. -type RuntimeInfo struct { - // CallDepth is the number of call frames the logr library adds between the - // end-user and the LogSink. LogSink implementations which choose to print - // the original logging site (e.g. file & line) should climb this many - // additional frames to find it. - CallDepth int -} - -// runtimeInfo is a static global. It must not be changed at run time. -var runtimeInfo = RuntimeInfo{ - CallDepth: 1, -} - -// LogSink represents a logging implementation. End-users will generally not -// interact with this type. -type LogSink interface { - // Init receives optional information about the logr library for LogSink - // implementations that need it. - Init(info RuntimeInfo) - - // Enabled tests whether this LogSink is enabled at the specified V-level. - // For example, commandline flags might be used to set the logging - // verbosity and disable some info logs. - Enabled(level int) bool - - // Info logs a non-error message with the given key/value pairs as context. - // The level argument is provided for optional logging. This method will - // only be called when Enabled(level) is true. See Logger.Info for more - // details. - Info(level int, msg string, keysAndValues ...interface{}) - - // Error logs an error, with the given message and key/value pairs as - // context. See Logger.Error for more details. - Error(err error, msg string, keysAndValues ...interface{}) - - // WithValues returns a new LogSink with additional key/value pairs. See - // Logger.WithValues for more details. - WithValues(keysAndValues ...interface{}) LogSink - - // WithName returns a new LogSink with the specified name appended. See - // Logger.WithName for more details. - WithName(name string) LogSink -} - -// CallDepthLogSink represents a Logger that knows how to climb the call stack -// to identify the original call site and can offset the depth by a specified -// number of frames. This is useful for users who have helper functions -// between the "real" call site and the actual calls to Logger methods. -// Implementations that log information about the call site (such as file, -// function, or line) would otherwise log information about the intermediate -// helper functions. -// -// This is an optional interface and implementations are not required to -// support it. -type CallDepthLogSink interface { - // WithCallDepth returns a LogSink that will offset the call - // stack by the specified number of frames when logging call - // site information. - // - // If depth is 0, the LogSink should skip exactly the number - // of call frames defined in RuntimeInfo.CallDepth when Info - // or Error are called, i.e. the attribution should be to the - // direct caller of Logger.Info or Logger.Error. - // - // If depth is 1 the attribution should skip 1 call frame, and so on. - // Successive calls to this are additive. - WithCallDepth(depth int) LogSink -} - -// CallStackHelperLogSink represents a Logger that knows how to climb -// the call stack to identify the original call site and can skip -// intermediate helper functions if they mark themselves as -// helper. Go's testing package uses that approach. -// -// This is useful for users who have helper functions between the -// "real" call site and the actual calls to Logger methods. -// Implementations that log information about the call site (such as -// file, function, or line) would otherwise log information about the -// intermediate helper functions. -// -// This is an optional interface and implementations are not required -// to support it. Implementations that choose to support this must not -// simply implement it as WithCallDepth(1), because -// Logger.WithCallStackHelper will call both methods if they are -// present. This should only be implemented for LogSinks that actually -// need it, as with testing.T. -type CallStackHelperLogSink interface { - // GetCallStackHelper returns a function that must be called - // to mark the direct caller as helper function when logging - // call site information. - GetCallStackHelper() func() -} - -// Marshaler is an optional interface that logged values may choose to -// implement. Loggers with structured output, such as JSON, should -// log the object return by the MarshalLog method instead of the -// original value. -type Marshaler interface { - // MarshalLog can be used to: - // - ensure that structs are not logged as strings when the original - // value has a String method: return a different type without a - // String method - // - select which fields of a complex type should get logged: - // return a simpler struct with fewer fields - // - log unexported fields: return a different struct - // with exported fields - // - // It may return any value of any type. - MarshalLog() interface{} -} diff --git a/vendor/github.com/go-openapi/jsonpointer/.editorconfig b/vendor/github.com/go-openapi/jsonpointer/.editorconfig deleted file mode 100644 index 3152da69a..000000000 --- a/vendor/github.com/go-openapi/jsonpointer/.editorconfig +++ /dev/null @@ -1,26 +0,0 @@ -# top-most EditorConfig file -root = true - -# Unix-style newlines with a newline ending every file -[*] -end_of_line = lf -insert_final_newline = true -indent_style = space -indent_size = 2 -trim_trailing_whitespace = true - -# Set default charset -[*.{js,py,go,scala,rb,java,html,css,less,sass,md}] -charset = utf-8 - -# Tab indentation (no size specified) -[*.go] -indent_style = tab - -[*.md] -trim_trailing_whitespace = false - -# Matches the exact files either package.json or .travis.yml -[{package.json,.travis.yml}] -indent_style = space -indent_size = 2 diff --git a/vendor/github.com/go-openapi/jsonpointer/.gitignore b/vendor/github.com/go-openapi/jsonpointer/.gitignore deleted file mode 100644 index 769c24400..000000000 --- a/vendor/github.com/go-openapi/jsonpointer/.gitignore +++ /dev/null @@ -1 +0,0 @@ -secrets.yml diff --git a/vendor/github.com/go-openapi/jsonpointer/.travis.yml b/vendor/github.com/go-openapi/jsonpointer/.travis.yml deleted file mode 100644 index 03a22fe06..000000000 --- a/vendor/github.com/go-openapi/jsonpointer/.travis.yml +++ /dev/null @@ -1,15 +0,0 @@ -after_success: -- bash <(curl -s https://codecov.io/bash) -go: -- 1.14.x -- 1.15.x -install: -- GO111MODULE=off go get -u gotest.tools/gotestsum -env: -- GO111MODULE=on -language: go -notifications: - slack: - secure: a5VgoiwB1G/AZqzmephPZIhEB9avMlsWSlVnM1dSAtYAwdrQHGTQxAmpOxYIoSPDhWNN5bfZmjd29++UlTwLcHSR+e0kJhH6IfDlsHj/HplNCJ9tyI0zYc7XchtdKgeMxMzBKCzgwFXGSbQGydXTliDNBo0HOzmY3cou/daMFTP60K+offcjS+3LRAYb1EroSRXZqrk1nuF/xDL3792DZUdPMiFR/L/Df6y74D6/QP4sTkTDFQitz4Wy/7jbsfj8dG6qK2zivgV6/l+w4OVjFkxVpPXogDWY10vVXNVynqxfJ7to2d1I9lNCHE2ilBCkWMIPdyJF7hjF8pKW+82yP4EzRh0vu8Xn0HT5MZpQxdRY/YMxNrWaG7SxsoEaO4q5uhgdzAqLYY3TRa7MjIK+7Ur+aqOeTXn6OKwVi0CjvZ6mIU3WUKSwiwkFZMbjRAkSb5CYwMEfGFO/z964xz83qGt6WAtBXNotqCQpTIiKtDHQeLOMfksHImCg6JLhQcWBVxamVgu0G3Pdh8Y6DyPnxraXY95+QDavbjqv7TeYT9T/FNnrkXaTTK0s4iWE5H4ACU0Qvz0wUYgfQrZv0/Hp7V17+rabUwnzYySHCy9SWX/7OV9Cfh31iMp9ZIffr76xmmThtOEqs8TrTtU6BWI3rWwvA9cXQipZTVtL0oswrGw= -script: -- gotestsum -f short-verbose -- -race -coverprofile=coverage.txt -covermode=atomic ./... diff --git a/vendor/github.com/go-openapi/jsonpointer/CODE_OF_CONDUCT.md b/vendor/github.com/go-openapi/jsonpointer/CODE_OF_CONDUCT.md deleted file mode 100644 index 9322b065e..000000000 --- a/vendor/github.com/go-openapi/jsonpointer/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,74 +0,0 @@ -# Contributor Covenant Code of Conduct - -## Our Pledge - -In the interest of fostering an open and welcoming environment, we as -contributors and maintainers pledge to making participation in our project and -our community a harassment-free experience for everyone, regardless of age, body -size, disability, ethnicity, gender identity and expression, level of experience, -nationality, personal appearance, race, religion, or sexual identity and -orientation. - -## Our Standards - -Examples of behavior that contributes to creating a positive environment -include: - -* Using welcoming and inclusive language -* Being respectful of differing viewpoints and experiences -* Gracefully accepting constructive criticism -* Focusing on what is best for the community -* Showing empathy towards other community members - -Examples of unacceptable behavior by participants include: - -* The use of sexualized language or imagery and unwelcome sexual attention or -advances -* Trolling, insulting/derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or electronic - address, without explicit permission -* Other conduct which could reasonably be considered inappropriate in a - professional setting - -## Our Responsibilities - -Project maintainers are responsible for clarifying the standards of acceptable -behavior and are expected to take appropriate and fair corrective action in -response to any instances of unacceptable behavior. - -Project maintainers have the right and responsibility to remove, edit, or -reject comments, commits, code, wiki edits, issues, and other contributions -that are not aligned to this Code of Conduct, or to ban temporarily or -permanently any contributor for other behaviors that they deem inappropriate, -threatening, offensive, or harmful. - -## Scope - -This Code of Conduct applies both within project spaces and in public spaces -when an individual is representing the project or its community. Examples of -representing a project or community include using an official project e-mail -address, posting via an official social media account, or acting as an appointed -representative at an online or offline event. Representation of a project may be -further defined and clarified by project maintainers. - -## Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported by contacting the project team at ivan+abuse@flanders.co.nz. All -complaints will be reviewed and investigated and will result in a response that -is deemed necessary and appropriate to the circumstances. The project team is -obligated to maintain confidentiality with regard to the reporter of an incident. -Further details of specific enforcement policies may be posted separately. - -Project maintainers who do not follow or enforce the Code of Conduct in good -faith may face temporary or permanent repercussions as determined by other -members of the project's leadership. - -## Attribution - -This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, -available at [http://contributor-covenant.org/version/1/4][version] - -[homepage]: http://contributor-covenant.org -[version]: http://contributor-covenant.org/version/1/4/ diff --git a/vendor/github.com/go-openapi/jsonpointer/LICENSE b/vendor/github.com/go-openapi/jsonpointer/LICENSE deleted file mode 100644 index d64569567..000000000 --- a/vendor/github.com/go-openapi/jsonpointer/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/github.com/go-openapi/jsonpointer/README.md b/vendor/github.com/go-openapi/jsonpointer/README.md deleted file mode 100644 index 813788aff..000000000 --- a/vendor/github.com/go-openapi/jsonpointer/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# gojsonpointer [![Build Status](https://travis-ci.org/go-openapi/jsonpointer.svg?branch=master)](https://travis-ci.org/go-openapi/jsonpointer) [![codecov](https://codecov.io/gh/go-openapi/jsonpointer/branch/master/graph/badge.svg)](https://codecov.io/gh/go-openapi/jsonpointer) [![Slack Status](https://slackin.goswagger.io/badge.svg)](https://slackin.goswagger.io) - -[![license](http://img.shields.io/badge/license-Apache%20v2-orange.svg)](https://raw.githubusercontent.com/go-openapi/jsonpointer/master/LICENSE) [![GoDoc](https://godoc.org/github.com/go-openapi/jsonpointer?status.svg)](http://godoc.org/github.com/go-openapi/jsonpointer) -An implementation of JSON Pointer - Go language - -## Status -Completed YES - -Tested YES - -## References -http://tools.ietf.org/html/draft-ietf-appsawg-json-pointer-07 - -### Note -The 4.Evaluation part of the previous reference, starting with 'If the currently referenced value is a JSON array, the reference token MUST contain either...' is not implemented. diff --git a/vendor/github.com/go-openapi/jsonpointer/pointer.go b/vendor/github.com/go-openapi/jsonpointer/pointer.go deleted file mode 100644 index 7df9853de..000000000 --- a/vendor/github.com/go-openapi/jsonpointer/pointer.go +++ /dev/null @@ -1,390 +0,0 @@ -// Copyright 2013 sigu-399 ( https://github.com/sigu-399 ) -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// author sigu-399 -// author-github https://github.com/sigu-399 -// author-mail sigu.399@gmail.com -// -// repository-name jsonpointer -// repository-desc An implementation of JSON Pointer - Go language -// -// description Main and unique file. -// -// created 25-02-2013 - -package jsonpointer - -import ( - "errors" - "fmt" - "reflect" - "strconv" - "strings" - - "github.com/go-openapi/swag" -) - -const ( - emptyPointer = `` - pointerSeparator = `/` - - invalidStart = `JSON pointer must be empty or start with a "` + pointerSeparator -) - -var jsonPointableType = reflect.TypeOf(new(JSONPointable)).Elem() -var jsonSetableType = reflect.TypeOf(new(JSONSetable)).Elem() - -// JSONPointable is an interface for structs to implement when they need to customize the -// json pointer process -type JSONPointable interface { - JSONLookup(string) (interface{}, error) -} - -// JSONSetable is an interface for structs to implement when they need to customize the -// json pointer process -type JSONSetable interface { - JSONSet(string, interface{}) error -} - -// New creates a new json pointer for the given string -func New(jsonPointerString string) (Pointer, error) { - - var p Pointer - err := p.parse(jsonPointerString) - return p, err - -} - -// Pointer the json pointer reprsentation -type Pointer struct { - referenceTokens []string -} - -// "Constructor", parses the given string JSON pointer -func (p *Pointer) parse(jsonPointerString string) error { - - var err error - - if jsonPointerString != emptyPointer { - if !strings.HasPrefix(jsonPointerString, pointerSeparator) { - err = errors.New(invalidStart) - } else { - referenceTokens := strings.Split(jsonPointerString, pointerSeparator) - for _, referenceToken := range referenceTokens[1:] { - p.referenceTokens = append(p.referenceTokens, referenceToken) - } - } - } - - return err -} - -// Get uses the pointer to retrieve a value from a JSON document -func (p *Pointer) Get(document interface{}) (interface{}, reflect.Kind, error) { - return p.get(document, swag.DefaultJSONNameProvider) -} - -// Set uses the pointer to set a value from a JSON document -func (p *Pointer) Set(document interface{}, value interface{}) (interface{}, error) { - return document, p.set(document, value, swag.DefaultJSONNameProvider) -} - -// GetForToken gets a value for a json pointer token 1 level deep -func GetForToken(document interface{}, decodedToken string) (interface{}, reflect.Kind, error) { - return getSingleImpl(document, decodedToken, swag.DefaultJSONNameProvider) -} - -// SetForToken gets a value for a json pointer token 1 level deep -func SetForToken(document interface{}, decodedToken string, value interface{}) (interface{}, error) { - return document, setSingleImpl(document, value, decodedToken, swag.DefaultJSONNameProvider) -} - -func getSingleImpl(node interface{}, decodedToken string, nameProvider *swag.NameProvider) (interface{}, reflect.Kind, error) { - rValue := reflect.Indirect(reflect.ValueOf(node)) - kind := rValue.Kind() - - if rValue.Type().Implements(jsonPointableType) { - r, err := node.(JSONPointable).JSONLookup(decodedToken) - if err != nil { - return nil, kind, err - } - return r, kind, nil - } - - switch kind { - case reflect.Struct: - nm, ok := nameProvider.GetGoNameForType(rValue.Type(), decodedToken) - if !ok { - return nil, kind, fmt.Errorf("object has no field %q", decodedToken) - } - fld := rValue.FieldByName(nm) - return fld.Interface(), kind, nil - - case reflect.Map: - kv := reflect.ValueOf(decodedToken) - mv := rValue.MapIndex(kv) - - if mv.IsValid() { - return mv.Interface(), kind, nil - } - return nil, kind, fmt.Errorf("object has no key %q", decodedToken) - - case reflect.Slice: - tokenIndex, err := strconv.Atoi(decodedToken) - if err != nil { - return nil, kind, err - } - sLength := rValue.Len() - if tokenIndex < 0 || tokenIndex >= sLength { - return nil, kind, fmt.Errorf("index out of bounds array[0,%d] index '%d'", sLength-1, tokenIndex) - } - - elem := rValue.Index(tokenIndex) - return elem.Interface(), kind, nil - - default: - return nil, kind, fmt.Errorf("invalid token reference %q", decodedToken) - } - -} - -func setSingleImpl(node, data interface{}, decodedToken string, nameProvider *swag.NameProvider) error { - rValue := reflect.Indirect(reflect.ValueOf(node)) - - if ns, ok := node.(JSONSetable); ok { // pointer impl - return ns.JSONSet(decodedToken, data) - } - - if rValue.Type().Implements(jsonSetableType) { - return node.(JSONSetable).JSONSet(decodedToken, data) - } - - switch rValue.Kind() { - case reflect.Struct: - nm, ok := nameProvider.GetGoNameForType(rValue.Type(), decodedToken) - if !ok { - return fmt.Errorf("object has no field %q", decodedToken) - } - fld := rValue.FieldByName(nm) - if fld.IsValid() { - fld.Set(reflect.ValueOf(data)) - } - return nil - - case reflect.Map: - kv := reflect.ValueOf(decodedToken) - rValue.SetMapIndex(kv, reflect.ValueOf(data)) - return nil - - case reflect.Slice: - tokenIndex, err := strconv.Atoi(decodedToken) - if err != nil { - return err - } - sLength := rValue.Len() - if tokenIndex < 0 || tokenIndex >= sLength { - return fmt.Errorf("index out of bounds array[0,%d] index '%d'", sLength, tokenIndex) - } - - elem := rValue.Index(tokenIndex) - if !elem.CanSet() { - return fmt.Errorf("can't set slice index %s to %v", decodedToken, data) - } - elem.Set(reflect.ValueOf(data)) - return nil - - default: - return fmt.Errorf("invalid token reference %q", decodedToken) - } - -} - -func (p *Pointer) get(node interface{}, nameProvider *swag.NameProvider) (interface{}, reflect.Kind, error) { - - if nameProvider == nil { - nameProvider = swag.DefaultJSONNameProvider - } - - kind := reflect.Invalid - - // Full document when empty - if len(p.referenceTokens) == 0 { - return node, kind, nil - } - - for _, token := range p.referenceTokens { - - decodedToken := Unescape(token) - - r, knd, err := getSingleImpl(node, decodedToken, nameProvider) - if err != nil { - return nil, knd, err - } - node, kind = r, knd - - } - - rValue := reflect.ValueOf(node) - kind = rValue.Kind() - - return node, kind, nil -} - -func (p *Pointer) set(node, data interface{}, nameProvider *swag.NameProvider) error { - knd := reflect.ValueOf(node).Kind() - - if knd != reflect.Ptr && knd != reflect.Struct && knd != reflect.Map && knd != reflect.Slice && knd != reflect.Array { - return fmt.Errorf("only structs, pointers, maps and slices are supported for setting values") - } - - if nameProvider == nil { - nameProvider = swag.DefaultJSONNameProvider - } - - // Full document when empty - if len(p.referenceTokens) == 0 { - return nil - } - - lastI := len(p.referenceTokens) - 1 - for i, token := range p.referenceTokens { - isLastToken := i == lastI - decodedToken := Unescape(token) - - if isLastToken { - - return setSingleImpl(node, data, decodedToken, nameProvider) - } - - rValue := reflect.Indirect(reflect.ValueOf(node)) - kind := rValue.Kind() - - if rValue.Type().Implements(jsonPointableType) { - r, err := node.(JSONPointable).JSONLookup(decodedToken) - if err != nil { - return err - } - fld := reflect.ValueOf(r) - if fld.CanAddr() && fld.Kind() != reflect.Interface && fld.Kind() != reflect.Map && fld.Kind() != reflect.Slice && fld.Kind() != reflect.Ptr { - node = fld.Addr().Interface() - continue - } - node = r - continue - } - - switch kind { - case reflect.Struct: - nm, ok := nameProvider.GetGoNameForType(rValue.Type(), decodedToken) - if !ok { - return fmt.Errorf("object has no field %q", decodedToken) - } - fld := rValue.FieldByName(nm) - if fld.CanAddr() && fld.Kind() != reflect.Interface && fld.Kind() != reflect.Map && fld.Kind() != reflect.Slice && fld.Kind() != reflect.Ptr { - node = fld.Addr().Interface() - continue - } - node = fld.Interface() - - case reflect.Map: - kv := reflect.ValueOf(decodedToken) - mv := rValue.MapIndex(kv) - - if !mv.IsValid() { - return fmt.Errorf("object has no key %q", decodedToken) - } - if mv.CanAddr() && mv.Kind() != reflect.Interface && mv.Kind() != reflect.Map && mv.Kind() != reflect.Slice && mv.Kind() != reflect.Ptr { - node = mv.Addr().Interface() - continue - } - node = mv.Interface() - - case reflect.Slice: - tokenIndex, err := strconv.Atoi(decodedToken) - if err != nil { - return err - } - sLength := rValue.Len() - if tokenIndex < 0 || tokenIndex >= sLength { - return fmt.Errorf("index out of bounds array[0,%d] index '%d'", sLength, tokenIndex) - } - - elem := rValue.Index(tokenIndex) - if elem.CanAddr() && elem.Kind() != reflect.Interface && elem.Kind() != reflect.Map && elem.Kind() != reflect.Slice && elem.Kind() != reflect.Ptr { - node = elem.Addr().Interface() - continue - } - node = elem.Interface() - - default: - return fmt.Errorf("invalid token reference %q", decodedToken) - } - - } - - return nil -} - -// DecodedTokens returns the decoded tokens -func (p *Pointer) DecodedTokens() []string { - result := make([]string, 0, len(p.referenceTokens)) - for _, t := range p.referenceTokens { - result = append(result, Unescape(t)) - } - return result -} - -// IsEmpty returns true if this is an empty json pointer -// this indicates that it points to the root document -func (p *Pointer) IsEmpty() bool { - return len(p.referenceTokens) == 0 -} - -// Pointer to string representation function -func (p *Pointer) String() string { - - if len(p.referenceTokens) == 0 { - return emptyPointer - } - - pointerString := pointerSeparator + strings.Join(p.referenceTokens, pointerSeparator) - - return pointerString -} - -// Specific JSON pointer encoding here -// ~0 => ~ -// ~1 => / -// ... and vice versa - -const ( - encRefTok0 = `~0` - encRefTok1 = `~1` - decRefTok0 = `~` - decRefTok1 = `/` -) - -// Unescape unescapes a json pointer reference token string to the original representation -func Unescape(token string) string { - step1 := strings.Replace(token, encRefTok1, decRefTok1, -1) - step2 := strings.Replace(step1, encRefTok0, decRefTok0, -1) - return step2 -} - -// Escape escapes a pointer reference token string -func Escape(token string) string { - step1 := strings.Replace(token, decRefTok0, encRefTok0, -1) - step2 := strings.Replace(step1, decRefTok1, encRefTok1, -1) - return step2 -} diff --git a/vendor/github.com/go-openapi/jsonreference/.gitignore b/vendor/github.com/go-openapi/jsonreference/.gitignore deleted file mode 100644 index 769c24400..000000000 --- a/vendor/github.com/go-openapi/jsonreference/.gitignore +++ /dev/null @@ -1 +0,0 @@ -secrets.yml diff --git a/vendor/github.com/go-openapi/jsonreference/.golangci.yml b/vendor/github.com/go-openapi/jsonreference/.golangci.yml deleted file mode 100644 index f9381aee5..000000000 --- a/vendor/github.com/go-openapi/jsonreference/.golangci.yml +++ /dev/null @@ -1,41 +0,0 @@ -linters-settings: - govet: - check-shadowing: true - golint: - min-confidence: 0 - gocyclo: - min-complexity: 30 - maligned: - suggest-new: true - dupl: - threshold: 100 - goconst: - min-len: 2 - min-occurrences: 4 -linters: - enable-all: true - disable: - - maligned - - lll - - gochecknoglobals - - godox - - gocognit - - whitespace - - wsl - - funlen - - gochecknoglobals - - gochecknoinits - - scopelint - - wrapcheck - - exhaustivestruct - - exhaustive - - nlreturn - - testpackage - - gci - - gofumpt - - goerr113 - - gomnd - - tparallel - - nestif - - godot - - errorlint diff --git a/vendor/github.com/go-openapi/jsonreference/.travis.yml b/vendor/github.com/go-openapi/jsonreference/.travis.yml deleted file mode 100644 index 05482f4b9..000000000 --- a/vendor/github.com/go-openapi/jsonreference/.travis.yml +++ /dev/null @@ -1,24 +0,0 @@ -after_success: -- bash <(curl -s https://codecov.io/bash) -go: -- 1.14.x -- 1.x -install: -- go get gotest.tools/gotestsum -jobs: - include: - # include linting job, but only for latest go version and amd64 arch - - go: 1.x - arch: amd64 - install: - go get github.com/golangci/golangci-lint/cmd/golangci-lint - script: - - golangci-lint run --new-from-rev master -env: -- GO111MODULE=on -language: go -notifications: - slack: - secure: OpQG/36F7DSF00HLm9WZMhyqFCYYyYTsVDObW226cWiR8PWYiNfLZiSEvIzT1Gx4dDjhigKTIqcLhG34CkL5iNXDjm9Yyo2RYhQPlK8NErNqUEXuBqn4RqYHW48VGhEhOyDd4Ei0E2FN5ZbgpvHgtpkdZ6XDi64r3Ac89isP9aPHXQTuv2Jog6b4/OKKiUTftLcTIst0p4Cp3gqOJWf1wnoj+IadWiECNVQT6zb47IYjtyw6+uV8iUjTzdKcRB6Zc6b4Dq7JAg1Zd7Jfxkql3hlKp4PNlRf9Cy7y5iA3G7MLyg3FcPX5z2kmcyPt2jOTRMBWUJ5zIQpOxizAcN8WsT3WWBL5KbuYK6k0PzujrIDLqdxGpNmjkkMfDBT9cKmZpm2FdW+oZgPFJP+oKmAo4u4KJz/vjiPTXgQlN5bmrLuRMCp+AwC5wkIohTqWZVPE2TK6ZSnMYcg/W39s+RP/9mJoyryAvPSpBOLTI+biCgaUCTOAZxNTWpMFc3tPYntc41WWkdKcooZ9JA5DwfcaVFyTGQ3YXz+HvX6G1z/gW0Q/A4dBi9mj2iE1xm7tRTT+4VQ2AXFvSEI1HJpfPgYnwAtwOD1v3Qm2EUHk9sCdtEDR4wVGEPIVn44GnwFMnGKx9JWppMPYwFu3SVDdHt+E+LOlhZUply11Aa+IVrT2KUQ= -script: -- gotestsum -f short-verbose -- -race -coverprofile=coverage.txt -covermode=atomic ./... diff --git a/vendor/github.com/go-openapi/jsonreference/CODE_OF_CONDUCT.md b/vendor/github.com/go-openapi/jsonreference/CODE_OF_CONDUCT.md deleted file mode 100644 index 9322b065e..000000000 --- a/vendor/github.com/go-openapi/jsonreference/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,74 +0,0 @@ -# Contributor Covenant Code of Conduct - -## Our Pledge - -In the interest of fostering an open and welcoming environment, we as -contributors and maintainers pledge to making participation in our project and -our community a harassment-free experience for everyone, regardless of age, body -size, disability, ethnicity, gender identity and expression, level of experience, -nationality, personal appearance, race, religion, or sexual identity and -orientation. - -## Our Standards - -Examples of behavior that contributes to creating a positive environment -include: - -* Using welcoming and inclusive language -* Being respectful of differing viewpoints and experiences -* Gracefully accepting constructive criticism -* Focusing on what is best for the community -* Showing empathy towards other community members - -Examples of unacceptable behavior by participants include: - -* The use of sexualized language or imagery and unwelcome sexual attention or -advances -* Trolling, insulting/derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or electronic - address, without explicit permission -* Other conduct which could reasonably be considered inappropriate in a - professional setting - -## Our Responsibilities - -Project maintainers are responsible for clarifying the standards of acceptable -behavior and are expected to take appropriate and fair corrective action in -response to any instances of unacceptable behavior. - -Project maintainers have the right and responsibility to remove, edit, or -reject comments, commits, code, wiki edits, issues, and other contributions -that are not aligned to this Code of Conduct, or to ban temporarily or -permanently any contributor for other behaviors that they deem inappropriate, -threatening, offensive, or harmful. - -## Scope - -This Code of Conduct applies both within project spaces and in public spaces -when an individual is representing the project or its community. Examples of -representing a project or community include using an official project e-mail -address, posting via an official social media account, or acting as an appointed -representative at an online or offline event. Representation of a project may be -further defined and clarified by project maintainers. - -## Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported by contacting the project team at ivan+abuse@flanders.co.nz. All -complaints will be reviewed and investigated and will result in a response that -is deemed necessary and appropriate to the circumstances. The project team is -obligated to maintain confidentiality with regard to the reporter of an incident. -Further details of specific enforcement policies may be posted separately. - -Project maintainers who do not follow or enforce the Code of Conduct in good -faith may face temporary or permanent repercussions as determined by other -members of the project's leadership. - -## Attribution - -This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, -available at [http://contributor-covenant.org/version/1/4][version] - -[homepage]: http://contributor-covenant.org -[version]: http://contributor-covenant.org/version/1/4/ diff --git a/vendor/github.com/go-openapi/jsonreference/LICENSE b/vendor/github.com/go-openapi/jsonreference/LICENSE deleted file mode 100644 index d64569567..000000000 --- a/vendor/github.com/go-openapi/jsonreference/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/github.com/go-openapi/jsonreference/README.md b/vendor/github.com/go-openapi/jsonreference/README.md deleted file mode 100644 index b94753aa5..000000000 --- a/vendor/github.com/go-openapi/jsonreference/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# gojsonreference [![Build Status](https://travis-ci.org/go-openapi/jsonreference.svg?branch=master)](https://travis-ci.org/go-openapi/jsonreference) [![codecov](https://codecov.io/gh/go-openapi/jsonreference/branch/master/graph/badge.svg)](https://codecov.io/gh/go-openapi/jsonreference) [![Slack Status](https://slackin.goswagger.io/badge.svg)](https://slackin.goswagger.io) - -[![license](http://img.shields.io/badge/license-Apache%20v2-orange.svg)](https://raw.githubusercontent.com/go-openapi/jsonreference/master/LICENSE) [![GoDoc](https://godoc.org/github.com/go-openapi/jsonreference?status.svg)](http://godoc.org/github.com/go-openapi/jsonreference) -An implementation of JSON Reference - Go language - -## Status -Feature complete. Stable API - -## Dependencies -https://github.com/go-openapi/jsonpointer - -## References -http://tools.ietf.org/html/draft-ietf-appsawg-json-pointer-07 - -http://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03 diff --git a/vendor/github.com/go-openapi/jsonreference/reference.go b/vendor/github.com/go-openapi/jsonreference/reference.go deleted file mode 100644 index 3bc0a6e26..000000000 --- a/vendor/github.com/go-openapi/jsonreference/reference.go +++ /dev/null @@ -1,156 +0,0 @@ -// Copyright 2013 sigu-399 ( https://github.com/sigu-399 ) -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// author sigu-399 -// author-github https://github.com/sigu-399 -// author-mail sigu.399@gmail.com -// -// repository-name jsonreference -// repository-desc An implementation of JSON Reference - Go language -// -// description Main and unique file. -// -// created 26-02-2013 - -package jsonreference - -import ( - "errors" - "net/url" - "strings" - - "github.com/PuerkitoBio/purell" - "github.com/go-openapi/jsonpointer" -) - -const ( - fragmentRune = `#` -) - -// New creates a new reference for the given string -func New(jsonReferenceString string) (Ref, error) { - - var r Ref - err := r.parse(jsonReferenceString) - return r, err - -} - -// MustCreateRef parses the ref string and panics when it's invalid. -// Use the New method for a version that returns an error -func MustCreateRef(ref string) Ref { - r, err := New(ref) - if err != nil { - panic(err) - } - return r -} - -// Ref represents a json reference object -type Ref struct { - referenceURL *url.URL - referencePointer jsonpointer.Pointer - - HasFullURL bool - HasURLPathOnly bool - HasFragmentOnly bool - HasFileScheme bool - HasFullFilePath bool -} - -// GetURL gets the URL for this reference -func (r *Ref) GetURL() *url.URL { - return r.referenceURL -} - -// GetPointer gets the json pointer for this reference -func (r *Ref) GetPointer() *jsonpointer.Pointer { - return &r.referencePointer -} - -// String returns the best version of the url for this reference -func (r *Ref) String() string { - - if r.referenceURL != nil { - return r.referenceURL.String() - } - - if r.HasFragmentOnly { - return fragmentRune + r.referencePointer.String() - } - - return r.referencePointer.String() -} - -// IsRoot returns true if this reference is a root document -func (r *Ref) IsRoot() bool { - return r.referenceURL != nil && - !r.IsCanonical() && - !r.HasURLPathOnly && - r.referenceURL.Fragment == "" -} - -// IsCanonical returns true when this pointer starts with http(s):// or file:// -func (r *Ref) IsCanonical() bool { - return (r.HasFileScheme && r.HasFullFilePath) || (!r.HasFileScheme && r.HasFullURL) -} - -// "Constructor", parses the given string JSON reference -func (r *Ref) parse(jsonReferenceString string) error { - - parsed, err := url.Parse(jsonReferenceString) - if err != nil { - return err - } - - r.referenceURL, _ = url.Parse(purell.NormalizeURL(parsed, purell.FlagsSafe|purell.FlagRemoveDuplicateSlashes)) - refURL := r.referenceURL - - if refURL.Scheme != "" && refURL.Host != "" { - r.HasFullURL = true - } else { - if refURL.Path != "" { - r.HasURLPathOnly = true - } else if refURL.RawQuery == "" && refURL.Fragment != "" { - r.HasFragmentOnly = true - } - } - - r.HasFileScheme = refURL.Scheme == "file" - r.HasFullFilePath = strings.HasPrefix(refURL.Path, "/") - - // invalid json-pointer error means url has no json-pointer fragment. simply ignore error - r.referencePointer, _ = jsonpointer.New(refURL.Fragment) - - return nil -} - -// Inherits creates a new reference from a parent and a child -// If the child cannot inherit from the parent, an error is returned -func (r *Ref) Inherits(child Ref) (*Ref, error) { - childURL := child.GetURL() - parentURL := r.GetURL() - if childURL == nil { - return nil, errors.New("child url is nil") - } - if parentURL == nil { - return &child, nil - } - - ref, err := New(parentURL.ResolveReference(childURL).String()) - if err != nil { - return nil, err - } - return &ref, nil -} diff --git a/vendor/github.com/go-openapi/swag/.editorconfig b/vendor/github.com/go-openapi/swag/.editorconfig deleted file mode 100644 index 3152da69a..000000000 --- a/vendor/github.com/go-openapi/swag/.editorconfig +++ /dev/null @@ -1,26 +0,0 @@ -# top-most EditorConfig file -root = true - -# Unix-style newlines with a newline ending every file -[*] -end_of_line = lf -insert_final_newline = true -indent_style = space -indent_size = 2 -trim_trailing_whitespace = true - -# Set default charset -[*.{js,py,go,scala,rb,java,html,css,less,sass,md}] -charset = utf-8 - -# Tab indentation (no size specified) -[*.go] -indent_style = tab - -[*.md] -trim_trailing_whitespace = false - -# Matches the exact files either package.json or .travis.yml -[{package.json,.travis.yml}] -indent_style = space -indent_size = 2 diff --git a/vendor/github.com/go-openapi/swag/.gitattributes b/vendor/github.com/go-openapi/swag/.gitattributes deleted file mode 100644 index 49ad52766..000000000 --- a/vendor/github.com/go-openapi/swag/.gitattributes +++ /dev/null @@ -1,2 +0,0 @@ -# gofmt always uses LF, whereas Git uses CRLF on Windows. -*.go text eol=lf diff --git a/vendor/github.com/go-openapi/swag/.gitignore b/vendor/github.com/go-openapi/swag/.gitignore deleted file mode 100644 index d69b53acc..000000000 --- a/vendor/github.com/go-openapi/swag/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -secrets.yml -vendor -Godeps -.idea diff --git a/vendor/github.com/go-openapi/swag/.golangci.yml b/vendor/github.com/go-openapi/swag/.golangci.yml deleted file mode 100644 index 2a4a71f3a..000000000 --- a/vendor/github.com/go-openapi/swag/.golangci.yml +++ /dev/null @@ -1,50 +0,0 @@ -linters-settings: - govet: - check-shadowing: true - golint: - min-confidence: 0 - gocyclo: - min-complexity: 25 - maligned: - suggest-new: true - dupl: - threshold: 100 - goconst: - min-len: 3 - min-occurrences: 2 - -linters: - enable-all: true - disable: - - maligned - - lll - - gochecknoinits - - gochecknoglobals - - nlreturn - - testpackage - - wrapcheck - - gomnd - - exhaustive - - exhaustivestruct - - goerr113 - - wsl - - whitespace - - gofumpt - - godot - - nestif - - godox - - funlen - - gci - - gocognit - - paralleltest - - thelper - - ifshort - - gomoddirectives - - cyclop - - forcetypeassert - - ireturn - - tagliatelle - - varnamelen - - goimports - - tenv - - golint diff --git a/vendor/github.com/go-openapi/swag/CODE_OF_CONDUCT.md b/vendor/github.com/go-openapi/swag/CODE_OF_CONDUCT.md deleted file mode 100644 index 9322b065e..000000000 --- a/vendor/github.com/go-openapi/swag/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,74 +0,0 @@ -# Contributor Covenant Code of Conduct - -## Our Pledge - -In the interest of fostering an open and welcoming environment, we as -contributors and maintainers pledge to making participation in our project and -our community a harassment-free experience for everyone, regardless of age, body -size, disability, ethnicity, gender identity and expression, level of experience, -nationality, personal appearance, race, religion, or sexual identity and -orientation. - -## Our Standards - -Examples of behavior that contributes to creating a positive environment -include: - -* Using welcoming and inclusive language -* Being respectful of differing viewpoints and experiences -* Gracefully accepting constructive criticism -* Focusing on what is best for the community -* Showing empathy towards other community members - -Examples of unacceptable behavior by participants include: - -* The use of sexualized language or imagery and unwelcome sexual attention or -advances -* Trolling, insulting/derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or electronic - address, without explicit permission -* Other conduct which could reasonably be considered inappropriate in a - professional setting - -## Our Responsibilities - -Project maintainers are responsible for clarifying the standards of acceptable -behavior and are expected to take appropriate and fair corrective action in -response to any instances of unacceptable behavior. - -Project maintainers have the right and responsibility to remove, edit, or -reject comments, commits, code, wiki edits, issues, and other contributions -that are not aligned to this Code of Conduct, or to ban temporarily or -permanently any contributor for other behaviors that they deem inappropriate, -threatening, offensive, or harmful. - -## Scope - -This Code of Conduct applies both within project spaces and in public spaces -when an individual is representing the project or its community. Examples of -representing a project or community include using an official project e-mail -address, posting via an official social media account, or acting as an appointed -representative at an online or offline event. Representation of a project may be -further defined and clarified by project maintainers. - -## Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported by contacting the project team at ivan+abuse@flanders.co.nz. All -complaints will be reviewed and investigated and will result in a response that -is deemed necessary and appropriate to the circumstances. The project team is -obligated to maintain confidentiality with regard to the reporter of an incident. -Further details of specific enforcement policies may be posted separately. - -Project maintainers who do not follow or enforce the Code of Conduct in good -faith may face temporary or permanent repercussions as determined by other -members of the project's leadership. - -## Attribution - -This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, -available at [http://contributor-covenant.org/version/1/4][version] - -[homepage]: http://contributor-covenant.org -[version]: http://contributor-covenant.org/version/1/4/ diff --git a/vendor/github.com/go-openapi/swag/LICENSE b/vendor/github.com/go-openapi/swag/LICENSE deleted file mode 100644 index d64569567..000000000 --- a/vendor/github.com/go-openapi/swag/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/github.com/go-openapi/swag/README.md b/vendor/github.com/go-openapi/swag/README.md deleted file mode 100644 index 217f6fa50..000000000 --- a/vendor/github.com/go-openapi/swag/README.md +++ /dev/null @@ -1,21 +0,0 @@ -# Swag [![Build Status](https://travis-ci.org/go-openapi/swag.svg?branch=master)](https://travis-ci.org/go-openapi/swag) [![codecov](https://codecov.io/gh/go-openapi/swag/branch/master/graph/badge.svg)](https://codecov.io/gh/go-openapi/swag) [![Slack Status](https://slackin.goswagger.io/badge.svg)](https://slackin.goswagger.io) - -[![license](http://img.shields.io/badge/license-Apache%20v2-orange.svg)](https://raw.githubusercontent.com/go-openapi/swag/master/LICENSE) -[![GoDoc](https://godoc.org/github.com/go-openapi/swag?status.svg)](http://godoc.org/github.com/go-openapi/swag) -[![Go Report Card](https://goreportcard.com/badge/github.com/go-openapi/swag)](https://goreportcard.com/report/github.com/go-openapi/swag) - -Contains a bunch of helper functions for go-openapi and go-swagger projects. - -You may also use it standalone for your projects. - -* convert between value and pointers for builtin types -* convert from string to builtin types (wraps strconv) -* fast json concatenation -* search in path -* load from file or http -* name mangling - - -This repo has only few dependencies outside of the standard library: - -* YAML utilities depend on gopkg.in/yaml.v2 diff --git a/vendor/github.com/go-openapi/swag/convert.go b/vendor/github.com/go-openapi/swag/convert.go deleted file mode 100644 index fc085aeb8..000000000 --- a/vendor/github.com/go-openapi/swag/convert.go +++ /dev/null @@ -1,208 +0,0 @@ -// Copyright 2015 go-swagger maintainers -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package swag - -import ( - "math" - "strconv" - "strings" -) - -// same as ECMA Number.MAX_SAFE_INTEGER and Number.MIN_SAFE_INTEGER -const ( - maxJSONFloat = float64(1<<53 - 1) // 9007199254740991.0 2^53 - 1 - minJSONFloat = -float64(1<<53 - 1) //-9007199254740991.0 -2^53 - 1 - epsilon float64 = 1e-9 -) - -// IsFloat64AJSONInteger allow for integers [-2^53, 2^53-1] inclusive -func IsFloat64AJSONInteger(f float64) bool { - if math.IsNaN(f) || math.IsInf(f, 0) || f < minJSONFloat || f > maxJSONFloat { - return false - } - fa := math.Abs(f) - g := float64(uint64(f)) - ga := math.Abs(g) - - diff := math.Abs(f - g) - - // more info: https://floating-point-gui.de/errors/comparison/#look-out-for-edge-cases - switch { - case f == g: // best case - return true - case f == float64(int64(f)) || f == float64(uint64(f)): // optimistic case - return true - case f == 0 || g == 0 || diff < math.SmallestNonzeroFloat64: // very close to 0 values - return diff < (epsilon * math.SmallestNonzeroFloat64) - } - // check the relative error - return diff/math.Min(fa+ga, math.MaxFloat64) < epsilon -} - -var evaluatesAsTrue map[string]struct{} - -func init() { - evaluatesAsTrue = map[string]struct{}{ - "true": {}, - "1": {}, - "yes": {}, - "ok": {}, - "y": {}, - "on": {}, - "selected": {}, - "checked": {}, - "t": {}, - "enabled": {}, - } -} - -// ConvertBool turn a string into a boolean -func ConvertBool(str string) (bool, error) { - _, ok := evaluatesAsTrue[strings.ToLower(str)] - return ok, nil -} - -// ConvertFloat32 turn a string into a float32 -func ConvertFloat32(str string) (float32, error) { - f, err := strconv.ParseFloat(str, 32) - if err != nil { - return 0, err - } - return float32(f), nil -} - -// ConvertFloat64 turn a string into a float64 -func ConvertFloat64(str string) (float64, error) { - return strconv.ParseFloat(str, 64) -} - -// ConvertInt8 turn a string into an int8 -func ConvertInt8(str string) (int8, error) { - i, err := strconv.ParseInt(str, 10, 8) - if err != nil { - return 0, err - } - return int8(i), nil -} - -// ConvertInt16 turn a string into an int16 -func ConvertInt16(str string) (int16, error) { - i, err := strconv.ParseInt(str, 10, 16) - if err != nil { - return 0, err - } - return int16(i), nil -} - -// ConvertInt32 turn a string into an int32 -func ConvertInt32(str string) (int32, error) { - i, err := strconv.ParseInt(str, 10, 32) - if err != nil { - return 0, err - } - return int32(i), nil -} - -// ConvertInt64 turn a string into an int64 -func ConvertInt64(str string) (int64, error) { - return strconv.ParseInt(str, 10, 64) -} - -// ConvertUint8 turn a string into an uint8 -func ConvertUint8(str string) (uint8, error) { - i, err := strconv.ParseUint(str, 10, 8) - if err != nil { - return 0, err - } - return uint8(i), nil -} - -// ConvertUint16 turn a string into an uint16 -func ConvertUint16(str string) (uint16, error) { - i, err := strconv.ParseUint(str, 10, 16) - if err != nil { - return 0, err - } - return uint16(i), nil -} - -// ConvertUint32 turn a string into an uint32 -func ConvertUint32(str string) (uint32, error) { - i, err := strconv.ParseUint(str, 10, 32) - if err != nil { - return 0, err - } - return uint32(i), nil -} - -// ConvertUint64 turn a string into an uint64 -func ConvertUint64(str string) (uint64, error) { - return strconv.ParseUint(str, 10, 64) -} - -// FormatBool turns a boolean into a string -func FormatBool(value bool) string { - return strconv.FormatBool(value) -} - -// FormatFloat32 turns a float32 into a string -func FormatFloat32(value float32) string { - return strconv.FormatFloat(float64(value), 'f', -1, 32) -} - -// FormatFloat64 turns a float64 into a string -func FormatFloat64(value float64) string { - return strconv.FormatFloat(value, 'f', -1, 64) -} - -// FormatInt8 turns an int8 into a string -func FormatInt8(value int8) string { - return strconv.FormatInt(int64(value), 10) -} - -// FormatInt16 turns an int16 into a string -func FormatInt16(value int16) string { - return strconv.FormatInt(int64(value), 10) -} - -// FormatInt32 turns an int32 into a string -func FormatInt32(value int32) string { - return strconv.Itoa(int(value)) -} - -// FormatInt64 turns an int64 into a string -func FormatInt64(value int64) string { - return strconv.FormatInt(value, 10) -} - -// FormatUint8 turns an uint8 into a string -func FormatUint8(value uint8) string { - return strconv.FormatUint(uint64(value), 10) -} - -// FormatUint16 turns an uint16 into a string -func FormatUint16(value uint16) string { - return strconv.FormatUint(uint64(value), 10) -} - -// FormatUint32 turns an uint32 into a string -func FormatUint32(value uint32) string { - return strconv.FormatUint(uint64(value), 10) -} - -// FormatUint64 turns an uint64 into a string -func FormatUint64(value uint64) string { - return strconv.FormatUint(value, 10) -} diff --git a/vendor/github.com/go-openapi/swag/convert_types.go b/vendor/github.com/go-openapi/swag/convert_types.go deleted file mode 100644 index c49cc473a..000000000 --- a/vendor/github.com/go-openapi/swag/convert_types.go +++ /dev/null @@ -1,730 +0,0 @@ -package swag - -import "time" - -// This file was taken from the aws go sdk - -// String returns a pointer to of the string value passed in. -func String(v string) *string { - return &v -} - -// StringValue returns the value of the string pointer passed in or -// "" if the pointer is nil. -func StringValue(v *string) string { - if v != nil { - return *v - } - return "" -} - -// StringSlice converts a slice of string values into a slice of -// string pointers -func StringSlice(src []string) []*string { - dst := make([]*string, len(src)) - for i := 0; i < len(src); i++ { - dst[i] = &(src[i]) - } - return dst -} - -// StringValueSlice converts a slice of string pointers into a slice of -// string values -func StringValueSlice(src []*string) []string { - dst := make([]string, len(src)) - for i := 0; i < len(src); i++ { - if src[i] != nil { - dst[i] = *(src[i]) - } - } - return dst -} - -// StringMap converts a string map of string values into a string -// map of string pointers -func StringMap(src map[string]string) map[string]*string { - dst := make(map[string]*string) - for k, val := range src { - v := val - dst[k] = &v - } - return dst -} - -// StringValueMap converts a string map of string pointers into a string -// map of string values -func StringValueMap(src map[string]*string) map[string]string { - dst := make(map[string]string) - for k, val := range src { - if val != nil { - dst[k] = *val - } - } - return dst -} - -// Bool returns a pointer to of the bool value passed in. -func Bool(v bool) *bool { - return &v -} - -// BoolValue returns the value of the bool pointer passed in or -// false if the pointer is nil. -func BoolValue(v *bool) bool { - if v != nil { - return *v - } - return false -} - -// BoolSlice converts a slice of bool values into a slice of -// bool pointers -func BoolSlice(src []bool) []*bool { - dst := make([]*bool, len(src)) - for i := 0; i < len(src); i++ { - dst[i] = &(src[i]) - } - return dst -} - -// BoolValueSlice converts a slice of bool pointers into a slice of -// bool values -func BoolValueSlice(src []*bool) []bool { - dst := make([]bool, len(src)) - for i := 0; i < len(src); i++ { - if src[i] != nil { - dst[i] = *(src[i]) - } - } - return dst -} - -// BoolMap converts a string map of bool values into a string -// map of bool pointers -func BoolMap(src map[string]bool) map[string]*bool { - dst := make(map[string]*bool) - for k, val := range src { - v := val - dst[k] = &v - } - return dst -} - -// BoolValueMap converts a string map of bool pointers into a string -// map of bool values -func BoolValueMap(src map[string]*bool) map[string]bool { - dst := make(map[string]bool) - for k, val := range src { - if val != nil { - dst[k] = *val - } - } - return dst -} - -// Int returns a pointer to of the int value passed in. -func Int(v int) *int { - return &v -} - -// IntValue returns the value of the int pointer passed in or -// 0 if the pointer is nil. -func IntValue(v *int) int { - if v != nil { - return *v - } - return 0 -} - -// IntSlice converts a slice of int values into a slice of -// int pointers -func IntSlice(src []int) []*int { - dst := make([]*int, len(src)) - for i := 0; i < len(src); i++ { - dst[i] = &(src[i]) - } - return dst -} - -// IntValueSlice converts a slice of int pointers into a slice of -// int values -func IntValueSlice(src []*int) []int { - dst := make([]int, len(src)) - for i := 0; i < len(src); i++ { - if src[i] != nil { - dst[i] = *(src[i]) - } - } - return dst -} - -// IntMap converts a string map of int values into a string -// map of int pointers -func IntMap(src map[string]int) map[string]*int { - dst := make(map[string]*int) - for k, val := range src { - v := val - dst[k] = &v - } - return dst -} - -// IntValueMap converts a string map of int pointers into a string -// map of int values -func IntValueMap(src map[string]*int) map[string]int { - dst := make(map[string]int) - for k, val := range src { - if val != nil { - dst[k] = *val - } - } - return dst -} - -// Int32 returns a pointer to of the int32 value passed in. -func Int32(v int32) *int32 { - return &v -} - -// Int32Value returns the value of the int32 pointer passed in or -// 0 if the pointer is nil. -func Int32Value(v *int32) int32 { - if v != nil { - return *v - } - return 0 -} - -// Int32Slice converts a slice of int32 values into a slice of -// int32 pointers -func Int32Slice(src []int32) []*int32 { - dst := make([]*int32, len(src)) - for i := 0; i < len(src); i++ { - dst[i] = &(src[i]) - } - return dst -} - -// Int32ValueSlice converts a slice of int32 pointers into a slice of -// int32 values -func Int32ValueSlice(src []*int32) []int32 { - dst := make([]int32, len(src)) - for i := 0; i < len(src); i++ { - if src[i] != nil { - dst[i] = *(src[i]) - } - } - return dst -} - -// Int32Map converts a string map of int32 values into a string -// map of int32 pointers -func Int32Map(src map[string]int32) map[string]*int32 { - dst := make(map[string]*int32) - for k, val := range src { - v := val - dst[k] = &v - } - return dst -} - -// Int32ValueMap converts a string map of int32 pointers into a string -// map of int32 values -func Int32ValueMap(src map[string]*int32) map[string]int32 { - dst := make(map[string]int32) - for k, val := range src { - if val != nil { - dst[k] = *val - } - } - return dst -} - -// Int64 returns a pointer to of the int64 value passed in. -func Int64(v int64) *int64 { - return &v -} - -// Int64Value returns the value of the int64 pointer passed in or -// 0 if the pointer is nil. -func Int64Value(v *int64) int64 { - if v != nil { - return *v - } - return 0 -} - -// Int64Slice converts a slice of int64 values into a slice of -// int64 pointers -func Int64Slice(src []int64) []*int64 { - dst := make([]*int64, len(src)) - for i := 0; i < len(src); i++ { - dst[i] = &(src[i]) - } - return dst -} - -// Int64ValueSlice converts a slice of int64 pointers into a slice of -// int64 values -func Int64ValueSlice(src []*int64) []int64 { - dst := make([]int64, len(src)) - for i := 0; i < len(src); i++ { - if src[i] != nil { - dst[i] = *(src[i]) - } - } - return dst -} - -// Int64Map converts a string map of int64 values into a string -// map of int64 pointers -func Int64Map(src map[string]int64) map[string]*int64 { - dst := make(map[string]*int64) - for k, val := range src { - v := val - dst[k] = &v - } - return dst -} - -// Int64ValueMap converts a string map of int64 pointers into a string -// map of int64 values -func Int64ValueMap(src map[string]*int64) map[string]int64 { - dst := make(map[string]int64) - for k, val := range src { - if val != nil { - dst[k] = *val - } - } - return dst -} - -// Uint16 returns a pointer to of the uint16 value passed in. -func Uint16(v uint16) *uint16 { - return &v -} - -// Uint16Value returns the value of the uint16 pointer passed in or -// 0 if the pointer is nil. -func Uint16Value(v *uint16) uint16 { - if v != nil { - return *v - } - - return 0 -} - -// Uint16Slice converts a slice of uint16 values into a slice of -// uint16 pointers -func Uint16Slice(src []uint16) []*uint16 { - dst := make([]*uint16, len(src)) - for i := 0; i < len(src); i++ { - dst[i] = &(src[i]) - } - - return dst -} - -// Uint16ValueSlice converts a slice of uint16 pointers into a slice of -// uint16 values -func Uint16ValueSlice(src []*uint16) []uint16 { - dst := make([]uint16, len(src)) - - for i := 0; i < len(src); i++ { - if src[i] != nil { - dst[i] = *(src[i]) - } - } - - return dst -} - -// Uint16Map converts a string map of uint16 values into a string -// map of uint16 pointers -func Uint16Map(src map[string]uint16) map[string]*uint16 { - dst := make(map[string]*uint16) - - for k, val := range src { - v := val - dst[k] = &v - } - - return dst -} - -// Uint16ValueMap converts a string map of uint16 pointers into a string -// map of uint16 values -func Uint16ValueMap(src map[string]*uint16) map[string]uint16 { - dst := make(map[string]uint16) - - for k, val := range src { - if val != nil { - dst[k] = *val - } - } - - return dst -} - -// Uint returns a pointer to of the uint value passed in. -func Uint(v uint) *uint { - return &v -} - -// UintValue returns the value of the uint pointer passed in or -// 0 if the pointer is nil. -func UintValue(v *uint) uint { - if v != nil { - return *v - } - return 0 -} - -// UintSlice converts a slice of uint values into a slice of -// uint pointers -func UintSlice(src []uint) []*uint { - dst := make([]*uint, len(src)) - for i := 0; i < len(src); i++ { - dst[i] = &(src[i]) - } - return dst -} - -// UintValueSlice converts a slice of uint pointers into a slice of -// uint values -func UintValueSlice(src []*uint) []uint { - dst := make([]uint, len(src)) - for i := 0; i < len(src); i++ { - if src[i] != nil { - dst[i] = *(src[i]) - } - } - return dst -} - -// UintMap converts a string map of uint values into a string -// map of uint pointers -func UintMap(src map[string]uint) map[string]*uint { - dst := make(map[string]*uint) - for k, val := range src { - v := val - dst[k] = &v - } - return dst -} - -// UintValueMap converts a string map of uint pointers into a string -// map of uint values -func UintValueMap(src map[string]*uint) map[string]uint { - dst := make(map[string]uint) - for k, val := range src { - if val != nil { - dst[k] = *val - } - } - return dst -} - -// Uint32 returns a pointer to of the uint32 value passed in. -func Uint32(v uint32) *uint32 { - return &v -} - -// Uint32Value returns the value of the uint32 pointer passed in or -// 0 if the pointer is nil. -func Uint32Value(v *uint32) uint32 { - if v != nil { - return *v - } - return 0 -} - -// Uint32Slice converts a slice of uint32 values into a slice of -// uint32 pointers -func Uint32Slice(src []uint32) []*uint32 { - dst := make([]*uint32, len(src)) - for i := 0; i < len(src); i++ { - dst[i] = &(src[i]) - } - return dst -} - -// Uint32ValueSlice converts a slice of uint32 pointers into a slice of -// uint32 values -func Uint32ValueSlice(src []*uint32) []uint32 { - dst := make([]uint32, len(src)) - for i := 0; i < len(src); i++ { - if src[i] != nil { - dst[i] = *(src[i]) - } - } - return dst -} - -// Uint32Map converts a string map of uint32 values into a string -// map of uint32 pointers -func Uint32Map(src map[string]uint32) map[string]*uint32 { - dst := make(map[string]*uint32) - for k, val := range src { - v := val - dst[k] = &v - } - return dst -} - -// Uint32ValueMap converts a string map of uint32 pointers into a string -// map of uint32 values -func Uint32ValueMap(src map[string]*uint32) map[string]uint32 { - dst := make(map[string]uint32) - for k, val := range src { - if val != nil { - dst[k] = *val - } - } - return dst -} - -// Uint64 returns a pointer to of the uint64 value passed in. -func Uint64(v uint64) *uint64 { - return &v -} - -// Uint64Value returns the value of the uint64 pointer passed in or -// 0 if the pointer is nil. -func Uint64Value(v *uint64) uint64 { - if v != nil { - return *v - } - return 0 -} - -// Uint64Slice converts a slice of uint64 values into a slice of -// uint64 pointers -func Uint64Slice(src []uint64) []*uint64 { - dst := make([]*uint64, len(src)) - for i := 0; i < len(src); i++ { - dst[i] = &(src[i]) - } - return dst -} - -// Uint64ValueSlice converts a slice of uint64 pointers into a slice of -// uint64 values -func Uint64ValueSlice(src []*uint64) []uint64 { - dst := make([]uint64, len(src)) - for i := 0; i < len(src); i++ { - if src[i] != nil { - dst[i] = *(src[i]) - } - } - return dst -} - -// Uint64Map converts a string map of uint64 values into a string -// map of uint64 pointers -func Uint64Map(src map[string]uint64) map[string]*uint64 { - dst := make(map[string]*uint64) - for k, val := range src { - v := val - dst[k] = &v - } - return dst -} - -// Uint64ValueMap converts a string map of uint64 pointers into a string -// map of uint64 values -func Uint64ValueMap(src map[string]*uint64) map[string]uint64 { - dst := make(map[string]uint64) - for k, val := range src { - if val != nil { - dst[k] = *val - } - } - return dst -} - -// Float32 returns a pointer to of the float32 value passed in. -func Float32(v float32) *float32 { - return &v -} - -// Float32Value returns the value of the float32 pointer passed in or -// 0 if the pointer is nil. -func Float32Value(v *float32) float32 { - if v != nil { - return *v - } - - return 0 -} - -// Float32Slice converts a slice of float32 values into a slice of -// float32 pointers -func Float32Slice(src []float32) []*float32 { - dst := make([]*float32, len(src)) - - for i := 0; i < len(src); i++ { - dst[i] = &(src[i]) - } - - return dst -} - -// Float32ValueSlice converts a slice of float32 pointers into a slice of -// float32 values -func Float32ValueSlice(src []*float32) []float32 { - dst := make([]float32, len(src)) - - for i := 0; i < len(src); i++ { - if src[i] != nil { - dst[i] = *(src[i]) - } - } - - return dst -} - -// Float32Map converts a string map of float32 values into a string -// map of float32 pointers -func Float32Map(src map[string]float32) map[string]*float32 { - dst := make(map[string]*float32) - - for k, val := range src { - v := val - dst[k] = &v - } - - return dst -} - -// Float32ValueMap converts a string map of float32 pointers into a string -// map of float32 values -func Float32ValueMap(src map[string]*float32) map[string]float32 { - dst := make(map[string]float32) - - for k, val := range src { - if val != nil { - dst[k] = *val - } - } - - return dst -} - -// Float64 returns a pointer to of the float64 value passed in. -func Float64(v float64) *float64 { - return &v -} - -// Float64Value returns the value of the float64 pointer passed in or -// 0 if the pointer is nil. -func Float64Value(v *float64) float64 { - if v != nil { - return *v - } - return 0 -} - -// Float64Slice converts a slice of float64 values into a slice of -// float64 pointers -func Float64Slice(src []float64) []*float64 { - dst := make([]*float64, len(src)) - for i := 0; i < len(src); i++ { - dst[i] = &(src[i]) - } - return dst -} - -// Float64ValueSlice converts a slice of float64 pointers into a slice of -// float64 values -func Float64ValueSlice(src []*float64) []float64 { - dst := make([]float64, len(src)) - for i := 0; i < len(src); i++ { - if src[i] != nil { - dst[i] = *(src[i]) - } - } - return dst -} - -// Float64Map converts a string map of float64 values into a string -// map of float64 pointers -func Float64Map(src map[string]float64) map[string]*float64 { - dst := make(map[string]*float64) - for k, val := range src { - v := val - dst[k] = &v - } - return dst -} - -// Float64ValueMap converts a string map of float64 pointers into a string -// map of float64 values -func Float64ValueMap(src map[string]*float64) map[string]float64 { - dst := make(map[string]float64) - for k, val := range src { - if val != nil { - dst[k] = *val - } - } - return dst -} - -// Time returns a pointer to of the time.Time value passed in. -func Time(v time.Time) *time.Time { - return &v -} - -// TimeValue returns the value of the time.Time pointer passed in or -// time.Time{} if the pointer is nil. -func TimeValue(v *time.Time) time.Time { - if v != nil { - return *v - } - return time.Time{} -} - -// TimeSlice converts a slice of time.Time values into a slice of -// time.Time pointers -func TimeSlice(src []time.Time) []*time.Time { - dst := make([]*time.Time, len(src)) - for i := 0; i < len(src); i++ { - dst[i] = &(src[i]) - } - return dst -} - -// TimeValueSlice converts a slice of time.Time pointers into a slice of -// time.Time values -func TimeValueSlice(src []*time.Time) []time.Time { - dst := make([]time.Time, len(src)) - for i := 0; i < len(src); i++ { - if src[i] != nil { - dst[i] = *(src[i]) - } - } - return dst -} - -// TimeMap converts a string map of time.Time values into a string -// map of time.Time pointers -func TimeMap(src map[string]time.Time) map[string]*time.Time { - dst := make(map[string]*time.Time) - for k, val := range src { - v := val - dst[k] = &v - } - return dst -} - -// TimeValueMap converts a string map of time.Time pointers into a string -// map of time.Time values -func TimeValueMap(src map[string]*time.Time) map[string]time.Time { - dst := make(map[string]time.Time) - for k, val := range src { - if val != nil { - dst[k] = *val - } - } - return dst -} diff --git a/vendor/github.com/go-openapi/swag/doc.go b/vendor/github.com/go-openapi/swag/doc.go deleted file mode 100644 index 8d2c8c501..000000000 --- a/vendor/github.com/go-openapi/swag/doc.go +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2015 go-swagger maintainers -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/* -Package swag contains a bunch of helper functions for go-openapi and go-swagger projects. - -You may also use it standalone for your projects. - - * convert between value and pointers for builtin types - * convert from string to builtin types (wraps strconv) - * fast json concatenation - * search in path - * load from file or http - * name mangling - - -This repo has only few dependencies outside of the standard library: - - * YAML utilities depend on gopkg.in/yaml.v2 -*/ -package swag diff --git a/vendor/github.com/go-openapi/swag/file.go b/vendor/github.com/go-openapi/swag/file.go deleted file mode 100644 index 16accc55f..000000000 --- a/vendor/github.com/go-openapi/swag/file.go +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2015 go-swagger maintainers -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package swag - -import "mime/multipart" - -// File represents an uploaded file. -type File struct { - Data multipart.File - Header *multipart.FileHeader -} - -// Read bytes from the file -func (f *File) Read(p []byte) (n int, err error) { - return f.Data.Read(p) -} - -// Close the file -func (f *File) Close() error { - return f.Data.Close() -} diff --git a/vendor/github.com/go-openapi/swag/json.go b/vendor/github.com/go-openapi/swag/json.go deleted file mode 100644 index 7e9902ca3..000000000 --- a/vendor/github.com/go-openapi/swag/json.go +++ /dev/null @@ -1,312 +0,0 @@ -// Copyright 2015 go-swagger maintainers -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package swag - -import ( - "bytes" - "encoding/json" - "log" - "reflect" - "strings" - "sync" - - "github.com/mailru/easyjson/jlexer" - "github.com/mailru/easyjson/jwriter" -) - -// nullJSON represents a JSON object with null type -var nullJSON = []byte("null") - -// DefaultJSONNameProvider the default cache for types -var DefaultJSONNameProvider = NewNameProvider() - -const comma = byte(',') - -var closers map[byte]byte - -func init() { - closers = map[byte]byte{ - '{': '}', - '[': ']', - } -} - -type ejMarshaler interface { - MarshalEasyJSON(w *jwriter.Writer) -} - -type ejUnmarshaler interface { - UnmarshalEasyJSON(w *jlexer.Lexer) -} - -// WriteJSON writes json data, prefers finding an appropriate interface to short-circuit the marshaler -// so it takes the fastest option available. -func WriteJSON(data interface{}) ([]byte, error) { - if d, ok := data.(ejMarshaler); ok { - jw := new(jwriter.Writer) - d.MarshalEasyJSON(jw) - return jw.BuildBytes() - } - if d, ok := data.(json.Marshaler); ok { - return d.MarshalJSON() - } - return json.Marshal(data) -} - -// ReadJSON reads json data, prefers finding an appropriate interface to short-circuit the unmarshaler -// so it takes the fastest option available -func ReadJSON(data []byte, value interface{}) error { - trimmedData := bytes.Trim(data, "\x00") - if d, ok := value.(ejUnmarshaler); ok { - jl := &jlexer.Lexer{Data: trimmedData} - d.UnmarshalEasyJSON(jl) - return jl.Error() - } - if d, ok := value.(json.Unmarshaler); ok { - return d.UnmarshalJSON(trimmedData) - } - return json.Unmarshal(trimmedData, value) -} - -// DynamicJSONToStruct converts an untyped json structure into a struct -func DynamicJSONToStruct(data interface{}, target interface{}) error { - // TODO: convert straight to a json typed map (mergo + iterate?) - b, err := WriteJSON(data) - if err != nil { - return err - } - return ReadJSON(b, target) -} - -// ConcatJSON concatenates multiple json objects efficiently -func ConcatJSON(blobs ...[]byte) []byte { - if len(blobs) == 0 { - return nil - } - - last := len(blobs) - 1 - for blobs[last] == nil || bytes.Equal(blobs[last], nullJSON) { - // strips trailing null objects - last-- - if last < 0 { - // there was nothing but "null"s or nil... - return nil - } - } - if last == 0 { - return blobs[0] - } - - var opening, closing byte - var idx, a int - buf := bytes.NewBuffer(nil) - - for i, b := range blobs[:last+1] { - if b == nil || bytes.Equal(b, nullJSON) { - // a null object is in the list: skip it - continue - } - if len(b) > 0 && opening == 0 { // is this an array or an object? - opening, closing = b[0], closers[b[0]] - } - - if opening != '{' && opening != '[' { - continue // don't know how to concatenate non container objects - } - - if len(b) < 3 { // yep empty but also the last one, so closing this thing - if i == last && a > 0 { - if err := buf.WriteByte(closing); err != nil { - log.Println(err) - } - } - continue - } - - idx = 0 - if a > 0 { // we need to join with a comma for everything beyond the first non-empty item - if err := buf.WriteByte(comma); err != nil { - log.Println(err) - } - idx = 1 // this is not the first or the last so we want to drop the leading bracket - } - - if i != last { // not the last one, strip brackets - if _, err := buf.Write(b[idx : len(b)-1]); err != nil { - log.Println(err) - } - } else { // last one, strip only the leading bracket - if _, err := buf.Write(b[idx:]); err != nil { - log.Println(err) - } - } - a++ - } - // somehow it ended up being empty, so provide a default value - if buf.Len() == 0 { - if err := buf.WriteByte(opening); err != nil { - log.Println(err) - } - if err := buf.WriteByte(closing); err != nil { - log.Println(err) - } - } - return buf.Bytes() -} - -// ToDynamicJSON turns an object into a properly JSON typed structure -func ToDynamicJSON(data interface{}) interface{} { - // TODO: convert straight to a json typed map (mergo + iterate?) - b, err := json.Marshal(data) - if err != nil { - log.Println(err) - } - var res interface{} - if err := json.Unmarshal(b, &res); err != nil { - log.Println(err) - } - return res -} - -// FromDynamicJSON turns an object into a properly JSON typed structure -func FromDynamicJSON(data, target interface{}) error { - b, err := json.Marshal(data) - if err != nil { - log.Println(err) - } - return json.Unmarshal(b, target) -} - -// NameProvider represents an object capable of translating from go property names -// to json property names -// This type is thread-safe. -type NameProvider struct { - lock *sync.Mutex - index map[reflect.Type]nameIndex -} - -type nameIndex struct { - jsonNames map[string]string - goNames map[string]string -} - -// NewNameProvider creates a new name provider -func NewNameProvider() *NameProvider { - return &NameProvider{ - lock: &sync.Mutex{}, - index: make(map[reflect.Type]nameIndex), - } -} - -func buildnameIndex(tpe reflect.Type, idx, reverseIdx map[string]string) { - for i := 0; i < tpe.NumField(); i++ { - targetDes := tpe.Field(i) - - if targetDes.PkgPath != "" { // unexported - continue - } - - if targetDes.Anonymous { // walk embedded structures tree down first - buildnameIndex(targetDes.Type, idx, reverseIdx) - continue - } - - if tag := targetDes.Tag.Get("json"); tag != "" { - - parts := strings.Split(tag, ",") - if len(parts) == 0 { - continue - } - - nm := parts[0] - if nm == "-" { - continue - } - if nm == "" { // empty string means we want to use the Go name - nm = targetDes.Name - } - - idx[nm] = targetDes.Name - reverseIdx[targetDes.Name] = nm - } - } -} - -func newNameIndex(tpe reflect.Type) nameIndex { - var idx = make(map[string]string, tpe.NumField()) - var reverseIdx = make(map[string]string, tpe.NumField()) - - buildnameIndex(tpe, idx, reverseIdx) - return nameIndex{jsonNames: idx, goNames: reverseIdx} -} - -// GetJSONNames gets all the json property names for a type -func (n *NameProvider) GetJSONNames(subject interface{}) []string { - n.lock.Lock() - defer n.lock.Unlock() - tpe := reflect.Indirect(reflect.ValueOf(subject)).Type() - names, ok := n.index[tpe] - if !ok { - names = n.makeNameIndex(tpe) - } - - res := make([]string, 0, len(names.jsonNames)) - for k := range names.jsonNames { - res = append(res, k) - } - return res -} - -// GetJSONName gets the json name for a go property name -func (n *NameProvider) GetJSONName(subject interface{}, name string) (string, bool) { - tpe := reflect.Indirect(reflect.ValueOf(subject)).Type() - return n.GetJSONNameForType(tpe, name) -} - -// GetJSONNameForType gets the json name for a go property name on a given type -func (n *NameProvider) GetJSONNameForType(tpe reflect.Type, name string) (string, bool) { - n.lock.Lock() - defer n.lock.Unlock() - names, ok := n.index[tpe] - if !ok { - names = n.makeNameIndex(tpe) - } - nme, ok := names.goNames[name] - return nme, ok -} - -func (n *NameProvider) makeNameIndex(tpe reflect.Type) nameIndex { - names := newNameIndex(tpe) - n.index[tpe] = names - return names -} - -// GetGoName gets the go name for a json property name -func (n *NameProvider) GetGoName(subject interface{}, name string) (string, bool) { - tpe := reflect.Indirect(reflect.ValueOf(subject)).Type() - return n.GetGoNameForType(tpe, name) -} - -// GetGoNameForType gets the go name for a given type for a json property name -func (n *NameProvider) GetGoNameForType(tpe reflect.Type, name string) (string, bool) { - n.lock.Lock() - defer n.lock.Unlock() - names, ok := n.index[tpe] - if !ok { - names = n.makeNameIndex(tpe) - } - nme, ok := names.jsonNames[name] - return nme, ok -} diff --git a/vendor/github.com/go-openapi/swag/loading.go b/vendor/github.com/go-openapi/swag/loading.go deleted file mode 100644 index 9a6040972..000000000 --- a/vendor/github.com/go-openapi/swag/loading.go +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright 2015 go-swagger maintainers -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package swag - -import ( - "fmt" - "io/ioutil" - "log" - "net/http" - "net/url" - "path/filepath" - "runtime" - "strings" - "time" -) - -// LoadHTTPTimeout the default timeout for load requests -var LoadHTTPTimeout = 30 * time.Second - -// LoadHTTPBasicAuthUsername the username to use when load requests require basic auth -var LoadHTTPBasicAuthUsername = "" - -// LoadHTTPBasicAuthPassword the password to use when load requests require basic auth -var LoadHTTPBasicAuthPassword = "" - -// LoadHTTPCustomHeaders an optional collection of custom HTTP headers for load requests -var LoadHTTPCustomHeaders = map[string]string{} - -// LoadFromFileOrHTTP loads the bytes from a file or a remote http server based on the path passed in -func LoadFromFileOrHTTP(path string) ([]byte, error) { - return LoadStrategy(path, ioutil.ReadFile, loadHTTPBytes(LoadHTTPTimeout))(path) -} - -// LoadFromFileOrHTTPWithTimeout loads the bytes from a file or a remote http server based on the path passed in -// timeout arg allows for per request overriding of the request timeout -func LoadFromFileOrHTTPWithTimeout(path string, timeout time.Duration) ([]byte, error) { - return LoadStrategy(path, ioutil.ReadFile, loadHTTPBytes(timeout))(path) -} - -// LoadStrategy returns a loader function for a given path or uri -func LoadStrategy(path string, local, remote func(string) ([]byte, error)) func(string) ([]byte, error) { - if strings.HasPrefix(path, "http") { - return remote - } - return func(pth string) ([]byte, error) { - upth, err := pathUnescape(pth) - if err != nil { - return nil, err - } - - if strings.HasPrefix(pth, `file://`) { - if runtime.GOOS == "windows" { - // support for canonical file URIs on windows. - // Zero tolerance here for dodgy URIs. - u, _ := url.Parse(upth) - if u.Host != "" { - // assume UNC name (volume share) - // file://host/share/folder\... ==> \\host\share\path\folder - // NOTE: UNC port not yet supported - upth = strings.Join([]string{`\`, u.Host, u.Path}, `\`) - } else { - // file:///c:/folder/... ==> just remove the leading slash - upth = strings.TrimPrefix(upth, `file:///`) - } - } else { - upth = strings.TrimPrefix(upth, `file://`) - } - } - - return local(filepath.FromSlash(upth)) - } -} - -func loadHTTPBytes(timeout time.Duration) func(path string) ([]byte, error) { - return func(path string) ([]byte, error) { - client := &http.Client{Timeout: timeout} - req, err := http.NewRequest("GET", path, nil) // nolint: noctx - if err != nil { - return nil, err - } - - if LoadHTTPBasicAuthUsername != "" && LoadHTTPBasicAuthPassword != "" { - req.SetBasicAuth(LoadHTTPBasicAuthUsername, LoadHTTPBasicAuthPassword) - } - - for key, val := range LoadHTTPCustomHeaders { - req.Header.Set(key, val) - } - - resp, err := client.Do(req) - defer func() { - if resp != nil { - if e := resp.Body.Close(); e != nil { - log.Println(e) - } - } - }() - if err != nil { - return nil, err - } - - if resp.StatusCode != http.StatusOK { - return nil, fmt.Errorf("could not access document at %q [%s] ", path, resp.Status) - } - - return ioutil.ReadAll(resp.Body) - } -} diff --git a/vendor/github.com/go-openapi/swag/name_lexem.go b/vendor/github.com/go-openapi/swag/name_lexem.go deleted file mode 100644 index aa7f6a9bb..000000000 --- a/vendor/github.com/go-openapi/swag/name_lexem.go +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright 2015 go-swagger maintainers -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package swag - -import "unicode" - -type ( - nameLexem interface { - GetUnsafeGoName() string - GetOriginal() string - IsInitialism() bool - } - - initialismNameLexem struct { - original string - matchedInitialism string - } - - casualNameLexem struct { - original string - } -) - -func newInitialismNameLexem(original, matchedInitialism string) *initialismNameLexem { - return &initialismNameLexem{ - original: original, - matchedInitialism: matchedInitialism, - } -} - -func newCasualNameLexem(original string) *casualNameLexem { - return &casualNameLexem{ - original: original, - } -} - -func (l *initialismNameLexem) GetUnsafeGoName() string { - return l.matchedInitialism -} - -func (l *casualNameLexem) GetUnsafeGoName() string { - var first rune - var rest string - for i, orig := range l.original { - if i == 0 { - first = orig - continue - } - if i > 0 { - rest = l.original[i:] - break - } - } - if len(l.original) > 1 { - return string(unicode.ToUpper(first)) + lower(rest) - } - - return l.original -} - -func (l *initialismNameLexem) GetOriginal() string { - return l.original -} - -func (l *casualNameLexem) GetOriginal() string { - return l.original -} - -func (l *initialismNameLexem) IsInitialism() bool { - return true -} - -func (l *casualNameLexem) IsInitialism() bool { - return false -} diff --git a/vendor/github.com/go-openapi/swag/net.go b/vendor/github.com/go-openapi/swag/net.go deleted file mode 100644 index 821235f84..000000000 --- a/vendor/github.com/go-openapi/swag/net.go +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2015 go-swagger maintainers -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package swag - -import ( - "net" - "strconv" -) - -// SplitHostPort splits a network address into a host and a port. -// The port is -1 when there is no port to be found -func SplitHostPort(addr string) (host string, port int, err error) { - h, p, err := net.SplitHostPort(addr) - if err != nil { - return "", -1, err - } - if p == "" { - return "", -1, &net.AddrError{Err: "missing port in address", Addr: addr} - } - - pi, err := strconv.Atoi(p) - if err != nil { - return "", -1, err - } - return h, pi, nil -} diff --git a/vendor/github.com/go-openapi/swag/path.go b/vendor/github.com/go-openapi/swag/path.go deleted file mode 100644 index 941bd0176..000000000 --- a/vendor/github.com/go-openapi/swag/path.go +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2015 go-swagger maintainers -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package swag - -import ( - "os" - "path/filepath" - "runtime" - "strings" -) - -const ( - // GOPATHKey represents the env key for gopath - GOPATHKey = "GOPATH" -) - -// FindInSearchPath finds a package in a provided lists of paths -func FindInSearchPath(searchPath, pkg string) string { - pathsList := filepath.SplitList(searchPath) - for _, path := range pathsList { - if evaluatedPath, err := filepath.EvalSymlinks(filepath.Join(path, "src", pkg)); err == nil { - if _, err := os.Stat(evaluatedPath); err == nil { - return evaluatedPath - } - } - } - return "" -} - -// FindInGoSearchPath finds a package in the $GOPATH:$GOROOT -func FindInGoSearchPath(pkg string) string { - return FindInSearchPath(FullGoSearchPath(), pkg) -} - -// FullGoSearchPath gets the search paths for finding packages -func FullGoSearchPath() string { - allPaths := os.Getenv(GOPATHKey) - if allPaths == "" { - allPaths = filepath.Join(os.Getenv("HOME"), "go") - } - if allPaths != "" { - allPaths = strings.Join([]string{allPaths, runtime.GOROOT()}, ":") - } else { - allPaths = runtime.GOROOT() - } - return allPaths -} diff --git a/vendor/github.com/go-openapi/swag/post_go18.go b/vendor/github.com/go-openapi/swag/post_go18.go deleted file mode 100644 index f5228b82c..000000000 --- a/vendor/github.com/go-openapi/swag/post_go18.go +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2015 go-swagger maintainers -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//go:build go1.8 -// +build go1.8 - -package swag - -import "net/url" - -func pathUnescape(path string) (string, error) { - return url.PathUnescape(path) -} diff --git a/vendor/github.com/go-openapi/swag/post_go19.go b/vendor/github.com/go-openapi/swag/post_go19.go deleted file mode 100644 index 7c7da9c08..000000000 --- a/vendor/github.com/go-openapi/swag/post_go19.go +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2015 go-swagger maintainers -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//go:build go1.9 -// +build go1.9 - -package swag - -import ( - "sort" - "sync" -) - -// indexOfInitialisms is a thread-safe implementation of the sorted index of initialisms. -// Since go1.9, this may be implemented with sync.Map. -type indexOfInitialisms struct { - sortMutex *sync.Mutex - index *sync.Map -} - -func newIndexOfInitialisms() *indexOfInitialisms { - return &indexOfInitialisms{ - sortMutex: new(sync.Mutex), - index: new(sync.Map), - } -} - -func (m *indexOfInitialisms) load(initial map[string]bool) *indexOfInitialisms { - m.sortMutex.Lock() - defer m.sortMutex.Unlock() - for k, v := range initial { - m.index.Store(k, v) - } - return m -} - -func (m *indexOfInitialisms) isInitialism(key string) bool { - _, ok := m.index.Load(key) - return ok -} - -func (m *indexOfInitialisms) add(key string) *indexOfInitialisms { - m.index.Store(key, true) - return m -} - -func (m *indexOfInitialisms) sorted() (result []string) { - m.sortMutex.Lock() - defer m.sortMutex.Unlock() - m.index.Range(func(key, value interface{}) bool { - k := key.(string) - result = append(result, k) - return true - }) - sort.Sort(sort.Reverse(byInitialism(result))) - return -} diff --git a/vendor/github.com/go-openapi/swag/pre_go18.go b/vendor/github.com/go-openapi/swag/pre_go18.go deleted file mode 100644 index 2757d9b95..000000000 --- a/vendor/github.com/go-openapi/swag/pre_go18.go +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2015 go-swagger maintainers -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//go:build !go1.8 -// +build !go1.8 - -package swag - -import "net/url" - -func pathUnescape(path string) (string, error) { - return url.QueryUnescape(path) -} diff --git a/vendor/github.com/go-openapi/swag/pre_go19.go b/vendor/github.com/go-openapi/swag/pre_go19.go deleted file mode 100644 index 0565db377..000000000 --- a/vendor/github.com/go-openapi/swag/pre_go19.go +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2015 go-swagger maintainers -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//go:build !go1.9 -// +build !go1.9 - -package swag - -import ( - "sort" - "sync" -) - -// indexOfInitialisms is a thread-safe implementation of the sorted index of initialisms. -// Before go1.9, this may be implemented with a mutex on the map. -type indexOfInitialisms struct { - getMutex *sync.Mutex - index map[string]bool -} - -func newIndexOfInitialisms() *indexOfInitialisms { - return &indexOfInitialisms{ - getMutex: new(sync.Mutex), - index: make(map[string]bool, 50), - } -} - -func (m *indexOfInitialisms) load(initial map[string]bool) *indexOfInitialisms { - m.getMutex.Lock() - defer m.getMutex.Unlock() - for k, v := range initial { - m.index[k] = v - } - return m -} - -func (m *indexOfInitialisms) isInitialism(key string) bool { - m.getMutex.Lock() - defer m.getMutex.Unlock() - _, ok := m.index[key] - return ok -} - -func (m *indexOfInitialisms) add(key string) *indexOfInitialisms { - m.getMutex.Lock() - defer m.getMutex.Unlock() - m.index[key] = true - return m -} - -func (m *indexOfInitialisms) sorted() (result []string) { - m.getMutex.Lock() - defer m.getMutex.Unlock() - for k := range m.index { - result = append(result, k) - } - sort.Sort(sort.Reverse(byInitialism(result))) - return -} diff --git a/vendor/github.com/go-openapi/swag/split.go b/vendor/github.com/go-openapi/swag/split.go deleted file mode 100644 index a1825fb7d..000000000 --- a/vendor/github.com/go-openapi/swag/split.go +++ /dev/null @@ -1,262 +0,0 @@ -// Copyright 2015 go-swagger maintainers -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package swag - -import ( - "unicode" -) - -var nameReplaceTable = map[rune]string{ - '@': "At ", - '&': "And ", - '|': "Pipe ", - '$': "Dollar ", - '!': "Bang ", - '-': "", - '_': "", -} - -type ( - splitter struct { - postSplitInitialismCheck bool - initialisms []string - } - - splitterOption func(*splitter) *splitter -) - -// split calls the splitter; splitter provides more control and post options -func split(str string) []string { - lexems := newSplitter().split(str) - result := make([]string, 0, len(lexems)) - - for _, lexem := range lexems { - result = append(result, lexem.GetOriginal()) - } - - return result - -} - -func (s *splitter) split(str string) []nameLexem { - return s.toNameLexems(str) -} - -func newSplitter(options ...splitterOption) *splitter { - splitter := &splitter{ - postSplitInitialismCheck: false, - initialisms: initialisms, - } - - for _, option := range options { - splitter = option(splitter) - } - - return splitter -} - -// withPostSplitInitialismCheck allows to catch initialisms after main split process -func withPostSplitInitialismCheck(s *splitter) *splitter { - s.postSplitInitialismCheck = true - return s -} - -type ( - initialismMatch struct { - start, end int - body []rune - complete bool - } - initialismMatches []*initialismMatch -) - -func (s *splitter) toNameLexems(name string) []nameLexem { - nameRunes := []rune(name) - matches := s.gatherInitialismMatches(nameRunes) - return s.mapMatchesToNameLexems(nameRunes, matches) -} - -func (s *splitter) gatherInitialismMatches(nameRunes []rune) initialismMatches { - matches := make(initialismMatches, 0) - - for currentRunePosition, currentRune := range nameRunes { - newMatches := make(initialismMatches, 0, len(matches)) - - // check current initialism matches - for _, match := range matches { - if keepCompleteMatch := match.complete; keepCompleteMatch { - newMatches = append(newMatches, match) - continue - } - - // drop failed match - currentMatchRune := match.body[currentRunePosition-match.start] - if !s.initialismRuneEqual(currentMatchRune, currentRune) { - continue - } - - // try to complete ongoing match - if currentRunePosition-match.start == len(match.body)-1 { - // we are close; the next step is to check the symbol ahead - // if it is a small letter, then it is not the end of match - // but beginning of the next word - - if currentRunePosition < len(nameRunes)-1 { - nextRune := nameRunes[currentRunePosition+1] - if newWord := unicode.IsLower(nextRune); newWord { - // oh ok, it was the start of a new word - continue - } - } - - match.complete = true - match.end = currentRunePosition - } - - newMatches = append(newMatches, match) - } - - // check for new initialism matches - for _, initialism := range s.initialisms { - initialismRunes := []rune(initialism) - if s.initialismRuneEqual(initialismRunes[0], currentRune) { - newMatches = append(newMatches, &initialismMatch{ - start: currentRunePosition, - body: initialismRunes, - complete: false, - }) - } - } - - matches = newMatches - } - - return matches -} - -func (s *splitter) mapMatchesToNameLexems(nameRunes []rune, matches initialismMatches) []nameLexem { - nameLexems := make([]nameLexem, 0) - - var lastAcceptedMatch *initialismMatch - for _, match := range matches { - if !match.complete { - continue - } - - if firstMatch := lastAcceptedMatch == nil; firstMatch { - nameLexems = append(nameLexems, s.breakCasualString(nameRunes[:match.start])...) - nameLexems = append(nameLexems, s.breakInitialism(string(match.body))) - - lastAcceptedMatch = match - - continue - } - - if overlappedMatch := match.start <= lastAcceptedMatch.end; overlappedMatch { - continue - } - - middle := nameRunes[lastAcceptedMatch.end+1 : match.start] - nameLexems = append(nameLexems, s.breakCasualString(middle)...) - nameLexems = append(nameLexems, s.breakInitialism(string(match.body))) - - lastAcceptedMatch = match - } - - // we have not found any accepted matches - if lastAcceptedMatch == nil { - return s.breakCasualString(nameRunes) - } - - if lastAcceptedMatch.end+1 != len(nameRunes) { - rest := nameRunes[lastAcceptedMatch.end+1:] - nameLexems = append(nameLexems, s.breakCasualString(rest)...) - } - - return nameLexems -} - -func (s *splitter) initialismRuneEqual(a, b rune) bool { - return a == b -} - -func (s *splitter) breakInitialism(original string) nameLexem { - return newInitialismNameLexem(original, original) -} - -func (s *splitter) breakCasualString(str []rune) []nameLexem { - segments := make([]nameLexem, 0) - currentSegment := "" - - addCasualNameLexem := func(original string) { - segments = append(segments, newCasualNameLexem(original)) - } - - addInitialismNameLexem := func(original, match string) { - segments = append(segments, newInitialismNameLexem(original, match)) - } - - addNameLexem := func(original string) { - if s.postSplitInitialismCheck { - for _, initialism := range s.initialisms { - if upper(initialism) == upper(original) { - addInitialismNameLexem(original, initialism) - return - } - } - } - - addCasualNameLexem(original) - } - - for _, rn := range string(str) { - if replace, found := nameReplaceTable[rn]; found { - if currentSegment != "" { - addNameLexem(currentSegment) - currentSegment = "" - } - - if replace != "" { - addNameLexem(replace) - } - - continue - } - - if !unicode.In(rn, unicode.L, unicode.M, unicode.N, unicode.Pc) { - if currentSegment != "" { - addNameLexem(currentSegment) - currentSegment = "" - } - - continue - } - - if unicode.IsUpper(rn) { - if currentSegment != "" { - addNameLexem(currentSegment) - } - currentSegment = "" - } - - currentSegment += string(rn) - } - - if currentSegment != "" { - addNameLexem(currentSegment) - } - - return segments -} diff --git a/vendor/github.com/go-openapi/swag/util.go b/vendor/github.com/go-openapi/swag/util.go deleted file mode 100644 index 193702f2c..000000000 --- a/vendor/github.com/go-openapi/swag/util.go +++ /dev/null @@ -1,385 +0,0 @@ -// Copyright 2015 go-swagger maintainers -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package swag - -import ( - "reflect" - "strings" - "unicode" -) - -// commonInitialisms are common acronyms that are kept as whole uppercased words. -var commonInitialisms *indexOfInitialisms - -// initialisms is a slice of sorted initialisms -var initialisms []string - -var isInitialism func(string) bool - -// GoNamePrefixFunc sets an optional rule to prefix go names -// which do not start with a letter. -// -// e.g. to help convert "123" into "{prefix}123" -// -// The default is to prefix with "X" -var GoNamePrefixFunc func(string) string - -func init() { - // Taken from https://github.com/golang/lint/blob/3390df4df2787994aea98de825b964ac7944b817/lint.go#L732-L769 - var configuredInitialisms = map[string]bool{ - "ACL": true, - "API": true, - "ASCII": true, - "CPU": true, - "CSS": true, - "DNS": true, - "EOF": true, - "GUID": true, - "HTML": true, - "HTTPS": true, - "HTTP": true, - "ID": true, - "IP": true, - "IPv4": true, - "IPv6": true, - "JSON": true, - "LHS": true, - "OAI": true, - "QPS": true, - "RAM": true, - "RHS": true, - "RPC": true, - "SLA": true, - "SMTP": true, - "SQL": true, - "SSH": true, - "TCP": true, - "TLS": true, - "TTL": true, - "UDP": true, - "UI": true, - "UID": true, - "UUID": true, - "URI": true, - "URL": true, - "UTF8": true, - "VM": true, - "XML": true, - "XMPP": true, - "XSRF": true, - "XSS": true, - } - - // a thread-safe index of initialisms - commonInitialisms = newIndexOfInitialisms().load(configuredInitialisms) - initialisms = commonInitialisms.sorted() - - // a test function - isInitialism = commonInitialisms.isInitialism -} - -const ( - // collectionFormatComma = "csv" - collectionFormatSpace = "ssv" - collectionFormatTab = "tsv" - collectionFormatPipe = "pipes" - collectionFormatMulti = "multi" -) - -// JoinByFormat joins a string array by a known format (e.g. swagger's collectionFormat attribute): -// ssv: space separated value -// tsv: tab separated value -// pipes: pipe (|) separated value -// csv: comma separated value (default) -func JoinByFormat(data []string, format string) []string { - if len(data) == 0 { - return data - } - var sep string - switch format { - case collectionFormatSpace: - sep = " " - case collectionFormatTab: - sep = "\t" - case collectionFormatPipe: - sep = "|" - case collectionFormatMulti: - return data - default: - sep = "," - } - return []string{strings.Join(data, sep)} -} - -// SplitByFormat splits a string by a known format: -// ssv: space separated value -// tsv: tab separated value -// pipes: pipe (|) separated value -// csv: comma separated value (default) -// -func SplitByFormat(data, format string) []string { - if data == "" { - return nil - } - var sep string - switch format { - case collectionFormatSpace: - sep = " " - case collectionFormatTab: - sep = "\t" - case collectionFormatPipe: - sep = "|" - case collectionFormatMulti: - return nil - default: - sep = "," - } - var result []string - for _, s := range strings.Split(data, sep) { - if ts := strings.TrimSpace(s); ts != "" { - result = append(result, ts) - } - } - return result -} - -type byInitialism []string - -func (s byInitialism) Len() int { - return len(s) -} -func (s byInitialism) Swap(i, j int) { - s[i], s[j] = s[j], s[i] -} -func (s byInitialism) Less(i, j int) bool { - if len(s[i]) != len(s[j]) { - return len(s[i]) < len(s[j]) - } - - return strings.Compare(s[i], s[j]) > 0 -} - -// Removes leading whitespaces -func trim(str string) string { - return strings.Trim(str, " ") -} - -// Shortcut to strings.ToUpper() -func upper(str string) string { - return strings.ToUpper(trim(str)) -} - -// Shortcut to strings.ToLower() -func lower(str string) string { - return strings.ToLower(trim(str)) -} - -// Camelize an uppercased word -func Camelize(word string) (camelized string) { - for pos, ru := range []rune(word) { - if pos > 0 { - camelized += string(unicode.ToLower(ru)) - } else { - camelized += string(unicode.ToUpper(ru)) - } - } - return -} - -// ToFileName lowercases and underscores a go type name -func ToFileName(name string) string { - in := split(name) - out := make([]string, 0, len(in)) - - for _, w := range in { - out = append(out, lower(w)) - } - - return strings.Join(out, "_") -} - -// ToCommandName lowercases and underscores a go type name -func ToCommandName(name string) string { - in := split(name) - out := make([]string, 0, len(in)) - - for _, w := range in { - out = append(out, lower(w)) - } - return strings.Join(out, "-") -} - -// ToHumanNameLower represents a code name as a human series of words -func ToHumanNameLower(name string) string { - in := newSplitter(withPostSplitInitialismCheck).split(name) - out := make([]string, 0, len(in)) - - for _, w := range in { - if !w.IsInitialism() { - out = append(out, lower(w.GetOriginal())) - } else { - out = append(out, w.GetOriginal()) - } - } - - return strings.Join(out, " ") -} - -// ToHumanNameTitle represents a code name as a human series of words with the first letters titleized -func ToHumanNameTitle(name string) string { - in := newSplitter(withPostSplitInitialismCheck).split(name) - - out := make([]string, 0, len(in)) - for _, w := range in { - original := w.GetOriginal() - if !w.IsInitialism() { - out = append(out, Camelize(original)) - } else { - out = append(out, original) - } - } - return strings.Join(out, " ") -} - -// ToJSONName camelcases a name which can be underscored or pascal cased -func ToJSONName(name string) string { - in := split(name) - out := make([]string, 0, len(in)) - - for i, w := range in { - if i == 0 { - out = append(out, lower(w)) - continue - } - out = append(out, Camelize(w)) - } - return strings.Join(out, "") -} - -// ToVarName camelcases a name which can be underscored or pascal cased -func ToVarName(name string) string { - res := ToGoName(name) - if isInitialism(res) { - return lower(res) - } - if len(res) <= 1 { - return lower(res) - } - return lower(res[:1]) + res[1:] -} - -// ToGoName translates a swagger name which can be underscored or camel cased to a name that golint likes -func ToGoName(name string) string { - lexems := newSplitter(withPostSplitInitialismCheck).split(name) - - result := "" - for _, lexem := range lexems { - goName := lexem.GetUnsafeGoName() - - // to support old behavior - if lexem.IsInitialism() { - goName = upper(goName) - } - result += goName - } - - if len(result) > 0 { - // Only prefix with X when the first character isn't an ascii letter - first := []rune(result)[0] - if !unicode.IsLetter(first) || (first > unicode.MaxASCII && !unicode.IsUpper(first)) { - if GoNamePrefixFunc == nil { - return "X" + result - } - result = GoNamePrefixFunc(name) + result - } - first = []rune(result)[0] - if unicode.IsLetter(first) && !unicode.IsUpper(first) { - result = string(append([]rune{unicode.ToUpper(first)}, []rune(result)[1:]...)) - } - } - - return result -} - -// ContainsStrings searches a slice of strings for a case-sensitive match -func ContainsStrings(coll []string, item string) bool { - for _, a := range coll { - if a == item { - return true - } - } - return false -} - -// ContainsStringsCI searches a slice of strings for a case-insensitive match -func ContainsStringsCI(coll []string, item string) bool { - for _, a := range coll { - if strings.EqualFold(a, item) { - return true - } - } - return false -} - -type zeroable interface { - IsZero() bool -} - -// IsZero returns true when the value passed into the function is a zero value. -// This allows for safer checking of interface values. -func IsZero(data interface{}) bool { - // check for things that have an IsZero method instead - if vv, ok := data.(zeroable); ok { - return vv.IsZero() - } - // continue with slightly more complex reflection - v := reflect.ValueOf(data) - switch v.Kind() { - case reflect.String: - return v.Len() == 0 - case reflect.Bool: - return !v.Bool() - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return v.Int() == 0 - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - return v.Uint() == 0 - case reflect.Float32, reflect.Float64: - return v.Float() == 0 - case reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice: - return v.IsNil() - case reflect.Struct, reflect.Array: - return reflect.DeepEqual(data, reflect.Zero(v.Type()).Interface()) - case reflect.Invalid: - return true - } - return false -} - -// AddInitialisms add additional initialisms -func AddInitialisms(words ...string) { - for _, word := range words { - // commonInitialisms[upper(word)] = true - commonInitialisms.add(upper(word)) - } - // sort again - initialisms = commonInitialisms.sorted() -} - -// CommandLineOptionsGroup represents a group of user-defined command line options -type CommandLineOptionsGroup struct { - ShortDescription string - LongDescription string - Options interface{} -} diff --git a/vendor/github.com/go-openapi/swag/yaml.go b/vendor/github.com/go-openapi/swag/yaml.go deleted file mode 100644 index ec9691440..000000000 --- a/vendor/github.com/go-openapi/swag/yaml.go +++ /dev/null @@ -1,246 +0,0 @@ -// Copyright 2015 go-swagger maintainers -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package swag - -import ( - "encoding/json" - "fmt" - "path/filepath" - "strconv" - - "github.com/mailru/easyjson/jlexer" - "github.com/mailru/easyjson/jwriter" - yaml "gopkg.in/yaml.v2" -) - -// YAMLMatcher matches yaml -func YAMLMatcher(path string) bool { - ext := filepath.Ext(path) - return ext == ".yaml" || ext == ".yml" -} - -// YAMLToJSON converts YAML unmarshaled data into json compatible data -func YAMLToJSON(data interface{}) (json.RawMessage, error) { - jm, err := transformData(data) - if err != nil { - return nil, err - } - b, err := WriteJSON(jm) - return json.RawMessage(b), err -} - -// BytesToYAMLDoc converts a byte slice into a YAML document -func BytesToYAMLDoc(data []byte) (interface{}, error) { - var canary map[interface{}]interface{} // validate this is an object and not a different type - if err := yaml.Unmarshal(data, &canary); err != nil { - return nil, err - } - - var document yaml.MapSlice // preserve order that is present in the document - if err := yaml.Unmarshal(data, &document); err != nil { - return nil, err - } - return document, nil -} - -// JSONMapSlice represent a JSON object, with the order of keys maintained -type JSONMapSlice []JSONMapItem - -// MarshalJSON renders a JSONMapSlice as JSON -func (s JSONMapSlice) MarshalJSON() ([]byte, error) { - w := &jwriter.Writer{Flags: jwriter.NilMapAsEmpty | jwriter.NilSliceAsEmpty} - s.MarshalEasyJSON(w) - return w.BuildBytes() -} - -// MarshalEasyJSON renders a JSONMapSlice as JSON, using easyJSON -func (s JSONMapSlice) MarshalEasyJSON(w *jwriter.Writer) { - w.RawByte('{') - - ln := len(s) - last := ln - 1 - for i := 0; i < ln; i++ { - s[i].MarshalEasyJSON(w) - if i != last { // last item - w.RawByte(',') - } - } - - w.RawByte('}') -} - -// UnmarshalJSON makes a JSONMapSlice from JSON -func (s *JSONMapSlice) UnmarshalJSON(data []byte) error { - l := jlexer.Lexer{Data: data} - s.UnmarshalEasyJSON(&l) - return l.Error() -} - -// UnmarshalEasyJSON makes a JSONMapSlice from JSON, using easyJSON -func (s *JSONMapSlice) UnmarshalEasyJSON(in *jlexer.Lexer) { - if in.IsNull() { - in.Skip() - return - } - - var result JSONMapSlice - in.Delim('{') - for !in.IsDelim('}') { - var mi JSONMapItem - mi.UnmarshalEasyJSON(in) - result = append(result, mi) - } - *s = result -} - -// JSONMapItem represents the value of a key in a JSON object held by JSONMapSlice -type JSONMapItem struct { - Key string - Value interface{} -} - -// MarshalJSON renders a JSONMapItem as JSON -func (s JSONMapItem) MarshalJSON() ([]byte, error) { - w := &jwriter.Writer{Flags: jwriter.NilMapAsEmpty | jwriter.NilSliceAsEmpty} - s.MarshalEasyJSON(w) - return w.BuildBytes() -} - -// MarshalEasyJSON renders a JSONMapItem as JSON, using easyJSON -func (s JSONMapItem) MarshalEasyJSON(w *jwriter.Writer) { - w.String(s.Key) - w.RawByte(':') - w.Raw(WriteJSON(s.Value)) -} - -// UnmarshalJSON makes a JSONMapItem from JSON -func (s *JSONMapItem) UnmarshalJSON(data []byte) error { - l := jlexer.Lexer{Data: data} - s.UnmarshalEasyJSON(&l) - return l.Error() -} - -// UnmarshalEasyJSON makes a JSONMapItem from JSON, using easyJSON -func (s *JSONMapItem) UnmarshalEasyJSON(in *jlexer.Lexer) { - key := in.UnsafeString() - in.WantColon() - value := in.Interface() - in.WantComma() - s.Key = key - s.Value = value -} - -func transformData(input interface{}) (out interface{}, err error) { - format := func(t interface{}) (string, error) { - switch k := t.(type) { - case string: - return k, nil - case uint: - return strconv.FormatUint(uint64(k), 10), nil - case uint8: - return strconv.FormatUint(uint64(k), 10), nil - case uint16: - return strconv.FormatUint(uint64(k), 10), nil - case uint32: - return strconv.FormatUint(uint64(k), 10), nil - case uint64: - return strconv.FormatUint(k, 10), nil - case int: - return strconv.Itoa(k), nil - case int8: - return strconv.FormatInt(int64(k), 10), nil - case int16: - return strconv.FormatInt(int64(k), 10), nil - case int32: - return strconv.FormatInt(int64(k), 10), nil - case int64: - return strconv.FormatInt(k, 10), nil - default: - return "", fmt.Errorf("unexpected map key type, got: %T", k) - } - } - - switch in := input.(type) { - case yaml.MapSlice: - - o := make(JSONMapSlice, len(in)) - for i, mi := range in { - var nmi JSONMapItem - if nmi.Key, err = format(mi.Key); err != nil { - return nil, err - } - - v, ert := transformData(mi.Value) - if ert != nil { - return nil, ert - } - nmi.Value = v - o[i] = nmi - } - return o, nil - case map[interface{}]interface{}: - o := make(JSONMapSlice, 0, len(in)) - for ke, va := range in { - var nmi JSONMapItem - if nmi.Key, err = format(ke); err != nil { - return nil, err - } - - v, ert := transformData(va) - if ert != nil { - return nil, ert - } - nmi.Value = v - o = append(o, nmi) - } - return o, nil - case []interface{}: - len1 := len(in) - o := make([]interface{}, len1) - for i := 0; i < len1; i++ { - o[i], err = transformData(in[i]) - if err != nil { - return nil, err - } - } - return o, nil - } - return input, nil -} - -// YAMLDoc loads a yaml document from either http or a file and converts it to json -func YAMLDoc(path string) (json.RawMessage, error) { - yamlDoc, err := YAMLData(path) - if err != nil { - return nil, err - } - - data, err := YAMLToJSON(yamlDoc) - if err != nil { - return nil, err - } - - return data, nil -} - -// YAMLData loads a yaml document from either http or a file -func YAMLData(path string) (interface{}, error) { - data, err := LoadFromFileOrHTTP(path) - if err != nil { - return nil, err - } - - return BytesToYAMLDoc(data) -} diff --git a/vendor/github.com/gogo/protobuf/AUTHORS b/vendor/github.com/gogo/protobuf/AUTHORS deleted file mode 100644 index 3d97fc7a2..000000000 --- a/vendor/github.com/gogo/protobuf/AUTHORS +++ /dev/null @@ -1,15 +0,0 @@ -# This is the official list of GoGo authors for copyright purposes. -# This file is distinct from the CONTRIBUTORS file, which -# lists people. For example, employees are listed in CONTRIBUTORS, -# but not in AUTHORS, because the employer holds the copyright. - -# Names should be added to this file as one of -# Organization's name -# Individual's name -# Individual's name - -# Please keep the list sorted. - -Sendgrid, Inc -Vastech SA (PTY) LTD -Walter Schulze diff --git a/vendor/github.com/gogo/protobuf/CONTRIBUTORS b/vendor/github.com/gogo/protobuf/CONTRIBUTORS deleted file mode 100644 index 1b4f6c208..000000000 --- a/vendor/github.com/gogo/protobuf/CONTRIBUTORS +++ /dev/null @@ -1,23 +0,0 @@ -Anton Povarov -Brian Goff -Clayton Coleman -Denis Smirnov -DongYun Kang -Dwayne Schultz -Georg Apitz -Gustav Paul -Johan Brandhorst -John Shahid -John Tuley -Laurent -Patrick Lee -Peter Edge -Roger Johansson -Sam Nguyen -Sergio Arbeo -Stephen J Day -Tamir Duberstein -Todd Eisenberger -Tormod Erevik Lea -Vyacheslav Kim -Walter Schulze diff --git a/vendor/github.com/gogo/protobuf/LICENSE b/vendor/github.com/gogo/protobuf/LICENSE deleted file mode 100644 index f57de90da..000000000 --- a/vendor/github.com/gogo/protobuf/LICENSE +++ /dev/null @@ -1,35 +0,0 @@ -Copyright (c) 2013, The GoGo Authors. All rights reserved. - -Protocol Buffers for Go with Gadgets - -Go support for Protocol Buffers - Google's data interchange format - -Copyright 2010 The Go Authors. All rights reserved. -https://github.com/golang/protobuf - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - diff --git a/vendor/github.com/gogo/protobuf/proto/Makefile b/vendor/github.com/gogo/protobuf/proto/Makefile deleted file mode 100644 index 00d65f327..000000000 --- a/vendor/github.com/gogo/protobuf/proto/Makefile +++ /dev/null @@ -1,43 +0,0 @@ -# Go support for Protocol Buffers - Google's data interchange format -# -# Copyright 2010 The Go Authors. All rights reserved. -# https://github.com/golang/protobuf -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -install: - go install - -test: install generate-test-pbs - go test - - -generate-test-pbs: - make install - make -C test_proto - make -C proto3_proto - make diff --git a/vendor/github.com/gogo/protobuf/proto/clone.go b/vendor/github.com/gogo/protobuf/proto/clone.go deleted file mode 100644 index a26b046d9..000000000 --- a/vendor/github.com/gogo/protobuf/proto/clone.go +++ /dev/null @@ -1,258 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2011 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// Protocol buffer deep copy and merge. -// TODO: RawMessage. - -package proto - -import ( - "fmt" - "log" - "reflect" - "strings" -) - -// Clone returns a deep copy of a protocol buffer. -func Clone(src Message) Message { - in := reflect.ValueOf(src) - if in.IsNil() { - return src - } - out := reflect.New(in.Type().Elem()) - dst := out.Interface().(Message) - Merge(dst, src) - return dst -} - -// Merger is the interface representing objects that can merge messages of the same type. -type Merger interface { - // Merge merges src into this message. - // Required and optional fields that are set in src will be set to that value in dst. - // Elements of repeated fields will be appended. - // - // Merge may panic if called with a different argument type than the receiver. - Merge(src Message) -} - -// generatedMerger is the custom merge method that generated protos will have. -// We must add this method since a generate Merge method will conflict with -// many existing protos that have a Merge data field already defined. -type generatedMerger interface { - XXX_Merge(src Message) -} - -// Merge merges src into dst. -// Required and optional fields that are set in src will be set to that value in dst. -// Elements of repeated fields will be appended. -// Merge panics if src and dst are not the same type, or if dst is nil. -func Merge(dst, src Message) { - if m, ok := dst.(Merger); ok { - m.Merge(src) - return - } - - in := reflect.ValueOf(src) - out := reflect.ValueOf(dst) - if out.IsNil() { - panic("proto: nil destination") - } - if in.Type() != out.Type() { - panic(fmt.Sprintf("proto.Merge(%T, %T) type mismatch", dst, src)) - } - if in.IsNil() { - return // Merge from nil src is a noop - } - if m, ok := dst.(generatedMerger); ok { - m.XXX_Merge(src) - return - } - mergeStruct(out.Elem(), in.Elem()) -} - -func mergeStruct(out, in reflect.Value) { - sprop := GetProperties(in.Type()) - for i := 0; i < in.NumField(); i++ { - f := in.Type().Field(i) - if strings.HasPrefix(f.Name, "XXX_") { - continue - } - mergeAny(out.Field(i), in.Field(i), false, sprop.Prop[i]) - } - - if emIn, ok := in.Addr().Interface().(extensionsBytes); ok { - emOut := out.Addr().Interface().(extensionsBytes) - bIn := emIn.GetExtensions() - bOut := emOut.GetExtensions() - *bOut = append(*bOut, *bIn...) - } else if emIn, err := extendable(in.Addr().Interface()); err == nil { - emOut, _ := extendable(out.Addr().Interface()) - mIn, muIn := emIn.extensionsRead() - if mIn != nil { - mOut := emOut.extensionsWrite() - muIn.Lock() - mergeExtension(mOut, mIn) - muIn.Unlock() - } - } - - uf := in.FieldByName("XXX_unrecognized") - if !uf.IsValid() { - return - } - uin := uf.Bytes() - if len(uin) > 0 { - out.FieldByName("XXX_unrecognized").SetBytes(append([]byte(nil), uin...)) - } -} - -// mergeAny performs a merge between two values of the same type. -// viaPtr indicates whether the values were indirected through a pointer (implying proto2). -// prop is set if this is a struct field (it may be nil). -func mergeAny(out, in reflect.Value, viaPtr bool, prop *Properties) { - if in.Type() == protoMessageType { - if !in.IsNil() { - if out.IsNil() { - out.Set(reflect.ValueOf(Clone(in.Interface().(Message)))) - } else { - Merge(out.Interface().(Message), in.Interface().(Message)) - } - } - return - } - switch in.Kind() { - case reflect.Bool, reflect.Float32, reflect.Float64, reflect.Int32, reflect.Int64, - reflect.String, reflect.Uint32, reflect.Uint64: - if !viaPtr && isProto3Zero(in) { - return - } - out.Set(in) - case reflect.Interface: - // Probably a oneof field; copy non-nil values. - if in.IsNil() { - return - } - // Allocate destination if it is not set, or set to a different type. - // Otherwise we will merge as normal. - if out.IsNil() || out.Elem().Type() != in.Elem().Type() { - out.Set(reflect.New(in.Elem().Elem().Type())) // interface -> *T -> T -> new(T) - } - mergeAny(out.Elem(), in.Elem(), false, nil) - case reflect.Map: - if in.Len() == 0 { - return - } - if out.IsNil() { - out.Set(reflect.MakeMap(in.Type())) - } - // For maps with value types of *T or []byte we need to deep copy each value. - elemKind := in.Type().Elem().Kind() - for _, key := range in.MapKeys() { - var val reflect.Value - switch elemKind { - case reflect.Ptr: - val = reflect.New(in.Type().Elem().Elem()) - mergeAny(val, in.MapIndex(key), false, nil) - case reflect.Slice: - val = in.MapIndex(key) - val = reflect.ValueOf(append([]byte{}, val.Bytes()...)) - default: - val = in.MapIndex(key) - } - out.SetMapIndex(key, val) - } - case reflect.Ptr: - if in.IsNil() { - return - } - if out.IsNil() { - out.Set(reflect.New(in.Elem().Type())) - } - mergeAny(out.Elem(), in.Elem(), true, nil) - case reflect.Slice: - if in.IsNil() { - return - } - if in.Type().Elem().Kind() == reflect.Uint8 { - // []byte is a scalar bytes field, not a repeated field. - - // Edge case: if this is in a proto3 message, a zero length - // bytes field is considered the zero value, and should not - // be merged. - if prop != nil && prop.proto3 && in.Len() == 0 { - return - } - - // Make a deep copy. - // Append to []byte{} instead of []byte(nil) so that we never end up - // with a nil result. - out.SetBytes(append([]byte{}, in.Bytes()...)) - return - } - n := in.Len() - if out.IsNil() { - out.Set(reflect.MakeSlice(in.Type(), 0, n)) - } - switch in.Type().Elem().Kind() { - case reflect.Bool, reflect.Float32, reflect.Float64, reflect.Int32, reflect.Int64, - reflect.String, reflect.Uint32, reflect.Uint64: - out.Set(reflect.AppendSlice(out, in)) - default: - for i := 0; i < n; i++ { - x := reflect.Indirect(reflect.New(in.Type().Elem())) - mergeAny(x, in.Index(i), false, nil) - out.Set(reflect.Append(out, x)) - } - } - case reflect.Struct: - mergeStruct(out, in) - default: - // unknown type, so not a protocol buffer - log.Printf("proto: don't know how to copy %v", in) - } -} - -func mergeExtension(out, in map[int32]Extension) { - for extNum, eIn := range in { - eOut := Extension{desc: eIn.desc} - if eIn.value != nil { - v := reflect.New(reflect.TypeOf(eIn.value)).Elem() - mergeAny(v, reflect.ValueOf(eIn.value), false, nil) - eOut.value = v.Interface() - } - if eIn.enc != nil { - eOut.enc = make([]byte, len(eIn.enc)) - copy(eOut.enc, eIn.enc) - } - - out[extNum] = eOut - } -} diff --git a/vendor/github.com/gogo/protobuf/proto/custom_gogo.go b/vendor/github.com/gogo/protobuf/proto/custom_gogo.go deleted file mode 100644 index 24552483c..000000000 --- a/vendor/github.com/gogo/protobuf/proto/custom_gogo.go +++ /dev/null @@ -1,39 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2018, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -import "reflect" - -type custom interface { - Marshal() ([]byte, error) - Unmarshal(data []byte) error - Size() int -} - -var customType = reflect.TypeOf((*custom)(nil)).Elem() diff --git a/vendor/github.com/gogo/protobuf/proto/decode.go b/vendor/github.com/gogo/protobuf/proto/decode.go deleted file mode 100644 index 63b0f08be..000000000 --- a/vendor/github.com/gogo/protobuf/proto/decode.go +++ /dev/null @@ -1,427 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -/* - * Routines for decoding protocol buffer data to construct in-memory representations. - */ - -import ( - "errors" - "fmt" - "io" -) - -// errOverflow is returned when an integer is too large to be represented. -var errOverflow = errors.New("proto: integer overflow") - -// ErrInternalBadWireType is returned by generated code when an incorrect -// wire type is encountered. It does not get returned to user code. -var ErrInternalBadWireType = errors.New("proto: internal error: bad wiretype for oneof") - -// DecodeVarint reads a varint-encoded integer from the slice. -// It returns the integer and the number of bytes consumed, or -// zero if there is not enough. -// This is the format for the -// int32, int64, uint32, uint64, bool, and enum -// protocol buffer types. -func DecodeVarint(buf []byte) (x uint64, n int) { - for shift := uint(0); shift < 64; shift += 7 { - if n >= len(buf) { - return 0, 0 - } - b := uint64(buf[n]) - n++ - x |= (b & 0x7F) << shift - if (b & 0x80) == 0 { - return x, n - } - } - - // The number is too large to represent in a 64-bit value. - return 0, 0 -} - -func (p *Buffer) decodeVarintSlow() (x uint64, err error) { - i := p.index - l := len(p.buf) - - for shift := uint(0); shift < 64; shift += 7 { - if i >= l { - err = io.ErrUnexpectedEOF - return - } - b := p.buf[i] - i++ - x |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - p.index = i - return - } - } - - // The number is too large to represent in a 64-bit value. - err = errOverflow - return -} - -// DecodeVarint reads a varint-encoded integer from the Buffer. -// This is the format for the -// int32, int64, uint32, uint64, bool, and enum -// protocol buffer types. -func (p *Buffer) DecodeVarint() (x uint64, err error) { - i := p.index - buf := p.buf - - if i >= len(buf) { - return 0, io.ErrUnexpectedEOF - } else if buf[i] < 0x80 { - p.index++ - return uint64(buf[i]), nil - } else if len(buf)-i < 10 { - return p.decodeVarintSlow() - } - - var b uint64 - // we already checked the first byte - x = uint64(buf[i]) - 0x80 - i++ - - b = uint64(buf[i]) - i++ - x += b << 7 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 7 - - b = uint64(buf[i]) - i++ - x += b << 14 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 14 - - b = uint64(buf[i]) - i++ - x += b << 21 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 21 - - b = uint64(buf[i]) - i++ - x += b << 28 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 28 - - b = uint64(buf[i]) - i++ - x += b << 35 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 35 - - b = uint64(buf[i]) - i++ - x += b << 42 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 42 - - b = uint64(buf[i]) - i++ - x += b << 49 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 49 - - b = uint64(buf[i]) - i++ - x += b << 56 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 56 - - b = uint64(buf[i]) - i++ - x += b << 63 - if b&0x80 == 0 { - goto done - } - - return 0, errOverflow - -done: - p.index = i - return x, nil -} - -// DecodeFixed64 reads a 64-bit integer from the Buffer. -// This is the format for the -// fixed64, sfixed64, and double protocol buffer types. -func (p *Buffer) DecodeFixed64() (x uint64, err error) { - // x, err already 0 - i := p.index + 8 - if i < 0 || i > len(p.buf) { - err = io.ErrUnexpectedEOF - return - } - p.index = i - - x = uint64(p.buf[i-8]) - x |= uint64(p.buf[i-7]) << 8 - x |= uint64(p.buf[i-6]) << 16 - x |= uint64(p.buf[i-5]) << 24 - x |= uint64(p.buf[i-4]) << 32 - x |= uint64(p.buf[i-3]) << 40 - x |= uint64(p.buf[i-2]) << 48 - x |= uint64(p.buf[i-1]) << 56 - return -} - -// DecodeFixed32 reads a 32-bit integer from the Buffer. -// This is the format for the -// fixed32, sfixed32, and float protocol buffer types. -func (p *Buffer) DecodeFixed32() (x uint64, err error) { - // x, err already 0 - i := p.index + 4 - if i < 0 || i > len(p.buf) { - err = io.ErrUnexpectedEOF - return - } - p.index = i - - x = uint64(p.buf[i-4]) - x |= uint64(p.buf[i-3]) << 8 - x |= uint64(p.buf[i-2]) << 16 - x |= uint64(p.buf[i-1]) << 24 - return -} - -// DecodeZigzag64 reads a zigzag-encoded 64-bit integer -// from the Buffer. -// This is the format used for the sint64 protocol buffer type. -func (p *Buffer) DecodeZigzag64() (x uint64, err error) { - x, err = p.DecodeVarint() - if err != nil { - return - } - x = (x >> 1) ^ uint64((int64(x&1)<<63)>>63) - return -} - -// DecodeZigzag32 reads a zigzag-encoded 32-bit integer -// from the Buffer. -// This is the format used for the sint32 protocol buffer type. -func (p *Buffer) DecodeZigzag32() (x uint64, err error) { - x, err = p.DecodeVarint() - if err != nil { - return - } - x = uint64((uint32(x) >> 1) ^ uint32((int32(x&1)<<31)>>31)) - return -} - -// DecodeRawBytes reads a count-delimited byte buffer from the Buffer. -// This is the format used for the bytes protocol buffer -// type and for embedded messages. -func (p *Buffer) DecodeRawBytes(alloc bool) (buf []byte, err error) { - n, err := p.DecodeVarint() - if err != nil { - return nil, err - } - - nb := int(n) - if nb < 0 { - return nil, fmt.Errorf("proto: bad byte length %d", nb) - } - end := p.index + nb - if end < p.index || end > len(p.buf) { - return nil, io.ErrUnexpectedEOF - } - - if !alloc { - // todo: check if can get more uses of alloc=false - buf = p.buf[p.index:end] - p.index += nb - return - } - - buf = make([]byte, nb) - copy(buf, p.buf[p.index:]) - p.index += nb - return -} - -// DecodeStringBytes reads an encoded string from the Buffer. -// This is the format used for the proto2 string type. -func (p *Buffer) DecodeStringBytes() (s string, err error) { - buf, err := p.DecodeRawBytes(false) - if err != nil { - return - } - return string(buf), nil -} - -// Unmarshaler is the interface representing objects that can -// unmarshal themselves. The argument points to data that may be -// overwritten, so implementations should not keep references to the -// buffer. -// Unmarshal implementations should not clear the receiver. -// Any unmarshaled data should be merged into the receiver. -// Callers of Unmarshal that do not want to retain existing data -// should Reset the receiver before calling Unmarshal. -type Unmarshaler interface { - Unmarshal([]byte) error -} - -// newUnmarshaler is the interface representing objects that can -// unmarshal themselves. The semantics are identical to Unmarshaler. -// -// This exists to support protoc-gen-go generated messages. -// The proto package will stop type-asserting to this interface in the future. -// -// DO NOT DEPEND ON THIS. -type newUnmarshaler interface { - XXX_Unmarshal([]byte) error -} - -// Unmarshal parses the protocol buffer representation in buf and places the -// decoded result in pb. If the struct underlying pb does not match -// the data in buf, the results can be unpredictable. -// -// Unmarshal resets pb before starting to unmarshal, so any -// existing data in pb is always removed. Use UnmarshalMerge -// to preserve and append to existing data. -func Unmarshal(buf []byte, pb Message) error { - pb.Reset() - if u, ok := pb.(newUnmarshaler); ok { - return u.XXX_Unmarshal(buf) - } - if u, ok := pb.(Unmarshaler); ok { - return u.Unmarshal(buf) - } - return NewBuffer(buf).Unmarshal(pb) -} - -// UnmarshalMerge parses the protocol buffer representation in buf and -// writes the decoded result to pb. If the struct underlying pb does not match -// the data in buf, the results can be unpredictable. -// -// UnmarshalMerge merges into existing data in pb. -// Most code should use Unmarshal instead. -func UnmarshalMerge(buf []byte, pb Message) error { - if u, ok := pb.(newUnmarshaler); ok { - return u.XXX_Unmarshal(buf) - } - if u, ok := pb.(Unmarshaler); ok { - // NOTE: The history of proto have unfortunately been inconsistent - // whether Unmarshaler should or should not implicitly clear itself. - // Some implementations do, most do not. - // Thus, calling this here may or may not do what people want. - // - // See https://github.com/golang/protobuf/issues/424 - return u.Unmarshal(buf) - } - return NewBuffer(buf).Unmarshal(pb) -} - -// DecodeMessage reads a count-delimited message from the Buffer. -func (p *Buffer) DecodeMessage(pb Message) error { - enc, err := p.DecodeRawBytes(false) - if err != nil { - return err - } - return NewBuffer(enc).Unmarshal(pb) -} - -// DecodeGroup reads a tag-delimited group from the Buffer. -// StartGroup tag is already consumed. This function consumes -// EndGroup tag. -func (p *Buffer) DecodeGroup(pb Message) error { - b := p.buf[p.index:] - x, y := findEndGroup(b) - if x < 0 { - return io.ErrUnexpectedEOF - } - err := Unmarshal(b[:x], pb) - p.index += y - return err -} - -// Unmarshal parses the protocol buffer representation in the -// Buffer and places the decoded result in pb. If the struct -// underlying pb does not match the data in the buffer, the results can be -// unpredictable. -// -// Unlike proto.Unmarshal, this does not reset pb before starting to unmarshal. -func (p *Buffer) Unmarshal(pb Message) error { - // If the object can unmarshal itself, let it. - if u, ok := pb.(newUnmarshaler); ok { - err := u.XXX_Unmarshal(p.buf[p.index:]) - p.index = len(p.buf) - return err - } - if u, ok := pb.(Unmarshaler); ok { - // NOTE: The history of proto have unfortunately been inconsistent - // whether Unmarshaler should or should not implicitly clear itself. - // Some implementations do, most do not. - // Thus, calling this here may or may not do what people want. - // - // See https://github.com/golang/protobuf/issues/424 - err := u.Unmarshal(p.buf[p.index:]) - p.index = len(p.buf) - return err - } - - // Slow workaround for messages that aren't Unmarshalers. - // This includes some hand-coded .pb.go files and - // bootstrap protos. - // TODO: fix all of those and then add Unmarshal to - // the Message interface. Then: - // The cast above and code below can be deleted. - // The old unmarshaler can be deleted. - // Clients can call Unmarshal directly (can already do that, actually). - var info InternalMessageInfo - err := info.Unmarshal(pb, p.buf[p.index:]) - p.index = len(p.buf) - return err -} diff --git a/vendor/github.com/gogo/protobuf/proto/deprecated.go b/vendor/github.com/gogo/protobuf/proto/deprecated.go deleted file mode 100644 index 35b882c09..000000000 --- a/vendor/github.com/gogo/protobuf/proto/deprecated.go +++ /dev/null @@ -1,63 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2018 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -import "errors" - -// Deprecated: do not use. -type Stats struct{ Emalloc, Dmalloc, Encode, Decode, Chit, Cmiss, Size uint64 } - -// Deprecated: do not use. -func GetStats() Stats { return Stats{} } - -// Deprecated: do not use. -func MarshalMessageSet(interface{}) ([]byte, error) { - return nil, errors.New("proto: not implemented") -} - -// Deprecated: do not use. -func UnmarshalMessageSet([]byte, interface{}) error { - return errors.New("proto: not implemented") -} - -// Deprecated: do not use. -func MarshalMessageSetJSON(interface{}) ([]byte, error) { - return nil, errors.New("proto: not implemented") -} - -// Deprecated: do not use. -func UnmarshalMessageSetJSON([]byte, interface{}) error { - return errors.New("proto: not implemented") -} - -// Deprecated: do not use. -func RegisterMessageSetType(Message, int32, string) {} diff --git a/vendor/github.com/gogo/protobuf/proto/discard.go b/vendor/github.com/gogo/protobuf/proto/discard.go deleted file mode 100644 index fe1bd7d90..000000000 --- a/vendor/github.com/gogo/protobuf/proto/discard.go +++ /dev/null @@ -1,350 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2017 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -import ( - "fmt" - "reflect" - "strings" - "sync" - "sync/atomic" -) - -type generatedDiscarder interface { - XXX_DiscardUnknown() -} - -// DiscardUnknown recursively discards all unknown fields from this message -// and all embedded messages. -// -// When unmarshaling a message with unrecognized fields, the tags and values -// of such fields are preserved in the Message. This allows a later call to -// marshal to be able to produce a message that continues to have those -// unrecognized fields. To avoid this, DiscardUnknown is used to -// explicitly clear the unknown fields after unmarshaling. -// -// For proto2 messages, the unknown fields of message extensions are only -// discarded from messages that have been accessed via GetExtension. -func DiscardUnknown(m Message) { - if m, ok := m.(generatedDiscarder); ok { - m.XXX_DiscardUnknown() - return - } - // TODO: Dynamically populate a InternalMessageInfo for legacy messages, - // but the master branch has no implementation for InternalMessageInfo, - // so it would be more work to replicate that approach. - discardLegacy(m) -} - -// DiscardUnknown recursively discards all unknown fields. -func (a *InternalMessageInfo) DiscardUnknown(m Message) { - di := atomicLoadDiscardInfo(&a.discard) - if di == nil { - di = getDiscardInfo(reflect.TypeOf(m).Elem()) - atomicStoreDiscardInfo(&a.discard, di) - } - di.discard(toPointer(&m)) -} - -type discardInfo struct { - typ reflect.Type - - initialized int32 // 0: only typ is valid, 1: everything is valid - lock sync.Mutex - - fields []discardFieldInfo - unrecognized field -} - -type discardFieldInfo struct { - field field // Offset of field, guaranteed to be valid - discard func(src pointer) -} - -var ( - discardInfoMap = map[reflect.Type]*discardInfo{} - discardInfoLock sync.Mutex -) - -func getDiscardInfo(t reflect.Type) *discardInfo { - discardInfoLock.Lock() - defer discardInfoLock.Unlock() - di := discardInfoMap[t] - if di == nil { - di = &discardInfo{typ: t} - discardInfoMap[t] = di - } - return di -} - -func (di *discardInfo) discard(src pointer) { - if src.isNil() { - return // Nothing to do. - } - - if atomic.LoadInt32(&di.initialized) == 0 { - di.computeDiscardInfo() - } - - for _, fi := range di.fields { - sfp := src.offset(fi.field) - fi.discard(sfp) - } - - // For proto2 messages, only discard unknown fields in message extensions - // that have been accessed via GetExtension. - if em, err := extendable(src.asPointerTo(di.typ).Interface()); err == nil { - // Ignore lock since DiscardUnknown is not concurrency safe. - emm, _ := em.extensionsRead() - for _, mx := range emm { - if m, ok := mx.value.(Message); ok { - DiscardUnknown(m) - } - } - } - - if di.unrecognized.IsValid() { - *src.offset(di.unrecognized).toBytes() = nil - } -} - -func (di *discardInfo) computeDiscardInfo() { - di.lock.Lock() - defer di.lock.Unlock() - if di.initialized != 0 { - return - } - t := di.typ - n := t.NumField() - - for i := 0; i < n; i++ { - f := t.Field(i) - if strings.HasPrefix(f.Name, "XXX_") { - continue - } - - dfi := discardFieldInfo{field: toField(&f)} - tf := f.Type - - // Unwrap tf to get its most basic type. - var isPointer, isSlice bool - if tf.Kind() == reflect.Slice && tf.Elem().Kind() != reflect.Uint8 { - isSlice = true - tf = tf.Elem() - } - if tf.Kind() == reflect.Ptr { - isPointer = true - tf = tf.Elem() - } - if isPointer && isSlice && tf.Kind() != reflect.Struct { - panic(fmt.Sprintf("%v.%s cannot be a slice of pointers to primitive types", t, f.Name)) - } - - switch tf.Kind() { - case reflect.Struct: - switch { - case !isPointer: - panic(fmt.Sprintf("%v.%s cannot be a direct struct value", t, f.Name)) - case isSlice: // E.g., []*pb.T - discardInfo := getDiscardInfo(tf) - dfi.discard = func(src pointer) { - sps := src.getPointerSlice() - for _, sp := range sps { - if !sp.isNil() { - discardInfo.discard(sp) - } - } - } - default: // E.g., *pb.T - discardInfo := getDiscardInfo(tf) - dfi.discard = func(src pointer) { - sp := src.getPointer() - if !sp.isNil() { - discardInfo.discard(sp) - } - } - } - case reflect.Map: - switch { - case isPointer || isSlice: - panic(fmt.Sprintf("%v.%s cannot be a pointer to a map or a slice of map values", t, f.Name)) - default: // E.g., map[K]V - if tf.Elem().Kind() == reflect.Ptr { // Proto struct (e.g., *T) - dfi.discard = func(src pointer) { - sm := src.asPointerTo(tf).Elem() - if sm.Len() == 0 { - return - } - for _, key := range sm.MapKeys() { - val := sm.MapIndex(key) - DiscardUnknown(val.Interface().(Message)) - } - } - } else { - dfi.discard = func(pointer) {} // Noop - } - } - case reflect.Interface: - // Must be oneof field. - switch { - case isPointer || isSlice: - panic(fmt.Sprintf("%v.%s cannot be a pointer to a interface or a slice of interface values", t, f.Name)) - default: // E.g., interface{} - // TODO: Make this faster? - dfi.discard = func(src pointer) { - su := src.asPointerTo(tf).Elem() - if !su.IsNil() { - sv := su.Elem().Elem().Field(0) - if sv.Kind() == reflect.Ptr && sv.IsNil() { - return - } - switch sv.Type().Kind() { - case reflect.Ptr: // Proto struct (e.g., *T) - DiscardUnknown(sv.Interface().(Message)) - } - } - } - } - default: - continue - } - di.fields = append(di.fields, dfi) - } - - di.unrecognized = invalidField - if f, ok := t.FieldByName("XXX_unrecognized"); ok { - if f.Type != reflect.TypeOf([]byte{}) { - panic("expected XXX_unrecognized to be of type []byte") - } - di.unrecognized = toField(&f) - } - - atomic.StoreInt32(&di.initialized, 1) -} - -func discardLegacy(m Message) { - v := reflect.ValueOf(m) - if v.Kind() != reflect.Ptr || v.IsNil() { - return - } - v = v.Elem() - if v.Kind() != reflect.Struct { - return - } - t := v.Type() - - for i := 0; i < v.NumField(); i++ { - f := t.Field(i) - if strings.HasPrefix(f.Name, "XXX_") { - continue - } - vf := v.Field(i) - tf := f.Type - - // Unwrap tf to get its most basic type. - var isPointer, isSlice bool - if tf.Kind() == reflect.Slice && tf.Elem().Kind() != reflect.Uint8 { - isSlice = true - tf = tf.Elem() - } - if tf.Kind() == reflect.Ptr { - isPointer = true - tf = tf.Elem() - } - if isPointer && isSlice && tf.Kind() != reflect.Struct { - panic(fmt.Sprintf("%T.%s cannot be a slice of pointers to primitive types", m, f.Name)) - } - - switch tf.Kind() { - case reflect.Struct: - switch { - case !isPointer: - panic(fmt.Sprintf("%T.%s cannot be a direct struct value", m, f.Name)) - case isSlice: // E.g., []*pb.T - for j := 0; j < vf.Len(); j++ { - discardLegacy(vf.Index(j).Interface().(Message)) - } - default: // E.g., *pb.T - discardLegacy(vf.Interface().(Message)) - } - case reflect.Map: - switch { - case isPointer || isSlice: - panic(fmt.Sprintf("%T.%s cannot be a pointer to a map or a slice of map values", m, f.Name)) - default: // E.g., map[K]V - tv := vf.Type().Elem() - if tv.Kind() == reflect.Ptr && tv.Implements(protoMessageType) { // Proto struct (e.g., *T) - for _, key := range vf.MapKeys() { - val := vf.MapIndex(key) - discardLegacy(val.Interface().(Message)) - } - } - } - case reflect.Interface: - // Must be oneof field. - switch { - case isPointer || isSlice: - panic(fmt.Sprintf("%T.%s cannot be a pointer to a interface or a slice of interface values", m, f.Name)) - default: // E.g., test_proto.isCommunique_Union interface - if !vf.IsNil() && f.Tag.Get("protobuf_oneof") != "" { - vf = vf.Elem() // E.g., *test_proto.Communique_Msg - if !vf.IsNil() { - vf = vf.Elem() // E.g., test_proto.Communique_Msg - vf = vf.Field(0) // E.g., Proto struct (e.g., *T) or primitive value - if vf.Kind() == reflect.Ptr { - discardLegacy(vf.Interface().(Message)) - } - } - } - } - } - } - - if vf := v.FieldByName("XXX_unrecognized"); vf.IsValid() { - if vf.Type() != reflect.TypeOf([]byte{}) { - panic("expected XXX_unrecognized to be of type []byte") - } - vf.Set(reflect.ValueOf([]byte(nil))) - } - - // For proto2 messages, only discard unknown fields in message extensions - // that have been accessed via GetExtension. - if em, err := extendable(m); err == nil { - // Ignore lock since discardLegacy is not concurrency safe. - emm, _ := em.extensionsRead() - for _, mx := range emm { - if m, ok := mx.value.(Message); ok { - discardLegacy(m) - } - } - } -} diff --git a/vendor/github.com/gogo/protobuf/proto/duration.go b/vendor/github.com/gogo/protobuf/proto/duration.go deleted file mode 100644 index 93464c91c..000000000 --- a/vendor/github.com/gogo/protobuf/proto/duration.go +++ /dev/null @@ -1,100 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2016 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -// This file implements conversions between google.protobuf.Duration -// and time.Duration. - -import ( - "errors" - "fmt" - "time" -) - -const ( - // Range of a Duration in seconds, as specified in - // google/protobuf/duration.proto. This is about 10,000 years in seconds. - maxSeconds = int64(10000 * 365.25 * 24 * 60 * 60) - minSeconds = -maxSeconds -) - -// validateDuration determines whether the Duration is valid according to the -// definition in google/protobuf/duration.proto. A valid Duration -// may still be too large to fit into a time.Duration (the range of Duration -// is about 10,000 years, and the range of time.Duration is about 290). -func validateDuration(d *duration) error { - if d == nil { - return errors.New("duration: nil Duration") - } - if d.Seconds < minSeconds || d.Seconds > maxSeconds { - return fmt.Errorf("duration: %#v: seconds out of range", d) - } - if d.Nanos <= -1e9 || d.Nanos >= 1e9 { - return fmt.Errorf("duration: %#v: nanos out of range", d) - } - // Seconds and Nanos must have the same sign, unless d.Nanos is zero. - if (d.Seconds < 0 && d.Nanos > 0) || (d.Seconds > 0 && d.Nanos < 0) { - return fmt.Errorf("duration: %#v: seconds and nanos have different signs", d) - } - return nil -} - -// DurationFromProto converts a Duration to a time.Duration. DurationFromProto -// returns an error if the Duration is invalid or is too large to be -// represented in a time.Duration. -func durationFromProto(p *duration) (time.Duration, error) { - if err := validateDuration(p); err != nil { - return 0, err - } - d := time.Duration(p.Seconds) * time.Second - if int64(d/time.Second) != p.Seconds { - return 0, fmt.Errorf("duration: %#v is out of range for time.Duration", p) - } - if p.Nanos != 0 { - d += time.Duration(p.Nanos) - if (d < 0) != (p.Nanos < 0) { - return 0, fmt.Errorf("duration: %#v is out of range for time.Duration", p) - } - } - return d, nil -} - -// DurationProto converts a time.Duration to a Duration. -func durationProto(d time.Duration) *duration { - nanos := d.Nanoseconds() - secs := nanos / 1e9 - nanos -= secs * 1e9 - return &duration{ - Seconds: secs, - Nanos: int32(nanos), - } -} diff --git a/vendor/github.com/gogo/protobuf/proto/duration_gogo.go b/vendor/github.com/gogo/protobuf/proto/duration_gogo.go deleted file mode 100644 index e748e1730..000000000 --- a/vendor/github.com/gogo/protobuf/proto/duration_gogo.go +++ /dev/null @@ -1,49 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2016, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -import ( - "reflect" - "time" -) - -var durationType = reflect.TypeOf((*time.Duration)(nil)).Elem() - -type duration struct { - Seconds int64 `protobuf:"varint,1,opt,name=seconds,proto3" json:"seconds,omitempty"` - Nanos int32 `protobuf:"varint,2,opt,name=nanos,proto3" json:"nanos,omitempty"` -} - -func (m *duration) Reset() { *m = duration{} } -func (*duration) ProtoMessage() {} -func (*duration) String() string { return "duration" } - -func init() { - RegisterType((*duration)(nil), "gogo.protobuf.proto.duration") -} diff --git a/vendor/github.com/gogo/protobuf/proto/encode.go b/vendor/github.com/gogo/protobuf/proto/encode.go deleted file mode 100644 index 9581ccd30..000000000 --- a/vendor/github.com/gogo/protobuf/proto/encode.go +++ /dev/null @@ -1,205 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -/* - * Routines for encoding data into the wire format for protocol buffers. - */ - -import ( - "errors" - "reflect" -) - -var ( - // errRepeatedHasNil is the error returned if Marshal is called with - // a struct with a repeated field containing a nil element. - errRepeatedHasNil = errors.New("proto: repeated field has nil element") - - // errOneofHasNil is the error returned if Marshal is called with - // a struct with a oneof field containing a nil element. - errOneofHasNil = errors.New("proto: oneof field has nil value") - - // ErrNil is the error returned if Marshal is called with nil. - ErrNil = errors.New("proto: Marshal called with nil") - - // ErrTooLarge is the error returned if Marshal is called with a - // message that encodes to >2GB. - ErrTooLarge = errors.New("proto: message encodes to over 2 GB") -) - -// The fundamental encoders that put bytes on the wire. -// Those that take integer types all accept uint64 and are -// therefore of type valueEncoder. - -const maxVarintBytes = 10 // maximum length of a varint - -// EncodeVarint returns the varint encoding of x. -// This is the format for the -// int32, int64, uint32, uint64, bool, and enum -// protocol buffer types. -// Not used by the package itself, but helpful to clients -// wishing to use the same encoding. -func EncodeVarint(x uint64) []byte { - var buf [maxVarintBytes]byte - var n int - for n = 0; x > 127; n++ { - buf[n] = 0x80 | uint8(x&0x7F) - x >>= 7 - } - buf[n] = uint8(x) - n++ - return buf[0:n] -} - -// EncodeVarint writes a varint-encoded integer to the Buffer. -// This is the format for the -// int32, int64, uint32, uint64, bool, and enum -// protocol buffer types. -func (p *Buffer) EncodeVarint(x uint64) error { - for x >= 1<<7 { - p.buf = append(p.buf, uint8(x&0x7f|0x80)) - x >>= 7 - } - p.buf = append(p.buf, uint8(x)) - return nil -} - -// SizeVarint returns the varint encoding size of an integer. -func SizeVarint(x uint64) int { - switch { - case x < 1<<7: - return 1 - case x < 1<<14: - return 2 - case x < 1<<21: - return 3 - case x < 1<<28: - return 4 - case x < 1<<35: - return 5 - case x < 1<<42: - return 6 - case x < 1<<49: - return 7 - case x < 1<<56: - return 8 - case x < 1<<63: - return 9 - } - return 10 -} - -// EncodeFixed64 writes a 64-bit integer to the Buffer. -// This is the format for the -// fixed64, sfixed64, and double protocol buffer types. -func (p *Buffer) EncodeFixed64(x uint64) error { - p.buf = append(p.buf, - uint8(x), - uint8(x>>8), - uint8(x>>16), - uint8(x>>24), - uint8(x>>32), - uint8(x>>40), - uint8(x>>48), - uint8(x>>56)) - return nil -} - -// EncodeFixed32 writes a 32-bit integer to the Buffer. -// This is the format for the -// fixed32, sfixed32, and float protocol buffer types. -func (p *Buffer) EncodeFixed32(x uint64) error { - p.buf = append(p.buf, - uint8(x), - uint8(x>>8), - uint8(x>>16), - uint8(x>>24)) - return nil -} - -// EncodeZigzag64 writes a zigzag-encoded 64-bit integer -// to the Buffer. -// This is the format used for the sint64 protocol buffer type. -func (p *Buffer) EncodeZigzag64(x uint64) error { - // use signed number to get arithmetic right shift. - return p.EncodeVarint(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} - -// EncodeZigzag32 writes a zigzag-encoded 32-bit integer -// to the Buffer. -// This is the format used for the sint32 protocol buffer type. -func (p *Buffer) EncodeZigzag32(x uint64) error { - // use signed number to get arithmetic right shift. - return p.EncodeVarint(uint64((uint32(x) << 1) ^ uint32((int32(x) >> 31)))) -} - -// EncodeRawBytes writes a count-delimited byte buffer to the Buffer. -// This is the format used for the bytes protocol buffer -// type and for embedded messages. -func (p *Buffer) EncodeRawBytes(b []byte) error { - p.EncodeVarint(uint64(len(b))) - p.buf = append(p.buf, b...) - return nil -} - -// EncodeStringBytes writes an encoded string to the Buffer. -// This is the format used for the proto2 string type. -func (p *Buffer) EncodeStringBytes(s string) error { - p.EncodeVarint(uint64(len(s))) - p.buf = append(p.buf, s...) - return nil -} - -// Marshaler is the interface representing objects that can marshal themselves. -type Marshaler interface { - Marshal() ([]byte, error) -} - -// EncodeMessage writes the protocol buffer to the Buffer, -// prefixed by a varint-encoded length. -func (p *Buffer) EncodeMessage(pb Message) error { - siz := Size(pb) - sizVar := SizeVarint(uint64(siz)) - p.grow(siz + sizVar) - p.EncodeVarint(uint64(siz)) - return p.Marshal(pb) -} - -// All protocol buffer fields are nillable, but be careful. -func isNil(v reflect.Value) bool { - switch v.Kind() { - case reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice: - return v.IsNil() - } - return false -} diff --git a/vendor/github.com/gogo/protobuf/proto/encode_gogo.go b/vendor/github.com/gogo/protobuf/proto/encode_gogo.go deleted file mode 100644 index 0f5fb173e..000000000 --- a/vendor/github.com/gogo/protobuf/proto/encode_gogo.go +++ /dev/null @@ -1,33 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -func NewRequiredNotSetError(field string) *RequiredNotSetError { - return &RequiredNotSetError{field} -} diff --git a/vendor/github.com/gogo/protobuf/proto/equal.go b/vendor/github.com/gogo/protobuf/proto/equal.go deleted file mode 100644 index d4db5a1c1..000000000 --- a/vendor/github.com/gogo/protobuf/proto/equal.go +++ /dev/null @@ -1,300 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2011 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// Protocol buffer comparison. - -package proto - -import ( - "bytes" - "log" - "reflect" - "strings" -) - -/* -Equal returns true iff protocol buffers a and b are equal. -The arguments must both be pointers to protocol buffer structs. - -Equality is defined in this way: - - Two messages are equal iff they are the same type, - corresponding fields are equal, unknown field sets - are equal, and extensions sets are equal. - - Two set scalar fields are equal iff their values are equal. - If the fields are of a floating-point type, remember that - NaN != x for all x, including NaN. If the message is defined - in a proto3 .proto file, fields are not "set"; specifically, - zero length proto3 "bytes" fields are equal (nil == {}). - - Two repeated fields are equal iff their lengths are the same, - and their corresponding elements are equal. Note a "bytes" field, - although represented by []byte, is not a repeated field and the - rule for the scalar fields described above applies. - - Two unset fields are equal. - - Two unknown field sets are equal if their current - encoded state is equal. - - Two extension sets are equal iff they have corresponding - elements that are pairwise equal. - - Two map fields are equal iff their lengths are the same, - and they contain the same set of elements. Zero-length map - fields are equal. - - Every other combination of things are not equal. - -The return value is undefined if a and b are not protocol buffers. -*/ -func Equal(a, b Message) bool { - if a == nil || b == nil { - return a == b - } - v1, v2 := reflect.ValueOf(a), reflect.ValueOf(b) - if v1.Type() != v2.Type() { - return false - } - if v1.Kind() == reflect.Ptr { - if v1.IsNil() { - return v2.IsNil() - } - if v2.IsNil() { - return false - } - v1, v2 = v1.Elem(), v2.Elem() - } - if v1.Kind() != reflect.Struct { - return false - } - return equalStruct(v1, v2) -} - -// v1 and v2 are known to have the same type. -func equalStruct(v1, v2 reflect.Value) bool { - sprop := GetProperties(v1.Type()) - for i := 0; i < v1.NumField(); i++ { - f := v1.Type().Field(i) - if strings.HasPrefix(f.Name, "XXX_") { - continue - } - f1, f2 := v1.Field(i), v2.Field(i) - if f.Type.Kind() == reflect.Ptr { - if n1, n2 := f1.IsNil(), f2.IsNil(); n1 && n2 { - // both unset - continue - } else if n1 != n2 { - // set/unset mismatch - return false - } - f1, f2 = f1.Elem(), f2.Elem() - } - if !equalAny(f1, f2, sprop.Prop[i]) { - return false - } - } - - if em1 := v1.FieldByName("XXX_InternalExtensions"); em1.IsValid() { - em2 := v2.FieldByName("XXX_InternalExtensions") - if !equalExtensions(v1.Type(), em1.Interface().(XXX_InternalExtensions), em2.Interface().(XXX_InternalExtensions)) { - return false - } - } - - if em1 := v1.FieldByName("XXX_extensions"); em1.IsValid() { - em2 := v2.FieldByName("XXX_extensions") - if !equalExtMap(v1.Type(), em1.Interface().(map[int32]Extension), em2.Interface().(map[int32]Extension)) { - return false - } - } - - uf := v1.FieldByName("XXX_unrecognized") - if !uf.IsValid() { - return true - } - - u1 := uf.Bytes() - u2 := v2.FieldByName("XXX_unrecognized").Bytes() - return bytes.Equal(u1, u2) -} - -// v1 and v2 are known to have the same type. -// prop may be nil. -func equalAny(v1, v2 reflect.Value, prop *Properties) bool { - if v1.Type() == protoMessageType { - m1, _ := v1.Interface().(Message) - m2, _ := v2.Interface().(Message) - return Equal(m1, m2) - } - switch v1.Kind() { - case reflect.Bool: - return v1.Bool() == v2.Bool() - case reflect.Float32, reflect.Float64: - return v1.Float() == v2.Float() - case reflect.Int32, reflect.Int64: - return v1.Int() == v2.Int() - case reflect.Interface: - // Probably a oneof field; compare the inner values. - n1, n2 := v1.IsNil(), v2.IsNil() - if n1 || n2 { - return n1 == n2 - } - e1, e2 := v1.Elem(), v2.Elem() - if e1.Type() != e2.Type() { - return false - } - return equalAny(e1, e2, nil) - case reflect.Map: - if v1.Len() != v2.Len() { - return false - } - for _, key := range v1.MapKeys() { - val2 := v2.MapIndex(key) - if !val2.IsValid() { - // This key was not found in the second map. - return false - } - if !equalAny(v1.MapIndex(key), val2, nil) { - return false - } - } - return true - case reflect.Ptr: - // Maps may have nil values in them, so check for nil. - if v1.IsNil() && v2.IsNil() { - return true - } - if v1.IsNil() != v2.IsNil() { - return false - } - return equalAny(v1.Elem(), v2.Elem(), prop) - case reflect.Slice: - if v1.Type().Elem().Kind() == reflect.Uint8 { - // short circuit: []byte - - // Edge case: if this is in a proto3 message, a zero length - // bytes field is considered the zero value. - if prop != nil && prop.proto3 && v1.Len() == 0 && v2.Len() == 0 { - return true - } - if v1.IsNil() != v2.IsNil() { - return false - } - return bytes.Equal(v1.Interface().([]byte), v2.Interface().([]byte)) - } - - if v1.Len() != v2.Len() { - return false - } - for i := 0; i < v1.Len(); i++ { - if !equalAny(v1.Index(i), v2.Index(i), prop) { - return false - } - } - return true - case reflect.String: - return v1.Interface().(string) == v2.Interface().(string) - case reflect.Struct: - return equalStruct(v1, v2) - case reflect.Uint32, reflect.Uint64: - return v1.Uint() == v2.Uint() - } - - // unknown type, so not a protocol buffer - log.Printf("proto: don't know how to compare %v", v1) - return false -} - -// base is the struct type that the extensions are based on. -// x1 and x2 are InternalExtensions. -func equalExtensions(base reflect.Type, x1, x2 XXX_InternalExtensions) bool { - em1, _ := x1.extensionsRead() - em2, _ := x2.extensionsRead() - return equalExtMap(base, em1, em2) -} - -func equalExtMap(base reflect.Type, em1, em2 map[int32]Extension) bool { - if len(em1) != len(em2) { - return false - } - - for extNum, e1 := range em1 { - e2, ok := em2[extNum] - if !ok { - return false - } - - m1, m2 := e1.value, e2.value - - if m1 == nil && m2 == nil { - // Both have only encoded form. - if bytes.Equal(e1.enc, e2.enc) { - continue - } - // The bytes are different, but the extensions might still be - // equal. We need to decode them to compare. - } - - if m1 != nil && m2 != nil { - // Both are unencoded. - if !equalAny(reflect.ValueOf(m1), reflect.ValueOf(m2), nil) { - return false - } - continue - } - - // At least one is encoded. To do a semantically correct comparison - // we need to unmarshal them first. - var desc *ExtensionDesc - if m := extensionMaps[base]; m != nil { - desc = m[extNum] - } - if desc == nil { - // If both have only encoded form and the bytes are the same, - // it is handled above. We get here when the bytes are different. - // We don't know how to decode it, so just compare them as byte - // slices. - log.Printf("proto: don't know how to compare extension %d of %v", extNum, base) - return false - } - var err error - if m1 == nil { - m1, err = decodeExtension(e1.enc, desc) - } - if m2 == nil && err == nil { - m2, err = decodeExtension(e2.enc, desc) - } - if err != nil { - // The encoded form is invalid. - log.Printf("proto: badly encoded extension %d of %v: %v", extNum, base, err) - return false - } - if !equalAny(reflect.ValueOf(m1), reflect.ValueOf(m2), nil) { - return false - } - } - - return true -} diff --git a/vendor/github.com/gogo/protobuf/proto/extensions.go b/vendor/github.com/gogo/protobuf/proto/extensions.go deleted file mode 100644 index 341c6f57f..000000000 --- a/vendor/github.com/gogo/protobuf/proto/extensions.go +++ /dev/null @@ -1,605 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -/* - * Types and routines for supporting protocol buffer extensions. - */ - -import ( - "errors" - "fmt" - "io" - "reflect" - "strconv" - "sync" -) - -// ErrMissingExtension is the error returned by GetExtension if the named extension is not in the message. -var ErrMissingExtension = errors.New("proto: missing extension") - -// ExtensionRange represents a range of message extensions for a protocol buffer. -// Used in code generated by the protocol compiler. -type ExtensionRange struct { - Start, End int32 // both inclusive -} - -// extendableProto is an interface implemented by any protocol buffer generated by the current -// proto compiler that may be extended. -type extendableProto interface { - Message - ExtensionRangeArray() []ExtensionRange - extensionsWrite() map[int32]Extension - extensionsRead() (map[int32]Extension, sync.Locker) -} - -// extendableProtoV1 is an interface implemented by a protocol buffer generated by the previous -// version of the proto compiler that may be extended. -type extendableProtoV1 interface { - Message - ExtensionRangeArray() []ExtensionRange - ExtensionMap() map[int32]Extension -} - -// extensionAdapter is a wrapper around extendableProtoV1 that implements extendableProto. -type extensionAdapter struct { - extendableProtoV1 -} - -func (e extensionAdapter) extensionsWrite() map[int32]Extension { - return e.ExtensionMap() -} - -func (e extensionAdapter) extensionsRead() (map[int32]Extension, sync.Locker) { - return e.ExtensionMap(), notLocker{} -} - -// notLocker is a sync.Locker whose Lock and Unlock methods are nops. -type notLocker struct{} - -func (n notLocker) Lock() {} -func (n notLocker) Unlock() {} - -// extendable returns the extendableProto interface for the given generated proto message. -// If the proto message has the old extension format, it returns a wrapper that implements -// the extendableProto interface. -func extendable(p interface{}) (extendableProto, error) { - switch p := p.(type) { - case extendableProto: - if isNilPtr(p) { - return nil, fmt.Errorf("proto: nil %T is not extendable", p) - } - return p, nil - case extendableProtoV1: - if isNilPtr(p) { - return nil, fmt.Errorf("proto: nil %T is not extendable", p) - } - return extensionAdapter{p}, nil - case extensionsBytes: - return slowExtensionAdapter{p}, nil - } - // Don't allocate a specific error containing %T: - // this is the hot path for Clone and MarshalText. - return nil, errNotExtendable -} - -var errNotExtendable = errors.New("proto: not an extendable proto.Message") - -func isNilPtr(x interface{}) bool { - v := reflect.ValueOf(x) - return v.Kind() == reflect.Ptr && v.IsNil() -} - -// XXX_InternalExtensions is an internal representation of proto extensions. -// -// Each generated message struct type embeds an anonymous XXX_InternalExtensions field, -// thus gaining the unexported 'extensions' method, which can be called only from the proto package. -// -// The methods of XXX_InternalExtensions are not concurrency safe in general, -// but calls to logically read-only methods such as has and get may be executed concurrently. -type XXX_InternalExtensions struct { - // The struct must be indirect so that if a user inadvertently copies a - // generated message and its embedded XXX_InternalExtensions, they - // avoid the mayhem of a copied mutex. - // - // The mutex serializes all logically read-only operations to p.extensionMap. - // It is up to the client to ensure that write operations to p.extensionMap are - // mutually exclusive with other accesses. - p *struct { - mu sync.Mutex - extensionMap map[int32]Extension - } -} - -// extensionsWrite returns the extension map, creating it on first use. -func (e *XXX_InternalExtensions) extensionsWrite() map[int32]Extension { - if e.p == nil { - e.p = new(struct { - mu sync.Mutex - extensionMap map[int32]Extension - }) - e.p.extensionMap = make(map[int32]Extension) - } - return e.p.extensionMap -} - -// extensionsRead returns the extensions map for read-only use. It may be nil. -// The caller must hold the returned mutex's lock when accessing Elements within the map. -func (e *XXX_InternalExtensions) extensionsRead() (map[int32]Extension, sync.Locker) { - if e.p == nil { - return nil, nil - } - return e.p.extensionMap, &e.p.mu -} - -// ExtensionDesc represents an extension specification. -// Used in generated code from the protocol compiler. -type ExtensionDesc struct { - ExtendedType Message // nil pointer to the type that is being extended - ExtensionType interface{} // nil pointer to the extension type - Field int32 // field number - Name string // fully-qualified name of extension, for text formatting - Tag string // protobuf tag style - Filename string // name of the file in which the extension is defined -} - -func (ed *ExtensionDesc) repeated() bool { - t := reflect.TypeOf(ed.ExtensionType) - return t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8 -} - -// Extension represents an extension in a message. -type Extension struct { - // When an extension is stored in a message using SetExtension - // only desc and value are set. When the message is marshaled - // enc will be set to the encoded form of the message. - // - // When a message is unmarshaled and contains extensions, each - // extension will have only enc set. When such an extension is - // accessed using GetExtension (or GetExtensions) desc and value - // will be set. - desc *ExtensionDesc - value interface{} - enc []byte -} - -// SetRawExtension is for testing only. -func SetRawExtension(base Message, id int32, b []byte) { - if ebase, ok := base.(extensionsBytes); ok { - clearExtension(base, id) - ext := ebase.GetExtensions() - *ext = append(*ext, b...) - return - } - epb, err := extendable(base) - if err != nil { - return - } - extmap := epb.extensionsWrite() - extmap[id] = Extension{enc: b} -} - -// isExtensionField returns true iff the given field number is in an extension range. -func isExtensionField(pb extendableProto, field int32) bool { - for _, er := range pb.ExtensionRangeArray() { - if er.Start <= field && field <= er.End { - return true - } - } - return false -} - -// checkExtensionTypes checks that the given extension is valid for pb. -func checkExtensionTypes(pb extendableProto, extension *ExtensionDesc) error { - var pbi interface{} = pb - // Check the extended type. - if ea, ok := pbi.(extensionAdapter); ok { - pbi = ea.extendableProtoV1 - } - if ea, ok := pbi.(slowExtensionAdapter); ok { - pbi = ea.extensionsBytes - } - if a, b := reflect.TypeOf(pbi), reflect.TypeOf(extension.ExtendedType); a != b { - return fmt.Errorf("proto: bad extended type; %v does not extend %v", b, a) - } - // Check the range. - if !isExtensionField(pb, extension.Field) { - return errors.New("proto: bad extension number; not in declared ranges") - } - return nil -} - -// extPropKey is sufficient to uniquely identify an extension. -type extPropKey struct { - base reflect.Type - field int32 -} - -var extProp = struct { - sync.RWMutex - m map[extPropKey]*Properties -}{ - m: make(map[extPropKey]*Properties), -} - -func extensionProperties(ed *ExtensionDesc) *Properties { - key := extPropKey{base: reflect.TypeOf(ed.ExtendedType), field: ed.Field} - - extProp.RLock() - if prop, ok := extProp.m[key]; ok { - extProp.RUnlock() - return prop - } - extProp.RUnlock() - - extProp.Lock() - defer extProp.Unlock() - // Check again. - if prop, ok := extProp.m[key]; ok { - return prop - } - - prop := new(Properties) - prop.Init(reflect.TypeOf(ed.ExtensionType), "unknown_name", ed.Tag, nil) - extProp.m[key] = prop - return prop -} - -// HasExtension returns whether the given extension is present in pb. -func HasExtension(pb Message, extension *ExtensionDesc) bool { - if epb, doki := pb.(extensionsBytes); doki { - ext := epb.GetExtensions() - buf := *ext - o := 0 - for o < len(buf) { - tag, n := DecodeVarint(buf[o:]) - fieldNum := int32(tag >> 3) - if int32(fieldNum) == extension.Field { - return true - } - wireType := int(tag & 0x7) - o += n - l, err := size(buf[o:], wireType) - if err != nil { - return false - } - o += l - } - return false - } - // TODO: Check types, field numbers, etc.? - epb, err := extendable(pb) - if err != nil { - return false - } - extmap, mu := epb.extensionsRead() - if extmap == nil { - return false - } - mu.Lock() - _, ok := extmap[extension.Field] - mu.Unlock() - return ok -} - -// ClearExtension removes the given extension from pb. -func ClearExtension(pb Message, extension *ExtensionDesc) { - clearExtension(pb, extension.Field) -} - -func clearExtension(pb Message, fieldNum int32) { - if epb, ok := pb.(extensionsBytes); ok { - offset := 0 - for offset != -1 { - offset = deleteExtension(epb, fieldNum, offset) - } - return - } - epb, err := extendable(pb) - if err != nil { - return - } - // TODO: Check types, field numbers, etc.? - extmap := epb.extensionsWrite() - delete(extmap, fieldNum) -} - -// GetExtension retrieves a proto2 extended field from pb. -// -// If the descriptor is type complete (i.e., ExtensionDesc.ExtensionType is non-nil), -// then GetExtension parses the encoded field and returns a Go value of the specified type. -// If the field is not present, then the default value is returned (if one is specified), -// otherwise ErrMissingExtension is reported. -// -// If the descriptor is not type complete (i.e., ExtensionDesc.ExtensionType is nil), -// then GetExtension returns the raw encoded bytes of the field extension. -func GetExtension(pb Message, extension *ExtensionDesc) (interface{}, error) { - if epb, doki := pb.(extensionsBytes); doki { - ext := epb.GetExtensions() - return decodeExtensionFromBytes(extension, *ext) - } - - epb, err := extendable(pb) - if err != nil { - return nil, err - } - - if extension.ExtendedType != nil { - // can only check type if this is a complete descriptor - if cerr := checkExtensionTypes(epb, extension); cerr != nil { - return nil, cerr - } - } - - emap, mu := epb.extensionsRead() - if emap == nil { - return defaultExtensionValue(extension) - } - mu.Lock() - defer mu.Unlock() - e, ok := emap[extension.Field] - if !ok { - // defaultExtensionValue returns the default value or - // ErrMissingExtension if there is no default. - return defaultExtensionValue(extension) - } - - if e.value != nil { - // Already decoded. Check the descriptor, though. - if e.desc != extension { - // This shouldn't happen. If it does, it means that - // GetExtension was called twice with two different - // descriptors with the same field number. - return nil, errors.New("proto: descriptor conflict") - } - return e.value, nil - } - - if extension.ExtensionType == nil { - // incomplete descriptor - return e.enc, nil - } - - v, err := decodeExtension(e.enc, extension) - if err != nil { - return nil, err - } - - // Remember the decoded version and drop the encoded version. - // That way it is safe to mutate what we return. - e.value = v - e.desc = extension - e.enc = nil - emap[extension.Field] = e - return e.value, nil -} - -// defaultExtensionValue returns the default value for extension. -// If no default for an extension is defined ErrMissingExtension is returned. -func defaultExtensionValue(extension *ExtensionDesc) (interface{}, error) { - if extension.ExtensionType == nil { - // incomplete descriptor, so no default - return nil, ErrMissingExtension - } - - t := reflect.TypeOf(extension.ExtensionType) - props := extensionProperties(extension) - - sf, _, err := fieldDefault(t, props) - if err != nil { - return nil, err - } - - if sf == nil || sf.value == nil { - // There is no default value. - return nil, ErrMissingExtension - } - - if t.Kind() != reflect.Ptr { - // We do not need to return a Ptr, we can directly return sf.value. - return sf.value, nil - } - - // We need to return an interface{} that is a pointer to sf.value. - value := reflect.New(t).Elem() - value.Set(reflect.New(value.Type().Elem())) - if sf.kind == reflect.Int32 { - // We may have an int32 or an enum, but the underlying data is int32. - // Since we can't set an int32 into a non int32 reflect.value directly - // set it as a int32. - value.Elem().SetInt(int64(sf.value.(int32))) - } else { - value.Elem().Set(reflect.ValueOf(sf.value)) - } - return value.Interface(), nil -} - -// decodeExtension decodes an extension encoded in b. -func decodeExtension(b []byte, extension *ExtensionDesc) (interface{}, error) { - t := reflect.TypeOf(extension.ExtensionType) - unmarshal := typeUnmarshaler(t, extension.Tag) - - // t is a pointer to a struct, pointer to basic type or a slice. - // Allocate space to store the pointer/slice. - value := reflect.New(t).Elem() - - var err error - for { - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - wire := int(x) & 7 - - b, err = unmarshal(b, valToPointer(value.Addr()), wire) - if err != nil { - return nil, err - } - - if len(b) == 0 { - break - } - } - return value.Interface(), nil -} - -// GetExtensions returns a slice of the extensions present in pb that are also listed in es. -// The returned slice has the same length as es; missing extensions will appear as nil elements. -func GetExtensions(pb Message, es []*ExtensionDesc) (extensions []interface{}, err error) { - epb, err := extendable(pb) - if err != nil { - return nil, err - } - extensions = make([]interface{}, len(es)) - for i, e := range es { - extensions[i], err = GetExtension(epb, e) - if err == ErrMissingExtension { - err = nil - } - if err != nil { - return - } - } - return -} - -// ExtensionDescs returns a new slice containing pb's extension descriptors, in undefined order. -// For non-registered extensions, ExtensionDescs returns an incomplete descriptor containing -// just the Field field, which defines the extension's field number. -func ExtensionDescs(pb Message) ([]*ExtensionDesc, error) { - epb, err := extendable(pb) - if err != nil { - return nil, err - } - registeredExtensions := RegisteredExtensions(pb) - - emap, mu := epb.extensionsRead() - if emap == nil { - return nil, nil - } - mu.Lock() - defer mu.Unlock() - extensions := make([]*ExtensionDesc, 0, len(emap)) - for extid, e := range emap { - desc := e.desc - if desc == nil { - desc = registeredExtensions[extid] - if desc == nil { - desc = &ExtensionDesc{Field: extid} - } - } - - extensions = append(extensions, desc) - } - return extensions, nil -} - -// SetExtension sets the specified extension of pb to the specified value. -func SetExtension(pb Message, extension *ExtensionDesc, value interface{}) error { - if epb, ok := pb.(extensionsBytes); ok { - ClearExtension(pb, extension) - newb, err := encodeExtension(extension, value) - if err != nil { - return err - } - bb := epb.GetExtensions() - *bb = append(*bb, newb...) - return nil - } - epb, err := extendable(pb) - if err != nil { - return err - } - if err := checkExtensionTypes(epb, extension); err != nil { - return err - } - typ := reflect.TypeOf(extension.ExtensionType) - if typ != reflect.TypeOf(value) { - return fmt.Errorf("proto: bad extension value type. got: %T, want: %T", value, extension.ExtensionType) - } - // nil extension values need to be caught early, because the - // encoder can't distinguish an ErrNil due to a nil extension - // from an ErrNil due to a missing field. Extensions are - // always optional, so the encoder would just swallow the error - // and drop all the extensions from the encoded message. - if reflect.ValueOf(value).IsNil() { - return fmt.Errorf("proto: SetExtension called with nil value of type %T", value) - } - - extmap := epb.extensionsWrite() - extmap[extension.Field] = Extension{desc: extension, value: value} - return nil -} - -// ClearAllExtensions clears all extensions from pb. -func ClearAllExtensions(pb Message) { - if epb, doki := pb.(extensionsBytes); doki { - ext := epb.GetExtensions() - *ext = []byte{} - return - } - epb, err := extendable(pb) - if err != nil { - return - } - m := epb.extensionsWrite() - for k := range m { - delete(m, k) - } -} - -// A global registry of extensions. -// The generated code will register the generated descriptors by calling RegisterExtension. - -var extensionMaps = make(map[reflect.Type]map[int32]*ExtensionDesc) - -// RegisterExtension is called from the generated code. -func RegisterExtension(desc *ExtensionDesc) { - st := reflect.TypeOf(desc.ExtendedType).Elem() - m := extensionMaps[st] - if m == nil { - m = make(map[int32]*ExtensionDesc) - extensionMaps[st] = m - } - if _, ok := m[desc.Field]; ok { - panic("proto: duplicate extension registered: " + st.String() + " " + strconv.Itoa(int(desc.Field))) - } - m[desc.Field] = desc -} - -// RegisteredExtensions returns a map of the registered extensions of a -// protocol buffer struct, indexed by the extension number. -// The argument pb should be a nil pointer to the struct type. -func RegisteredExtensions(pb Message) map[int32]*ExtensionDesc { - return extensionMaps[reflect.TypeOf(pb).Elem()] -} diff --git a/vendor/github.com/gogo/protobuf/proto/extensions_gogo.go b/vendor/github.com/gogo/protobuf/proto/extensions_gogo.go deleted file mode 100644 index 6f1ae120e..000000000 --- a/vendor/github.com/gogo/protobuf/proto/extensions_gogo.go +++ /dev/null @@ -1,389 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -import ( - "bytes" - "errors" - "fmt" - "io" - "reflect" - "sort" - "strings" - "sync" -) - -type extensionsBytes interface { - Message - ExtensionRangeArray() []ExtensionRange - GetExtensions() *[]byte -} - -type slowExtensionAdapter struct { - extensionsBytes -} - -func (s slowExtensionAdapter) extensionsWrite() map[int32]Extension { - panic("Please report a bug to github.com/gogo/protobuf if you see this message: Writing extensions is not supported for extensions stored in a byte slice field.") -} - -func (s slowExtensionAdapter) extensionsRead() (map[int32]Extension, sync.Locker) { - b := s.GetExtensions() - m, err := BytesToExtensionsMap(*b) - if err != nil { - panic(err) - } - return m, notLocker{} -} - -func GetBoolExtension(pb Message, extension *ExtensionDesc, ifnotset bool) bool { - if reflect.ValueOf(pb).IsNil() { - return ifnotset - } - value, err := GetExtension(pb, extension) - if err != nil { - return ifnotset - } - if value == nil { - return ifnotset - } - if value.(*bool) == nil { - return ifnotset - } - return *(value.(*bool)) -} - -func (this *Extension) Equal(that *Extension) bool { - if err := this.Encode(); err != nil { - return false - } - if err := that.Encode(); err != nil { - return false - } - return bytes.Equal(this.enc, that.enc) -} - -func (this *Extension) Compare(that *Extension) int { - if err := this.Encode(); err != nil { - return 1 - } - if err := that.Encode(); err != nil { - return -1 - } - return bytes.Compare(this.enc, that.enc) -} - -func SizeOfInternalExtension(m extendableProto) (n int) { - info := getMarshalInfo(reflect.TypeOf(m)) - return info.sizeV1Extensions(m.extensionsWrite()) -} - -type sortableMapElem struct { - field int32 - ext Extension -} - -func newSortableExtensionsFromMap(m map[int32]Extension) sortableExtensions { - s := make(sortableExtensions, 0, len(m)) - for k, v := range m { - s = append(s, &sortableMapElem{field: k, ext: v}) - } - return s -} - -type sortableExtensions []*sortableMapElem - -func (this sortableExtensions) Len() int { return len(this) } - -func (this sortableExtensions) Swap(i, j int) { this[i], this[j] = this[j], this[i] } - -func (this sortableExtensions) Less(i, j int) bool { return this[i].field < this[j].field } - -func (this sortableExtensions) String() string { - sort.Sort(this) - ss := make([]string, len(this)) - for i := range this { - ss[i] = fmt.Sprintf("%d: %v", this[i].field, this[i].ext) - } - return "map[" + strings.Join(ss, ",") + "]" -} - -func StringFromInternalExtension(m extendableProto) string { - return StringFromExtensionsMap(m.extensionsWrite()) -} - -func StringFromExtensionsMap(m map[int32]Extension) string { - return newSortableExtensionsFromMap(m).String() -} - -func StringFromExtensionsBytes(ext []byte) string { - m, err := BytesToExtensionsMap(ext) - if err != nil { - panic(err) - } - return StringFromExtensionsMap(m) -} - -func EncodeInternalExtension(m extendableProto, data []byte) (n int, err error) { - return EncodeExtensionMap(m.extensionsWrite(), data) -} - -func EncodeInternalExtensionBackwards(m extendableProto, data []byte) (n int, err error) { - return EncodeExtensionMapBackwards(m.extensionsWrite(), data) -} - -func EncodeExtensionMap(m map[int32]Extension, data []byte) (n int, err error) { - o := 0 - for _, e := range m { - if err := e.Encode(); err != nil { - return 0, err - } - n := copy(data[o:], e.enc) - if n != len(e.enc) { - return 0, io.ErrShortBuffer - } - o += n - } - return o, nil -} - -func EncodeExtensionMapBackwards(m map[int32]Extension, data []byte) (n int, err error) { - o := 0 - end := len(data) - for _, e := range m { - if err := e.Encode(); err != nil { - return 0, err - } - n := copy(data[end-len(e.enc):], e.enc) - if n != len(e.enc) { - return 0, io.ErrShortBuffer - } - end -= n - o += n - } - return o, nil -} - -func GetRawExtension(m map[int32]Extension, id int32) ([]byte, error) { - e := m[id] - if err := e.Encode(); err != nil { - return nil, err - } - return e.enc, nil -} - -func size(buf []byte, wire int) (int, error) { - switch wire { - case WireVarint: - _, n := DecodeVarint(buf) - return n, nil - case WireFixed64: - return 8, nil - case WireBytes: - v, n := DecodeVarint(buf) - return int(v) + n, nil - case WireFixed32: - return 4, nil - case WireStartGroup: - offset := 0 - for { - u, n := DecodeVarint(buf[offset:]) - fwire := int(u & 0x7) - offset += n - if fwire == WireEndGroup { - return offset, nil - } - s, err := size(buf[offset:], wire) - if err != nil { - return 0, err - } - offset += s - } - } - return 0, fmt.Errorf("proto: can't get size for unknown wire type %d", wire) -} - -func BytesToExtensionsMap(buf []byte) (map[int32]Extension, error) { - m := make(map[int32]Extension) - i := 0 - for i < len(buf) { - tag, n := DecodeVarint(buf[i:]) - if n <= 0 { - return nil, fmt.Errorf("unable to decode varint") - } - fieldNum := int32(tag >> 3) - wireType := int(tag & 0x7) - l, err := size(buf[i+n:], wireType) - if err != nil { - return nil, err - } - end := i + int(l) + n - m[int32(fieldNum)] = Extension{enc: buf[i:end]} - i = end - } - return m, nil -} - -func NewExtension(e []byte) Extension { - ee := Extension{enc: make([]byte, len(e))} - copy(ee.enc, e) - return ee -} - -func AppendExtension(e Message, tag int32, buf []byte) { - if ee, eok := e.(extensionsBytes); eok { - ext := ee.GetExtensions() - *ext = append(*ext, buf...) - return - } - if ee, eok := e.(extendableProto); eok { - m := ee.extensionsWrite() - ext := m[int32(tag)] // may be missing - ext.enc = append(ext.enc, buf...) - m[int32(tag)] = ext - } -} - -func encodeExtension(extension *ExtensionDesc, value interface{}) ([]byte, error) { - u := getMarshalInfo(reflect.TypeOf(extension.ExtendedType)) - ei := u.getExtElemInfo(extension) - v := value - p := toAddrPointer(&v, ei.isptr) - siz := ei.sizer(p, SizeVarint(ei.wiretag)) - buf := make([]byte, 0, siz) - return ei.marshaler(buf, p, ei.wiretag, false) -} - -func decodeExtensionFromBytes(extension *ExtensionDesc, buf []byte) (interface{}, error) { - o := 0 - for o < len(buf) { - tag, n := DecodeVarint((buf)[o:]) - fieldNum := int32(tag >> 3) - wireType := int(tag & 0x7) - if o+n > len(buf) { - return nil, fmt.Errorf("unable to decode extension") - } - l, err := size((buf)[o+n:], wireType) - if err != nil { - return nil, err - } - if int32(fieldNum) == extension.Field { - if o+n+l > len(buf) { - return nil, fmt.Errorf("unable to decode extension") - } - v, err := decodeExtension((buf)[o:o+n+l], extension) - if err != nil { - return nil, err - } - return v, nil - } - o += n + l - } - return defaultExtensionValue(extension) -} - -func (this *Extension) Encode() error { - if this.enc == nil { - var err error - this.enc, err = encodeExtension(this.desc, this.value) - if err != nil { - return err - } - } - return nil -} - -func (this Extension) GoString() string { - if err := this.Encode(); err != nil { - return fmt.Sprintf("error encoding extension: %v", err) - } - return fmt.Sprintf("proto.NewExtension(%#v)", this.enc) -} - -func SetUnsafeExtension(pb Message, fieldNum int32, value interface{}) error { - typ := reflect.TypeOf(pb).Elem() - ext, ok := extensionMaps[typ] - if !ok { - return fmt.Errorf("proto: bad extended type; %s is not extendable", typ.String()) - } - desc, ok := ext[fieldNum] - if !ok { - return errors.New("proto: bad extension number; not in declared ranges") - } - return SetExtension(pb, desc, value) -} - -func GetUnsafeExtension(pb Message, fieldNum int32) (interface{}, error) { - typ := reflect.TypeOf(pb).Elem() - ext, ok := extensionMaps[typ] - if !ok { - return nil, fmt.Errorf("proto: bad extended type; %s is not extendable", typ.String()) - } - desc, ok := ext[fieldNum] - if !ok { - return nil, fmt.Errorf("unregistered field number %d", fieldNum) - } - return GetExtension(pb, desc) -} - -func NewUnsafeXXX_InternalExtensions(m map[int32]Extension) XXX_InternalExtensions { - x := &XXX_InternalExtensions{ - p: new(struct { - mu sync.Mutex - extensionMap map[int32]Extension - }), - } - x.p.extensionMap = m - return *x -} - -func GetUnsafeExtensionsMap(extendable Message) map[int32]Extension { - pb := extendable.(extendableProto) - return pb.extensionsWrite() -} - -func deleteExtension(pb extensionsBytes, theFieldNum int32, offset int) int { - ext := pb.GetExtensions() - for offset < len(*ext) { - tag, n1 := DecodeVarint((*ext)[offset:]) - fieldNum := int32(tag >> 3) - wireType := int(tag & 0x7) - n2, err := size((*ext)[offset+n1:], wireType) - if err != nil { - panic(err) - } - newOffset := offset + n1 + n2 - if fieldNum == theFieldNum { - *ext = append((*ext)[:offset], (*ext)[newOffset:]...) - return offset - } - offset = newOffset - } - return -1 -} diff --git a/vendor/github.com/gogo/protobuf/proto/lib.go b/vendor/github.com/gogo/protobuf/proto/lib.go deleted file mode 100644 index 80db1c155..000000000 --- a/vendor/github.com/gogo/protobuf/proto/lib.go +++ /dev/null @@ -1,973 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -/* -Package proto converts data structures to and from the wire format of -protocol buffers. It works in concert with the Go source code generated -for .proto files by the protocol compiler. - -A summary of the properties of the protocol buffer interface -for a protocol buffer variable v: - - - Names are turned from camel_case to CamelCase for export. - - There are no methods on v to set fields; just treat - them as structure fields. - - There are getters that return a field's value if set, - and return the field's default value if unset. - The getters work even if the receiver is a nil message. - - The zero value for a struct is its correct initialization state. - All desired fields must be set before marshaling. - - A Reset() method will restore a protobuf struct to its zero state. - - Non-repeated fields are pointers to the values; nil means unset. - That is, optional or required field int32 f becomes F *int32. - - Repeated fields are slices. - - Helper functions are available to aid the setting of fields. - msg.Foo = proto.String("hello") // set field - - Constants are defined to hold the default values of all fields that - have them. They have the form Default_StructName_FieldName. - Because the getter methods handle defaulted values, - direct use of these constants should be rare. - - Enums are given type names and maps from names to values. - Enum values are prefixed by the enclosing message's name, or by the - enum's type name if it is a top-level enum. Enum types have a String - method, and a Enum method to assist in message construction. - - Nested messages, groups and enums have type names prefixed with the name of - the surrounding message type. - - Extensions are given descriptor names that start with E_, - followed by an underscore-delimited list of the nested messages - that contain it (if any) followed by the CamelCased name of the - extension field itself. HasExtension, ClearExtension, GetExtension - and SetExtension are functions for manipulating extensions. - - Oneof field sets are given a single field in their message, - with distinguished wrapper types for each possible field value. - - Marshal and Unmarshal are functions to encode and decode the wire format. - -When the .proto file specifies `syntax="proto3"`, there are some differences: - - - Non-repeated fields of non-message type are values instead of pointers. - - Enum types do not get an Enum method. - -The simplest way to describe this is to see an example. -Given file test.proto, containing - - package example; - - enum FOO { X = 17; } - - message Test { - required string label = 1; - optional int32 type = 2 [default=77]; - repeated int64 reps = 3; - optional group OptionalGroup = 4 { - required string RequiredField = 5; - } - oneof union { - int32 number = 6; - string name = 7; - } - } - -The resulting file, test.pb.go, is: - - package example - - import proto "github.com/gogo/protobuf/proto" - import math "math" - - type FOO int32 - const ( - FOO_X FOO = 17 - ) - var FOO_name = map[int32]string{ - 17: "X", - } - var FOO_value = map[string]int32{ - "X": 17, - } - - func (x FOO) Enum() *FOO { - p := new(FOO) - *p = x - return p - } - func (x FOO) String() string { - return proto.EnumName(FOO_name, int32(x)) - } - func (x *FOO) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(FOO_value, data) - if err != nil { - return err - } - *x = FOO(value) - return nil - } - - type Test struct { - Label *string `protobuf:"bytes,1,req,name=label" json:"label,omitempty"` - Type *int32 `protobuf:"varint,2,opt,name=type,def=77" json:"type,omitempty"` - Reps []int64 `protobuf:"varint,3,rep,name=reps" json:"reps,omitempty"` - Optionalgroup *Test_OptionalGroup `protobuf:"group,4,opt,name=OptionalGroup" json:"optionalgroup,omitempty"` - // Types that are valid to be assigned to Union: - // *Test_Number - // *Test_Name - Union isTest_Union `protobuf_oneof:"union"` - XXX_unrecognized []byte `json:"-"` - } - func (m *Test) Reset() { *m = Test{} } - func (m *Test) String() string { return proto.CompactTextString(m) } - func (*Test) ProtoMessage() {} - - type isTest_Union interface { - isTest_Union() - } - - type Test_Number struct { - Number int32 `protobuf:"varint,6,opt,name=number"` - } - type Test_Name struct { - Name string `protobuf:"bytes,7,opt,name=name"` - } - - func (*Test_Number) isTest_Union() {} - func (*Test_Name) isTest_Union() {} - - func (m *Test) GetUnion() isTest_Union { - if m != nil { - return m.Union - } - return nil - } - const Default_Test_Type int32 = 77 - - func (m *Test) GetLabel() string { - if m != nil && m.Label != nil { - return *m.Label - } - return "" - } - - func (m *Test) GetType() int32 { - if m != nil && m.Type != nil { - return *m.Type - } - return Default_Test_Type - } - - func (m *Test) GetOptionalgroup() *Test_OptionalGroup { - if m != nil { - return m.Optionalgroup - } - return nil - } - - type Test_OptionalGroup struct { - RequiredField *string `protobuf:"bytes,5,req" json:"RequiredField,omitempty"` - } - func (m *Test_OptionalGroup) Reset() { *m = Test_OptionalGroup{} } - func (m *Test_OptionalGroup) String() string { return proto.CompactTextString(m) } - - func (m *Test_OptionalGroup) GetRequiredField() string { - if m != nil && m.RequiredField != nil { - return *m.RequiredField - } - return "" - } - - func (m *Test) GetNumber() int32 { - if x, ok := m.GetUnion().(*Test_Number); ok { - return x.Number - } - return 0 - } - - func (m *Test) GetName() string { - if x, ok := m.GetUnion().(*Test_Name); ok { - return x.Name - } - return "" - } - - func init() { - proto.RegisterEnum("example.FOO", FOO_name, FOO_value) - } - -To create and play with a Test object: - - package main - - import ( - "log" - - "github.com/gogo/protobuf/proto" - pb "./example.pb" - ) - - func main() { - test := &pb.Test{ - Label: proto.String("hello"), - Type: proto.Int32(17), - Reps: []int64{1, 2, 3}, - Optionalgroup: &pb.Test_OptionalGroup{ - RequiredField: proto.String("good bye"), - }, - Union: &pb.Test_Name{"fred"}, - } - data, err := proto.Marshal(test) - if err != nil { - log.Fatal("marshaling error: ", err) - } - newTest := &pb.Test{} - err = proto.Unmarshal(data, newTest) - if err != nil { - log.Fatal("unmarshaling error: ", err) - } - // Now test and newTest contain the same data. - if test.GetLabel() != newTest.GetLabel() { - log.Fatalf("data mismatch %q != %q", test.GetLabel(), newTest.GetLabel()) - } - // Use a type switch to determine which oneof was set. - switch u := test.Union.(type) { - case *pb.Test_Number: // u.Number contains the number. - case *pb.Test_Name: // u.Name contains the string. - } - // etc. - } -*/ -package proto - -import ( - "encoding/json" - "fmt" - "log" - "reflect" - "sort" - "strconv" - "sync" -) - -// RequiredNotSetError is an error type returned by either Marshal or Unmarshal. -// Marshal reports this when a required field is not initialized. -// Unmarshal reports this when a required field is missing from the wire data. -type RequiredNotSetError struct{ field string } - -func (e *RequiredNotSetError) Error() string { - if e.field == "" { - return fmt.Sprintf("proto: required field not set") - } - return fmt.Sprintf("proto: required field %q not set", e.field) -} -func (e *RequiredNotSetError) RequiredNotSet() bool { - return true -} - -type invalidUTF8Error struct{ field string } - -func (e *invalidUTF8Error) Error() string { - if e.field == "" { - return "proto: invalid UTF-8 detected" - } - return fmt.Sprintf("proto: field %q contains invalid UTF-8", e.field) -} -func (e *invalidUTF8Error) InvalidUTF8() bool { - return true -} - -// errInvalidUTF8 is a sentinel error to identify fields with invalid UTF-8. -// This error should not be exposed to the external API as such errors should -// be recreated with the field information. -var errInvalidUTF8 = &invalidUTF8Error{} - -// isNonFatal reports whether the error is either a RequiredNotSet error -// or a InvalidUTF8 error. -func isNonFatal(err error) bool { - if re, ok := err.(interface{ RequiredNotSet() bool }); ok && re.RequiredNotSet() { - return true - } - if re, ok := err.(interface{ InvalidUTF8() bool }); ok && re.InvalidUTF8() { - return true - } - return false -} - -type nonFatal struct{ E error } - -// Merge merges err into nf and reports whether it was successful. -// Otherwise it returns false for any fatal non-nil errors. -func (nf *nonFatal) Merge(err error) (ok bool) { - if err == nil { - return true // not an error - } - if !isNonFatal(err) { - return false // fatal error - } - if nf.E == nil { - nf.E = err // store first instance of non-fatal error - } - return true -} - -// Message is implemented by generated protocol buffer messages. -type Message interface { - Reset() - String() string - ProtoMessage() -} - -// A Buffer is a buffer manager for marshaling and unmarshaling -// protocol buffers. It may be reused between invocations to -// reduce memory usage. It is not necessary to use a Buffer; -// the global functions Marshal and Unmarshal create a -// temporary Buffer and are fine for most applications. -type Buffer struct { - buf []byte // encode/decode byte stream - index int // read point - - deterministic bool -} - -// NewBuffer allocates a new Buffer and initializes its internal data to -// the contents of the argument slice. -func NewBuffer(e []byte) *Buffer { - return &Buffer{buf: e} -} - -// Reset resets the Buffer, ready for marshaling a new protocol buffer. -func (p *Buffer) Reset() { - p.buf = p.buf[0:0] // for reading/writing - p.index = 0 // for reading -} - -// SetBuf replaces the internal buffer with the slice, -// ready for unmarshaling the contents of the slice. -func (p *Buffer) SetBuf(s []byte) { - p.buf = s - p.index = 0 -} - -// Bytes returns the contents of the Buffer. -func (p *Buffer) Bytes() []byte { return p.buf } - -// SetDeterministic sets whether to use deterministic serialization. -// -// Deterministic serialization guarantees that for a given binary, equal -// messages will always be serialized to the same bytes. This implies: -// -// - Repeated serialization of a message will return the same bytes. -// - Different processes of the same binary (which may be executing on -// different machines) will serialize equal messages to the same bytes. -// -// Note that the deterministic serialization is NOT canonical across -// languages. It is not guaranteed to remain stable over time. It is unstable -// across different builds with schema changes due to unknown fields. -// Users who need canonical serialization (e.g., persistent storage in a -// canonical form, fingerprinting, etc.) should define their own -// canonicalization specification and implement their own serializer rather -// than relying on this API. -// -// If deterministic serialization is requested, map entries will be sorted -// by keys in lexographical order. This is an implementation detail and -// subject to change. -func (p *Buffer) SetDeterministic(deterministic bool) { - p.deterministic = deterministic -} - -/* - * Helper routines for simplifying the creation of optional fields of basic type. - */ - -// Bool is a helper routine that allocates a new bool value -// to store v and returns a pointer to it. -func Bool(v bool) *bool { - return &v -} - -// Int32 is a helper routine that allocates a new int32 value -// to store v and returns a pointer to it. -func Int32(v int32) *int32 { - return &v -} - -// Int is a helper routine that allocates a new int32 value -// to store v and returns a pointer to it, but unlike Int32 -// its argument value is an int. -func Int(v int) *int32 { - p := new(int32) - *p = int32(v) - return p -} - -// Int64 is a helper routine that allocates a new int64 value -// to store v and returns a pointer to it. -func Int64(v int64) *int64 { - return &v -} - -// Float32 is a helper routine that allocates a new float32 value -// to store v and returns a pointer to it. -func Float32(v float32) *float32 { - return &v -} - -// Float64 is a helper routine that allocates a new float64 value -// to store v and returns a pointer to it. -func Float64(v float64) *float64 { - return &v -} - -// Uint32 is a helper routine that allocates a new uint32 value -// to store v and returns a pointer to it. -func Uint32(v uint32) *uint32 { - return &v -} - -// Uint64 is a helper routine that allocates a new uint64 value -// to store v and returns a pointer to it. -func Uint64(v uint64) *uint64 { - return &v -} - -// String is a helper routine that allocates a new string value -// to store v and returns a pointer to it. -func String(v string) *string { - return &v -} - -// EnumName is a helper function to simplify printing protocol buffer enums -// by name. Given an enum map and a value, it returns a useful string. -func EnumName(m map[int32]string, v int32) string { - s, ok := m[v] - if ok { - return s - } - return strconv.Itoa(int(v)) -} - -// UnmarshalJSONEnum is a helper function to simplify recovering enum int values -// from their JSON-encoded representation. Given a map from the enum's symbolic -// names to its int values, and a byte buffer containing the JSON-encoded -// value, it returns an int32 that can be cast to the enum type by the caller. -// -// The function can deal with both JSON representations, numeric and symbolic. -func UnmarshalJSONEnum(m map[string]int32, data []byte, enumName string) (int32, error) { - if data[0] == '"' { - // New style: enums are strings. - var repr string - if err := json.Unmarshal(data, &repr); err != nil { - return -1, err - } - val, ok := m[repr] - if !ok { - return 0, fmt.Errorf("unrecognized enum %s value %q", enumName, repr) - } - return val, nil - } - // Old style: enums are ints. - var val int32 - if err := json.Unmarshal(data, &val); err != nil { - return 0, fmt.Errorf("cannot unmarshal %#q into enum %s", data, enumName) - } - return val, nil -} - -// DebugPrint dumps the encoded data in b in a debugging format with a header -// including the string s. Used in testing but made available for general debugging. -func (p *Buffer) DebugPrint(s string, b []byte) { - var u uint64 - - obuf := p.buf - sindex := p.index - p.buf = b - p.index = 0 - depth := 0 - - fmt.Printf("\n--- %s ---\n", s) - -out: - for { - for i := 0; i < depth; i++ { - fmt.Print(" ") - } - - index := p.index - if index == len(p.buf) { - break - } - - op, err := p.DecodeVarint() - if err != nil { - fmt.Printf("%3d: fetching op err %v\n", index, err) - break out - } - tag := op >> 3 - wire := op & 7 - - switch wire { - default: - fmt.Printf("%3d: t=%3d unknown wire=%d\n", - index, tag, wire) - break out - - case WireBytes: - var r []byte - - r, err = p.DecodeRawBytes(false) - if err != nil { - break out - } - fmt.Printf("%3d: t=%3d bytes [%d]", index, tag, len(r)) - if len(r) <= 6 { - for i := 0; i < len(r); i++ { - fmt.Printf(" %.2x", r[i]) - } - } else { - for i := 0; i < 3; i++ { - fmt.Printf(" %.2x", r[i]) - } - fmt.Printf(" ..") - for i := len(r) - 3; i < len(r); i++ { - fmt.Printf(" %.2x", r[i]) - } - } - fmt.Printf("\n") - - case WireFixed32: - u, err = p.DecodeFixed32() - if err != nil { - fmt.Printf("%3d: t=%3d fix32 err %v\n", index, tag, err) - break out - } - fmt.Printf("%3d: t=%3d fix32 %d\n", index, tag, u) - - case WireFixed64: - u, err = p.DecodeFixed64() - if err != nil { - fmt.Printf("%3d: t=%3d fix64 err %v\n", index, tag, err) - break out - } - fmt.Printf("%3d: t=%3d fix64 %d\n", index, tag, u) - - case WireVarint: - u, err = p.DecodeVarint() - if err != nil { - fmt.Printf("%3d: t=%3d varint err %v\n", index, tag, err) - break out - } - fmt.Printf("%3d: t=%3d varint %d\n", index, tag, u) - - case WireStartGroup: - fmt.Printf("%3d: t=%3d start\n", index, tag) - depth++ - - case WireEndGroup: - depth-- - fmt.Printf("%3d: t=%3d end\n", index, tag) - } - } - - if depth != 0 { - fmt.Printf("%3d: start-end not balanced %d\n", p.index, depth) - } - fmt.Printf("\n") - - p.buf = obuf - p.index = sindex -} - -// SetDefaults sets unset protocol buffer fields to their default values. -// It only modifies fields that are both unset and have defined defaults. -// It recursively sets default values in any non-nil sub-messages. -func SetDefaults(pb Message) { - setDefaults(reflect.ValueOf(pb), true, false) -} - -// v is a struct. -func setDefaults(v reflect.Value, recur, zeros bool) { - if v.Kind() == reflect.Ptr { - v = v.Elem() - } - - defaultMu.RLock() - dm, ok := defaults[v.Type()] - defaultMu.RUnlock() - if !ok { - dm = buildDefaultMessage(v.Type()) - defaultMu.Lock() - defaults[v.Type()] = dm - defaultMu.Unlock() - } - - for _, sf := range dm.scalars { - f := v.Field(sf.index) - if !f.IsNil() { - // field already set - continue - } - dv := sf.value - if dv == nil && !zeros { - // no explicit default, and don't want to set zeros - continue - } - fptr := f.Addr().Interface() // **T - // TODO: Consider batching the allocations we do here. - switch sf.kind { - case reflect.Bool: - b := new(bool) - if dv != nil { - *b = dv.(bool) - } - *(fptr.(**bool)) = b - case reflect.Float32: - f := new(float32) - if dv != nil { - *f = dv.(float32) - } - *(fptr.(**float32)) = f - case reflect.Float64: - f := new(float64) - if dv != nil { - *f = dv.(float64) - } - *(fptr.(**float64)) = f - case reflect.Int32: - // might be an enum - if ft := f.Type(); ft != int32PtrType { - // enum - f.Set(reflect.New(ft.Elem())) - if dv != nil { - f.Elem().SetInt(int64(dv.(int32))) - } - } else { - // int32 field - i := new(int32) - if dv != nil { - *i = dv.(int32) - } - *(fptr.(**int32)) = i - } - case reflect.Int64: - i := new(int64) - if dv != nil { - *i = dv.(int64) - } - *(fptr.(**int64)) = i - case reflect.String: - s := new(string) - if dv != nil { - *s = dv.(string) - } - *(fptr.(**string)) = s - case reflect.Uint8: - // exceptional case: []byte - var b []byte - if dv != nil { - db := dv.([]byte) - b = make([]byte, len(db)) - copy(b, db) - } else { - b = []byte{} - } - *(fptr.(*[]byte)) = b - case reflect.Uint32: - u := new(uint32) - if dv != nil { - *u = dv.(uint32) - } - *(fptr.(**uint32)) = u - case reflect.Uint64: - u := new(uint64) - if dv != nil { - *u = dv.(uint64) - } - *(fptr.(**uint64)) = u - default: - log.Printf("proto: can't set default for field %v (sf.kind=%v)", f, sf.kind) - } - } - - for _, ni := range dm.nested { - f := v.Field(ni) - // f is *T or T or []*T or []T - switch f.Kind() { - case reflect.Struct: - setDefaults(f, recur, zeros) - - case reflect.Ptr: - if f.IsNil() { - continue - } - setDefaults(f, recur, zeros) - - case reflect.Slice: - for i := 0; i < f.Len(); i++ { - e := f.Index(i) - if e.Kind() == reflect.Ptr && e.IsNil() { - continue - } - setDefaults(e, recur, zeros) - } - - case reflect.Map: - for _, k := range f.MapKeys() { - e := f.MapIndex(k) - if e.IsNil() { - continue - } - setDefaults(e, recur, zeros) - } - } - } -} - -var ( - // defaults maps a protocol buffer struct type to a slice of the fields, - // with its scalar fields set to their proto-declared non-zero default values. - defaultMu sync.RWMutex - defaults = make(map[reflect.Type]defaultMessage) - - int32PtrType = reflect.TypeOf((*int32)(nil)) -) - -// defaultMessage represents information about the default values of a message. -type defaultMessage struct { - scalars []scalarField - nested []int // struct field index of nested messages -} - -type scalarField struct { - index int // struct field index - kind reflect.Kind // element type (the T in *T or []T) - value interface{} // the proto-declared default value, or nil -} - -// t is a struct type. -func buildDefaultMessage(t reflect.Type) (dm defaultMessage) { - sprop := GetProperties(t) - for _, prop := range sprop.Prop { - fi, ok := sprop.decoderTags.get(prop.Tag) - if !ok { - // XXX_unrecognized - continue - } - ft := t.Field(fi).Type - - sf, nested, err := fieldDefault(ft, prop) - switch { - case err != nil: - log.Print(err) - case nested: - dm.nested = append(dm.nested, fi) - case sf != nil: - sf.index = fi - dm.scalars = append(dm.scalars, *sf) - } - } - - return dm -} - -// fieldDefault returns the scalarField for field type ft. -// sf will be nil if the field can not have a default. -// nestedMessage will be true if this is a nested message. -// Note that sf.index is not set on return. -func fieldDefault(ft reflect.Type, prop *Properties) (sf *scalarField, nestedMessage bool, err error) { - var canHaveDefault bool - switch ft.Kind() { - case reflect.Struct: - nestedMessage = true // non-nullable - - case reflect.Ptr: - if ft.Elem().Kind() == reflect.Struct { - nestedMessage = true - } else { - canHaveDefault = true // proto2 scalar field - } - - case reflect.Slice: - switch ft.Elem().Kind() { - case reflect.Ptr, reflect.Struct: - nestedMessage = true // repeated message - case reflect.Uint8: - canHaveDefault = true // bytes field - } - - case reflect.Map: - if ft.Elem().Kind() == reflect.Ptr { - nestedMessage = true // map with message values - } - } - - if !canHaveDefault { - if nestedMessage { - return nil, true, nil - } - return nil, false, nil - } - - // We now know that ft is a pointer or slice. - sf = &scalarField{kind: ft.Elem().Kind()} - - // scalar fields without defaults - if !prop.HasDefault { - return sf, false, nil - } - - // a scalar field: either *T or []byte - switch ft.Elem().Kind() { - case reflect.Bool: - x, err := strconv.ParseBool(prop.Default) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default bool %q: %v", prop.Default, err) - } - sf.value = x - case reflect.Float32: - x, err := strconv.ParseFloat(prop.Default, 32) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default float32 %q: %v", prop.Default, err) - } - sf.value = float32(x) - case reflect.Float64: - x, err := strconv.ParseFloat(prop.Default, 64) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default float64 %q: %v", prop.Default, err) - } - sf.value = x - case reflect.Int32: - x, err := strconv.ParseInt(prop.Default, 10, 32) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default int32 %q: %v", prop.Default, err) - } - sf.value = int32(x) - case reflect.Int64: - x, err := strconv.ParseInt(prop.Default, 10, 64) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default int64 %q: %v", prop.Default, err) - } - sf.value = x - case reflect.String: - sf.value = prop.Default - case reflect.Uint8: - // []byte (not *uint8) - sf.value = []byte(prop.Default) - case reflect.Uint32: - x, err := strconv.ParseUint(prop.Default, 10, 32) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default uint32 %q: %v", prop.Default, err) - } - sf.value = uint32(x) - case reflect.Uint64: - x, err := strconv.ParseUint(prop.Default, 10, 64) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default uint64 %q: %v", prop.Default, err) - } - sf.value = x - default: - return nil, false, fmt.Errorf("proto: unhandled def kind %v", ft.Elem().Kind()) - } - - return sf, false, nil -} - -// mapKeys returns a sort.Interface to be used for sorting the map keys. -// Map fields may have key types of non-float scalars, strings and enums. -func mapKeys(vs []reflect.Value) sort.Interface { - s := mapKeySorter{vs: vs} - - // Type specialization per https://developers.google.com/protocol-buffers/docs/proto#maps. - if len(vs) == 0 { - return s - } - switch vs[0].Kind() { - case reflect.Int32, reflect.Int64: - s.less = func(a, b reflect.Value) bool { return a.Int() < b.Int() } - case reflect.Uint32, reflect.Uint64: - s.less = func(a, b reflect.Value) bool { return a.Uint() < b.Uint() } - case reflect.Bool: - s.less = func(a, b reflect.Value) bool { return !a.Bool() && b.Bool() } // false < true - case reflect.String: - s.less = func(a, b reflect.Value) bool { return a.String() < b.String() } - default: - panic(fmt.Sprintf("unsupported map key type: %v", vs[0].Kind())) - } - - return s -} - -type mapKeySorter struct { - vs []reflect.Value - less func(a, b reflect.Value) bool -} - -func (s mapKeySorter) Len() int { return len(s.vs) } -func (s mapKeySorter) Swap(i, j int) { s.vs[i], s.vs[j] = s.vs[j], s.vs[i] } -func (s mapKeySorter) Less(i, j int) bool { - return s.less(s.vs[i], s.vs[j]) -} - -// isProto3Zero reports whether v is a zero proto3 value. -func isProto3Zero(v reflect.Value) bool { - switch v.Kind() { - case reflect.Bool: - return !v.Bool() - case reflect.Int32, reflect.Int64: - return v.Int() == 0 - case reflect.Uint32, reflect.Uint64: - return v.Uint() == 0 - case reflect.Float32, reflect.Float64: - return v.Float() == 0 - case reflect.String: - return v.String() == "" - } - return false -} - -const ( - // ProtoPackageIsVersion3 is referenced from generated protocol buffer files - // to assert that that code is compatible with this version of the proto package. - GoGoProtoPackageIsVersion3 = true - - // ProtoPackageIsVersion2 is referenced from generated protocol buffer files - // to assert that that code is compatible with this version of the proto package. - GoGoProtoPackageIsVersion2 = true - - // ProtoPackageIsVersion1 is referenced from generated protocol buffer files - // to assert that that code is compatible with this version of the proto package. - GoGoProtoPackageIsVersion1 = true -) - -// InternalMessageInfo is a type used internally by generated .pb.go files. -// This type is not intended to be used by non-generated code. -// This type is not subject to any compatibility guarantee. -type InternalMessageInfo struct { - marshal *marshalInfo - unmarshal *unmarshalInfo - merge *mergeInfo - discard *discardInfo -} diff --git a/vendor/github.com/gogo/protobuf/proto/lib_gogo.go b/vendor/github.com/gogo/protobuf/proto/lib_gogo.go deleted file mode 100644 index b3aa39190..000000000 --- a/vendor/github.com/gogo/protobuf/proto/lib_gogo.go +++ /dev/null @@ -1,50 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -import ( - "encoding/json" - "strconv" -) - -type Sizer interface { - Size() int -} - -type ProtoSizer interface { - ProtoSize() int -} - -func MarshalJSONEnum(m map[int32]string, value int32) ([]byte, error) { - s, ok := m[value] - if !ok { - s = strconv.Itoa(int(value)) - } - return json.Marshal(s) -} diff --git a/vendor/github.com/gogo/protobuf/proto/message_set.go b/vendor/github.com/gogo/protobuf/proto/message_set.go deleted file mode 100644 index f48a75676..000000000 --- a/vendor/github.com/gogo/protobuf/proto/message_set.go +++ /dev/null @@ -1,181 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -/* - * Support for message sets. - */ - -import ( - "errors" -) - -// errNoMessageTypeID occurs when a protocol buffer does not have a message type ID. -// A message type ID is required for storing a protocol buffer in a message set. -var errNoMessageTypeID = errors.New("proto does not have a message type ID") - -// The first two types (_MessageSet_Item and messageSet) -// model what the protocol compiler produces for the following protocol message: -// message MessageSet { -// repeated group Item = 1 { -// required int32 type_id = 2; -// required string message = 3; -// }; -// } -// That is the MessageSet wire format. We can't use a proto to generate these -// because that would introduce a circular dependency between it and this package. - -type _MessageSet_Item struct { - TypeId *int32 `protobuf:"varint,2,req,name=type_id"` - Message []byte `protobuf:"bytes,3,req,name=message"` -} - -type messageSet struct { - Item []*_MessageSet_Item `protobuf:"group,1,rep"` - XXX_unrecognized []byte - // TODO: caching? -} - -// Make sure messageSet is a Message. -var _ Message = (*messageSet)(nil) - -// messageTypeIder is an interface satisfied by a protocol buffer type -// that may be stored in a MessageSet. -type messageTypeIder interface { - MessageTypeId() int32 -} - -func (ms *messageSet) find(pb Message) *_MessageSet_Item { - mti, ok := pb.(messageTypeIder) - if !ok { - return nil - } - id := mti.MessageTypeId() - for _, item := range ms.Item { - if *item.TypeId == id { - return item - } - } - return nil -} - -func (ms *messageSet) Has(pb Message) bool { - return ms.find(pb) != nil -} - -func (ms *messageSet) Unmarshal(pb Message) error { - if item := ms.find(pb); item != nil { - return Unmarshal(item.Message, pb) - } - if _, ok := pb.(messageTypeIder); !ok { - return errNoMessageTypeID - } - return nil // TODO: return error instead? -} - -func (ms *messageSet) Marshal(pb Message) error { - msg, err := Marshal(pb) - if err != nil { - return err - } - if item := ms.find(pb); item != nil { - // reuse existing item - item.Message = msg - return nil - } - - mti, ok := pb.(messageTypeIder) - if !ok { - return errNoMessageTypeID - } - - mtid := mti.MessageTypeId() - ms.Item = append(ms.Item, &_MessageSet_Item{ - TypeId: &mtid, - Message: msg, - }) - return nil -} - -func (ms *messageSet) Reset() { *ms = messageSet{} } -func (ms *messageSet) String() string { return CompactTextString(ms) } -func (*messageSet) ProtoMessage() {} - -// Support for the message_set_wire_format message option. - -func skipVarint(buf []byte) []byte { - i := 0 - for ; buf[i]&0x80 != 0; i++ { - } - return buf[i+1:] -} - -// unmarshalMessageSet decodes the extension map encoded in buf in the message set wire format. -// It is called by Unmarshal methods on protocol buffer messages with the message_set_wire_format option. -func unmarshalMessageSet(buf []byte, exts interface{}) error { - var m map[int32]Extension - switch exts := exts.(type) { - case *XXX_InternalExtensions: - m = exts.extensionsWrite() - case map[int32]Extension: - m = exts - default: - return errors.New("proto: not an extension map") - } - - ms := new(messageSet) - if err := Unmarshal(buf, ms); err != nil { - return err - } - for _, item := range ms.Item { - id := *item.TypeId - msg := item.Message - - // Restore wire type and field number varint, plus length varint. - // Be careful to preserve duplicate items. - b := EncodeVarint(uint64(id)<<3 | WireBytes) - if ext, ok := m[id]; ok { - // Existing data; rip off the tag and length varint - // so we join the new data correctly. - // We can assume that ext.enc is set because we are unmarshaling. - o := ext.enc[len(b):] // skip wire type and field number - _, n := DecodeVarint(o) // calculate length of length varint - o = o[n:] // skip length varint - msg = append(o, msg...) // join old data and new data - } - b = append(b, EncodeVarint(uint64(len(msg)))...) - b = append(b, msg...) - - m[id] = Extension{enc: b} - } - return nil -} diff --git a/vendor/github.com/gogo/protobuf/proto/pointer_reflect.go b/vendor/github.com/gogo/protobuf/proto/pointer_reflect.go deleted file mode 100644 index b6cad9083..000000000 --- a/vendor/github.com/gogo/protobuf/proto/pointer_reflect.go +++ /dev/null @@ -1,357 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2012 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// +build purego appengine js - -// This file contains an implementation of proto field accesses using package reflect. -// It is slower than the code in pointer_unsafe.go but it avoids package unsafe and can -// be used on App Engine. - -package proto - -import ( - "reflect" - "sync" -) - -const unsafeAllowed = false - -// A field identifies a field in a struct, accessible from a pointer. -// In this implementation, a field is identified by the sequence of field indices -// passed to reflect's FieldByIndex. -type field []int - -// toField returns a field equivalent to the given reflect field. -func toField(f *reflect.StructField) field { - return f.Index -} - -// invalidField is an invalid field identifier. -var invalidField = field(nil) - -// zeroField is a noop when calling pointer.offset. -var zeroField = field([]int{}) - -// IsValid reports whether the field identifier is valid. -func (f field) IsValid() bool { return f != nil } - -// The pointer type is for the table-driven decoder. -// The implementation here uses a reflect.Value of pointer type to -// create a generic pointer. In pointer_unsafe.go we use unsafe -// instead of reflect to implement the same (but faster) interface. -type pointer struct { - v reflect.Value -} - -// toPointer converts an interface of pointer type to a pointer -// that points to the same target. -func toPointer(i *Message) pointer { - return pointer{v: reflect.ValueOf(*i)} -} - -// toAddrPointer converts an interface to a pointer that points to -// the interface data. -func toAddrPointer(i *interface{}, isptr bool) pointer { - v := reflect.ValueOf(*i) - u := reflect.New(v.Type()) - u.Elem().Set(v) - return pointer{v: u} -} - -// valToPointer converts v to a pointer. v must be of pointer type. -func valToPointer(v reflect.Value) pointer { - return pointer{v: v} -} - -// offset converts from a pointer to a structure to a pointer to -// one of its fields. -func (p pointer) offset(f field) pointer { - return pointer{v: p.v.Elem().FieldByIndex(f).Addr()} -} - -func (p pointer) isNil() bool { - return p.v.IsNil() -} - -// grow updates the slice s in place to make it one element longer. -// s must be addressable. -// Returns the (addressable) new element. -func grow(s reflect.Value) reflect.Value { - n, m := s.Len(), s.Cap() - if n < m { - s.SetLen(n + 1) - } else { - s.Set(reflect.Append(s, reflect.Zero(s.Type().Elem()))) - } - return s.Index(n) -} - -func (p pointer) toInt64() *int64 { - return p.v.Interface().(*int64) -} -func (p pointer) toInt64Ptr() **int64 { - return p.v.Interface().(**int64) -} -func (p pointer) toInt64Slice() *[]int64 { - return p.v.Interface().(*[]int64) -} - -var int32ptr = reflect.TypeOf((*int32)(nil)) - -func (p pointer) toInt32() *int32 { - return p.v.Convert(int32ptr).Interface().(*int32) -} - -// The toInt32Ptr/Slice methods don't work because of enums. -// Instead, we must use set/get methods for the int32ptr/slice case. -/* - func (p pointer) toInt32Ptr() **int32 { - return p.v.Interface().(**int32) -} - func (p pointer) toInt32Slice() *[]int32 { - return p.v.Interface().(*[]int32) -} -*/ -func (p pointer) getInt32Ptr() *int32 { - if p.v.Type().Elem().Elem() == reflect.TypeOf(int32(0)) { - // raw int32 type - return p.v.Elem().Interface().(*int32) - } - // an enum - return p.v.Elem().Convert(int32PtrType).Interface().(*int32) -} -func (p pointer) setInt32Ptr(v int32) { - // Allocate value in a *int32. Possibly convert that to a *enum. - // Then assign it to a **int32 or **enum. - // Note: we can convert *int32 to *enum, but we can't convert - // **int32 to **enum! - p.v.Elem().Set(reflect.ValueOf(&v).Convert(p.v.Type().Elem())) -} - -// getInt32Slice copies []int32 from p as a new slice. -// This behavior differs from the implementation in pointer_unsafe.go. -func (p pointer) getInt32Slice() []int32 { - if p.v.Type().Elem().Elem() == reflect.TypeOf(int32(0)) { - // raw int32 type - return p.v.Elem().Interface().([]int32) - } - // an enum - // Allocate a []int32, then assign []enum's values into it. - // Note: we can't convert []enum to []int32. - slice := p.v.Elem() - s := make([]int32, slice.Len()) - for i := 0; i < slice.Len(); i++ { - s[i] = int32(slice.Index(i).Int()) - } - return s -} - -// setInt32Slice copies []int32 into p as a new slice. -// This behavior differs from the implementation in pointer_unsafe.go. -func (p pointer) setInt32Slice(v []int32) { - if p.v.Type().Elem().Elem() == reflect.TypeOf(int32(0)) { - // raw int32 type - p.v.Elem().Set(reflect.ValueOf(v)) - return - } - // an enum - // Allocate a []enum, then assign []int32's values into it. - // Note: we can't convert []enum to []int32. - slice := reflect.MakeSlice(p.v.Type().Elem(), len(v), cap(v)) - for i, x := range v { - slice.Index(i).SetInt(int64(x)) - } - p.v.Elem().Set(slice) -} -func (p pointer) appendInt32Slice(v int32) { - grow(p.v.Elem()).SetInt(int64(v)) -} - -func (p pointer) toUint64() *uint64 { - return p.v.Interface().(*uint64) -} -func (p pointer) toUint64Ptr() **uint64 { - return p.v.Interface().(**uint64) -} -func (p pointer) toUint64Slice() *[]uint64 { - return p.v.Interface().(*[]uint64) -} -func (p pointer) toUint32() *uint32 { - return p.v.Interface().(*uint32) -} -func (p pointer) toUint32Ptr() **uint32 { - return p.v.Interface().(**uint32) -} -func (p pointer) toUint32Slice() *[]uint32 { - return p.v.Interface().(*[]uint32) -} -func (p pointer) toBool() *bool { - return p.v.Interface().(*bool) -} -func (p pointer) toBoolPtr() **bool { - return p.v.Interface().(**bool) -} -func (p pointer) toBoolSlice() *[]bool { - return p.v.Interface().(*[]bool) -} -func (p pointer) toFloat64() *float64 { - return p.v.Interface().(*float64) -} -func (p pointer) toFloat64Ptr() **float64 { - return p.v.Interface().(**float64) -} -func (p pointer) toFloat64Slice() *[]float64 { - return p.v.Interface().(*[]float64) -} -func (p pointer) toFloat32() *float32 { - return p.v.Interface().(*float32) -} -func (p pointer) toFloat32Ptr() **float32 { - return p.v.Interface().(**float32) -} -func (p pointer) toFloat32Slice() *[]float32 { - return p.v.Interface().(*[]float32) -} -func (p pointer) toString() *string { - return p.v.Interface().(*string) -} -func (p pointer) toStringPtr() **string { - return p.v.Interface().(**string) -} -func (p pointer) toStringSlice() *[]string { - return p.v.Interface().(*[]string) -} -func (p pointer) toBytes() *[]byte { - return p.v.Interface().(*[]byte) -} -func (p pointer) toBytesSlice() *[][]byte { - return p.v.Interface().(*[][]byte) -} -func (p pointer) toExtensions() *XXX_InternalExtensions { - return p.v.Interface().(*XXX_InternalExtensions) -} -func (p pointer) toOldExtensions() *map[int32]Extension { - return p.v.Interface().(*map[int32]Extension) -} -func (p pointer) getPointer() pointer { - return pointer{v: p.v.Elem()} -} -func (p pointer) setPointer(q pointer) { - p.v.Elem().Set(q.v) -} -func (p pointer) appendPointer(q pointer) { - grow(p.v.Elem()).Set(q.v) -} - -// getPointerSlice copies []*T from p as a new []pointer. -// This behavior differs from the implementation in pointer_unsafe.go. -func (p pointer) getPointerSlice() []pointer { - if p.v.IsNil() { - return nil - } - n := p.v.Elem().Len() - s := make([]pointer, n) - for i := 0; i < n; i++ { - s[i] = pointer{v: p.v.Elem().Index(i)} - } - return s -} - -// setPointerSlice copies []pointer into p as a new []*T. -// This behavior differs from the implementation in pointer_unsafe.go. -func (p pointer) setPointerSlice(v []pointer) { - if v == nil { - p.v.Elem().Set(reflect.New(p.v.Elem().Type()).Elem()) - return - } - s := reflect.MakeSlice(p.v.Elem().Type(), 0, len(v)) - for _, p := range v { - s = reflect.Append(s, p.v) - } - p.v.Elem().Set(s) -} - -// getInterfacePointer returns a pointer that points to the -// interface data of the interface pointed by p. -func (p pointer) getInterfacePointer() pointer { - if p.v.Elem().IsNil() { - return pointer{v: p.v.Elem()} - } - return pointer{v: p.v.Elem().Elem().Elem().Field(0).Addr()} // *interface -> interface -> *struct -> struct -} - -func (p pointer) asPointerTo(t reflect.Type) reflect.Value { - // TODO: check that p.v.Type().Elem() == t? - return p.v -} - -func atomicLoadUnmarshalInfo(p **unmarshalInfo) *unmarshalInfo { - atomicLock.Lock() - defer atomicLock.Unlock() - return *p -} -func atomicStoreUnmarshalInfo(p **unmarshalInfo, v *unmarshalInfo) { - atomicLock.Lock() - defer atomicLock.Unlock() - *p = v -} -func atomicLoadMarshalInfo(p **marshalInfo) *marshalInfo { - atomicLock.Lock() - defer atomicLock.Unlock() - return *p -} -func atomicStoreMarshalInfo(p **marshalInfo, v *marshalInfo) { - atomicLock.Lock() - defer atomicLock.Unlock() - *p = v -} -func atomicLoadMergeInfo(p **mergeInfo) *mergeInfo { - atomicLock.Lock() - defer atomicLock.Unlock() - return *p -} -func atomicStoreMergeInfo(p **mergeInfo, v *mergeInfo) { - atomicLock.Lock() - defer atomicLock.Unlock() - *p = v -} -func atomicLoadDiscardInfo(p **discardInfo) *discardInfo { - atomicLock.Lock() - defer atomicLock.Unlock() - return *p -} -func atomicStoreDiscardInfo(p **discardInfo, v *discardInfo) { - atomicLock.Lock() - defer atomicLock.Unlock() - *p = v -} - -var atomicLock sync.Mutex diff --git a/vendor/github.com/gogo/protobuf/proto/pointer_reflect_gogo.go b/vendor/github.com/gogo/protobuf/proto/pointer_reflect_gogo.go deleted file mode 100644 index 7ffd3c29d..000000000 --- a/vendor/github.com/gogo/protobuf/proto/pointer_reflect_gogo.go +++ /dev/null @@ -1,59 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2018, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// +build purego appengine js - -// This file contains an implementation of proto field accesses using package reflect. -// It is slower than the code in pointer_unsafe.go but it avoids package unsafe and can -// be used on App Engine. - -package proto - -import ( - "reflect" -) - -// TODO: untested, so probably incorrect. - -func (p pointer) getRef() pointer { - return pointer{v: p.v.Addr()} -} - -func (p pointer) appendRef(v pointer, typ reflect.Type) { - slice := p.getSlice(typ) - elem := v.asPointerTo(typ).Elem() - newSlice := reflect.Append(slice, elem) - slice.Set(newSlice) -} - -func (p pointer) getSlice(typ reflect.Type) reflect.Value { - sliceTyp := reflect.SliceOf(typ) - slice := p.asPointerTo(sliceTyp) - slice = slice.Elem() - return slice -} diff --git a/vendor/github.com/gogo/protobuf/proto/pointer_unsafe.go b/vendor/github.com/gogo/protobuf/proto/pointer_unsafe.go deleted file mode 100644 index d55a335d9..000000000 --- a/vendor/github.com/gogo/protobuf/proto/pointer_unsafe.go +++ /dev/null @@ -1,308 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2012 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// +build !purego,!appengine,!js - -// This file contains the implementation of the proto field accesses using package unsafe. - -package proto - -import ( - "reflect" - "sync/atomic" - "unsafe" -) - -const unsafeAllowed = true - -// A field identifies a field in a struct, accessible from a pointer. -// In this implementation, a field is identified by its byte offset from the start of the struct. -type field uintptr - -// toField returns a field equivalent to the given reflect field. -func toField(f *reflect.StructField) field { - return field(f.Offset) -} - -// invalidField is an invalid field identifier. -const invalidField = ^field(0) - -// zeroField is a noop when calling pointer.offset. -const zeroField = field(0) - -// IsValid reports whether the field identifier is valid. -func (f field) IsValid() bool { - return f != invalidField -} - -// The pointer type below is for the new table-driven encoder/decoder. -// The implementation here uses unsafe.Pointer to create a generic pointer. -// In pointer_reflect.go we use reflect instead of unsafe to implement -// the same (but slower) interface. -type pointer struct { - p unsafe.Pointer -} - -// size of pointer -var ptrSize = unsafe.Sizeof(uintptr(0)) - -// toPointer converts an interface of pointer type to a pointer -// that points to the same target. -func toPointer(i *Message) pointer { - // Super-tricky - read pointer out of data word of interface value. - // Saves ~25ns over the equivalent: - // return valToPointer(reflect.ValueOf(*i)) - return pointer{p: (*[2]unsafe.Pointer)(unsafe.Pointer(i))[1]} -} - -// toAddrPointer converts an interface to a pointer that points to -// the interface data. -func toAddrPointer(i *interface{}, isptr bool) pointer { - // Super-tricky - read or get the address of data word of interface value. - if isptr { - // The interface is of pointer type, thus it is a direct interface. - // The data word is the pointer data itself. We take its address. - return pointer{p: unsafe.Pointer(uintptr(unsafe.Pointer(i)) + ptrSize)} - } - // The interface is not of pointer type. The data word is the pointer - // to the data. - return pointer{p: (*[2]unsafe.Pointer)(unsafe.Pointer(i))[1]} -} - -// valToPointer converts v to a pointer. v must be of pointer type. -func valToPointer(v reflect.Value) pointer { - return pointer{p: unsafe.Pointer(v.Pointer())} -} - -// offset converts from a pointer to a structure to a pointer to -// one of its fields. -func (p pointer) offset(f field) pointer { - // For safety, we should panic if !f.IsValid, however calling panic causes - // this to no longer be inlineable, which is a serious performance cost. - /* - if !f.IsValid() { - panic("invalid field") - } - */ - return pointer{p: unsafe.Pointer(uintptr(p.p) + uintptr(f))} -} - -func (p pointer) isNil() bool { - return p.p == nil -} - -func (p pointer) toInt64() *int64 { - return (*int64)(p.p) -} -func (p pointer) toInt64Ptr() **int64 { - return (**int64)(p.p) -} -func (p pointer) toInt64Slice() *[]int64 { - return (*[]int64)(p.p) -} -func (p pointer) toInt32() *int32 { - return (*int32)(p.p) -} - -// See pointer_reflect.go for why toInt32Ptr/Slice doesn't exist. -/* - func (p pointer) toInt32Ptr() **int32 { - return (**int32)(p.p) - } - func (p pointer) toInt32Slice() *[]int32 { - return (*[]int32)(p.p) - } -*/ -func (p pointer) getInt32Ptr() *int32 { - return *(**int32)(p.p) -} -func (p pointer) setInt32Ptr(v int32) { - *(**int32)(p.p) = &v -} - -// getInt32Slice loads a []int32 from p. -// The value returned is aliased with the original slice. -// This behavior differs from the implementation in pointer_reflect.go. -func (p pointer) getInt32Slice() []int32 { - return *(*[]int32)(p.p) -} - -// setInt32Slice stores a []int32 to p. -// The value set is aliased with the input slice. -// This behavior differs from the implementation in pointer_reflect.go. -func (p pointer) setInt32Slice(v []int32) { - *(*[]int32)(p.p) = v -} - -// TODO: Can we get rid of appendInt32Slice and use setInt32Slice instead? -func (p pointer) appendInt32Slice(v int32) { - s := (*[]int32)(p.p) - *s = append(*s, v) -} - -func (p pointer) toUint64() *uint64 { - return (*uint64)(p.p) -} -func (p pointer) toUint64Ptr() **uint64 { - return (**uint64)(p.p) -} -func (p pointer) toUint64Slice() *[]uint64 { - return (*[]uint64)(p.p) -} -func (p pointer) toUint32() *uint32 { - return (*uint32)(p.p) -} -func (p pointer) toUint32Ptr() **uint32 { - return (**uint32)(p.p) -} -func (p pointer) toUint32Slice() *[]uint32 { - return (*[]uint32)(p.p) -} -func (p pointer) toBool() *bool { - return (*bool)(p.p) -} -func (p pointer) toBoolPtr() **bool { - return (**bool)(p.p) -} -func (p pointer) toBoolSlice() *[]bool { - return (*[]bool)(p.p) -} -func (p pointer) toFloat64() *float64 { - return (*float64)(p.p) -} -func (p pointer) toFloat64Ptr() **float64 { - return (**float64)(p.p) -} -func (p pointer) toFloat64Slice() *[]float64 { - return (*[]float64)(p.p) -} -func (p pointer) toFloat32() *float32 { - return (*float32)(p.p) -} -func (p pointer) toFloat32Ptr() **float32 { - return (**float32)(p.p) -} -func (p pointer) toFloat32Slice() *[]float32 { - return (*[]float32)(p.p) -} -func (p pointer) toString() *string { - return (*string)(p.p) -} -func (p pointer) toStringPtr() **string { - return (**string)(p.p) -} -func (p pointer) toStringSlice() *[]string { - return (*[]string)(p.p) -} -func (p pointer) toBytes() *[]byte { - return (*[]byte)(p.p) -} -func (p pointer) toBytesSlice() *[][]byte { - return (*[][]byte)(p.p) -} -func (p pointer) toExtensions() *XXX_InternalExtensions { - return (*XXX_InternalExtensions)(p.p) -} -func (p pointer) toOldExtensions() *map[int32]Extension { - return (*map[int32]Extension)(p.p) -} - -// getPointerSlice loads []*T from p as a []pointer. -// The value returned is aliased with the original slice. -// This behavior differs from the implementation in pointer_reflect.go. -func (p pointer) getPointerSlice() []pointer { - // Super-tricky - p should point to a []*T where T is a - // message type. We load it as []pointer. - return *(*[]pointer)(p.p) -} - -// setPointerSlice stores []pointer into p as a []*T. -// The value set is aliased with the input slice. -// This behavior differs from the implementation in pointer_reflect.go. -func (p pointer) setPointerSlice(v []pointer) { - // Super-tricky - p should point to a []*T where T is a - // message type. We store it as []pointer. - *(*[]pointer)(p.p) = v -} - -// getPointer loads the pointer at p and returns it. -func (p pointer) getPointer() pointer { - return pointer{p: *(*unsafe.Pointer)(p.p)} -} - -// setPointer stores the pointer q at p. -func (p pointer) setPointer(q pointer) { - *(*unsafe.Pointer)(p.p) = q.p -} - -// append q to the slice pointed to by p. -func (p pointer) appendPointer(q pointer) { - s := (*[]unsafe.Pointer)(p.p) - *s = append(*s, q.p) -} - -// getInterfacePointer returns a pointer that points to the -// interface data of the interface pointed by p. -func (p pointer) getInterfacePointer() pointer { - // Super-tricky - read pointer out of data word of interface value. - return pointer{p: (*(*[2]unsafe.Pointer)(p.p))[1]} -} - -// asPointerTo returns a reflect.Value that is a pointer to an -// object of type t stored at p. -func (p pointer) asPointerTo(t reflect.Type) reflect.Value { - return reflect.NewAt(t, p.p) -} - -func atomicLoadUnmarshalInfo(p **unmarshalInfo) *unmarshalInfo { - return (*unmarshalInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p)))) -} -func atomicStoreUnmarshalInfo(p **unmarshalInfo, v *unmarshalInfo) { - atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v)) -} -func atomicLoadMarshalInfo(p **marshalInfo) *marshalInfo { - return (*marshalInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p)))) -} -func atomicStoreMarshalInfo(p **marshalInfo, v *marshalInfo) { - atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v)) -} -func atomicLoadMergeInfo(p **mergeInfo) *mergeInfo { - return (*mergeInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p)))) -} -func atomicStoreMergeInfo(p **mergeInfo, v *mergeInfo) { - atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v)) -} -func atomicLoadDiscardInfo(p **discardInfo) *discardInfo { - return (*discardInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p)))) -} -func atomicStoreDiscardInfo(p **discardInfo, v *discardInfo) { - atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v)) -} diff --git a/vendor/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go b/vendor/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go deleted file mode 100644 index aca8eed02..000000000 --- a/vendor/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go +++ /dev/null @@ -1,56 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2018, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// +build !purego,!appengine,!js - -// This file contains the implementation of the proto field accesses using package unsafe. - -package proto - -import ( - "reflect" - "unsafe" -) - -func (p pointer) getRef() pointer { - return pointer{p: (unsafe.Pointer)(&p.p)} -} - -func (p pointer) appendRef(v pointer, typ reflect.Type) { - slice := p.getSlice(typ) - elem := v.asPointerTo(typ).Elem() - newSlice := reflect.Append(slice, elem) - slice.Set(newSlice) -} - -func (p pointer) getSlice(typ reflect.Type) reflect.Value { - sliceTyp := reflect.SliceOf(typ) - slice := p.asPointerTo(sliceTyp) - slice = slice.Elem() - return slice -} diff --git a/vendor/github.com/gogo/protobuf/proto/properties.go b/vendor/github.com/gogo/protobuf/proto/properties.go deleted file mode 100644 index 28da1475f..000000000 --- a/vendor/github.com/gogo/protobuf/proto/properties.go +++ /dev/null @@ -1,610 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -/* - * Routines for encoding data into the wire format for protocol buffers. - */ - -import ( - "fmt" - "log" - "reflect" - "sort" - "strconv" - "strings" - "sync" -) - -const debug bool = false - -// Constants that identify the encoding of a value on the wire. -const ( - WireVarint = 0 - WireFixed64 = 1 - WireBytes = 2 - WireStartGroup = 3 - WireEndGroup = 4 - WireFixed32 = 5 -) - -// tagMap is an optimization over map[int]int for typical protocol buffer -// use-cases. Encoded protocol buffers are often in tag order with small tag -// numbers. -type tagMap struct { - fastTags []int - slowTags map[int]int -} - -// tagMapFastLimit is the upper bound on the tag number that will be stored in -// the tagMap slice rather than its map. -const tagMapFastLimit = 1024 - -func (p *tagMap) get(t int) (int, bool) { - if t > 0 && t < tagMapFastLimit { - if t >= len(p.fastTags) { - return 0, false - } - fi := p.fastTags[t] - return fi, fi >= 0 - } - fi, ok := p.slowTags[t] - return fi, ok -} - -func (p *tagMap) put(t int, fi int) { - if t > 0 && t < tagMapFastLimit { - for len(p.fastTags) < t+1 { - p.fastTags = append(p.fastTags, -1) - } - p.fastTags[t] = fi - return - } - if p.slowTags == nil { - p.slowTags = make(map[int]int) - } - p.slowTags[t] = fi -} - -// StructProperties represents properties for all the fields of a struct. -// decoderTags and decoderOrigNames should only be used by the decoder. -type StructProperties struct { - Prop []*Properties // properties for each field - reqCount int // required count - decoderTags tagMap // map from proto tag to struct field number - decoderOrigNames map[string]int // map from original name to struct field number - order []int // list of struct field numbers in tag order - - // OneofTypes contains information about the oneof fields in this message. - // It is keyed by the original name of a field. - OneofTypes map[string]*OneofProperties -} - -// OneofProperties represents information about a specific field in a oneof. -type OneofProperties struct { - Type reflect.Type // pointer to generated struct type for this oneof field - Field int // struct field number of the containing oneof in the message - Prop *Properties -} - -// Implement the sorting interface so we can sort the fields in tag order, as recommended by the spec. -// See encode.go, (*Buffer).enc_struct. - -func (sp *StructProperties) Len() int { return len(sp.order) } -func (sp *StructProperties) Less(i, j int) bool { - return sp.Prop[sp.order[i]].Tag < sp.Prop[sp.order[j]].Tag -} -func (sp *StructProperties) Swap(i, j int) { sp.order[i], sp.order[j] = sp.order[j], sp.order[i] } - -// Properties represents the protocol-specific behavior of a single struct field. -type Properties struct { - Name string // name of the field, for error messages - OrigName string // original name before protocol compiler (always set) - JSONName string // name to use for JSON; determined by protoc - Wire string - WireType int - Tag int - Required bool - Optional bool - Repeated bool - Packed bool // relevant for repeated primitives only - Enum string // set for enum types only - proto3 bool // whether this is known to be a proto3 field - oneof bool // whether this is a oneof field - - Default string // default value - HasDefault bool // whether an explicit default was provided - CustomType string - CastType string - StdTime bool - StdDuration bool - WktPointer bool - - stype reflect.Type // set for struct types only - ctype reflect.Type // set for custom types only - sprop *StructProperties // set for struct types only - - mtype reflect.Type // set for map types only - MapKeyProp *Properties // set for map types only - MapValProp *Properties // set for map types only -} - -// String formats the properties in the protobuf struct field tag style. -func (p *Properties) String() string { - s := p.Wire - s += "," - s += strconv.Itoa(p.Tag) - if p.Required { - s += ",req" - } - if p.Optional { - s += ",opt" - } - if p.Repeated { - s += ",rep" - } - if p.Packed { - s += ",packed" - } - s += ",name=" + p.OrigName - if p.JSONName != p.OrigName { - s += ",json=" + p.JSONName - } - if p.proto3 { - s += ",proto3" - } - if p.oneof { - s += ",oneof" - } - if len(p.Enum) > 0 { - s += ",enum=" + p.Enum - } - if p.HasDefault { - s += ",def=" + p.Default - } - return s -} - -// Parse populates p by parsing a string in the protobuf struct field tag style. -func (p *Properties) Parse(s string) { - // "bytes,49,opt,name=foo,def=hello!" - fields := strings.Split(s, ",") // breaks def=, but handled below. - if len(fields) < 2 { - log.Printf("proto: tag has too few fields: %q", s) - return - } - - p.Wire = fields[0] - switch p.Wire { - case "varint": - p.WireType = WireVarint - case "fixed32": - p.WireType = WireFixed32 - case "fixed64": - p.WireType = WireFixed64 - case "zigzag32": - p.WireType = WireVarint - case "zigzag64": - p.WireType = WireVarint - case "bytes", "group": - p.WireType = WireBytes - // no numeric converter for non-numeric types - default: - log.Printf("proto: tag has unknown wire type: %q", s) - return - } - - var err error - p.Tag, err = strconv.Atoi(fields[1]) - if err != nil { - return - } - -outer: - for i := 2; i < len(fields); i++ { - f := fields[i] - switch { - case f == "req": - p.Required = true - case f == "opt": - p.Optional = true - case f == "rep": - p.Repeated = true - case f == "packed": - p.Packed = true - case strings.HasPrefix(f, "name="): - p.OrigName = f[5:] - case strings.HasPrefix(f, "json="): - p.JSONName = f[5:] - case strings.HasPrefix(f, "enum="): - p.Enum = f[5:] - case f == "proto3": - p.proto3 = true - case f == "oneof": - p.oneof = true - case strings.HasPrefix(f, "def="): - p.HasDefault = true - p.Default = f[4:] // rest of string - if i+1 < len(fields) { - // Commas aren't escaped, and def is always last. - p.Default += "," + strings.Join(fields[i+1:], ",") - break outer - } - case strings.HasPrefix(f, "embedded="): - p.OrigName = strings.Split(f, "=")[1] - case strings.HasPrefix(f, "customtype="): - p.CustomType = strings.Split(f, "=")[1] - case strings.HasPrefix(f, "casttype="): - p.CastType = strings.Split(f, "=")[1] - case f == "stdtime": - p.StdTime = true - case f == "stdduration": - p.StdDuration = true - case f == "wktptr": - p.WktPointer = true - } - } -} - -var protoMessageType = reflect.TypeOf((*Message)(nil)).Elem() - -// setFieldProps initializes the field properties for submessages and maps. -func (p *Properties) setFieldProps(typ reflect.Type, f *reflect.StructField, lockGetProp bool) { - isMap := typ.Kind() == reflect.Map - if len(p.CustomType) > 0 && !isMap { - p.ctype = typ - p.setTag(lockGetProp) - return - } - if p.StdTime && !isMap { - p.setTag(lockGetProp) - return - } - if p.StdDuration && !isMap { - p.setTag(lockGetProp) - return - } - if p.WktPointer && !isMap { - p.setTag(lockGetProp) - return - } - switch t1 := typ; t1.Kind() { - case reflect.Struct: - p.stype = typ - case reflect.Ptr: - if t1.Elem().Kind() == reflect.Struct { - p.stype = t1.Elem() - } - case reflect.Slice: - switch t2 := t1.Elem(); t2.Kind() { - case reflect.Ptr: - switch t3 := t2.Elem(); t3.Kind() { - case reflect.Struct: - p.stype = t3 - } - case reflect.Struct: - p.stype = t2 - } - - case reflect.Map: - - p.mtype = t1 - p.MapKeyProp = &Properties{} - p.MapKeyProp.init(reflect.PtrTo(p.mtype.Key()), "Key", f.Tag.Get("protobuf_key"), nil, lockGetProp) - p.MapValProp = &Properties{} - vtype := p.mtype.Elem() - if vtype.Kind() != reflect.Ptr && vtype.Kind() != reflect.Slice { - // The value type is not a message (*T) or bytes ([]byte), - // so we need encoders for the pointer to this type. - vtype = reflect.PtrTo(vtype) - } - - p.MapValProp.CustomType = p.CustomType - p.MapValProp.StdDuration = p.StdDuration - p.MapValProp.StdTime = p.StdTime - p.MapValProp.WktPointer = p.WktPointer - p.MapValProp.init(vtype, "Value", f.Tag.Get("protobuf_val"), nil, lockGetProp) - } - p.setTag(lockGetProp) -} - -func (p *Properties) setTag(lockGetProp bool) { - if p.stype != nil { - if lockGetProp { - p.sprop = GetProperties(p.stype) - } else { - p.sprop = getPropertiesLocked(p.stype) - } - } -} - -var ( - marshalerType = reflect.TypeOf((*Marshaler)(nil)).Elem() -) - -// Init populates the properties from a protocol buffer struct tag. -func (p *Properties) Init(typ reflect.Type, name, tag string, f *reflect.StructField) { - p.init(typ, name, tag, f, true) -} - -func (p *Properties) init(typ reflect.Type, name, tag string, f *reflect.StructField, lockGetProp bool) { - // "bytes,49,opt,def=hello!" - p.Name = name - p.OrigName = name - if tag == "" { - return - } - p.Parse(tag) - p.setFieldProps(typ, f, lockGetProp) -} - -var ( - propertiesMu sync.RWMutex - propertiesMap = make(map[reflect.Type]*StructProperties) -) - -// GetProperties returns the list of properties for the type represented by t. -// t must represent a generated struct type of a protocol message. -func GetProperties(t reflect.Type) *StructProperties { - if t.Kind() != reflect.Struct { - panic("proto: type must have kind struct") - } - - // Most calls to GetProperties in a long-running program will be - // retrieving details for types we have seen before. - propertiesMu.RLock() - sprop, ok := propertiesMap[t] - propertiesMu.RUnlock() - if ok { - return sprop - } - - propertiesMu.Lock() - sprop = getPropertiesLocked(t) - propertiesMu.Unlock() - return sprop -} - -type ( - oneofFuncsIface interface { - XXX_OneofFuncs() (func(Message, *Buffer) error, func(Message, int, int, *Buffer) (bool, error), func(Message) int, []interface{}) - } - oneofWrappersIface interface { - XXX_OneofWrappers() []interface{} - } -) - -// getPropertiesLocked requires that propertiesMu is held. -func getPropertiesLocked(t reflect.Type) *StructProperties { - if prop, ok := propertiesMap[t]; ok { - return prop - } - - prop := new(StructProperties) - // in case of recursive protos, fill this in now. - propertiesMap[t] = prop - - // build properties - prop.Prop = make([]*Properties, t.NumField()) - prop.order = make([]int, t.NumField()) - - isOneofMessage := false - for i := 0; i < t.NumField(); i++ { - f := t.Field(i) - p := new(Properties) - name := f.Name - p.init(f.Type, name, f.Tag.Get("protobuf"), &f, false) - - oneof := f.Tag.Get("protobuf_oneof") // special case - if oneof != "" { - isOneofMessage = true - // Oneof fields don't use the traditional protobuf tag. - p.OrigName = oneof - } - prop.Prop[i] = p - prop.order[i] = i - if debug { - print(i, " ", f.Name, " ", t.String(), " ") - if p.Tag > 0 { - print(p.String()) - } - print("\n") - } - } - - // Re-order prop.order. - sort.Sort(prop) - - if isOneofMessage { - var oots []interface{} - switch m := reflect.Zero(reflect.PtrTo(t)).Interface().(type) { - case oneofFuncsIface: - _, _, _, oots = m.XXX_OneofFuncs() - case oneofWrappersIface: - oots = m.XXX_OneofWrappers() - } - if len(oots) > 0 { - // Interpret oneof metadata. - prop.OneofTypes = make(map[string]*OneofProperties) - for _, oot := range oots { - oop := &OneofProperties{ - Type: reflect.ValueOf(oot).Type(), // *T - Prop: new(Properties), - } - sft := oop.Type.Elem().Field(0) - oop.Prop.Name = sft.Name - oop.Prop.Parse(sft.Tag.Get("protobuf")) - // There will be exactly one interface field that - // this new value is assignable to. - for i := 0; i < t.NumField(); i++ { - f := t.Field(i) - if f.Type.Kind() != reflect.Interface { - continue - } - if !oop.Type.AssignableTo(f.Type) { - continue - } - oop.Field = i - break - } - prop.OneofTypes[oop.Prop.OrigName] = oop - } - } - } - - // build required counts - // build tags - reqCount := 0 - prop.decoderOrigNames = make(map[string]int) - for i, p := range prop.Prop { - if strings.HasPrefix(p.Name, "XXX_") { - // Internal fields should not appear in tags/origNames maps. - // They are handled specially when encoding and decoding. - continue - } - if p.Required { - reqCount++ - } - prop.decoderTags.put(p.Tag, i) - prop.decoderOrigNames[p.OrigName] = i - } - prop.reqCount = reqCount - - return prop -} - -// A global registry of enum types. -// The generated code will register the generated maps by calling RegisterEnum. - -var enumValueMaps = make(map[string]map[string]int32) -var enumStringMaps = make(map[string]map[int32]string) - -// RegisterEnum is called from the generated code to install the enum descriptor -// maps into the global table to aid parsing text format protocol buffers. -func RegisterEnum(typeName string, unusedNameMap map[int32]string, valueMap map[string]int32) { - if _, ok := enumValueMaps[typeName]; ok { - panic("proto: duplicate enum registered: " + typeName) - } - enumValueMaps[typeName] = valueMap - if _, ok := enumStringMaps[typeName]; ok { - panic("proto: duplicate enum registered: " + typeName) - } - enumStringMaps[typeName] = unusedNameMap -} - -// EnumValueMap returns the mapping from names to integers of the -// enum type enumType, or a nil if not found. -func EnumValueMap(enumType string) map[string]int32 { - return enumValueMaps[enumType] -} - -// A registry of all linked message types. -// The string is a fully-qualified proto name ("pkg.Message"). -var ( - protoTypedNils = make(map[string]Message) // a map from proto names to typed nil pointers - protoMapTypes = make(map[string]reflect.Type) // a map from proto names to map types - revProtoTypes = make(map[reflect.Type]string) -) - -// RegisterType is called from generated code and maps from the fully qualified -// proto name to the type (pointer to struct) of the protocol buffer. -func RegisterType(x Message, name string) { - if _, ok := protoTypedNils[name]; ok { - // TODO: Some day, make this a panic. - log.Printf("proto: duplicate proto type registered: %s", name) - return - } - t := reflect.TypeOf(x) - if v := reflect.ValueOf(x); v.Kind() == reflect.Ptr && v.Pointer() == 0 { - // Generated code always calls RegisterType with nil x. - // This check is just for extra safety. - protoTypedNils[name] = x - } else { - protoTypedNils[name] = reflect.Zero(t).Interface().(Message) - } - revProtoTypes[t] = name -} - -// RegisterMapType is called from generated code and maps from the fully qualified -// proto name to the native map type of the proto map definition. -func RegisterMapType(x interface{}, name string) { - if reflect.TypeOf(x).Kind() != reflect.Map { - panic(fmt.Sprintf("RegisterMapType(%T, %q); want map", x, name)) - } - if _, ok := protoMapTypes[name]; ok { - log.Printf("proto: duplicate proto type registered: %s", name) - return - } - t := reflect.TypeOf(x) - protoMapTypes[name] = t - revProtoTypes[t] = name -} - -// MessageName returns the fully-qualified proto name for the given message type. -func MessageName(x Message) string { - type xname interface { - XXX_MessageName() string - } - if m, ok := x.(xname); ok { - return m.XXX_MessageName() - } - return revProtoTypes[reflect.TypeOf(x)] -} - -// MessageType returns the message type (pointer to struct) for a named message. -// The type is not guaranteed to implement proto.Message if the name refers to a -// map entry. -func MessageType(name string) reflect.Type { - if t, ok := protoTypedNils[name]; ok { - return reflect.TypeOf(t) - } - return protoMapTypes[name] -} - -// A registry of all linked proto files. -var ( - protoFiles = make(map[string][]byte) // file name => fileDescriptor -) - -// RegisterFile is called from generated code and maps from the -// full file name of a .proto file to its compressed FileDescriptorProto. -func RegisterFile(filename string, fileDescriptor []byte) { - protoFiles[filename] = fileDescriptor -} - -// FileDescriptor returns the compressed FileDescriptorProto for a .proto file. -func FileDescriptor(filename string) []byte { return protoFiles[filename] } diff --git a/vendor/github.com/gogo/protobuf/proto/properties_gogo.go b/vendor/github.com/gogo/protobuf/proto/properties_gogo.go deleted file mode 100644 index 40ea3dd93..000000000 --- a/vendor/github.com/gogo/protobuf/proto/properties_gogo.go +++ /dev/null @@ -1,36 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2018, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -import ( - "reflect" -) - -var sizerType = reflect.TypeOf((*Sizer)(nil)).Elem() -var protosizerType = reflect.TypeOf((*ProtoSizer)(nil)).Elem() diff --git a/vendor/github.com/gogo/protobuf/proto/skip_gogo.go b/vendor/github.com/gogo/protobuf/proto/skip_gogo.go deleted file mode 100644 index 5a5fd93f7..000000000 --- a/vendor/github.com/gogo/protobuf/proto/skip_gogo.go +++ /dev/null @@ -1,119 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -import ( - "fmt" - "io" -) - -func Skip(data []byte) (n int, err error) { - l := len(data) - index := 0 - for index < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if index >= l { - return 0, io.ErrUnexpectedEOF - } - b := data[index] - index++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for { - if index >= l { - return 0, io.ErrUnexpectedEOF - } - index++ - if data[index-1] < 0x80 { - break - } - } - return index, nil - case 1: - index += 8 - return index, nil - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if index >= l { - return 0, io.ErrUnexpectedEOF - } - b := data[index] - index++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - index += length - return index, nil - case 3: - for { - var innerWire uint64 - var start int = index - for shift := uint(0); ; shift += 7 { - if index >= l { - return 0, io.ErrUnexpectedEOF - } - b := data[index] - index++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := Skip(data[start:]) - if err != nil { - return 0, err - } - index = start + next - } - return index, nil - case 4: - return index, nil - case 5: - index += 4 - return index, nil - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - } - panic("unreachable") -} diff --git a/vendor/github.com/gogo/protobuf/proto/table_marshal.go b/vendor/github.com/gogo/protobuf/proto/table_marshal.go deleted file mode 100644 index f8babdefa..000000000 --- a/vendor/github.com/gogo/protobuf/proto/table_marshal.go +++ /dev/null @@ -1,3009 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2016 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -import ( - "errors" - "fmt" - "math" - "reflect" - "sort" - "strconv" - "strings" - "sync" - "sync/atomic" - "unicode/utf8" -) - -// a sizer takes a pointer to a field and the size of its tag, computes the size of -// the encoded data. -type sizer func(pointer, int) int - -// a marshaler takes a byte slice, a pointer to a field, and its tag (in wire format), -// marshals the field to the end of the slice, returns the slice and error (if any). -type marshaler func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) - -// marshalInfo is the information used for marshaling a message. -type marshalInfo struct { - typ reflect.Type - fields []*marshalFieldInfo - unrecognized field // offset of XXX_unrecognized - extensions field // offset of XXX_InternalExtensions - v1extensions field // offset of XXX_extensions - sizecache field // offset of XXX_sizecache - initialized int32 // 0 -- only typ is set, 1 -- fully initialized - messageset bool // uses message set wire format - hasmarshaler bool // has custom marshaler - sync.RWMutex // protect extElems map, also for initialization - extElems map[int32]*marshalElemInfo // info of extension elements - - hassizer bool // has custom sizer - hasprotosizer bool // has custom protosizer - - bytesExtensions field // offset of XXX_extensions where the field type is []byte -} - -// marshalFieldInfo is the information used for marshaling a field of a message. -type marshalFieldInfo struct { - field field - wiretag uint64 // tag in wire format - tagsize int // size of tag in wire format - sizer sizer - marshaler marshaler - isPointer bool - required bool // field is required - name string // name of the field, for error reporting - oneofElems map[reflect.Type]*marshalElemInfo // info of oneof elements -} - -// marshalElemInfo is the information used for marshaling an extension or oneof element. -type marshalElemInfo struct { - wiretag uint64 // tag in wire format - tagsize int // size of tag in wire format - sizer sizer - marshaler marshaler - isptr bool // elem is pointer typed, thus interface of this type is a direct interface (extension only) -} - -var ( - marshalInfoMap = map[reflect.Type]*marshalInfo{} - marshalInfoLock sync.Mutex - - uint8SliceType = reflect.TypeOf(([]uint8)(nil)).Kind() -) - -// getMarshalInfo returns the information to marshal a given type of message. -// The info it returns may not necessarily initialized. -// t is the type of the message (NOT the pointer to it). -func getMarshalInfo(t reflect.Type) *marshalInfo { - marshalInfoLock.Lock() - u, ok := marshalInfoMap[t] - if !ok { - u = &marshalInfo{typ: t} - marshalInfoMap[t] = u - } - marshalInfoLock.Unlock() - return u -} - -// Size is the entry point from generated code, -// and should be ONLY called by generated code. -// It computes the size of encoded data of msg. -// a is a pointer to a place to store cached marshal info. -func (a *InternalMessageInfo) Size(msg Message) int { - u := getMessageMarshalInfo(msg, a) - ptr := toPointer(&msg) - if ptr.isNil() { - // We get here if msg is a typed nil ((*SomeMessage)(nil)), - // so it satisfies the interface, and msg == nil wouldn't - // catch it. We don't want crash in this case. - return 0 - } - return u.size(ptr) -} - -// Marshal is the entry point from generated code, -// and should be ONLY called by generated code. -// It marshals msg to the end of b. -// a is a pointer to a place to store cached marshal info. -func (a *InternalMessageInfo) Marshal(b []byte, msg Message, deterministic bool) ([]byte, error) { - u := getMessageMarshalInfo(msg, a) - ptr := toPointer(&msg) - if ptr.isNil() { - // We get here if msg is a typed nil ((*SomeMessage)(nil)), - // so it satisfies the interface, and msg == nil wouldn't - // catch it. We don't want crash in this case. - return b, ErrNil - } - return u.marshal(b, ptr, deterministic) -} - -func getMessageMarshalInfo(msg interface{}, a *InternalMessageInfo) *marshalInfo { - // u := a.marshal, but atomically. - // We use an atomic here to ensure memory consistency. - u := atomicLoadMarshalInfo(&a.marshal) - if u == nil { - // Get marshal information from type of message. - t := reflect.ValueOf(msg).Type() - if t.Kind() != reflect.Ptr { - panic(fmt.Sprintf("cannot handle non-pointer message type %v", t)) - } - u = getMarshalInfo(t.Elem()) - // Store it in the cache for later users. - // a.marshal = u, but atomically. - atomicStoreMarshalInfo(&a.marshal, u) - } - return u -} - -// size is the main function to compute the size of the encoded data of a message. -// ptr is the pointer to the message. -func (u *marshalInfo) size(ptr pointer) int { - if atomic.LoadInt32(&u.initialized) == 0 { - u.computeMarshalInfo() - } - - // If the message can marshal itself, let it do it, for compatibility. - // NOTE: This is not efficient. - if u.hasmarshaler { - // Uses the message's Size method if available - if u.hassizer { - s := ptr.asPointerTo(u.typ).Interface().(Sizer) - return s.Size() - } - // Uses the message's ProtoSize method if available - if u.hasprotosizer { - s := ptr.asPointerTo(u.typ).Interface().(ProtoSizer) - return s.ProtoSize() - } - - m := ptr.asPointerTo(u.typ).Interface().(Marshaler) - b, _ := m.Marshal() - return len(b) - } - - n := 0 - for _, f := range u.fields { - if f.isPointer && ptr.offset(f.field).getPointer().isNil() { - // nil pointer always marshals to nothing - continue - } - n += f.sizer(ptr.offset(f.field), f.tagsize) - } - if u.extensions.IsValid() { - e := ptr.offset(u.extensions).toExtensions() - if u.messageset { - n += u.sizeMessageSet(e) - } else { - n += u.sizeExtensions(e) - } - } - if u.v1extensions.IsValid() { - m := *ptr.offset(u.v1extensions).toOldExtensions() - n += u.sizeV1Extensions(m) - } - if u.bytesExtensions.IsValid() { - s := *ptr.offset(u.bytesExtensions).toBytes() - n += len(s) - } - if u.unrecognized.IsValid() { - s := *ptr.offset(u.unrecognized).toBytes() - n += len(s) - } - - // cache the result for use in marshal - if u.sizecache.IsValid() { - atomic.StoreInt32(ptr.offset(u.sizecache).toInt32(), int32(n)) - } - return n -} - -// cachedsize gets the size from cache. If there is no cache (i.e. message is not generated), -// fall back to compute the size. -func (u *marshalInfo) cachedsize(ptr pointer) int { - if u.sizecache.IsValid() { - return int(atomic.LoadInt32(ptr.offset(u.sizecache).toInt32())) - } - return u.size(ptr) -} - -// marshal is the main function to marshal a message. It takes a byte slice and appends -// the encoded data to the end of the slice, returns the slice and error (if any). -// ptr is the pointer to the message. -// If deterministic is true, map is marshaled in deterministic order. -func (u *marshalInfo) marshal(b []byte, ptr pointer, deterministic bool) ([]byte, error) { - if atomic.LoadInt32(&u.initialized) == 0 { - u.computeMarshalInfo() - } - - // If the message can marshal itself, let it do it, for compatibility. - // NOTE: This is not efficient. - if u.hasmarshaler { - m := ptr.asPointerTo(u.typ).Interface().(Marshaler) - b1, err := m.Marshal() - b = append(b, b1...) - return b, err - } - - var err, errLater error - // The old marshaler encodes extensions at beginning. - if u.extensions.IsValid() { - e := ptr.offset(u.extensions).toExtensions() - if u.messageset { - b, err = u.appendMessageSet(b, e, deterministic) - } else { - b, err = u.appendExtensions(b, e, deterministic) - } - if err != nil { - return b, err - } - } - if u.v1extensions.IsValid() { - m := *ptr.offset(u.v1extensions).toOldExtensions() - b, err = u.appendV1Extensions(b, m, deterministic) - if err != nil { - return b, err - } - } - if u.bytesExtensions.IsValid() { - s := *ptr.offset(u.bytesExtensions).toBytes() - b = append(b, s...) - } - for _, f := range u.fields { - if f.required { - if f.isPointer && ptr.offset(f.field).getPointer().isNil() { - // Required field is not set. - // We record the error but keep going, to give a complete marshaling. - if errLater == nil { - errLater = &RequiredNotSetError{f.name} - } - continue - } - } - if f.isPointer && ptr.offset(f.field).getPointer().isNil() { - // nil pointer always marshals to nothing - continue - } - b, err = f.marshaler(b, ptr.offset(f.field), f.wiretag, deterministic) - if err != nil { - if err1, ok := err.(*RequiredNotSetError); ok { - // Required field in submessage is not set. - // We record the error but keep going, to give a complete marshaling. - if errLater == nil { - errLater = &RequiredNotSetError{f.name + "." + err1.field} - } - continue - } - if err == errRepeatedHasNil { - err = errors.New("proto: repeated field " + f.name + " has nil element") - } - if err == errInvalidUTF8 { - if errLater == nil { - fullName := revProtoTypes[reflect.PtrTo(u.typ)] + "." + f.name - errLater = &invalidUTF8Error{fullName} - } - continue - } - return b, err - } - } - if u.unrecognized.IsValid() { - s := *ptr.offset(u.unrecognized).toBytes() - b = append(b, s...) - } - return b, errLater -} - -// computeMarshalInfo initializes the marshal info. -func (u *marshalInfo) computeMarshalInfo() { - u.Lock() - defer u.Unlock() - if u.initialized != 0 { // non-atomic read is ok as it is protected by the lock - return - } - - t := u.typ - u.unrecognized = invalidField - u.extensions = invalidField - u.v1extensions = invalidField - u.bytesExtensions = invalidField - u.sizecache = invalidField - isOneofMessage := false - - if reflect.PtrTo(t).Implements(sizerType) { - u.hassizer = true - } - if reflect.PtrTo(t).Implements(protosizerType) { - u.hasprotosizer = true - } - // If the message can marshal itself, let it do it, for compatibility. - // NOTE: This is not efficient. - if reflect.PtrTo(t).Implements(marshalerType) { - u.hasmarshaler = true - atomic.StoreInt32(&u.initialized, 1) - return - } - - n := t.NumField() - - // deal with XXX fields first - for i := 0; i < t.NumField(); i++ { - f := t.Field(i) - if f.Tag.Get("protobuf_oneof") != "" { - isOneofMessage = true - } - if !strings.HasPrefix(f.Name, "XXX_") { - continue - } - switch f.Name { - case "XXX_sizecache": - u.sizecache = toField(&f) - case "XXX_unrecognized": - u.unrecognized = toField(&f) - case "XXX_InternalExtensions": - u.extensions = toField(&f) - u.messageset = f.Tag.Get("protobuf_messageset") == "1" - case "XXX_extensions": - if f.Type.Kind() == reflect.Map { - u.v1extensions = toField(&f) - } else { - u.bytesExtensions = toField(&f) - } - case "XXX_NoUnkeyedLiteral": - // nothing to do - default: - panic("unknown XXX field: " + f.Name) - } - n-- - } - - // get oneof implementers - var oneofImplementers []interface{} - // gogo: isOneofMessage is needed for embedded oneof messages, without a marshaler and unmarshaler - if isOneofMessage { - switch m := reflect.Zero(reflect.PtrTo(t)).Interface().(type) { - case oneofFuncsIface: - _, _, _, oneofImplementers = m.XXX_OneofFuncs() - case oneofWrappersIface: - oneofImplementers = m.XXX_OneofWrappers() - } - } - - // normal fields - fields := make([]marshalFieldInfo, n) // batch allocation - u.fields = make([]*marshalFieldInfo, 0, n) - for i, j := 0, 0; i < t.NumField(); i++ { - f := t.Field(i) - - if strings.HasPrefix(f.Name, "XXX_") { - continue - } - field := &fields[j] - j++ - field.name = f.Name - u.fields = append(u.fields, field) - if f.Tag.Get("protobuf_oneof") != "" { - field.computeOneofFieldInfo(&f, oneofImplementers) - continue - } - if f.Tag.Get("protobuf") == "" { - // field has no tag (not in generated message), ignore it - u.fields = u.fields[:len(u.fields)-1] - j-- - continue - } - field.computeMarshalFieldInfo(&f) - } - - // fields are marshaled in tag order on the wire. - sort.Sort(byTag(u.fields)) - - atomic.StoreInt32(&u.initialized, 1) -} - -// helper for sorting fields by tag -type byTag []*marshalFieldInfo - -func (a byTag) Len() int { return len(a) } -func (a byTag) Swap(i, j int) { a[i], a[j] = a[j], a[i] } -func (a byTag) Less(i, j int) bool { return a[i].wiretag < a[j].wiretag } - -// getExtElemInfo returns the information to marshal an extension element. -// The info it returns is initialized. -func (u *marshalInfo) getExtElemInfo(desc *ExtensionDesc) *marshalElemInfo { - // get from cache first - u.RLock() - e, ok := u.extElems[desc.Field] - u.RUnlock() - if ok { - return e - } - - t := reflect.TypeOf(desc.ExtensionType) // pointer or slice to basic type or struct - tags := strings.Split(desc.Tag, ",") - tag, err := strconv.Atoi(tags[1]) - if err != nil { - panic("tag is not an integer") - } - wt := wiretype(tags[0]) - sizr, marshalr := typeMarshaler(t, tags, false, false) - e = &marshalElemInfo{ - wiretag: uint64(tag)<<3 | wt, - tagsize: SizeVarint(uint64(tag) << 3), - sizer: sizr, - marshaler: marshalr, - isptr: t.Kind() == reflect.Ptr, - } - - // update cache - u.Lock() - if u.extElems == nil { - u.extElems = make(map[int32]*marshalElemInfo) - } - u.extElems[desc.Field] = e - u.Unlock() - return e -} - -// computeMarshalFieldInfo fills up the information to marshal a field. -func (fi *marshalFieldInfo) computeMarshalFieldInfo(f *reflect.StructField) { - // parse protobuf tag of the field. - // tag has format of "bytes,49,opt,name=foo,def=hello!" - tags := strings.Split(f.Tag.Get("protobuf"), ",") - if tags[0] == "" { - return - } - tag, err := strconv.Atoi(tags[1]) - if err != nil { - panic("tag is not an integer") - } - wt := wiretype(tags[0]) - if tags[2] == "req" { - fi.required = true - } - fi.setTag(f, tag, wt) - fi.setMarshaler(f, tags) -} - -func (fi *marshalFieldInfo) computeOneofFieldInfo(f *reflect.StructField, oneofImplementers []interface{}) { - fi.field = toField(f) - fi.wiretag = math.MaxInt32 // Use a large tag number, make oneofs sorted at the end. This tag will not appear on the wire. - fi.isPointer = true - fi.sizer, fi.marshaler = makeOneOfMarshaler(fi, f) - fi.oneofElems = make(map[reflect.Type]*marshalElemInfo) - - ityp := f.Type // interface type - for _, o := range oneofImplementers { - t := reflect.TypeOf(o) - if !t.Implements(ityp) { - continue - } - sf := t.Elem().Field(0) // oneof implementer is a struct with a single field - tags := strings.Split(sf.Tag.Get("protobuf"), ",") - tag, err := strconv.Atoi(tags[1]) - if err != nil { - panic("tag is not an integer") - } - wt := wiretype(tags[0]) - sizr, marshalr := typeMarshaler(sf.Type, tags, false, true) // oneof should not omit any zero value - fi.oneofElems[t.Elem()] = &marshalElemInfo{ - wiretag: uint64(tag)<<3 | wt, - tagsize: SizeVarint(uint64(tag) << 3), - sizer: sizr, - marshaler: marshalr, - } - } -} - -// wiretype returns the wire encoding of the type. -func wiretype(encoding string) uint64 { - switch encoding { - case "fixed32": - return WireFixed32 - case "fixed64": - return WireFixed64 - case "varint", "zigzag32", "zigzag64": - return WireVarint - case "bytes": - return WireBytes - case "group": - return WireStartGroup - } - panic("unknown wire type " + encoding) -} - -// setTag fills up the tag (in wire format) and its size in the info of a field. -func (fi *marshalFieldInfo) setTag(f *reflect.StructField, tag int, wt uint64) { - fi.field = toField(f) - fi.wiretag = uint64(tag)<<3 | wt - fi.tagsize = SizeVarint(uint64(tag) << 3) -} - -// setMarshaler fills up the sizer and marshaler in the info of a field. -func (fi *marshalFieldInfo) setMarshaler(f *reflect.StructField, tags []string) { - switch f.Type.Kind() { - case reflect.Map: - // map field - fi.isPointer = true - fi.sizer, fi.marshaler = makeMapMarshaler(f) - return - case reflect.Ptr, reflect.Slice: - fi.isPointer = true - } - fi.sizer, fi.marshaler = typeMarshaler(f.Type, tags, true, false) -} - -// typeMarshaler returns the sizer and marshaler of a given field. -// t is the type of the field. -// tags is the generated "protobuf" tag of the field. -// If nozero is true, zero value is not marshaled to the wire. -// If oneof is true, it is a oneof field. -func typeMarshaler(t reflect.Type, tags []string, nozero, oneof bool) (sizer, marshaler) { - encoding := tags[0] - - pointer := false - slice := false - if t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8 { - slice = true - t = t.Elem() - } - if t.Kind() == reflect.Ptr { - pointer = true - t = t.Elem() - } - - packed := false - proto3 := false - ctype := false - isTime := false - isDuration := false - isWktPointer := false - validateUTF8 := true - for i := 2; i < len(tags); i++ { - if tags[i] == "packed" { - packed = true - } - if tags[i] == "proto3" { - proto3 = true - } - if strings.HasPrefix(tags[i], "customtype=") { - ctype = true - } - if tags[i] == "stdtime" { - isTime = true - } - if tags[i] == "stdduration" { - isDuration = true - } - if tags[i] == "wktptr" { - isWktPointer = true - } - } - validateUTF8 = validateUTF8 && proto3 - if !proto3 && !pointer && !slice { - nozero = false - } - - if ctype { - if reflect.PtrTo(t).Implements(customType) { - if slice { - return makeMessageRefSliceMarshaler(getMarshalInfo(t)) - } - if pointer { - return makeCustomPtrMarshaler(getMarshalInfo(t)) - } - return makeCustomMarshaler(getMarshalInfo(t)) - } else { - panic(fmt.Sprintf("custom type: type: %v, does not implement the proto.custom interface", t)) - } - } - - if isTime { - if pointer { - if slice { - return makeTimePtrSliceMarshaler(getMarshalInfo(t)) - } - return makeTimePtrMarshaler(getMarshalInfo(t)) - } - if slice { - return makeTimeSliceMarshaler(getMarshalInfo(t)) - } - return makeTimeMarshaler(getMarshalInfo(t)) - } - - if isDuration { - if pointer { - if slice { - return makeDurationPtrSliceMarshaler(getMarshalInfo(t)) - } - return makeDurationPtrMarshaler(getMarshalInfo(t)) - } - if slice { - return makeDurationSliceMarshaler(getMarshalInfo(t)) - } - return makeDurationMarshaler(getMarshalInfo(t)) - } - - if isWktPointer { - switch t.Kind() { - case reflect.Float64: - if pointer { - if slice { - return makeStdDoubleValuePtrSliceMarshaler(getMarshalInfo(t)) - } - return makeStdDoubleValuePtrMarshaler(getMarshalInfo(t)) - } - if slice { - return makeStdDoubleValueSliceMarshaler(getMarshalInfo(t)) - } - return makeStdDoubleValueMarshaler(getMarshalInfo(t)) - case reflect.Float32: - if pointer { - if slice { - return makeStdFloatValuePtrSliceMarshaler(getMarshalInfo(t)) - } - return makeStdFloatValuePtrMarshaler(getMarshalInfo(t)) - } - if slice { - return makeStdFloatValueSliceMarshaler(getMarshalInfo(t)) - } - return makeStdFloatValueMarshaler(getMarshalInfo(t)) - case reflect.Int64: - if pointer { - if slice { - return makeStdInt64ValuePtrSliceMarshaler(getMarshalInfo(t)) - } - return makeStdInt64ValuePtrMarshaler(getMarshalInfo(t)) - } - if slice { - return makeStdInt64ValueSliceMarshaler(getMarshalInfo(t)) - } - return makeStdInt64ValueMarshaler(getMarshalInfo(t)) - case reflect.Uint64: - if pointer { - if slice { - return makeStdUInt64ValuePtrSliceMarshaler(getMarshalInfo(t)) - } - return makeStdUInt64ValuePtrMarshaler(getMarshalInfo(t)) - } - if slice { - return makeStdUInt64ValueSliceMarshaler(getMarshalInfo(t)) - } - return makeStdUInt64ValueMarshaler(getMarshalInfo(t)) - case reflect.Int32: - if pointer { - if slice { - return makeStdInt32ValuePtrSliceMarshaler(getMarshalInfo(t)) - } - return makeStdInt32ValuePtrMarshaler(getMarshalInfo(t)) - } - if slice { - return makeStdInt32ValueSliceMarshaler(getMarshalInfo(t)) - } - return makeStdInt32ValueMarshaler(getMarshalInfo(t)) - case reflect.Uint32: - if pointer { - if slice { - return makeStdUInt32ValuePtrSliceMarshaler(getMarshalInfo(t)) - } - return makeStdUInt32ValuePtrMarshaler(getMarshalInfo(t)) - } - if slice { - return makeStdUInt32ValueSliceMarshaler(getMarshalInfo(t)) - } - return makeStdUInt32ValueMarshaler(getMarshalInfo(t)) - case reflect.Bool: - if pointer { - if slice { - return makeStdBoolValuePtrSliceMarshaler(getMarshalInfo(t)) - } - return makeStdBoolValuePtrMarshaler(getMarshalInfo(t)) - } - if slice { - return makeStdBoolValueSliceMarshaler(getMarshalInfo(t)) - } - return makeStdBoolValueMarshaler(getMarshalInfo(t)) - case reflect.String: - if pointer { - if slice { - return makeStdStringValuePtrSliceMarshaler(getMarshalInfo(t)) - } - return makeStdStringValuePtrMarshaler(getMarshalInfo(t)) - } - if slice { - return makeStdStringValueSliceMarshaler(getMarshalInfo(t)) - } - return makeStdStringValueMarshaler(getMarshalInfo(t)) - case uint8SliceType: - if pointer { - if slice { - return makeStdBytesValuePtrSliceMarshaler(getMarshalInfo(t)) - } - return makeStdBytesValuePtrMarshaler(getMarshalInfo(t)) - } - if slice { - return makeStdBytesValueSliceMarshaler(getMarshalInfo(t)) - } - return makeStdBytesValueMarshaler(getMarshalInfo(t)) - default: - panic(fmt.Sprintf("unknown wktpointer type %#v", t)) - } - } - - switch t.Kind() { - case reflect.Bool: - if pointer { - return sizeBoolPtr, appendBoolPtr - } - if slice { - if packed { - return sizeBoolPackedSlice, appendBoolPackedSlice - } - return sizeBoolSlice, appendBoolSlice - } - if nozero { - return sizeBoolValueNoZero, appendBoolValueNoZero - } - return sizeBoolValue, appendBoolValue - case reflect.Uint32: - switch encoding { - case "fixed32": - if pointer { - return sizeFixed32Ptr, appendFixed32Ptr - } - if slice { - if packed { - return sizeFixed32PackedSlice, appendFixed32PackedSlice - } - return sizeFixed32Slice, appendFixed32Slice - } - if nozero { - return sizeFixed32ValueNoZero, appendFixed32ValueNoZero - } - return sizeFixed32Value, appendFixed32Value - case "varint": - if pointer { - return sizeVarint32Ptr, appendVarint32Ptr - } - if slice { - if packed { - return sizeVarint32PackedSlice, appendVarint32PackedSlice - } - return sizeVarint32Slice, appendVarint32Slice - } - if nozero { - return sizeVarint32ValueNoZero, appendVarint32ValueNoZero - } - return sizeVarint32Value, appendVarint32Value - } - case reflect.Int32: - switch encoding { - case "fixed32": - if pointer { - return sizeFixedS32Ptr, appendFixedS32Ptr - } - if slice { - if packed { - return sizeFixedS32PackedSlice, appendFixedS32PackedSlice - } - return sizeFixedS32Slice, appendFixedS32Slice - } - if nozero { - return sizeFixedS32ValueNoZero, appendFixedS32ValueNoZero - } - return sizeFixedS32Value, appendFixedS32Value - case "varint": - if pointer { - return sizeVarintS32Ptr, appendVarintS32Ptr - } - if slice { - if packed { - return sizeVarintS32PackedSlice, appendVarintS32PackedSlice - } - return sizeVarintS32Slice, appendVarintS32Slice - } - if nozero { - return sizeVarintS32ValueNoZero, appendVarintS32ValueNoZero - } - return sizeVarintS32Value, appendVarintS32Value - case "zigzag32": - if pointer { - return sizeZigzag32Ptr, appendZigzag32Ptr - } - if slice { - if packed { - return sizeZigzag32PackedSlice, appendZigzag32PackedSlice - } - return sizeZigzag32Slice, appendZigzag32Slice - } - if nozero { - return sizeZigzag32ValueNoZero, appendZigzag32ValueNoZero - } - return sizeZigzag32Value, appendZigzag32Value - } - case reflect.Uint64: - switch encoding { - case "fixed64": - if pointer { - return sizeFixed64Ptr, appendFixed64Ptr - } - if slice { - if packed { - return sizeFixed64PackedSlice, appendFixed64PackedSlice - } - return sizeFixed64Slice, appendFixed64Slice - } - if nozero { - return sizeFixed64ValueNoZero, appendFixed64ValueNoZero - } - return sizeFixed64Value, appendFixed64Value - case "varint": - if pointer { - return sizeVarint64Ptr, appendVarint64Ptr - } - if slice { - if packed { - return sizeVarint64PackedSlice, appendVarint64PackedSlice - } - return sizeVarint64Slice, appendVarint64Slice - } - if nozero { - return sizeVarint64ValueNoZero, appendVarint64ValueNoZero - } - return sizeVarint64Value, appendVarint64Value - } - case reflect.Int64: - switch encoding { - case "fixed64": - if pointer { - return sizeFixedS64Ptr, appendFixedS64Ptr - } - if slice { - if packed { - return sizeFixedS64PackedSlice, appendFixedS64PackedSlice - } - return sizeFixedS64Slice, appendFixedS64Slice - } - if nozero { - return sizeFixedS64ValueNoZero, appendFixedS64ValueNoZero - } - return sizeFixedS64Value, appendFixedS64Value - case "varint": - if pointer { - return sizeVarintS64Ptr, appendVarintS64Ptr - } - if slice { - if packed { - return sizeVarintS64PackedSlice, appendVarintS64PackedSlice - } - return sizeVarintS64Slice, appendVarintS64Slice - } - if nozero { - return sizeVarintS64ValueNoZero, appendVarintS64ValueNoZero - } - return sizeVarintS64Value, appendVarintS64Value - case "zigzag64": - if pointer { - return sizeZigzag64Ptr, appendZigzag64Ptr - } - if slice { - if packed { - return sizeZigzag64PackedSlice, appendZigzag64PackedSlice - } - return sizeZigzag64Slice, appendZigzag64Slice - } - if nozero { - return sizeZigzag64ValueNoZero, appendZigzag64ValueNoZero - } - return sizeZigzag64Value, appendZigzag64Value - } - case reflect.Float32: - if pointer { - return sizeFloat32Ptr, appendFloat32Ptr - } - if slice { - if packed { - return sizeFloat32PackedSlice, appendFloat32PackedSlice - } - return sizeFloat32Slice, appendFloat32Slice - } - if nozero { - return sizeFloat32ValueNoZero, appendFloat32ValueNoZero - } - return sizeFloat32Value, appendFloat32Value - case reflect.Float64: - if pointer { - return sizeFloat64Ptr, appendFloat64Ptr - } - if slice { - if packed { - return sizeFloat64PackedSlice, appendFloat64PackedSlice - } - return sizeFloat64Slice, appendFloat64Slice - } - if nozero { - return sizeFloat64ValueNoZero, appendFloat64ValueNoZero - } - return sizeFloat64Value, appendFloat64Value - case reflect.String: - if validateUTF8 { - if pointer { - return sizeStringPtr, appendUTF8StringPtr - } - if slice { - return sizeStringSlice, appendUTF8StringSlice - } - if nozero { - return sizeStringValueNoZero, appendUTF8StringValueNoZero - } - return sizeStringValue, appendUTF8StringValue - } - if pointer { - return sizeStringPtr, appendStringPtr - } - if slice { - return sizeStringSlice, appendStringSlice - } - if nozero { - return sizeStringValueNoZero, appendStringValueNoZero - } - return sizeStringValue, appendStringValue - case reflect.Slice: - if slice { - return sizeBytesSlice, appendBytesSlice - } - if oneof { - // Oneof bytes field may also have "proto3" tag. - // We want to marshal it as a oneof field. Do this - // check before the proto3 check. - return sizeBytesOneof, appendBytesOneof - } - if proto3 { - return sizeBytes3, appendBytes3 - } - return sizeBytes, appendBytes - case reflect.Struct: - switch encoding { - case "group": - if slice { - return makeGroupSliceMarshaler(getMarshalInfo(t)) - } - return makeGroupMarshaler(getMarshalInfo(t)) - case "bytes": - if pointer { - if slice { - return makeMessageSliceMarshaler(getMarshalInfo(t)) - } - return makeMessageMarshaler(getMarshalInfo(t)) - } else { - if slice { - return makeMessageRefSliceMarshaler(getMarshalInfo(t)) - } - return makeMessageRefMarshaler(getMarshalInfo(t)) - } - } - } - panic(fmt.Sprintf("unknown or mismatched type: type: %v, wire type: %v", t, encoding)) -} - -// Below are functions to size/marshal a specific type of a field. -// They are stored in the field's info, and called by function pointers. -// They have type sizer or marshaler. - -func sizeFixed32Value(_ pointer, tagsize int) int { - return 4 + tagsize -} -func sizeFixed32ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toUint32() - if v == 0 { - return 0 - } - return 4 + tagsize -} -func sizeFixed32Ptr(ptr pointer, tagsize int) int { - p := *ptr.toUint32Ptr() - if p == nil { - return 0 - } - return 4 + tagsize -} -func sizeFixed32Slice(ptr pointer, tagsize int) int { - s := *ptr.toUint32Slice() - return (4 + tagsize) * len(s) -} -func sizeFixed32PackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toUint32Slice() - if len(s) == 0 { - return 0 - } - return 4*len(s) + SizeVarint(uint64(4*len(s))) + tagsize -} -func sizeFixedS32Value(_ pointer, tagsize int) int { - return 4 + tagsize -} -func sizeFixedS32ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toInt32() - if v == 0 { - return 0 - } - return 4 + tagsize -} -func sizeFixedS32Ptr(ptr pointer, tagsize int) int { - p := ptr.getInt32Ptr() - if p == nil { - return 0 - } - return 4 + tagsize -} -func sizeFixedS32Slice(ptr pointer, tagsize int) int { - s := ptr.getInt32Slice() - return (4 + tagsize) * len(s) -} -func sizeFixedS32PackedSlice(ptr pointer, tagsize int) int { - s := ptr.getInt32Slice() - if len(s) == 0 { - return 0 - } - return 4*len(s) + SizeVarint(uint64(4*len(s))) + tagsize -} -func sizeFloat32Value(_ pointer, tagsize int) int { - return 4 + tagsize -} -func sizeFloat32ValueNoZero(ptr pointer, tagsize int) int { - v := math.Float32bits(*ptr.toFloat32()) - if v == 0 { - return 0 - } - return 4 + tagsize -} -func sizeFloat32Ptr(ptr pointer, tagsize int) int { - p := *ptr.toFloat32Ptr() - if p == nil { - return 0 - } - return 4 + tagsize -} -func sizeFloat32Slice(ptr pointer, tagsize int) int { - s := *ptr.toFloat32Slice() - return (4 + tagsize) * len(s) -} -func sizeFloat32PackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toFloat32Slice() - if len(s) == 0 { - return 0 - } - return 4*len(s) + SizeVarint(uint64(4*len(s))) + tagsize -} -func sizeFixed64Value(_ pointer, tagsize int) int { - return 8 + tagsize -} -func sizeFixed64ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toUint64() - if v == 0 { - return 0 - } - return 8 + tagsize -} -func sizeFixed64Ptr(ptr pointer, tagsize int) int { - p := *ptr.toUint64Ptr() - if p == nil { - return 0 - } - return 8 + tagsize -} -func sizeFixed64Slice(ptr pointer, tagsize int) int { - s := *ptr.toUint64Slice() - return (8 + tagsize) * len(s) -} -func sizeFixed64PackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toUint64Slice() - if len(s) == 0 { - return 0 - } - return 8*len(s) + SizeVarint(uint64(8*len(s))) + tagsize -} -func sizeFixedS64Value(_ pointer, tagsize int) int { - return 8 + tagsize -} -func sizeFixedS64ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toInt64() - if v == 0 { - return 0 - } - return 8 + tagsize -} -func sizeFixedS64Ptr(ptr pointer, tagsize int) int { - p := *ptr.toInt64Ptr() - if p == nil { - return 0 - } - return 8 + tagsize -} -func sizeFixedS64Slice(ptr pointer, tagsize int) int { - s := *ptr.toInt64Slice() - return (8 + tagsize) * len(s) -} -func sizeFixedS64PackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toInt64Slice() - if len(s) == 0 { - return 0 - } - return 8*len(s) + SizeVarint(uint64(8*len(s))) + tagsize -} -func sizeFloat64Value(_ pointer, tagsize int) int { - return 8 + tagsize -} -func sizeFloat64ValueNoZero(ptr pointer, tagsize int) int { - v := math.Float64bits(*ptr.toFloat64()) - if v == 0 { - return 0 - } - return 8 + tagsize -} -func sizeFloat64Ptr(ptr pointer, tagsize int) int { - p := *ptr.toFloat64Ptr() - if p == nil { - return 0 - } - return 8 + tagsize -} -func sizeFloat64Slice(ptr pointer, tagsize int) int { - s := *ptr.toFloat64Slice() - return (8 + tagsize) * len(s) -} -func sizeFloat64PackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toFloat64Slice() - if len(s) == 0 { - return 0 - } - return 8*len(s) + SizeVarint(uint64(8*len(s))) + tagsize -} -func sizeVarint32Value(ptr pointer, tagsize int) int { - v := *ptr.toUint32() - return SizeVarint(uint64(v)) + tagsize -} -func sizeVarint32ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toUint32() - if v == 0 { - return 0 - } - return SizeVarint(uint64(v)) + tagsize -} -func sizeVarint32Ptr(ptr pointer, tagsize int) int { - p := *ptr.toUint32Ptr() - if p == nil { - return 0 - } - return SizeVarint(uint64(*p)) + tagsize -} -func sizeVarint32Slice(ptr pointer, tagsize int) int { - s := *ptr.toUint32Slice() - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v)) + tagsize - } - return n -} -func sizeVarint32PackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toUint32Slice() - if len(s) == 0 { - return 0 - } - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v)) - } - return n + SizeVarint(uint64(n)) + tagsize -} -func sizeVarintS32Value(ptr pointer, tagsize int) int { - v := *ptr.toInt32() - return SizeVarint(uint64(v)) + tagsize -} -func sizeVarintS32ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toInt32() - if v == 0 { - return 0 - } - return SizeVarint(uint64(v)) + tagsize -} -func sizeVarintS32Ptr(ptr pointer, tagsize int) int { - p := ptr.getInt32Ptr() - if p == nil { - return 0 - } - return SizeVarint(uint64(*p)) + tagsize -} -func sizeVarintS32Slice(ptr pointer, tagsize int) int { - s := ptr.getInt32Slice() - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v)) + tagsize - } - return n -} -func sizeVarintS32PackedSlice(ptr pointer, tagsize int) int { - s := ptr.getInt32Slice() - if len(s) == 0 { - return 0 - } - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v)) - } - return n + SizeVarint(uint64(n)) + tagsize -} -func sizeVarint64Value(ptr pointer, tagsize int) int { - v := *ptr.toUint64() - return SizeVarint(v) + tagsize -} -func sizeVarint64ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toUint64() - if v == 0 { - return 0 - } - return SizeVarint(v) + tagsize -} -func sizeVarint64Ptr(ptr pointer, tagsize int) int { - p := *ptr.toUint64Ptr() - if p == nil { - return 0 - } - return SizeVarint(*p) + tagsize -} -func sizeVarint64Slice(ptr pointer, tagsize int) int { - s := *ptr.toUint64Slice() - n := 0 - for _, v := range s { - n += SizeVarint(v) + tagsize - } - return n -} -func sizeVarint64PackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toUint64Slice() - if len(s) == 0 { - return 0 - } - n := 0 - for _, v := range s { - n += SizeVarint(v) - } - return n + SizeVarint(uint64(n)) + tagsize -} -func sizeVarintS64Value(ptr pointer, tagsize int) int { - v := *ptr.toInt64() - return SizeVarint(uint64(v)) + tagsize -} -func sizeVarintS64ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toInt64() - if v == 0 { - return 0 - } - return SizeVarint(uint64(v)) + tagsize -} -func sizeVarintS64Ptr(ptr pointer, tagsize int) int { - p := *ptr.toInt64Ptr() - if p == nil { - return 0 - } - return SizeVarint(uint64(*p)) + tagsize -} -func sizeVarintS64Slice(ptr pointer, tagsize int) int { - s := *ptr.toInt64Slice() - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v)) + tagsize - } - return n -} -func sizeVarintS64PackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toInt64Slice() - if len(s) == 0 { - return 0 - } - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v)) - } - return n + SizeVarint(uint64(n)) + tagsize -} -func sizeZigzag32Value(ptr pointer, tagsize int) int { - v := *ptr.toInt32() - return SizeVarint(uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + tagsize -} -func sizeZigzag32ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toInt32() - if v == 0 { - return 0 - } - return SizeVarint(uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + tagsize -} -func sizeZigzag32Ptr(ptr pointer, tagsize int) int { - p := ptr.getInt32Ptr() - if p == nil { - return 0 - } - v := *p - return SizeVarint(uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + tagsize -} -func sizeZigzag32Slice(ptr pointer, tagsize int) int { - s := ptr.getInt32Slice() - n := 0 - for _, v := range s { - n += SizeVarint(uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + tagsize - } - return n -} -func sizeZigzag32PackedSlice(ptr pointer, tagsize int) int { - s := ptr.getInt32Slice() - if len(s) == 0 { - return 0 - } - n := 0 - for _, v := range s { - n += SizeVarint(uint64((uint32(v) << 1) ^ uint32((int32(v) >> 31)))) - } - return n + SizeVarint(uint64(n)) + tagsize -} -func sizeZigzag64Value(ptr pointer, tagsize int) int { - v := *ptr.toInt64() - return SizeVarint(uint64(v<<1)^uint64((int64(v)>>63))) + tagsize -} -func sizeZigzag64ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toInt64() - if v == 0 { - return 0 - } - return SizeVarint(uint64(v<<1)^uint64((int64(v)>>63))) + tagsize -} -func sizeZigzag64Ptr(ptr pointer, tagsize int) int { - p := *ptr.toInt64Ptr() - if p == nil { - return 0 - } - v := *p - return SizeVarint(uint64(v<<1)^uint64((int64(v)>>63))) + tagsize -} -func sizeZigzag64Slice(ptr pointer, tagsize int) int { - s := *ptr.toInt64Slice() - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v<<1)^uint64((int64(v)>>63))) + tagsize - } - return n -} -func sizeZigzag64PackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toInt64Slice() - if len(s) == 0 { - return 0 - } - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v<<1) ^ uint64((int64(v) >> 63))) - } - return n + SizeVarint(uint64(n)) + tagsize -} -func sizeBoolValue(_ pointer, tagsize int) int { - return 1 + tagsize -} -func sizeBoolValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toBool() - if !v { - return 0 - } - return 1 + tagsize -} -func sizeBoolPtr(ptr pointer, tagsize int) int { - p := *ptr.toBoolPtr() - if p == nil { - return 0 - } - return 1 + tagsize -} -func sizeBoolSlice(ptr pointer, tagsize int) int { - s := *ptr.toBoolSlice() - return (1 + tagsize) * len(s) -} -func sizeBoolPackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toBoolSlice() - if len(s) == 0 { - return 0 - } - return len(s) + SizeVarint(uint64(len(s))) + tagsize -} -func sizeStringValue(ptr pointer, tagsize int) int { - v := *ptr.toString() - return len(v) + SizeVarint(uint64(len(v))) + tagsize -} -func sizeStringValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toString() - if v == "" { - return 0 - } - return len(v) + SizeVarint(uint64(len(v))) + tagsize -} -func sizeStringPtr(ptr pointer, tagsize int) int { - p := *ptr.toStringPtr() - if p == nil { - return 0 - } - v := *p - return len(v) + SizeVarint(uint64(len(v))) + tagsize -} -func sizeStringSlice(ptr pointer, tagsize int) int { - s := *ptr.toStringSlice() - n := 0 - for _, v := range s { - n += len(v) + SizeVarint(uint64(len(v))) + tagsize - } - return n -} -func sizeBytes(ptr pointer, tagsize int) int { - v := *ptr.toBytes() - if v == nil { - return 0 - } - return len(v) + SizeVarint(uint64(len(v))) + tagsize -} -func sizeBytes3(ptr pointer, tagsize int) int { - v := *ptr.toBytes() - if len(v) == 0 { - return 0 - } - return len(v) + SizeVarint(uint64(len(v))) + tagsize -} -func sizeBytesOneof(ptr pointer, tagsize int) int { - v := *ptr.toBytes() - return len(v) + SizeVarint(uint64(len(v))) + tagsize -} -func sizeBytesSlice(ptr pointer, tagsize int) int { - s := *ptr.toBytesSlice() - n := 0 - for _, v := range s { - n += len(v) + SizeVarint(uint64(len(v))) + tagsize - } - return n -} - -// appendFixed32 appends an encoded fixed32 to b. -func appendFixed32(b []byte, v uint32) []byte { - b = append(b, - byte(v), - byte(v>>8), - byte(v>>16), - byte(v>>24)) - return b -} - -// appendFixed64 appends an encoded fixed64 to b. -func appendFixed64(b []byte, v uint64) []byte { - b = append(b, - byte(v), - byte(v>>8), - byte(v>>16), - byte(v>>24), - byte(v>>32), - byte(v>>40), - byte(v>>48), - byte(v>>56)) - return b -} - -// appendVarint appends an encoded varint to b. -func appendVarint(b []byte, v uint64) []byte { - // TODO: make 1-byte (maybe 2-byte) case inline-able, once we - // have non-leaf inliner. - switch { - case v < 1<<7: - b = append(b, byte(v)) - case v < 1<<14: - b = append(b, - byte(v&0x7f|0x80), - byte(v>>7)) - case v < 1<<21: - b = append(b, - byte(v&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte(v>>14)) - case v < 1<<28: - b = append(b, - byte(v&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte(v>>21)) - case v < 1<<35: - b = append(b, - byte(v&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte((v>>21)&0x7f|0x80), - byte(v>>28)) - case v < 1<<42: - b = append(b, - byte(v&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte((v>>21)&0x7f|0x80), - byte((v>>28)&0x7f|0x80), - byte(v>>35)) - case v < 1<<49: - b = append(b, - byte(v&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte((v>>21)&0x7f|0x80), - byte((v>>28)&0x7f|0x80), - byte((v>>35)&0x7f|0x80), - byte(v>>42)) - case v < 1<<56: - b = append(b, - byte(v&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte((v>>21)&0x7f|0x80), - byte((v>>28)&0x7f|0x80), - byte((v>>35)&0x7f|0x80), - byte((v>>42)&0x7f|0x80), - byte(v>>49)) - case v < 1<<63: - b = append(b, - byte(v&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte((v>>21)&0x7f|0x80), - byte((v>>28)&0x7f|0x80), - byte((v>>35)&0x7f|0x80), - byte((v>>42)&0x7f|0x80), - byte((v>>49)&0x7f|0x80), - byte(v>>56)) - default: - b = append(b, - byte(v&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte((v>>21)&0x7f|0x80), - byte((v>>28)&0x7f|0x80), - byte((v>>35)&0x7f|0x80), - byte((v>>42)&0x7f|0x80), - byte((v>>49)&0x7f|0x80), - byte((v>>56)&0x7f|0x80), - 1) - } - return b -} - -func appendFixed32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toUint32() - b = appendVarint(b, wiretag) - b = appendFixed32(b, v) - return b, nil -} -func appendFixed32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toUint32() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed32(b, v) - return b, nil -} -func appendFixed32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toUint32Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed32(b, *p) - return b, nil -} -func appendFixed32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toUint32Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendFixed32(b, v) - } - return b, nil -} -func appendFixed32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toUint32Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - b = appendVarint(b, uint64(4*len(s))) - for _, v := range s { - b = appendFixed32(b, v) - } - return b, nil -} -func appendFixedS32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt32() - b = appendVarint(b, wiretag) - b = appendFixed32(b, uint32(v)) - return b, nil -} -func appendFixedS32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt32() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed32(b, uint32(v)) - return b, nil -} -func appendFixedS32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := ptr.getInt32Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed32(b, uint32(*p)) - return b, nil -} -func appendFixedS32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := ptr.getInt32Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendFixed32(b, uint32(v)) - } - return b, nil -} -func appendFixedS32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := ptr.getInt32Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - b = appendVarint(b, uint64(4*len(s))) - for _, v := range s { - b = appendFixed32(b, uint32(v)) - } - return b, nil -} -func appendFloat32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := math.Float32bits(*ptr.toFloat32()) - b = appendVarint(b, wiretag) - b = appendFixed32(b, v) - return b, nil -} -func appendFloat32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := math.Float32bits(*ptr.toFloat32()) - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed32(b, v) - return b, nil -} -func appendFloat32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toFloat32Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed32(b, math.Float32bits(*p)) - return b, nil -} -func appendFloat32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toFloat32Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendFixed32(b, math.Float32bits(v)) - } - return b, nil -} -func appendFloat32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toFloat32Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - b = appendVarint(b, uint64(4*len(s))) - for _, v := range s { - b = appendFixed32(b, math.Float32bits(v)) - } - return b, nil -} -func appendFixed64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toUint64() - b = appendVarint(b, wiretag) - b = appendFixed64(b, v) - return b, nil -} -func appendFixed64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toUint64() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed64(b, v) - return b, nil -} -func appendFixed64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toUint64Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed64(b, *p) - return b, nil -} -func appendFixed64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toUint64Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendFixed64(b, v) - } - return b, nil -} -func appendFixed64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toUint64Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - b = appendVarint(b, uint64(8*len(s))) - for _, v := range s { - b = appendFixed64(b, v) - } - return b, nil -} -func appendFixedS64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt64() - b = appendVarint(b, wiretag) - b = appendFixed64(b, uint64(v)) - return b, nil -} -func appendFixedS64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt64() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed64(b, uint64(v)) - return b, nil -} -func appendFixedS64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toInt64Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed64(b, uint64(*p)) - return b, nil -} -func appendFixedS64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toInt64Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendFixed64(b, uint64(v)) - } - return b, nil -} -func appendFixedS64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toInt64Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - b = appendVarint(b, uint64(8*len(s))) - for _, v := range s { - b = appendFixed64(b, uint64(v)) - } - return b, nil -} -func appendFloat64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := math.Float64bits(*ptr.toFloat64()) - b = appendVarint(b, wiretag) - b = appendFixed64(b, v) - return b, nil -} -func appendFloat64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := math.Float64bits(*ptr.toFloat64()) - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed64(b, v) - return b, nil -} -func appendFloat64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toFloat64Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed64(b, math.Float64bits(*p)) - return b, nil -} -func appendFloat64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toFloat64Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendFixed64(b, math.Float64bits(v)) - } - return b, nil -} -func appendFloat64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toFloat64Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - b = appendVarint(b, uint64(8*len(s))) - for _, v := range s { - b = appendFixed64(b, math.Float64bits(v)) - } - return b, nil -} -func appendVarint32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toUint32() - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v)) - return b, nil -} -func appendVarint32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toUint32() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v)) - return b, nil -} -func appendVarint32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toUint32Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(*p)) - return b, nil -} -func appendVarint32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toUint32Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v)) - } - return b, nil -} -func appendVarint32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toUint32Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - // compute size - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v)) - } - b = appendVarint(b, uint64(n)) - for _, v := range s { - b = appendVarint(b, uint64(v)) - } - return b, nil -} -func appendVarintS32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt32() - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v)) - return b, nil -} -func appendVarintS32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt32() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v)) - return b, nil -} -func appendVarintS32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := ptr.getInt32Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(*p)) - return b, nil -} -func appendVarintS32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := ptr.getInt32Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v)) - } - return b, nil -} -func appendVarintS32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := ptr.getInt32Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - // compute size - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v)) - } - b = appendVarint(b, uint64(n)) - for _, v := range s { - b = appendVarint(b, uint64(v)) - } - return b, nil -} -func appendVarint64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toUint64() - b = appendVarint(b, wiretag) - b = appendVarint(b, v) - return b, nil -} -func appendVarint64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toUint64() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, v) - return b, nil -} -func appendVarint64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toUint64Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, *p) - return b, nil -} -func appendVarint64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toUint64Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendVarint(b, v) - } - return b, nil -} -func appendVarint64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toUint64Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - // compute size - n := 0 - for _, v := range s { - n += SizeVarint(v) - } - b = appendVarint(b, uint64(n)) - for _, v := range s { - b = appendVarint(b, v) - } - return b, nil -} -func appendVarintS64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt64() - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v)) - return b, nil -} -func appendVarintS64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt64() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v)) - return b, nil -} -func appendVarintS64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toInt64Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(*p)) - return b, nil -} -func appendVarintS64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toInt64Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v)) - } - return b, nil -} -func appendVarintS64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toInt64Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - // compute size - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v)) - } - b = appendVarint(b, uint64(n)) - for _, v := range s { - b = appendVarint(b, uint64(v)) - } - return b, nil -} -func appendZigzag32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt32() - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) - return b, nil -} -func appendZigzag32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt32() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) - return b, nil -} -func appendZigzag32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := ptr.getInt32Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - v := *p - b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) - return b, nil -} -func appendZigzag32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := ptr.getInt32Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) - } - return b, nil -} -func appendZigzag32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := ptr.getInt32Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - // compute size - n := 0 - for _, v := range s { - n += SizeVarint(uint64((uint32(v) << 1) ^ uint32((int32(v) >> 31)))) - } - b = appendVarint(b, uint64(n)) - for _, v := range s { - b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) - } - return b, nil -} -func appendZigzag64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt64() - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63))) - return b, nil -} -func appendZigzag64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt64() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63))) - return b, nil -} -func appendZigzag64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toInt64Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - v := *p - b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63))) - return b, nil -} -func appendZigzag64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toInt64Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63))) - } - return b, nil -} -func appendZigzag64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toInt64Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - // compute size - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v<<1) ^ uint64((int64(v) >> 63))) - } - b = appendVarint(b, uint64(n)) - for _, v := range s { - b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63))) - } - return b, nil -} -func appendBoolValue(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toBool() - b = appendVarint(b, wiretag) - if v { - b = append(b, 1) - } else { - b = append(b, 0) - } - return b, nil -} -func appendBoolValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toBool() - if !v { - return b, nil - } - b = appendVarint(b, wiretag) - b = append(b, 1) - return b, nil -} - -func appendBoolPtr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toBoolPtr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - if *p { - b = append(b, 1) - } else { - b = append(b, 0) - } - return b, nil -} -func appendBoolSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toBoolSlice() - for _, v := range s { - b = appendVarint(b, wiretag) - if v { - b = append(b, 1) - } else { - b = append(b, 0) - } - } - return b, nil -} -func appendBoolPackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toBoolSlice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - b = appendVarint(b, uint64(len(s))) - for _, v := range s { - if v { - b = append(b, 1) - } else { - b = append(b, 0) - } - } - return b, nil -} -func appendStringValue(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toString() - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - return b, nil -} -func appendStringValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toString() - if v == "" { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - return b, nil -} -func appendStringPtr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toStringPtr() - if p == nil { - return b, nil - } - v := *p - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - return b, nil -} -func appendStringSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toStringSlice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - } - return b, nil -} -func appendUTF8StringValue(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - var invalidUTF8 bool - v := *ptr.toString() - if !utf8.ValidString(v) { - invalidUTF8 = true - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - if invalidUTF8 { - return b, errInvalidUTF8 - } - return b, nil -} -func appendUTF8StringValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - var invalidUTF8 bool - v := *ptr.toString() - if v == "" { - return b, nil - } - if !utf8.ValidString(v) { - invalidUTF8 = true - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - if invalidUTF8 { - return b, errInvalidUTF8 - } - return b, nil -} -func appendUTF8StringPtr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - var invalidUTF8 bool - p := *ptr.toStringPtr() - if p == nil { - return b, nil - } - v := *p - if !utf8.ValidString(v) { - invalidUTF8 = true - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - if invalidUTF8 { - return b, errInvalidUTF8 - } - return b, nil -} -func appendUTF8StringSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - var invalidUTF8 bool - s := *ptr.toStringSlice() - for _, v := range s { - if !utf8.ValidString(v) { - invalidUTF8 = true - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - } - if invalidUTF8 { - return b, errInvalidUTF8 - } - return b, nil -} -func appendBytes(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toBytes() - if v == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - return b, nil -} -func appendBytes3(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toBytes() - if len(v) == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - return b, nil -} -func appendBytesOneof(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toBytes() - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - return b, nil -} -func appendBytesSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toBytesSlice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - } - return b, nil -} - -// makeGroupMarshaler returns the sizer and marshaler for a group. -// u is the marshal info of the underlying message. -func makeGroupMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - p := ptr.getPointer() - if p.isNil() { - return 0 - } - return u.size(p) + 2*tagsize - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - p := ptr.getPointer() - if p.isNil() { - return b, nil - } - var err error - b = appendVarint(b, wiretag) // start group - b, err = u.marshal(b, p, deterministic) - b = appendVarint(b, wiretag+(WireEndGroup-WireStartGroup)) // end group - return b, err - } -} - -// makeGroupSliceMarshaler returns the sizer and marshaler for a group slice. -// u is the marshal info of the underlying message. -func makeGroupSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getPointerSlice() - n := 0 - for _, v := range s { - if v.isNil() { - continue - } - n += u.size(v) + 2*tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getPointerSlice() - var err error - var nerr nonFatal - for _, v := range s { - if v.isNil() { - return b, errRepeatedHasNil - } - b = appendVarint(b, wiretag) // start group - b, err = u.marshal(b, v, deterministic) - b = appendVarint(b, wiretag+(WireEndGroup-WireStartGroup)) // end group - if !nerr.Merge(err) { - if err == ErrNil { - err = errRepeatedHasNil - } - return b, err - } - } - return b, nerr.E - } -} - -// makeMessageMarshaler returns the sizer and marshaler for a message field. -// u is the marshal info of the message. -func makeMessageMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - p := ptr.getPointer() - if p.isNil() { - return 0 - } - siz := u.size(p) - return siz + SizeVarint(uint64(siz)) + tagsize - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - p := ptr.getPointer() - if p.isNil() { - return b, nil - } - b = appendVarint(b, wiretag) - siz := u.cachedsize(p) - b = appendVarint(b, uint64(siz)) - return u.marshal(b, p, deterministic) - } -} - -// makeMessageSliceMarshaler returns the sizer and marshaler for a message slice. -// u is the marshal info of the message. -func makeMessageSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getPointerSlice() - n := 0 - for _, v := range s { - if v.isNil() { - continue - } - siz := u.size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getPointerSlice() - var err error - var nerr nonFatal - for _, v := range s { - if v.isNil() { - return b, errRepeatedHasNil - } - b = appendVarint(b, wiretag) - siz := u.cachedsize(v) - b = appendVarint(b, uint64(siz)) - b, err = u.marshal(b, v, deterministic) - - if !nerr.Merge(err) { - if err == ErrNil { - err = errRepeatedHasNil - } - return b, err - } - } - return b, nerr.E - } -} - -// makeMapMarshaler returns the sizer and marshaler for a map field. -// f is the pointer to the reflect data structure of the field. -func makeMapMarshaler(f *reflect.StructField) (sizer, marshaler) { - // figure out key and value type - t := f.Type - keyType := t.Key() - valType := t.Elem() - tags := strings.Split(f.Tag.Get("protobuf"), ",") - keyTags := strings.Split(f.Tag.Get("protobuf_key"), ",") - valTags := strings.Split(f.Tag.Get("protobuf_val"), ",") - stdOptions := false - for _, t := range tags { - if strings.HasPrefix(t, "customtype=") { - valTags = append(valTags, t) - } - if t == "stdtime" { - valTags = append(valTags, t) - stdOptions = true - } - if t == "stdduration" { - valTags = append(valTags, t) - stdOptions = true - } - if t == "wktptr" { - valTags = append(valTags, t) - } - } - keySizer, keyMarshaler := typeMarshaler(keyType, keyTags, false, false) // don't omit zero value in map - valSizer, valMarshaler := typeMarshaler(valType, valTags, false, false) // don't omit zero value in map - keyWireTag := 1<<3 | wiretype(keyTags[0]) - valWireTag := 2<<3 | wiretype(valTags[0]) - - // We create an interface to get the addresses of the map key and value. - // If value is pointer-typed, the interface is a direct interface, the - // idata itself is the value. Otherwise, the idata is the pointer to the - // value. - // Key cannot be pointer-typed. - valIsPtr := valType.Kind() == reflect.Ptr - - // If value is a message with nested maps, calling - // valSizer in marshal may be quadratic. We should use - // cached version in marshal (but not in size). - // If value is not message type, we don't have size cache, - // but it cannot be nested either. Just use valSizer. - valCachedSizer := valSizer - if valIsPtr && !stdOptions && valType.Elem().Kind() == reflect.Struct { - u := getMarshalInfo(valType.Elem()) - valCachedSizer = func(ptr pointer, tagsize int) int { - // Same as message sizer, but use cache. - p := ptr.getPointer() - if p.isNil() { - return 0 - } - siz := u.cachedsize(p) - return siz + SizeVarint(uint64(siz)) + tagsize - } - } - return func(ptr pointer, tagsize int) int { - m := ptr.asPointerTo(t).Elem() // the map - n := 0 - for _, k := range m.MapKeys() { - ki := k.Interface() - vi := m.MapIndex(k).Interface() - kaddr := toAddrPointer(&ki, false) // pointer to key - vaddr := toAddrPointer(&vi, valIsPtr) // pointer to value - siz := keySizer(kaddr, 1) + valSizer(vaddr, 1) // tag of key = 1 (size=1), tag of val = 2 (size=1) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, tag uint64, deterministic bool) ([]byte, error) { - m := ptr.asPointerTo(t).Elem() // the map - var err error - keys := m.MapKeys() - if len(keys) > 1 && deterministic { - sort.Sort(mapKeys(keys)) - } - - var nerr nonFatal - for _, k := range keys { - ki := k.Interface() - vi := m.MapIndex(k).Interface() - kaddr := toAddrPointer(&ki, false) // pointer to key - vaddr := toAddrPointer(&vi, valIsPtr) // pointer to value - b = appendVarint(b, tag) - siz := keySizer(kaddr, 1) + valCachedSizer(vaddr, 1) // tag of key = 1 (size=1), tag of val = 2 (size=1) - b = appendVarint(b, uint64(siz)) - b, err = keyMarshaler(b, kaddr, keyWireTag, deterministic) - if !nerr.Merge(err) { - return b, err - } - b, err = valMarshaler(b, vaddr, valWireTag, deterministic) - if err != ErrNil && !nerr.Merge(err) { // allow nil value in map - return b, err - } - } - return b, nerr.E - } -} - -// makeOneOfMarshaler returns the sizer and marshaler for a oneof field. -// fi is the marshal info of the field. -// f is the pointer to the reflect data structure of the field. -func makeOneOfMarshaler(fi *marshalFieldInfo, f *reflect.StructField) (sizer, marshaler) { - // Oneof field is an interface. We need to get the actual data type on the fly. - t := f.Type - return func(ptr pointer, _ int) int { - p := ptr.getInterfacePointer() - if p.isNil() { - return 0 - } - v := ptr.asPointerTo(t).Elem().Elem().Elem() // *interface -> interface -> *struct -> struct - telem := v.Type() - e := fi.oneofElems[telem] - return e.sizer(p, e.tagsize) - }, - func(b []byte, ptr pointer, _ uint64, deterministic bool) ([]byte, error) { - p := ptr.getInterfacePointer() - if p.isNil() { - return b, nil - } - v := ptr.asPointerTo(t).Elem().Elem().Elem() // *interface -> interface -> *struct -> struct - telem := v.Type() - if telem.Field(0).Type.Kind() == reflect.Ptr && p.getPointer().isNil() { - return b, errOneofHasNil - } - e := fi.oneofElems[telem] - return e.marshaler(b, p, e.wiretag, deterministic) - } -} - -// sizeExtensions computes the size of encoded data for a XXX_InternalExtensions field. -func (u *marshalInfo) sizeExtensions(ext *XXX_InternalExtensions) int { - m, mu := ext.extensionsRead() - if m == nil { - return 0 - } - mu.Lock() - - n := 0 - for _, e := range m { - if e.value == nil || e.desc == nil { - // Extension is only in its encoded form. - n += len(e.enc) - continue - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - ei := u.getExtElemInfo(e.desc) - v := e.value - p := toAddrPointer(&v, ei.isptr) - n += ei.sizer(p, ei.tagsize) - } - mu.Unlock() - return n -} - -// appendExtensions marshals a XXX_InternalExtensions field to the end of byte slice b. -func (u *marshalInfo) appendExtensions(b []byte, ext *XXX_InternalExtensions, deterministic bool) ([]byte, error) { - m, mu := ext.extensionsRead() - if m == nil { - return b, nil - } - mu.Lock() - defer mu.Unlock() - - var err error - var nerr nonFatal - - // Fast-path for common cases: zero or one extensions. - // Don't bother sorting the keys. - if len(m) <= 1 { - for _, e := range m { - if e.value == nil || e.desc == nil { - // Extension is only in its encoded form. - b = append(b, e.enc...) - continue - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - - ei := u.getExtElemInfo(e.desc) - v := e.value - p := toAddrPointer(&v, ei.isptr) - b, err = ei.marshaler(b, p, ei.wiretag, deterministic) - if !nerr.Merge(err) { - return b, err - } - } - return b, nerr.E - } - - // Sort the keys to provide a deterministic encoding. - // Not sure this is required, but the old code does it. - keys := make([]int, 0, len(m)) - for k := range m { - keys = append(keys, int(k)) - } - sort.Ints(keys) - - for _, k := range keys { - e := m[int32(k)] - if e.value == nil || e.desc == nil { - // Extension is only in its encoded form. - b = append(b, e.enc...) - continue - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - - ei := u.getExtElemInfo(e.desc) - v := e.value - p := toAddrPointer(&v, ei.isptr) - b, err = ei.marshaler(b, p, ei.wiretag, deterministic) - if !nerr.Merge(err) { - return b, err - } - } - return b, nerr.E -} - -// message set format is: -// message MessageSet { -// repeated group Item = 1 { -// required int32 type_id = 2; -// required string message = 3; -// }; -// } - -// sizeMessageSet computes the size of encoded data for a XXX_InternalExtensions field -// in message set format (above). -func (u *marshalInfo) sizeMessageSet(ext *XXX_InternalExtensions) int { - m, mu := ext.extensionsRead() - if m == nil { - return 0 - } - mu.Lock() - - n := 0 - for id, e := range m { - n += 2 // start group, end group. tag = 1 (size=1) - n += SizeVarint(uint64(id)) + 1 // type_id, tag = 2 (size=1) - - if e.value == nil || e.desc == nil { - // Extension is only in its encoded form. - msgWithLen := skipVarint(e.enc) // skip old tag, but leave the length varint - siz := len(msgWithLen) - n += siz + 1 // message, tag = 3 (size=1) - continue - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - - ei := u.getExtElemInfo(e.desc) - v := e.value - p := toAddrPointer(&v, ei.isptr) - n += ei.sizer(p, 1) // message, tag = 3 (size=1) - } - mu.Unlock() - return n -} - -// appendMessageSet marshals a XXX_InternalExtensions field in message set format (above) -// to the end of byte slice b. -func (u *marshalInfo) appendMessageSet(b []byte, ext *XXX_InternalExtensions, deterministic bool) ([]byte, error) { - m, mu := ext.extensionsRead() - if m == nil { - return b, nil - } - mu.Lock() - defer mu.Unlock() - - var err error - var nerr nonFatal - - // Fast-path for common cases: zero or one extensions. - // Don't bother sorting the keys. - if len(m) <= 1 { - for id, e := range m { - b = append(b, 1<<3|WireStartGroup) - b = append(b, 2<<3|WireVarint) - b = appendVarint(b, uint64(id)) - - if e.value == nil || e.desc == nil { - // Extension is only in its encoded form. - msgWithLen := skipVarint(e.enc) // skip old tag, but leave the length varint - b = append(b, 3<<3|WireBytes) - b = append(b, msgWithLen...) - b = append(b, 1<<3|WireEndGroup) - continue - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - - ei := u.getExtElemInfo(e.desc) - v := e.value - p := toAddrPointer(&v, ei.isptr) - b, err = ei.marshaler(b, p, 3<<3|WireBytes, deterministic) - if !nerr.Merge(err) { - return b, err - } - b = append(b, 1<<3|WireEndGroup) - } - return b, nerr.E - } - - // Sort the keys to provide a deterministic encoding. - keys := make([]int, 0, len(m)) - for k := range m { - keys = append(keys, int(k)) - } - sort.Ints(keys) - - for _, id := range keys { - e := m[int32(id)] - b = append(b, 1<<3|WireStartGroup) - b = append(b, 2<<3|WireVarint) - b = appendVarint(b, uint64(id)) - - if e.value == nil || e.desc == nil { - // Extension is only in its encoded form. - msgWithLen := skipVarint(e.enc) // skip old tag, but leave the length varint - b = append(b, 3<<3|WireBytes) - b = append(b, msgWithLen...) - b = append(b, 1<<3|WireEndGroup) - continue - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - - ei := u.getExtElemInfo(e.desc) - v := e.value - p := toAddrPointer(&v, ei.isptr) - b, err = ei.marshaler(b, p, 3<<3|WireBytes, deterministic) - b = append(b, 1<<3|WireEndGroup) - if !nerr.Merge(err) { - return b, err - } - } - return b, nerr.E -} - -// sizeV1Extensions computes the size of encoded data for a V1-API extension field. -func (u *marshalInfo) sizeV1Extensions(m map[int32]Extension) int { - if m == nil { - return 0 - } - - n := 0 - for _, e := range m { - if e.value == nil || e.desc == nil { - // Extension is only in its encoded form. - n += len(e.enc) - continue - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - - ei := u.getExtElemInfo(e.desc) - v := e.value - p := toAddrPointer(&v, ei.isptr) - n += ei.sizer(p, ei.tagsize) - } - return n -} - -// appendV1Extensions marshals a V1-API extension field to the end of byte slice b. -func (u *marshalInfo) appendV1Extensions(b []byte, m map[int32]Extension, deterministic bool) ([]byte, error) { - if m == nil { - return b, nil - } - - // Sort the keys to provide a deterministic encoding. - keys := make([]int, 0, len(m)) - for k := range m { - keys = append(keys, int(k)) - } - sort.Ints(keys) - - var err error - var nerr nonFatal - for _, k := range keys { - e := m[int32(k)] - if e.value == nil || e.desc == nil { - // Extension is only in its encoded form. - b = append(b, e.enc...) - continue - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - - ei := u.getExtElemInfo(e.desc) - v := e.value - p := toAddrPointer(&v, ei.isptr) - b, err = ei.marshaler(b, p, ei.wiretag, deterministic) - if !nerr.Merge(err) { - return b, err - } - } - return b, nerr.E -} - -// newMarshaler is the interface representing objects that can marshal themselves. -// -// This exists to support protoc-gen-go generated messages. -// The proto package will stop type-asserting to this interface in the future. -// -// DO NOT DEPEND ON THIS. -type newMarshaler interface { - XXX_Size() int - XXX_Marshal(b []byte, deterministic bool) ([]byte, error) -} - -// Size returns the encoded size of a protocol buffer message. -// This is the main entry point. -func Size(pb Message) int { - if m, ok := pb.(newMarshaler); ok { - return m.XXX_Size() - } - if m, ok := pb.(Marshaler); ok { - // If the message can marshal itself, let it do it, for compatibility. - // NOTE: This is not efficient. - b, _ := m.Marshal() - return len(b) - } - // in case somehow we didn't generate the wrapper - if pb == nil { - return 0 - } - var info InternalMessageInfo - return info.Size(pb) -} - -// Marshal takes a protocol buffer message -// and encodes it into the wire format, returning the data. -// This is the main entry point. -func Marshal(pb Message) ([]byte, error) { - if m, ok := pb.(newMarshaler); ok { - siz := m.XXX_Size() - b := make([]byte, 0, siz) - return m.XXX_Marshal(b, false) - } - if m, ok := pb.(Marshaler); ok { - // If the message can marshal itself, let it do it, for compatibility. - // NOTE: This is not efficient. - return m.Marshal() - } - // in case somehow we didn't generate the wrapper - if pb == nil { - return nil, ErrNil - } - var info InternalMessageInfo - siz := info.Size(pb) - b := make([]byte, 0, siz) - return info.Marshal(b, pb, false) -} - -// Marshal takes a protocol buffer message -// and encodes it into the wire format, writing the result to the -// Buffer. -// This is an alternative entry point. It is not necessary to use -// a Buffer for most applications. -func (p *Buffer) Marshal(pb Message) error { - var err error - if p.deterministic { - if _, ok := pb.(Marshaler); ok { - return fmt.Errorf("proto: deterministic not supported by the Marshal method of %T", pb) - } - } - if m, ok := pb.(newMarshaler); ok { - siz := m.XXX_Size() - p.grow(siz) // make sure buf has enough capacity - pp := p.buf[len(p.buf) : len(p.buf) : len(p.buf)+siz] - pp, err = m.XXX_Marshal(pp, p.deterministic) - p.buf = append(p.buf, pp...) - return err - } - if m, ok := pb.(Marshaler); ok { - // If the message can marshal itself, let it do it, for compatibility. - // NOTE: This is not efficient. - var b []byte - b, err = m.Marshal() - p.buf = append(p.buf, b...) - return err - } - // in case somehow we didn't generate the wrapper - if pb == nil { - return ErrNil - } - var info InternalMessageInfo - siz := info.Size(pb) - p.grow(siz) // make sure buf has enough capacity - p.buf, err = info.Marshal(p.buf, pb, p.deterministic) - return err -} - -// grow grows the buffer's capacity, if necessary, to guarantee space for -// another n bytes. After grow(n), at least n bytes can be written to the -// buffer without another allocation. -func (p *Buffer) grow(n int) { - need := len(p.buf) + n - if need <= cap(p.buf) { - return - } - newCap := len(p.buf) * 2 - if newCap < need { - newCap = need - } - p.buf = append(make([]byte, 0, newCap), p.buf...) -} diff --git a/vendor/github.com/gogo/protobuf/proto/table_marshal_gogo.go b/vendor/github.com/gogo/protobuf/proto/table_marshal_gogo.go deleted file mode 100644 index 997f57c1e..000000000 --- a/vendor/github.com/gogo/protobuf/proto/table_marshal_gogo.go +++ /dev/null @@ -1,388 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2018, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -import ( - "reflect" - "time" -) - -// makeMessageRefMarshaler differs a bit from makeMessageMarshaler -// It marshal a message T instead of a *T -func makeMessageRefMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - siz := u.size(ptr) - return siz + SizeVarint(uint64(siz)) + tagsize - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - b = appendVarint(b, wiretag) - siz := u.cachedsize(ptr) - b = appendVarint(b, uint64(siz)) - return u.marshal(b, ptr, deterministic) - } -} - -// makeMessageRefSliceMarshaler differs quite a lot from makeMessageSliceMarshaler -// It marshals a slice of messages []T instead of []*T -func makeMessageRefSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(u.typ) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - e := elem.Interface() - v := toAddrPointer(&e, false) - siz := u.size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(u.typ) - var err, errreq error - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - e := elem.Interface() - v := toAddrPointer(&e, false) - b = appendVarint(b, wiretag) - siz := u.size(v) - b = appendVarint(b, uint64(siz)) - b, err = u.marshal(b, v, deterministic) - - if err != nil { - if _, ok := err.(*RequiredNotSetError); ok { - // Required field in submessage is not set. - // We record the error but keep going, to give a complete marshaling. - if errreq == nil { - errreq = err - } - continue - } - if err == ErrNil { - err = errRepeatedHasNil - } - return b, err - } - } - - return b, errreq - } -} - -func makeCustomPtrMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - if ptr.isNil() { - return 0 - } - m := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(custom) - siz := m.Size() - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - if ptr.isNil() { - return b, nil - } - m := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(custom) - siz := m.Size() - buf, err := m.Marshal() - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - return b, nil - } -} - -func makeCustomMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - m := ptr.asPointerTo(u.typ).Interface().(custom) - siz := m.Size() - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - m := ptr.asPointerTo(u.typ).Interface().(custom) - siz := m.Size() - buf, err := m.Marshal() - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - return b, nil - } -} - -func makeTimeMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - t := ptr.asPointerTo(u.typ).Interface().(*time.Time) - ts, err := timestampProto(*t) - if err != nil { - return 0 - } - siz := Size(ts) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - t := ptr.asPointerTo(u.typ).Interface().(*time.Time) - ts, err := timestampProto(*t) - if err != nil { - return nil, err - } - buf, err := Marshal(ts) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeTimePtrMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - if ptr.isNil() { - return 0 - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*time.Time) - ts, err := timestampProto(*t) - if err != nil { - return 0 - } - siz := Size(ts) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - if ptr.isNil() { - return b, nil - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*time.Time) - ts, err := timestampProto(*t) - if err != nil { - return nil, err - } - buf, err := Marshal(ts) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeTimeSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(u.typ) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(time.Time) - ts, err := timestampProto(t) - if err != nil { - return 0 - } - siz := Size(ts) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(u.typ) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(time.Time) - ts, err := timestampProto(t) - if err != nil { - return nil, err - } - siz := Size(ts) - buf, err := Marshal(ts) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeTimePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*time.Time) - ts, err := timestampProto(*t) - if err != nil { - return 0 - } - siz := Size(ts) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*time.Time) - ts, err := timestampProto(*t) - if err != nil { - return nil, err - } - siz := Size(ts) - buf, err := Marshal(ts) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeDurationMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - d := ptr.asPointerTo(u.typ).Interface().(*time.Duration) - dur := durationProto(*d) - siz := Size(dur) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - d := ptr.asPointerTo(u.typ).Interface().(*time.Duration) - dur := durationProto(*d) - buf, err := Marshal(dur) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeDurationPtrMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - if ptr.isNil() { - return 0 - } - d := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*time.Duration) - dur := durationProto(*d) - siz := Size(dur) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - if ptr.isNil() { - return b, nil - } - d := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*time.Duration) - dur := durationProto(*d) - buf, err := Marshal(dur) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeDurationSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(u.typ) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - d := elem.Interface().(time.Duration) - dur := durationProto(d) - siz := Size(dur) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(u.typ) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - d := elem.Interface().(time.Duration) - dur := durationProto(d) - siz := Size(dur) - buf, err := Marshal(dur) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeDurationPtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - d := elem.Interface().(*time.Duration) - dur := durationProto(*d) - siz := Size(dur) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - d := elem.Interface().(*time.Duration) - dur := durationProto(*d) - siz := Size(dur) - buf, err := Marshal(dur) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} diff --git a/vendor/github.com/gogo/protobuf/proto/table_merge.go b/vendor/github.com/gogo/protobuf/proto/table_merge.go deleted file mode 100644 index 60dcf70d1..000000000 --- a/vendor/github.com/gogo/protobuf/proto/table_merge.go +++ /dev/null @@ -1,676 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2016 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -import ( - "fmt" - "reflect" - "strings" - "sync" - "sync/atomic" -) - -// Merge merges the src message into dst. -// This assumes that dst and src of the same type and are non-nil. -func (a *InternalMessageInfo) Merge(dst, src Message) { - mi := atomicLoadMergeInfo(&a.merge) - if mi == nil { - mi = getMergeInfo(reflect.TypeOf(dst).Elem()) - atomicStoreMergeInfo(&a.merge, mi) - } - mi.merge(toPointer(&dst), toPointer(&src)) -} - -type mergeInfo struct { - typ reflect.Type - - initialized int32 // 0: only typ is valid, 1: everything is valid - lock sync.Mutex - - fields []mergeFieldInfo - unrecognized field // Offset of XXX_unrecognized -} - -type mergeFieldInfo struct { - field field // Offset of field, guaranteed to be valid - - // isPointer reports whether the value in the field is a pointer. - // This is true for the following situations: - // * Pointer to struct - // * Pointer to basic type (proto2 only) - // * Slice (first value in slice header is a pointer) - // * String (first value in string header is a pointer) - isPointer bool - - // basicWidth reports the width of the field assuming that it is directly - // embedded in the struct (as is the case for basic types in proto3). - // The possible values are: - // 0: invalid - // 1: bool - // 4: int32, uint32, float32 - // 8: int64, uint64, float64 - basicWidth int - - // Where dst and src are pointers to the types being merged. - merge func(dst, src pointer) -} - -var ( - mergeInfoMap = map[reflect.Type]*mergeInfo{} - mergeInfoLock sync.Mutex -) - -func getMergeInfo(t reflect.Type) *mergeInfo { - mergeInfoLock.Lock() - defer mergeInfoLock.Unlock() - mi := mergeInfoMap[t] - if mi == nil { - mi = &mergeInfo{typ: t} - mergeInfoMap[t] = mi - } - return mi -} - -// merge merges src into dst assuming they are both of type *mi.typ. -func (mi *mergeInfo) merge(dst, src pointer) { - if dst.isNil() { - panic("proto: nil destination") - } - if src.isNil() { - return // Nothing to do. - } - - if atomic.LoadInt32(&mi.initialized) == 0 { - mi.computeMergeInfo() - } - - for _, fi := range mi.fields { - sfp := src.offset(fi.field) - - // As an optimization, we can avoid the merge function call cost - // if we know for sure that the source will have no effect - // by checking if it is the zero value. - if unsafeAllowed { - if fi.isPointer && sfp.getPointer().isNil() { // Could be slice or string - continue - } - if fi.basicWidth > 0 { - switch { - case fi.basicWidth == 1 && !*sfp.toBool(): - continue - case fi.basicWidth == 4 && *sfp.toUint32() == 0: - continue - case fi.basicWidth == 8 && *sfp.toUint64() == 0: - continue - } - } - } - - dfp := dst.offset(fi.field) - fi.merge(dfp, sfp) - } - - // TODO: Make this faster? - out := dst.asPointerTo(mi.typ).Elem() - in := src.asPointerTo(mi.typ).Elem() - if emIn, err := extendable(in.Addr().Interface()); err == nil { - emOut, _ := extendable(out.Addr().Interface()) - mIn, muIn := emIn.extensionsRead() - if mIn != nil { - mOut := emOut.extensionsWrite() - muIn.Lock() - mergeExtension(mOut, mIn) - muIn.Unlock() - } - } - - if mi.unrecognized.IsValid() { - if b := *src.offset(mi.unrecognized).toBytes(); len(b) > 0 { - *dst.offset(mi.unrecognized).toBytes() = append([]byte(nil), b...) - } - } -} - -func (mi *mergeInfo) computeMergeInfo() { - mi.lock.Lock() - defer mi.lock.Unlock() - if mi.initialized != 0 { - return - } - t := mi.typ - n := t.NumField() - - props := GetProperties(t) - for i := 0; i < n; i++ { - f := t.Field(i) - if strings.HasPrefix(f.Name, "XXX_") { - continue - } - - mfi := mergeFieldInfo{field: toField(&f)} - tf := f.Type - - // As an optimization, we can avoid the merge function call cost - // if we know for sure that the source will have no effect - // by checking if it is the zero value. - if unsafeAllowed { - switch tf.Kind() { - case reflect.Ptr, reflect.Slice, reflect.String: - // As a special case, we assume slices and strings are pointers - // since we know that the first field in the SliceSlice or - // StringHeader is a data pointer. - mfi.isPointer = true - case reflect.Bool: - mfi.basicWidth = 1 - case reflect.Int32, reflect.Uint32, reflect.Float32: - mfi.basicWidth = 4 - case reflect.Int64, reflect.Uint64, reflect.Float64: - mfi.basicWidth = 8 - } - } - - // Unwrap tf to get at its most basic type. - var isPointer, isSlice bool - if tf.Kind() == reflect.Slice && tf.Elem().Kind() != reflect.Uint8 { - isSlice = true - tf = tf.Elem() - } - if tf.Kind() == reflect.Ptr { - isPointer = true - tf = tf.Elem() - } - if isPointer && isSlice && tf.Kind() != reflect.Struct { - panic("both pointer and slice for basic type in " + tf.Name()) - } - - switch tf.Kind() { - case reflect.Int32: - switch { - case isSlice: // E.g., []int32 - mfi.merge = func(dst, src pointer) { - // NOTE: toInt32Slice is not defined (see pointer_reflect.go). - /* - sfsp := src.toInt32Slice() - if *sfsp != nil { - dfsp := dst.toInt32Slice() - *dfsp = append(*dfsp, *sfsp...) - if *dfsp == nil { - *dfsp = []int64{} - } - } - */ - sfs := src.getInt32Slice() - if sfs != nil { - dfs := dst.getInt32Slice() - dfs = append(dfs, sfs...) - if dfs == nil { - dfs = []int32{} - } - dst.setInt32Slice(dfs) - } - } - case isPointer: // E.g., *int32 - mfi.merge = func(dst, src pointer) { - // NOTE: toInt32Ptr is not defined (see pointer_reflect.go). - /* - sfpp := src.toInt32Ptr() - if *sfpp != nil { - dfpp := dst.toInt32Ptr() - if *dfpp == nil { - *dfpp = Int32(**sfpp) - } else { - **dfpp = **sfpp - } - } - */ - sfp := src.getInt32Ptr() - if sfp != nil { - dfp := dst.getInt32Ptr() - if dfp == nil { - dst.setInt32Ptr(*sfp) - } else { - *dfp = *sfp - } - } - } - default: // E.g., int32 - mfi.merge = func(dst, src pointer) { - if v := *src.toInt32(); v != 0 { - *dst.toInt32() = v - } - } - } - case reflect.Int64: - switch { - case isSlice: // E.g., []int64 - mfi.merge = func(dst, src pointer) { - sfsp := src.toInt64Slice() - if *sfsp != nil { - dfsp := dst.toInt64Slice() - *dfsp = append(*dfsp, *sfsp...) - if *dfsp == nil { - *dfsp = []int64{} - } - } - } - case isPointer: // E.g., *int64 - mfi.merge = func(dst, src pointer) { - sfpp := src.toInt64Ptr() - if *sfpp != nil { - dfpp := dst.toInt64Ptr() - if *dfpp == nil { - *dfpp = Int64(**sfpp) - } else { - **dfpp = **sfpp - } - } - } - default: // E.g., int64 - mfi.merge = func(dst, src pointer) { - if v := *src.toInt64(); v != 0 { - *dst.toInt64() = v - } - } - } - case reflect.Uint32: - switch { - case isSlice: // E.g., []uint32 - mfi.merge = func(dst, src pointer) { - sfsp := src.toUint32Slice() - if *sfsp != nil { - dfsp := dst.toUint32Slice() - *dfsp = append(*dfsp, *sfsp...) - if *dfsp == nil { - *dfsp = []uint32{} - } - } - } - case isPointer: // E.g., *uint32 - mfi.merge = func(dst, src pointer) { - sfpp := src.toUint32Ptr() - if *sfpp != nil { - dfpp := dst.toUint32Ptr() - if *dfpp == nil { - *dfpp = Uint32(**sfpp) - } else { - **dfpp = **sfpp - } - } - } - default: // E.g., uint32 - mfi.merge = func(dst, src pointer) { - if v := *src.toUint32(); v != 0 { - *dst.toUint32() = v - } - } - } - case reflect.Uint64: - switch { - case isSlice: // E.g., []uint64 - mfi.merge = func(dst, src pointer) { - sfsp := src.toUint64Slice() - if *sfsp != nil { - dfsp := dst.toUint64Slice() - *dfsp = append(*dfsp, *sfsp...) - if *dfsp == nil { - *dfsp = []uint64{} - } - } - } - case isPointer: // E.g., *uint64 - mfi.merge = func(dst, src pointer) { - sfpp := src.toUint64Ptr() - if *sfpp != nil { - dfpp := dst.toUint64Ptr() - if *dfpp == nil { - *dfpp = Uint64(**sfpp) - } else { - **dfpp = **sfpp - } - } - } - default: // E.g., uint64 - mfi.merge = func(dst, src pointer) { - if v := *src.toUint64(); v != 0 { - *dst.toUint64() = v - } - } - } - case reflect.Float32: - switch { - case isSlice: // E.g., []float32 - mfi.merge = func(dst, src pointer) { - sfsp := src.toFloat32Slice() - if *sfsp != nil { - dfsp := dst.toFloat32Slice() - *dfsp = append(*dfsp, *sfsp...) - if *dfsp == nil { - *dfsp = []float32{} - } - } - } - case isPointer: // E.g., *float32 - mfi.merge = func(dst, src pointer) { - sfpp := src.toFloat32Ptr() - if *sfpp != nil { - dfpp := dst.toFloat32Ptr() - if *dfpp == nil { - *dfpp = Float32(**sfpp) - } else { - **dfpp = **sfpp - } - } - } - default: // E.g., float32 - mfi.merge = func(dst, src pointer) { - if v := *src.toFloat32(); v != 0 { - *dst.toFloat32() = v - } - } - } - case reflect.Float64: - switch { - case isSlice: // E.g., []float64 - mfi.merge = func(dst, src pointer) { - sfsp := src.toFloat64Slice() - if *sfsp != nil { - dfsp := dst.toFloat64Slice() - *dfsp = append(*dfsp, *sfsp...) - if *dfsp == nil { - *dfsp = []float64{} - } - } - } - case isPointer: // E.g., *float64 - mfi.merge = func(dst, src pointer) { - sfpp := src.toFloat64Ptr() - if *sfpp != nil { - dfpp := dst.toFloat64Ptr() - if *dfpp == nil { - *dfpp = Float64(**sfpp) - } else { - **dfpp = **sfpp - } - } - } - default: // E.g., float64 - mfi.merge = func(dst, src pointer) { - if v := *src.toFloat64(); v != 0 { - *dst.toFloat64() = v - } - } - } - case reflect.Bool: - switch { - case isSlice: // E.g., []bool - mfi.merge = func(dst, src pointer) { - sfsp := src.toBoolSlice() - if *sfsp != nil { - dfsp := dst.toBoolSlice() - *dfsp = append(*dfsp, *sfsp...) - if *dfsp == nil { - *dfsp = []bool{} - } - } - } - case isPointer: // E.g., *bool - mfi.merge = func(dst, src pointer) { - sfpp := src.toBoolPtr() - if *sfpp != nil { - dfpp := dst.toBoolPtr() - if *dfpp == nil { - *dfpp = Bool(**sfpp) - } else { - **dfpp = **sfpp - } - } - } - default: // E.g., bool - mfi.merge = func(dst, src pointer) { - if v := *src.toBool(); v { - *dst.toBool() = v - } - } - } - case reflect.String: - switch { - case isSlice: // E.g., []string - mfi.merge = func(dst, src pointer) { - sfsp := src.toStringSlice() - if *sfsp != nil { - dfsp := dst.toStringSlice() - *dfsp = append(*dfsp, *sfsp...) - if *dfsp == nil { - *dfsp = []string{} - } - } - } - case isPointer: // E.g., *string - mfi.merge = func(dst, src pointer) { - sfpp := src.toStringPtr() - if *sfpp != nil { - dfpp := dst.toStringPtr() - if *dfpp == nil { - *dfpp = String(**sfpp) - } else { - **dfpp = **sfpp - } - } - } - default: // E.g., string - mfi.merge = func(dst, src pointer) { - if v := *src.toString(); v != "" { - *dst.toString() = v - } - } - } - case reflect.Slice: - isProto3 := props.Prop[i].proto3 - switch { - case isPointer: - panic("bad pointer in byte slice case in " + tf.Name()) - case tf.Elem().Kind() != reflect.Uint8: - panic("bad element kind in byte slice case in " + tf.Name()) - case isSlice: // E.g., [][]byte - mfi.merge = func(dst, src pointer) { - sbsp := src.toBytesSlice() - if *sbsp != nil { - dbsp := dst.toBytesSlice() - for _, sb := range *sbsp { - if sb == nil { - *dbsp = append(*dbsp, nil) - } else { - *dbsp = append(*dbsp, append([]byte{}, sb...)) - } - } - if *dbsp == nil { - *dbsp = [][]byte{} - } - } - } - default: // E.g., []byte - mfi.merge = func(dst, src pointer) { - sbp := src.toBytes() - if *sbp != nil { - dbp := dst.toBytes() - if !isProto3 || len(*sbp) > 0 { - *dbp = append([]byte{}, *sbp...) - } - } - } - } - case reflect.Struct: - switch { - case isSlice && !isPointer: // E.g. []pb.T - mergeInfo := getMergeInfo(tf) - zero := reflect.Zero(tf) - mfi.merge = func(dst, src pointer) { - // TODO: Make this faster? - dstsp := dst.asPointerTo(f.Type) - dsts := dstsp.Elem() - srcs := src.asPointerTo(f.Type).Elem() - for i := 0; i < srcs.Len(); i++ { - dsts = reflect.Append(dsts, zero) - srcElement := srcs.Index(i).Addr() - dstElement := dsts.Index(dsts.Len() - 1).Addr() - mergeInfo.merge(valToPointer(dstElement), valToPointer(srcElement)) - } - if dsts.IsNil() { - dsts = reflect.MakeSlice(f.Type, 0, 0) - } - dstsp.Elem().Set(dsts) - } - case !isPointer: - mergeInfo := getMergeInfo(tf) - mfi.merge = func(dst, src pointer) { - mergeInfo.merge(dst, src) - } - case isSlice: // E.g., []*pb.T - mergeInfo := getMergeInfo(tf) - mfi.merge = func(dst, src pointer) { - sps := src.getPointerSlice() - if sps != nil { - dps := dst.getPointerSlice() - for _, sp := range sps { - var dp pointer - if !sp.isNil() { - dp = valToPointer(reflect.New(tf)) - mergeInfo.merge(dp, sp) - } - dps = append(dps, dp) - } - if dps == nil { - dps = []pointer{} - } - dst.setPointerSlice(dps) - } - } - default: // E.g., *pb.T - mergeInfo := getMergeInfo(tf) - mfi.merge = func(dst, src pointer) { - sp := src.getPointer() - if !sp.isNil() { - dp := dst.getPointer() - if dp.isNil() { - dp = valToPointer(reflect.New(tf)) - dst.setPointer(dp) - } - mergeInfo.merge(dp, sp) - } - } - } - case reflect.Map: - switch { - case isPointer || isSlice: - panic("bad pointer or slice in map case in " + tf.Name()) - default: // E.g., map[K]V - mfi.merge = func(dst, src pointer) { - sm := src.asPointerTo(tf).Elem() - if sm.Len() == 0 { - return - } - dm := dst.asPointerTo(tf).Elem() - if dm.IsNil() { - dm.Set(reflect.MakeMap(tf)) - } - - switch tf.Elem().Kind() { - case reflect.Ptr: // Proto struct (e.g., *T) - for _, key := range sm.MapKeys() { - val := sm.MapIndex(key) - val = reflect.ValueOf(Clone(val.Interface().(Message))) - dm.SetMapIndex(key, val) - } - case reflect.Slice: // E.g. Bytes type (e.g., []byte) - for _, key := range sm.MapKeys() { - val := sm.MapIndex(key) - val = reflect.ValueOf(append([]byte{}, val.Bytes()...)) - dm.SetMapIndex(key, val) - } - default: // Basic type (e.g., string) - for _, key := range sm.MapKeys() { - val := sm.MapIndex(key) - dm.SetMapIndex(key, val) - } - } - } - } - case reflect.Interface: - // Must be oneof field. - switch { - case isPointer || isSlice: - panic("bad pointer or slice in interface case in " + tf.Name()) - default: // E.g., interface{} - // TODO: Make this faster? - mfi.merge = func(dst, src pointer) { - su := src.asPointerTo(tf).Elem() - if !su.IsNil() { - du := dst.asPointerTo(tf).Elem() - typ := su.Elem().Type() - if du.IsNil() || du.Elem().Type() != typ { - du.Set(reflect.New(typ.Elem())) // Initialize interface if empty - } - sv := su.Elem().Elem().Field(0) - if sv.Kind() == reflect.Ptr && sv.IsNil() { - return - } - dv := du.Elem().Elem().Field(0) - if dv.Kind() == reflect.Ptr && dv.IsNil() { - dv.Set(reflect.New(sv.Type().Elem())) // Initialize proto message if empty - } - switch sv.Type().Kind() { - case reflect.Ptr: // Proto struct (e.g., *T) - Merge(dv.Interface().(Message), sv.Interface().(Message)) - case reflect.Slice: // E.g. Bytes type (e.g., []byte) - dv.Set(reflect.ValueOf(append([]byte{}, sv.Bytes()...))) - default: // Basic type (e.g., string) - dv.Set(sv) - } - } - } - } - default: - panic(fmt.Sprintf("merger not found for type:%s", tf)) - } - mi.fields = append(mi.fields, mfi) - } - - mi.unrecognized = invalidField - if f, ok := t.FieldByName("XXX_unrecognized"); ok { - if f.Type != reflect.TypeOf([]byte{}) { - panic("expected XXX_unrecognized to be of type []byte") - } - mi.unrecognized = toField(&f) - } - - atomic.StoreInt32(&mi.initialized, 1) -} diff --git a/vendor/github.com/gogo/protobuf/proto/table_unmarshal.go b/vendor/github.com/gogo/protobuf/proto/table_unmarshal.go deleted file mode 100644 index 937229386..000000000 --- a/vendor/github.com/gogo/protobuf/proto/table_unmarshal.go +++ /dev/null @@ -1,2249 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2016 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -import ( - "errors" - "fmt" - "io" - "math" - "reflect" - "strconv" - "strings" - "sync" - "sync/atomic" - "unicode/utf8" -) - -// Unmarshal is the entry point from the generated .pb.go files. -// This function is not intended to be used by non-generated code. -// This function is not subject to any compatibility guarantee. -// msg contains a pointer to a protocol buffer struct. -// b is the data to be unmarshaled into the protocol buffer. -// a is a pointer to a place to store cached unmarshal information. -func (a *InternalMessageInfo) Unmarshal(msg Message, b []byte) error { - // Load the unmarshal information for this message type. - // The atomic load ensures memory consistency. - u := atomicLoadUnmarshalInfo(&a.unmarshal) - if u == nil { - // Slow path: find unmarshal info for msg, update a with it. - u = getUnmarshalInfo(reflect.TypeOf(msg).Elem()) - atomicStoreUnmarshalInfo(&a.unmarshal, u) - } - // Then do the unmarshaling. - err := u.unmarshal(toPointer(&msg), b) - return err -} - -type unmarshalInfo struct { - typ reflect.Type // type of the protobuf struct - - // 0 = only typ field is initialized - // 1 = completely initialized - initialized int32 - lock sync.Mutex // prevents double initialization - dense []unmarshalFieldInfo // fields indexed by tag # - sparse map[uint64]unmarshalFieldInfo // fields indexed by tag # - reqFields []string // names of required fields - reqMask uint64 // 1< 0 { - // Read tag and wire type. - // Special case 1 and 2 byte varints. - var x uint64 - if b[0] < 128 { - x = uint64(b[0]) - b = b[1:] - } else if len(b) >= 2 && b[1] < 128 { - x = uint64(b[0]&0x7f) + uint64(b[1])<<7 - b = b[2:] - } else { - var n int - x, n = decodeVarint(b) - if n == 0 { - return io.ErrUnexpectedEOF - } - b = b[n:] - } - tag := x >> 3 - wire := int(x) & 7 - - // Dispatch on the tag to one of the unmarshal* functions below. - var f unmarshalFieldInfo - if tag < uint64(len(u.dense)) { - f = u.dense[tag] - } else { - f = u.sparse[tag] - } - if fn := f.unmarshal; fn != nil { - var err error - b, err = fn(b, m.offset(f.field), wire) - if err == nil { - reqMask |= f.reqMask - continue - } - if r, ok := err.(*RequiredNotSetError); ok { - // Remember this error, but keep parsing. We need to produce - // a full parse even if a required field is missing. - if errLater == nil { - errLater = r - } - reqMask |= f.reqMask - continue - } - if err != errInternalBadWireType { - if err == errInvalidUTF8 { - if errLater == nil { - fullName := revProtoTypes[reflect.PtrTo(u.typ)] + "." + f.name - errLater = &invalidUTF8Error{fullName} - } - continue - } - return err - } - // Fragments with bad wire type are treated as unknown fields. - } - - // Unknown tag. - if !u.unrecognized.IsValid() { - // Don't keep unrecognized data; just skip it. - var err error - b, err = skipField(b, wire) - if err != nil { - return err - } - continue - } - // Keep unrecognized data around. - // maybe in extensions, maybe in the unrecognized field. - z := m.offset(u.unrecognized).toBytes() - var emap map[int32]Extension - var e Extension - for _, r := range u.extensionRanges { - if uint64(r.Start) <= tag && tag <= uint64(r.End) { - if u.extensions.IsValid() { - mp := m.offset(u.extensions).toExtensions() - emap = mp.extensionsWrite() - e = emap[int32(tag)] - z = &e.enc - break - } - if u.oldExtensions.IsValid() { - p := m.offset(u.oldExtensions).toOldExtensions() - emap = *p - if emap == nil { - emap = map[int32]Extension{} - *p = emap - } - e = emap[int32(tag)] - z = &e.enc - break - } - if u.bytesExtensions.IsValid() { - z = m.offset(u.bytesExtensions).toBytes() - break - } - panic("no extensions field available") - } - } - // Use wire type to skip data. - var err error - b0 := b - b, err = skipField(b, wire) - if err != nil { - return err - } - *z = encodeVarint(*z, tag<<3|uint64(wire)) - *z = append(*z, b0[:len(b0)-len(b)]...) - - if emap != nil { - emap[int32(tag)] = e - } - } - if reqMask != u.reqMask && errLater == nil { - // A required field of this message is missing. - for _, n := range u.reqFields { - if reqMask&1 == 0 { - errLater = &RequiredNotSetError{n} - } - reqMask >>= 1 - } - } - return errLater -} - -// computeUnmarshalInfo fills in u with information for use -// in unmarshaling protocol buffers of type u.typ. -func (u *unmarshalInfo) computeUnmarshalInfo() { - u.lock.Lock() - defer u.lock.Unlock() - if u.initialized != 0 { - return - } - t := u.typ - n := t.NumField() - - // Set up the "not found" value for the unrecognized byte buffer. - // This is the default for proto3. - u.unrecognized = invalidField - u.extensions = invalidField - u.oldExtensions = invalidField - u.bytesExtensions = invalidField - - // List of the generated type and offset for each oneof field. - type oneofField struct { - ityp reflect.Type // interface type of oneof field - field field // offset in containing message - } - var oneofFields []oneofField - - for i := 0; i < n; i++ { - f := t.Field(i) - if f.Name == "XXX_unrecognized" { - // The byte slice used to hold unrecognized input is special. - if f.Type != reflect.TypeOf(([]byte)(nil)) { - panic("bad type for XXX_unrecognized field: " + f.Type.Name()) - } - u.unrecognized = toField(&f) - continue - } - if f.Name == "XXX_InternalExtensions" { - // Ditto here. - if f.Type != reflect.TypeOf(XXX_InternalExtensions{}) { - panic("bad type for XXX_InternalExtensions field: " + f.Type.Name()) - } - u.extensions = toField(&f) - if f.Tag.Get("protobuf_messageset") == "1" { - u.isMessageSet = true - } - continue - } - if f.Name == "XXX_extensions" { - // An older form of the extensions field. - if f.Type == reflect.TypeOf((map[int32]Extension)(nil)) { - u.oldExtensions = toField(&f) - continue - } else if f.Type == reflect.TypeOf(([]byte)(nil)) { - u.bytesExtensions = toField(&f) - continue - } - panic("bad type for XXX_extensions field: " + f.Type.Name()) - } - if f.Name == "XXX_NoUnkeyedLiteral" || f.Name == "XXX_sizecache" { - continue - } - - oneof := f.Tag.Get("protobuf_oneof") - if oneof != "" { - oneofFields = append(oneofFields, oneofField{f.Type, toField(&f)}) - // The rest of oneof processing happens below. - continue - } - - tags := f.Tag.Get("protobuf") - tagArray := strings.Split(tags, ",") - if len(tagArray) < 2 { - panic("protobuf tag not enough fields in " + t.Name() + "." + f.Name + ": " + tags) - } - tag, err := strconv.Atoi(tagArray[1]) - if err != nil { - panic("protobuf tag field not an integer: " + tagArray[1]) - } - - name := "" - for _, tag := range tagArray[3:] { - if strings.HasPrefix(tag, "name=") { - name = tag[5:] - } - } - - // Extract unmarshaling function from the field (its type and tags). - unmarshal := fieldUnmarshaler(&f) - - // Required field? - var reqMask uint64 - if tagArray[2] == "req" { - bit := len(u.reqFields) - u.reqFields = append(u.reqFields, name) - reqMask = uint64(1) << uint(bit) - // TODO: if we have more than 64 required fields, we end up - // not verifying that all required fields are present. - // Fix this, perhaps using a count of required fields? - } - - // Store the info in the correct slot in the message. - u.setTag(tag, toField(&f), unmarshal, reqMask, name) - } - - // Find any types associated with oneof fields. - // gogo: len(oneofFields) > 0 is needed for embedded oneof messages, without a marshaler and unmarshaler - if len(oneofFields) > 0 { - var oneofImplementers []interface{} - switch m := reflect.Zero(reflect.PtrTo(t)).Interface().(type) { - case oneofFuncsIface: - _, _, _, oneofImplementers = m.XXX_OneofFuncs() - case oneofWrappersIface: - oneofImplementers = m.XXX_OneofWrappers() - } - for _, v := range oneofImplementers { - tptr := reflect.TypeOf(v) // *Msg_X - typ := tptr.Elem() // Msg_X - - f := typ.Field(0) // oneof implementers have one field - baseUnmarshal := fieldUnmarshaler(&f) - tags := strings.Split(f.Tag.Get("protobuf"), ",") - fieldNum, err := strconv.Atoi(tags[1]) - if err != nil { - panic("protobuf tag field not an integer: " + tags[1]) - } - var name string - for _, tag := range tags { - if strings.HasPrefix(tag, "name=") { - name = strings.TrimPrefix(tag, "name=") - break - } - } - - // Find the oneof field that this struct implements. - // Might take O(n^2) to process all of the oneofs, but who cares. - for _, of := range oneofFields { - if tptr.Implements(of.ityp) { - // We have found the corresponding interface for this struct. - // That lets us know where this struct should be stored - // when we encounter it during unmarshaling. - unmarshal := makeUnmarshalOneof(typ, of.ityp, baseUnmarshal) - u.setTag(fieldNum, of.field, unmarshal, 0, name) - } - } - - } - } - - // Get extension ranges, if any. - fn := reflect.Zero(reflect.PtrTo(t)).MethodByName("ExtensionRangeArray") - if fn.IsValid() { - if !u.extensions.IsValid() && !u.oldExtensions.IsValid() && !u.bytesExtensions.IsValid() { - panic("a message with extensions, but no extensions field in " + t.Name()) - } - u.extensionRanges = fn.Call(nil)[0].Interface().([]ExtensionRange) - } - - // Explicitly disallow tag 0. This will ensure we flag an error - // when decoding a buffer of all zeros. Without this code, we - // would decode and skip an all-zero buffer of even length. - // [0 0] is [tag=0/wiretype=varint varint-encoded-0]. - u.setTag(0, zeroField, func(b []byte, f pointer, w int) ([]byte, error) { - return nil, fmt.Errorf("proto: %s: illegal tag 0 (wire type %d)", t, w) - }, 0, "") - - // Set mask for required field check. - u.reqMask = uint64(1)<= 0 && (tag < 16 || tag < 2*n) { // TODO: what are the right numbers here? - for len(u.dense) <= tag { - u.dense = append(u.dense, unmarshalFieldInfo{}) - } - u.dense[tag] = i - return - } - if u.sparse == nil { - u.sparse = map[uint64]unmarshalFieldInfo{} - } - u.sparse[uint64(tag)] = i -} - -// fieldUnmarshaler returns an unmarshaler for the given field. -func fieldUnmarshaler(f *reflect.StructField) unmarshaler { - if f.Type.Kind() == reflect.Map { - return makeUnmarshalMap(f) - } - return typeUnmarshaler(f.Type, f.Tag.Get("protobuf")) -} - -// typeUnmarshaler returns an unmarshaler for the given field type / field tag pair. -func typeUnmarshaler(t reflect.Type, tags string) unmarshaler { - tagArray := strings.Split(tags, ",") - encoding := tagArray[0] - name := "unknown" - ctype := false - isTime := false - isDuration := false - isWktPointer := false - proto3 := false - validateUTF8 := true - for _, tag := range tagArray[3:] { - if strings.HasPrefix(tag, "name=") { - name = tag[5:] - } - if tag == "proto3" { - proto3 = true - } - if strings.HasPrefix(tag, "customtype=") { - ctype = true - } - if tag == "stdtime" { - isTime = true - } - if tag == "stdduration" { - isDuration = true - } - if tag == "wktptr" { - isWktPointer = true - } - } - validateUTF8 = validateUTF8 && proto3 - - // Figure out packaging (pointer, slice, or both) - slice := false - pointer := false - if t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8 { - slice = true - t = t.Elem() - } - if t.Kind() == reflect.Ptr { - pointer = true - t = t.Elem() - } - - if ctype { - if reflect.PtrTo(t).Implements(customType) { - if slice { - return makeUnmarshalCustomSlice(getUnmarshalInfo(t), name) - } - if pointer { - return makeUnmarshalCustomPtr(getUnmarshalInfo(t), name) - } - return makeUnmarshalCustom(getUnmarshalInfo(t), name) - } else { - panic(fmt.Sprintf("custom type: type: %v, does not implement the proto.custom interface", t)) - } - } - - if isTime { - if pointer { - if slice { - return makeUnmarshalTimePtrSlice(getUnmarshalInfo(t), name) - } - return makeUnmarshalTimePtr(getUnmarshalInfo(t), name) - } - if slice { - return makeUnmarshalTimeSlice(getUnmarshalInfo(t), name) - } - return makeUnmarshalTime(getUnmarshalInfo(t), name) - } - - if isDuration { - if pointer { - if slice { - return makeUnmarshalDurationPtrSlice(getUnmarshalInfo(t), name) - } - return makeUnmarshalDurationPtr(getUnmarshalInfo(t), name) - } - if slice { - return makeUnmarshalDurationSlice(getUnmarshalInfo(t), name) - } - return makeUnmarshalDuration(getUnmarshalInfo(t), name) - } - - if isWktPointer { - switch t.Kind() { - case reflect.Float64: - if pointer { - if slice { - return makeStdDoubleValuePtrSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdDoubleValuePtrUnmarshaler(getUnmarshalInfo(t), name) - } - if slice { - return makeStdDoubleValueSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdDoubleValueUnmarshaler(getUnmarshalInfo(t), name) - case reflect.Float32: - if pointer { - if slice { - return makeStdFloatValuePtrSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdFloatValuePtrUnmarshaler(getUnmarshalInfo(t), name) - } - if slice { - return makeStdFloatValueSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdFloatValueUnmarshaler(getUnmarshalInfo(t), name) - case reflect.Int64: - if pointer { - if slice { - return makeStdInt64ValuePtrSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdInt64ValuePtrUnmarshaler(getUnmarshalInfo(t), name) - } - if slice { - return makeStdInt64ValueSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdInt64ValueUnmarshaler(getUnmarshalInfo(t), name) - case reflect.Uint64: - if pointer { - if slice { - return makeStdUInt64ValuePtrSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdUInt64ValuePtrUnmarshaler(getUnmarshalInfo(t), name) - } - if slice { - return makeStdUInt64ValueSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdUInt64ValueUnmarshaler(getUnmarshalInfo(t), name) - case reflect.Int32: - if pointer { - if slice { - return makeStdInt32ValuePtrSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdInt32ValuePtrUnmarshaler(getUnmarshalInfo(t), name) - } - if slice { - return makeStdInt32ValueSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdInt32ValueUnmarshaler(getUnmarshalInfo(t), name) - case reflect.Uint32: - if pointer { - if slice { - return makeStdUInt32ValuePtrSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdUInt32ValuePtrUnmarshaler(getUnmarshalInfo(t), name) - } - if slice { - return makeStdUInt32ValueSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdUInt32ValueUnmarshaler(getUnmarshalInfo(t), name) - case reflect.Bool: - if pointer { - if slice { - return makeStdBoolValuePtrSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdBoolValuePtrUnmarshaler(getUnmarshalInfo(t), name) - } - if slice { - return makeStdBoolValueSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdBoolValueUnmarshaler(getUnmarshalInfo(t), name) - case reflect.String: - if pointer { - if slice { - return makeStdStringValuePtrSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdStringValuePtrUnmarshaler(getUnmarshalInfo(t), name) - } - if slice { - return makeStdStringValueSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdStringValueUnmarshaler(getUnmarshalInfo(t), name) - case uint8SliceType: - if pointer { - if slice { - return makeStdBytesValuePtrSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdBytesValuePtrUnmarshaler(getUnmarshalInfo(t), name) - } - if slice { - return makeStdBytesValueSliceUnmarshaler(getUnmarshalInfo(t), name) - } - return makeStdBytesValueUnmarshaler(getUnmarshalInfo(t), name) - default: - panic(fmt.Sprintf("unknown wktpointer type %#v", t)) - } - } - - // We'll never have both pointer and slice for basic types. - if pointer && slice && t.Kind() != reflect.Struct { - panic("both pointer and slice for basic type in " + t.Name()) - } - - switch t.Kind() { - case reflect.Bool: - if pointer { - return unmarshalBoolPtr - } - if slice { - return unmarshalBoolSlice - } - return unmarshalBoolValue - case reflect.Int32: - switch encoding { - case "fixed32": - if pointer { - return unmarshalFixedS32Ptr - } - if slice { - return unmarshalFixedS32Slice - } - return unmarshalFixedS32Value - case "varint": - // this could be int32 or enum - if pointer { - return unmarshalInt32Ptr - } - if slice { - return unmarshalInt32Slice - } - return unmarshalInt32Value - case "zigzag32": - if pointer { - return unmarshalSint32Ptr - } - if slice { - return unmarshalSint32Slice - } - return unmarshalSint32Value - } - case reflect.Int64: - switch encoding { - case "fixed64": - if pointer { - return unmarshalFixedS64Ptr - } - if slice { - return unmarshalFixedS64Slice - } - return unmarshalFixedS64Value - case "varint": - if pointer { - return unmarshalInt64Ptr - } - if slice { - return unmarshalInt64Slice - } - return unmarshalInt64Value - case "zigzag64": - if pointer { - return unmarshalSint64Ptr - } - if slice { - return unmarshalSint64Slice - } - return unmarshalSint64Value - } - case reflect.Uint32: - switch encoding { - case "fixed32": - if pointer { - return unmarshalFixed32Ptr - } - if slice { - return unmarshalFixed32Slice - } - return unmarshalFixed32Value - case "varint": - if pointer { - return unmarshalUint32Ptr - } - if slice { - return unmarshalUint32Slice - } - return unmarshalUint32Value - } - case reflect.Uint64: - switch encoding { - case "fixed64": - if pointer { - return unmarshalFixed64Ptr - } - if slice { - return unmarshalFixed64Slice - } - return unmarshalFixed64Value - case "varint": - if pointer { - return unmarshalUint64Ptr - } - if slice { - return unmarshalUint64Slice - } - return unmarshalUint64Value - } - case reflect.Float32: - if pointer { - return unmarshalFloat32Ptr - } - if slice { - return unmarshalFloat32Slice - } - return unmarshalFloat32Value - case reflect.Float64: - if pointer { - return unmarshalFloat64Ptr - } - if slice { - return unmarshalFloat64Slice - } - return unmarshalFloat64Value - case reflect.Map: - panic("map type in typeUnmarshaler in " + t.Name()) - case reflect.Slice: - if pointer { - panic("bad pointer in slice case in " + t.Name()) - } - if slice { - return unmarshalBytesSlice - } - return unmarshalBytesValue - case reflect.String: - if validateUTF8 { - if pointer { - return unmarshalUTF8StringPtr - } - if slice { - return unmarshalUTF8StringSlice - } - return unmarshalUTF8StringValue - } - if pointer { - return unmarshalStringPtr - } - if slice { - return unmarshalStringSlice - } - return unmarshalStringValue - case reflect.Struct: - // message or group field - if !pointer { - switch encoding { - case "bytes": - if slice { - return makeUnmarshalMessageSlice(getUnmarshalInfo(t), name) - } - return makeUnmarshalMessage(getUnmarshalInfo(t), name) - } - } - switch encoding { - case "bytes": - if slice { - return makeUnmarshalMessageSlicePtr(getUnmarshalInfo(t), name) - } - return makeUnmarshalMessagePtr(getUnmarshalInfo(t), name) - case "group": - if slice { - return makeUnmarshalGroupSlicePtr(getUnmarshalInfo(t), name) - } - return makeUnmarshalGroupPtr(getUnmarshalInfo(t), name) - } - } - panic(fmt.Sprintf("unmarshaler not found type:%s encoding:%s", t, encoding)) -} - -// Below are all the unmarshalers for individual fields of various types. - -func unmarshalInt64Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int64(x) - *f.toInt64() = v - return b, nil -} - -func unmarshalInt64Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int64(x) - *f.toInt64Ptr() = &v - return b, nil -} - -func unmarshalInt64Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - x, n = decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int64(x) - s := f.toInt64Slice() - *s = append(*s, v) - } - return res, nil - } - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int64(x) - s := f.toInt64Slice() - *s = append(*s, v) - return b, nil -} - -func unmarshalSint64Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int64(x>>1) ^ int64(x)<<63>>63 - *f.toInt64() = v - return b, nil -} - -func unmarshalSint64Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int64(x>>1) ^ int64(x)<<63>>63 - *f.toInt64Ptr() = &v - return b, nil -} - -func unmarshalSint64Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - x, n = decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int64(x>>1) ^ int64(x)<<63>>63 - s := f.toInt64Slice() - *s = append(*s, v) - } - return res, nil - } - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int64(x>>1) ^ int64(x)<<63>>63 - s := f.toInt64Slice() - *s = append(*s, v) - return b, nil -} - -func unmarshalUint64Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := uint64(x) - *f.toUint64() = v - return b, nil -} - -func unmarshalUint64Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := uint64(x) - *f.toUint64Ptr() = &v - return b, nil -} - -func unmarshalUint64Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - x, n = decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := uint64(x) - s := f.toUint64Slice() - *s = append(*s, v) - } - return res, nil - } - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := uint64(x) - s := f.toUint64Slice() - *s = append(*s, v) - return b, nil -} - -func unmarshalInt32Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int32(x) - *f.toInt32() = v - return b, nil -} - -func unmarshalInt32Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int32(x) - f.setInt32Ptr(v) - return b, nil -} - -func unmarshalInt32Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - x, n = decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int32(x) - f.appendInt32Slice(v) - } - return res, nil - } - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int32(x) - f.appendInt32Slice(v) - return b, nil -} - -func unmarshalSint32Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int32(x>>1) ^ int32(x)<<31>>31 - *f.toInt32() = v - return b, nil -} - -func unmarshalSint32Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int32(x>>1) ^ int32(x)<<31>>31 - f.setInt32Ptr(v) - return b, nil -} - -func unmarshalSint32Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - x, n = decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int32(x>>1) ^ int32(x)<<31>>31 - f.appendInt32Slice(v) - } - return res, nil - } - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int32(x>>1) ^ int32(x)<<31>>31 - f.appendInt32Slice(v) - return b, nil -} - -func unmarshalUint32Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := uint32(x) - *f.toUint32() = v - return b, nil -} - -func unmarshalUint32Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := uint32(x) - *f.toUint32Ptr() = &v - return b, nil -} - -func unmarshalUint32Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - x, n = decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := uint32(x) - s := f.toUint32Slice() - *s = append(*s, v) - } - return res, nil - } - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := uint32(x) - s := f.toUint32Slice() - *s = append(*s, v) - return b, nil -} - -func unmarshalFixed64Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed64 { - return b, errInternalBadWireType - } - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 - *f.toUint64() = v - return b[8:], nil -} - -func unmarshalFixed64Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed64 { - return b, errInternalBadWireType - } - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 - *f.toUint64Ptr() = &v - return b[8:], nil -} - -func unmarshalFixed64Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 - s := f.toUint64Slice() - *s = append(*s, v) - b = b[8:] - } - return res, nil - } - if w != WireFixed64 { - return b, errInternalBadWireType - } - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 - s := f.toUint64Slice() - *s = append(*s, v) - return b[8:], nil -} - -func unmarshalFixedS64Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed64 { - return b, errInternalBadWireType - } - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := int64(b[0]) | int64(b[1])<<8 | int64(b[2])<<16 | int64(b[3])<<24 | int64(b[4])<<32 | int64(b[5])<<40 | int64(b[6])<<48 | int64(b[7])<<56 - *f.toInt64() = v - return b[8:], nil -} - -func unmarshalFixedS64Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed64 { - return b, errInternalBadWireType - } - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := int64(b[0]) | int64(b[1])<<8 | int64(b[2])<<16 | int64(b[3])<<24 | int64(b[4])<<32 | int64(b[5])<<40 | int64(b[6])<<48 | int64(b[7])<<56 - *f.toInt64Ptr() = &v - return b[8:], nil -} - -func unmarshalFixedS64Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := int64(b[0]) | int64(b[1])<<8 | int64(b[2])<<16 | int64(b[3])<<24 | int64(b[4])<<32 | int64(b[5])<<40 | int64(b[6])<<48 | int64(b[7])<<56 - s := f.toInt64Slice() - *s = append(*s, v) - b = b[8:] - } - return res, nil - } - if w != WireFixed64 { - return b, errInternalBadWireType - } - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := int64(b[0]) | int64(b[1])<<8 | int64(b[2])<<16 | int64(b[3])<<24 | int64(b[4])<<32 | int64(b[5])<<40 | int64(b[6])<<48 | int64(b[7])<<56 - s := f.toInt64Slice() - *s = append(*s, v) - return b[8:], nil -} - -func unmarshalFixed32Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed32 { - return b, errInternalBadWireType - } - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 - *f.toUint32() = v - return b[4:], nil -} - -func unmarshalFixed32Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed32 { - return b, errInternalBadWireType - } - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 - *f.toUint32Ptr() = &v - return b[4:], nil -} - -func unmarshalFixed32Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 - s := f.toUint32Slice() - *s = append(*s, v) - b = b[4:] - } - return res, nil - } - if w != WireFixed32 { - return b, errInternalBadWireType - } - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 - s := f.toUint32Slice() - *s = append(*s, v) - return b[4:], nil -} - -func unmarshalFixedS32Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed32 { - return b, errInternalBadWireType - } - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := int32(b[0]) | int32(b[1])<<8 | int32(b[2])<<16 | int32(b[3])<<24 - *f.toInt32() = v - return b[4:], nil -} - -func unmarshalFixedS32Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed32 { - return b, errInternalBadWireType - } - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := int32(b[0]) | int32(b[1])<<8 | int32(b[2])<<16 | int32(b[3])<<24 - f.setInt32Ptr(v) - return b[4:], nil -} - -func unmarshalFixedS32Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := int32(b[0]) | int32(b[1])<<8 | int32(b[2])<<16 | int32(b[3])<<24 - f.appendInt32Slice(v) - b = b[4:] - } - return res, nil - } - if w != WireFixed32 { - return b, errInternalBadWireType - } - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := int32(b[0]) | int32(b[1])<<8 | int32(b[2])<<16 | int32(b[3])<<24 - f.appendInt32Slice(v) - return b[4:], nil -} - -func unmarshalBoolValue(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - // Note: any length varint is allowed, even though any sane - // encoder will use one byte. - // See https://github.com/golang/protobuf/issues/76 - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - // TODO: check if x>1? Tests seem to indicate no. - v := x != 0 - *f.toBool() = v - return b[n:], nil -} - -func unmarshalBoolPtr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - v := x != 0 - *f.toBoolPtr() = &v - return b[n:], nil -} - -func unmarshalBoolSlice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - x, n = decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - v := x != 0 - s := f.toBoolSlice() - *s = append(*s, v) - b = b[n:] - } - return res, nil - } - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - v := x != 0 - s := f.toBoolSlice() - *s = append(*s, v) - return b[n:], nil -} - -func unmarshalFloat64Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed64 { - return b, errInternalBadWireType - } - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := math.Float64frombits(uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56) - *f.toFloat64() = v - return b[8:], nil -} - -func unmarshalFloat64Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed64 { - return b, errInternalBadWireType - } - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := math.Float64frombits(uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56) - *f.toFloat64Ptr() = &v - return b[8:], nil -} - -func unmarshalFloat64Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := math.Float64frombits(uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56) - s := f.toFloat64Slice() - *s = append(*s, v) - b = b[8:] - } - return res, nil - } - if w != WireFixed64 { - return b, errInternalBadWireType - } - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := math.Float64frombits(uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56) - s := f.toFloat64Slice() - *s = append(*s, v) - return b[8:], nil -} - -func unmarshalFloat32Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed32 { - return b, errInternalBadWireType - } - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := math.Float32frombits(uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24) - *f.toFloat32() = v - return b[4:], nil -} - -func unmarshalFloat32Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed32 { - return b, errInternalBadWireType - } - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := math.Float32frombits(uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24) - *f.toFloat32Ptr() = &v - return b[4:], nil -} - -func unmarshalFloat32Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := math.Float32frombits(uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24) - s := f.toFloat32Slice() - *s = append(*s, v) - b = b[4:] - } - return res, nil - } - if w != WireFixed32 { - return b, errInternalBadWireType - } - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := math.Float32frombits(uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24) - s := f.toFloat32Slice() - *s = append(*s, v) - return b[4:], nil -} - -func unmarshalStringValue(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - v := string(b[:x]) - *f.toString() = v - return b[x:], nil -} - -func unmarshalStringPtr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - v := string(b[:x]) - *f.toStringPtr() = &v - return b[x:], nil -} - -func unmarshalStringSlice(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - v := string(b[:x]) - s := f.toStringSlice() - *s = append(*s, v) - return b[x:], nil -} - -func unmarshalUTF8StringValue(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - v := string(b[:x]) - *f.toString() = v - if !utf8.ValidString(v) { - return b[x:], errInvalidUTF8 - } - return b[x:], nil -} - -func unmarshalUTF8StringPtr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - v := string(b[:x]) - *f.toStringPtr() = &v - if !utf8.ValidString(v) { - return b[x:], errInvalidUTF8 - } - return b[x:], nil -} - -func unmarshalUTF8StringSlice(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - v := string(b[:x]) - s := f.toStringSlice() - *s = append(*s, v) - if !utf8.ValidString(v) { - return b[x:], errInvalidUTF8 - } - return b[x:], nil -} - -var emptyBuf [0]byte - -func unmarshalBytesValue(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - // The use of append here is a trick which avoids the zeroing - // that would be required if we used a make/copy pair. - // We append to emptyBuf instead of nil because we want - // a non-nil result even when the length is 0. - v := append(emptyBuf[:], b[:x]...) - *f.toBytes() = v - return b[x:], nil -} - -func unmarshalBytesSlice(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - v := append(emptyBuf[:], b[:x]...) - s := f.toBytesSlice() - *s = append(*s, v) - return b[x:], nil -} - -func makeUnmarshalMessagePtr(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - // First read the message field to see if something is there. - // The semantics of multiple submessages are weird. Instead of - // the last one winning (as it is for all other fields), multiple - // submessages are merged. - v := f.getPointer() - if v.isNil() { - v = valToPointer(reflect.New(sub.typ)) - f.setPointer(v) - } - err := sub.unmarshal(v, b[:x]) - if err != nil { - if r, ok := err.(*RequiredNotSetError); ok { - r.field = name + "." + r.field - } else { - return nil, err - } - } - return b[x:], err - } -} - -func makeUnmarshalMessageSlicePtr(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - v := valToPointer(reflect.New(sub.typ)) - err := sub.unmarshal(v, b[:x]) - if err != nil { - if r, ok := err.(*RequiredNotSetError); ok { - r.field = name + "." + r.field - } else { - return nil, err - } - } - f.appendPointer(v) - return b[x:], err - } -} - -func makeUnmarshalGroupPtr(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireStartGroup { - return b, errInternalBadWireType - } - x, y := findEndGroup(b) - if x < 0 { - return nil, io.ErrUnexpectedEOF - } - v := f.getPointer() - if v.isNil() { - v = valToPointer(reflect.New(sub.typ)) - f.setPointer(v) - } - err := sub.unmarshal(v, b[:x]) - if err != nil { - if r, ok := err.(*RequiredNotSetError); ok { - r.field = name + "." + r.field - } else { - return nil, err - } - } - return b[y:], err - } -} - -func makeUnmarshalGroupSlicePtr(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireStartGroup { - return b, errInternalBadWireType - } - x, y := findEndGroup(b) - if x < 0 { - return nil, io.ErrUnexpectedEOF - } - v := valToPointer(reflect.New(sub.typ)) - err := sub.unmarshal(v, b[:x]) - if err != nil { - if r, ok := err.(*RequiredNotSetError); ok { - r.field = name + "." + r.field - } else { - return nil, err - } - } - f.appendPointer(v) - return b[y:], err - } -} - -func makeUnmarshalMap(f *reflect.StructField) unmarshaler { - t := f.Type - kt := t.Key() - vt := t.Elem() - tagArray := strings.Split(f.Tag.Get("protobuf"), ",") - valTags := strings.Split(f.Tag.Get("protobuf_val"), ",") - for _, t := range tagArray { - if strings.HasPrefix(t, "customtype=") { - valTags = append(valTags, t) - } - if t == "stdtime" { - valTags = append(valTags, t) - } - if t == "stdduration" { - valTags = append(valTags, t) - } - if t == "wktptr" { - valTags = append(valTags, t) - } - } - unmarshalKey := typeUnmarshaler(kt, f.Tag.Get("protobuf_key")) - unmarshalVal := typeUnmarshaler(vt, strings.Join(valTags, ",")) - return func(b []byte, f pointer, w int) ([]byte, error) { - // The map entry is a submessage. Figure out how big it is. - if w != WireBytes { - return nil, fmt.Errorf("proto: bad wiretype for map field: got %d want %d", w, WireBytes) - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - r := b[x:] // unused data to return - b = b[:x] // data for map entry - - // Note: we could use #keys * #values ~= 200 functions - // to do map decoding without reflection. Probably not worth it. - // Maps will be somewhat slow. Oh well. - - // Read key and value from data. - var nerr nonFatal - k := reflect.New(kt) - v := reflect.New(vt) - for len(b) > 0 { - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - wire := int(x) & 7 - b = b[n:] - - var err error - switch x >> 3 { - case 1: - b, err = unmarshalKey(b, valToPointer(k), wire) - case 2: - b, err = unmarshalVal(b, valToPointer(v), wire) - default: - err = errInternalBadWireType // skip unknown tag - } - - if nerr.Merge(err) { - continue - } - if err != errInternalBadWireType { - return nil, err - } - - // Skip past unknown fields. - b, err = skipField(b, wire) - if err != nil { - return nil, err - } - } - - // Get map, allocate if needed. - m := f.asPointerTo(t).Elem() // an addressable map[K]T - if m.IsNil() { - m.Set(reflect.MakeMap(t)) - } - - // Insert into map. - m.SetMapIndex(k.Elem(), v.Elem()) - - return r, nerr.E - } -} - -// makeUnmarshalOneof makes an unmarshaler for oneof fields. -// for: -// message Msg { -// oneof F { -// int64 X = 1; -// float64 Y = 2; -// } -// } -// typ is the type of the concrete entry for a oneof case (e.g. Msg_X). -// ityp is the interface type of the oneof field (e.g. isMsg_F). -// unmarshal is the unmarshaler for the base type of the oneof case (e.g. int64). -// Note that this function will be called once for each case in the oneof. -func makeUnmarshalOneof(typ, ityp reflect.Type, unmarshal unmarshaler) unmarshaler { - sf := typ.Field(0) - field0 := toField(&sf) - return func(b []byte, f pointer, w int) ([]byte, error) { - // Allocate holder for value. - v := reflect.New(typ) - - // Unmarshal data into holder. - // We unmarshal into the first field of the holder object. - var err error - var nerr nonFatal - b, err = unmarshal(b, valToPointer(v).offset(field0), w) - if !nerr.Merge(err) { - return nil, err - } - - // Write pointer to holder into target field. - f.asPointerTo(ityp).Elem().Set(v) - - return b, nerr.E - } -} - -// Error used by decode internally. -var errInternalBadWireType = errors.New("proto: internal error: bad wiretype") - -// skipField skips past a field of type wire and returns the remaining bytes. -func skipField(b []byte, wire int) ([]byte, error) { - switch wire { - case WireVarint: - _, k := decodeVarint(b) - if k == 0 { - return b, io.ErrUnexpectedEOF - } - b = b[k:] - case WireFixed32: - if len(b) < 4 { - return b, io.ErrUnexpectedEOF - } - b = b[4:] - case WireFixed64: - if len(b) < 8 { - return b, io.ErrUnexpectedEOF - } - b = b[8:] - case WireBytes: - m, k := decodeVarint(b) - if k == 0 || uint64(len(b)-k) < m { - return b, io.ErrUnexpectedEOF - } - b = b[uint64(k)+m:] - case WireStartGroup: - _, i := findEndGroup(b) - if i == -1 { - return b, io.ErrUnexpectedEOF - } - b = b[i:] - default: - return b, fmt.Errorf("proto: can't skip unknown wire type %d", wire) - } - return b, nil -} - -// findEndGroup finds the index of the next EndGroup tag. -// Groups may be nested, so the "next" EndGroup tag is the first -// unpaired EndGroup. -// findEndGroup returns the indexes of the start and end of the EndGroup tag. -// Returns (-1,-1) if it can't find one. -func findEndGroup(b []byte) (int, int) { - depth := 1 - i := 0 - for { - x, n := decodeVarint(b[i:]) - if n == 0 { - return -1, -1 - } - j := i - i += n - switch x & 7 { - case WireVarint: - _, k := decodeVarint(b[i:]) - if k == 0 { - return -1, -1 - } - i += k - case WireFixed32: - if len(b)-4 < i { - return -1, -1 - } - i += 4 - case WireFixed64: - if len(b)-8 < i { - return -1, -1 - } - i += 8 - case WireBytes: - m, k := decodeVarint(b[i:]) - if k == 0 { - return -1, -1 - } - i += k - if uint64(len(b)-i) < m { - return -1, -1 - } - i += int(m) - case WireStartGroup: - depth++ - case WireEndGroup: - depth-- - if depth == 0 { - return j, i - } - default: - return -1, -1 - } - } -} - -// encodeVarint appends a varint-encoded integer to b and returns the result. -func encodeVarint(b []byte, x uint64) []byte { - for x >= 1<<7 { - b = append(b, byte(x&0x7f|0x80)) - x >>= 7 - } - return append(b, byte(x)) -} - -// decodeVarint reads a varint-encoded integer from b. -// Returns the decoded integer and the number of bytes read. -// If there is an error, it returns 0,0. -func decodeVarint(b []byte) (uint64, int) { - var x, y uint64 - if len(b) == 0 { - goto bad - } - x = uint64(b[0]) - if x < 0x80 { - return x, 1 - } - x -= 0x80 - - if len(b) <= 1 { - goto bad - } - y = uint64(b[1]) - x += y << 7 - if y < 0x80 { - return x, 2 - } - x -= 0x80 << 7 - - if len(b) <= 2 { - goto bad - } - y = uint64(b[2]) - x += y << 14 - if y < 0x80 { - return x, 3 - } - x -= 0x80 << 14 - - if len(b) <= 3 { - goto bad - } - y = uint64(b[3]) - x += y << 21 - if y < 0x80 { - return x, 4 - } - x -= 0x80 << 21 - - if len(b) <= 4 { - goto bad - } - y = uint64(b[4]) - x += y << 28 - if y < 0x80 { - return x, 5 - } - x -= 0x80 << 28 - - if len(b) <= 5 { - goto bad - } - y = uint64(b[5]) - x += y << 35 - if y < 0x80 { - return x, 6 - } - x -= 0x80 << 35 - - if len(b) <= 6 { - goto bad - } - y = uint64(b[6]) - x += y << 42 - if y < 0x80 { - return x, 7 - } - x -= 0x80 << 42 - - if len(b) <= 7 { - goto bad - } - y = uint64(b[7]) - x += y << 49 - if y < 0x80 { - return x, 8 - } - x -= 0x80 << 49 - - if len(b) <= 8 { - goto bad - } - y = uint64(b[8]) - x += y << 56 - if y < 0x80 { - return x, 9 - } - x -= 0x80 << 56 - - if len(b) <= 9 { - goto bad - } - y = uint64(b[9]) - x += y << 63 - if y < 2 { - return x, 10 - } - -bad: - return 0, 0 -} diff --git a/vendor/github.com/gogo/protobuf/proto/table_unmarshal_gogo.go b/vendor/github.com/gogo/protobuf/proto/table_unmarshal_gogo.go deleted file mode 100644 index 00d6c7ad9..000000000 --- a/vendor/github.com/gogo/protobuf/proto/table_unmarshal_gogo.go +++ /dev/null @@ -1,385 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2018, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -import ( - "io" - "reflect" -) - -func makeUnmarshalMessage(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - // First read the message field to see if something is there. - // The semantics of multiple submessages are weird. Instead of - // the last one winning (as it is for all other fields), multiple - // submessages are merged. - v := f // gogo: changed from v := f.getPointer() - if v.isNil() { - v = valToPointer(reflect.New(sub.typ)) - f.setPointer(v) - } - err := sub.unmarshal(v, b[:x]) - if err != nil { - if r, ok := err.(*RequiredNotSetError); ok { - r.field = name + "." + r.field - } else { - return nil, err - } - } - return b[x:], err - } -} - -func makeUnmarshalMessageSlice(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - v := valToPointer(reflect.New(sub.typ)) - err := sub.unmarshal(v, b[:x]) - if err != nil { - if r, ok := err.(*RequiredNotSetError); ok { - r.field = name + "." + r.field - } else { - return nil, err - } - } - f.appendRef(v, sub.typ) // gogo: changed from f.appendPointer(v) - return b[x:], err - } -} - -func makeUnmarshalCustomPtr(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - - s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() - s.Set(reflect.New(sub.typ)) - m := s.Interface().(custom) - if err := m.Unmarshal(b[:x]); err != nil { - return nil, err - } - return b[x:], nil - } -} - -func makeUnmarshalCustomSlice(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := reflect.New(sub.typ) - c := m.Interface().(custom) - if err := c.Unmarshal(b[:x]); err != nil { - return nil, err - } - v := valToPointer(m) - f.appendRef(v, sub.typ) - return b[x:], nil - } -} - -func makeUnmarshalCustom(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - - m := f.asPointerTo(sub.typ).Interface().(custom) - if err := m.Unmarshal(b[:x]); err != nil { - return nil, err - } - return b[x:], nil - } -} - -func makeUnmarshalTime(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := ×tamp{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - t, err := timestampFromProto(m) - if err != nil { - return nil, err - } - s := f.asPointerTo(sub.typ).Elem() - s.Set(reflect.ValueOf(t)) - return b[x:], nil - } -} - -func makeUnmarshalTimePtr(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := ×tamp{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - t, err := timestampFromProto(m) - if err != nil { - return nil, err - } - s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() - s.Set(reflect.ValueOf(&t)) - return b[x:], nil - } -} - -func makeUnmarshalTimePtrSlice(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := ×tamp{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - t, err := timestampFromProto(m) - if err != nil { - return nil, err - } - slice := f.getSlice(reflect.PtrTo(sub.typ)) - newSlice := reflect.Append(slice, reflect.ValueOf(&t)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeUnmarshalTimeSlice(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := ×tamp{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - t, err := timestampFromProto(m) - if err != nil { - return nil, err - } - slice := f.getSlice(sub.typ) - newSlice := reflect.Append(slice, reflect.ValueOf(t)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeUnmarshalDurationPtr(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &duration{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - d, err := durationFromProto(m) - if err != nil { - return nil, err - } - s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() - s.Set(reflect.ValueOf(&d)) - return b[x:], nil - } -} - -func makeUnmarshalDuration(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &duration{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - d, err := durationFromProto(m) - if err != nil { - return nil, err - } - s := f.asPointerTo(sub.typ).Elem() - s.Set(reflect.ValueOf(d)) - return b[x:], nil - } -} - -func makeUnmarshalDurationPtrSlice(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &duration{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - d, err := durationFromProto(m) - if err != nil { - return nil, err - } - slice := f.getSlice(reflect.PtrTo(sub.typ)) - newSlice := reflect.Append(slice, reflect.ValueOf(&d)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeUnmarshalDurationSlice(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &duration{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - d, err := durationFromProto(m) - if err != nil { - return nil, err - } - slice := f.getSlice(sub.typ) - newSlice := reflect.Append(slice, reflect.ValueOf(d)) - slice.Set(newSlice) - return b[x:], nil - } -} diff --git a/vendor/github.com/gogo/protobuf/proto/text.go b/vendor/github.com/gogo/protobuf/proto/text.go deleted file mode 100644 index 87416afe9..000000000 --- a/vendor/github.com/gogo/protobuf/proto/text.go +++ /dev/null @@ -1,930 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -// Functions for writing the text protocol buffer format. - -import ( - "bufio" - "bytes" - "encoding" - "errors" - "fmt" - "io" - "log" - "math" - "reflect" - "sort" - "strings" - "sync" - "time" -) - -var ( - newline = []byte("\n") - spaces = []byte(" ") - endBraceNewline = []byte("}\n") - backslashN = []byte{'\\', 'n'} - backslashR = []byte{'\\', 'r'} - backslashT = []byte{'\\', 't'} - backslashDQ = []byte{'\\', '"'} - backslashBS = []byte{'\\', '\\'} - posInf = []byte("inf") - negInf = []byte("-inf") - nan = []byte("nan") -) - -type writer interface { - io.Writer - WriteByte(byte) error -} - -// textWriter is an io.Writer that tracks its indentation level. -type textWriter struct { - ind int - complete bool // if the current position is a complete line - compact bool // whether to write out as a one-liner - w writer -} - -func (w *textWriter) WriteString(s string) (n int, err error) { - if !strings.Contains(s, "\n") { - if !w.compact && w.complete { - w.writeIndent() - } - w.complete = false - return io.WriteString(w.w, s) - } - // WriteString is typically called without newlines, so this - // codepath and its copy are rare. We copy to avoid - // duplicating all of Write's logic here. - return w.Write([]byte(s)) -} - -func (w *textWriter) Write(p []byte) (n int, err error) { - newlines := bytes.Count(p, newline) - if newlines == 0 { - if !w.compact && w.complete { - w.writeIndent() - } - n, err = w.w.Write(p) - w.complete = false - return n, err - } - - frags := bytes.SplitN(p, newline, newlines+1) - if w.compact { - for i, frag := range frags { - if i > 0 { - if err := w.w.WriteByte(' '); err != nil { - return n, err - } - n++ - } - nn, err := w.w.Write(frag) - n += nn - if err != nil { - return n, err - } - } - return n, nil - } - - for i, frag := range frags { - if w.complete { - w.writeIndent() - } - nn, err := w.w.Write(frag) - n += nn - if err != nil { - return n, err - } - if i+1 < len(frags) { - if err := w.w.WriteByte('\n'); err != nil { - return n, err - } - n++ - } - } - w.complete = len(frags[len(frags)-1]) == 0 - return n, nil -} - -func (w *textWriter) WriteByte(c byte) error { - if w.compact && c == '\n' { - c = ' ' - } - if !w.compact && w.complete { - w.writeIndent() - } - err := w.w.WriteByte(c) - w.complete = c == '\n' - return err -} - -func (w *textWriter) indent() { w.ind++ } - -func (w *textWriter) unindent() { - if w.ind == 0 { - log.Print("proto: textWriter unindented too far") - return - } - w.ind-- -} - -func writeName(w *textWriter, props *Properties) error { - if _, err := w.WriteString(props.OrigName); err != nil { - return err - } - if props.Wire != "group" { - return w.WriteByte(':') - } - return nil -} - -func requiresQuotes(u string) bool { - // When type URL contains any characters except [0-9A-Za-z./\-]*, it must be quoted. - for _, ch := range u { - switch { - case ch == '.' || ch == '/' || ch == '_': - continue - case '0' <= ch && ch <= '9': - continue - case 'A' <= ch && ch <= 'Z': - continue - case 'a' <= ch && ch <= 'z': - continue - default: - return true - } - } - return false -} - -// isAny reports whether sv is a google.protobuf.Any message -func isAny(sv reflect.Value) bool { - type wkt interface { - XXX_WellKnownType() string - } - t, ok := sv.Addr().Interface().(wkt) - return ok && t.XXX_WellKnownType() == "Any" -} - -// writeProto3Any writes an expanded google.protobuf.Any message. -// -// It returns (false, nil) if sv value can't be unmarshaled (e.g. because -// required messages are not linked in). -// -// It returns (true, error) when sv was written in expanded format or an error -// was encountered. -func (tm *TextMarshaler) writeProto3Any(w *textWriter, sv reflect.Value) (bool, error) { - turl := sv.FieldByName("TypeUrl") - val := sv.FieldByName("Value") - if !turl.IsValid() || !val.IsValid() { - return true, errors.New("proto: invalid google.protobuf.Any message") - } - - b, ok := val.Interface().([]byte) - if !ok { - return true, errors.New("proto: invalid google.protobuf.Any message") - } - - parts := strings.Split(turl.String(), "/") - mt := MessageType(parts[len(parts)-1]) - if mt == nil { - return false, nil - } - m := reflect.New(mt.Elem()) - if err := Unmarshal(b, m.Interface().(Message)); err != nil { - return false, nil - } - w.Write([]byte("[")) - u := turl.String() - if requiresQuotes(u) { - writeString(w, u) - } else { - w.Write([]byte(u)) - } - if w.compact { - w.Write([]byte("]:<")) - } else { - w.Write([]byte("]: <\n")) - w.ind++ - } - if err := tm.writeStruct(w, m.Elem()); err != nil { - return true, err - } - if w.compact { - w.Write([]byte("> ")) - } else { - w.ind-- - w.Write([]byte(">\n")) - } - return true, nil -} - -func (tm *TextMarshaler) writeStruct(w *textWriter, sv reflect.Value) error { - if tm.ExpandAny && isAny(sv) { - if canExpand, err := tm.writeProto3Any(w, sv); canExpand { - return err - } - } - st := sv.Type() - sprops := GetProperties(st) - for i := 0; i < sv.NumField(); i++ { - fv := sv.Field(i) - props := sprops.Prop[i] - name := st.Field(i).Name - - if name == "XXX_NoUnkeyedLiteral" { - continue - } - - if strings.HasPrefix(name, "XXX_") { - // There are two XXX_ fields: - // XXX_unrecognized []byte - // XXX_extensions map[int32]proto.Extension - // The first is handled here; - // the second is handled at the bottom of this function. - if name == "XXX_unrecognized" && !fv.IsNil() { - if err := writeUnknownStruct(w, fv.Interface().([]byte)); err != nil { - return err - } - } - continue - } - if fv.Kind() == reflect.Ptr && fv.IsNil() { - // Field not filled in. This could be an optional field or - // a required field that wasn't filled in. Either way, there - // isn't anything we can show for it. - continue - } - if fv.Kind() == reflect.Slice && fv.IsNil() { - // Repeated field that is empty, or a bytes field that is unused. - continue - } - - if props.Repeated && fv.Kind() == reflect.Slice { - // Repeated field. - for j := 0; j < fv.Len(); j++ { - if err := writeName(w, props); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte(' '); err != nil { - return err - } - } - v := fv.Index(j) - if v.Kind() == reflect.Ptr && v.IsNil() { - // A nil message in a repeated field is not valid, - // but we can handle that more gracefully than panicking. - if _, err := w.Write([]byte("\n")); err != nil { - return err - } - continue - } - if len(props.Enum) > 0 { - if err := tm.writeEnum(w, v, props); err != nil { - return err - } - } else if err := tm.writeAny(w, v, props); err != nil { - return err - } - if err := w.WriteByte('\n'); err != nil { - return err - } - } - continue - } - if fv.Kind() == reflect.Map { - // Map fields are rendered as a repeated struct with key/value fields. - keys := fv.MapKeys() - sort.Sort(mapKeys(keys)) - for _, key := range keys { - val := fv.MapIndex(key) - if err := writeName(w, props); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte(' '); err != nil { - return err - } - } - // open struct - if err := w.WriteByte('<'); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte('\n'); err != nil { - return err - } - } - w.indent() - // key - if _, err := w.WriteString("key:"); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte(' '); err != nil { - return err - } - } - if err := tm.writeAny(w, key, props.MapKeyProp); err != nil { - return err - } - if err := w.WriteByte('\n'); err != nil { - return err - } - // nil values aren't legal, but we can avoid panicking because of them. - if val.Kind() != reflect.Ptr || !val.IsNil() { - // value - if _, err := w.WriteString("value:"); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte(' '); err != nil { - return err - } - } - if err := tm.writeAny(w, val, props.MapValProp); err != nil { - return err - } - if err := w.WriteByte('\n'); err != nil { - return err - } - } - // close struct - w.unindent() - if err := w.WriteByte('>'); err != nil { - return err - } - if err := w.WriteByte('\n'); err != nil { - return err - } - } - continue - } - if props.proto3 && fv.Kind() == reflect.Slice && fv.Len() == 0 { - // empty bytes field - continue - } - if props.proto3 && fv.Kind() != reflect.Ptr && fv.Kind() != reflect.Slice { - // proto3 non-repeated scalar field; skip if zero value - if isProto3Zero(fv) { - continue - } - } - - if fv.Kind() == reflect.Interface { - // Check if it is a oneof. - if st.Field(i).Tag.Get("protobuf_oneof") != "" { - // fv is nil, or holds a pointer to generated struct. - // That generated struct has exactly one field, - // which has a protobuf struct tag. - if fv.IsNil() { - continue - } - inner := fv.Elem().Elem() // interface -> *T -> T - tag := inner.Type().Field(0).Tag.Get("protobuf") - props = new(Properties) // Overwrite the outer props var, but not its pointee. - props.Parse(tag) - // Write the value in the oneof, not the oneof itself. - fv = inner.Field(0) - - // Special case to cope with malformed messages gracefully: - // If the value in the oneof is a nil pointer, don't panic - // in writeAny. - if fv.Kind() == reflect.Ptr && fv.IsNil() { - // Use errors.New so writeAny won't render quotes. - msg := errors.New("/* nil */") - fv = reflect.ValueOf(&msg).Elem() - } - } - } - - if err := writeName(w, props); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte(' '); err != nil { - return err - } - } - - if len(props.Enum) > 0 { - if err := tm.writeEnum(w, fv, props); err != nil { - return err - } - } else if err := tm.writeAny(w, fv, props); err != nil { - return err - } - - if err := w.WriteByte('\n'); err != nil { - return err - } - } - - // Extensions (the XXX_extensions field). - pv := sv - if pv.CanAddr() { - pv = sv.Addr() - } else { - pv = reflect.New(sv.Type()) - pv.Elem().Set(sv) - } - if _, err := extendable(pv.Interface()); err == nil { - if err := tm.writeExtensions(w, pv); err != nil { - return err - } - } - - return nil -} - -var textMarshalerType = reflect.TypeOf((*encoding.TextMarshaler)(nil)).Elem() - -// writeAny writes an arbitrary field. -func (tm *TextMarshaler) writeAny(w *textWriter, v reflect.Value, props *Properties) error { - v = reflect.Indirect(v) - - if props != nil { - if len(props.CustomType) > 0 { - custom, ok := v.Interface().(Marshaler) - if ok { - data, err := custom.Marshal() - if err != nil { - return err - } - if err := writeString(w, string(data)); err != nil { - return err - } - return nil - } - } else if len(props.CastType) > 0 { - if _, ok := v.Interface().(interface { - String() string - }); ok { - switch v.Kind() { - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, - reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: - _, err := fmt.Fprintf(w, "%d", v.Interface()) - return err - } - } - } else if props.StdTime { - t, ok := v.Interface().(time.Time) - if !ok { - return fmt.Errorf("stdtime is not time.Time, but %T", v.Interface()) - } - tproto, err := timestampProto(t) - if err != nil { - return err - } - propsCopy := *props // Make a copy so that this is goroutine-safe - propsCopy.StdTime = false - err = tm.writeAny(w, reflect.ValueOf(tproto), &propsCopy) - return err - } else if props.StdDuration { - d, ok := v.Interface().(time.Duration) - if !ok { - return fmt.Errorf("stdtime is not time.Duration, but %T", v.Interface()) - } - dproto := durationProto(d) - propsCopy := *props // Make a copy so that this is goroutine-safe - propsCopy.StdDuration = false - err := tm.writeAny(w, reflect.ValueOf(dproto), &propsCopy) - return err - } - } - - // Floats have special cases. - if v.Kind() == reflect.Float32 || v.Kind() == reflect.Float64 { - x := v.Float() - var b []byte - switch { - case math.IsInf(x, 1): - b = posInf - case math.IsInf(x, -1): - b = negInf - case math.IsNaN(x): - b = nan - } - if b != nil { - _, err := w.Write(b) - return err - } - // Other values are handled below. - } - - // We don't attempt to serialise every possible value type; only those - // that can occur in protocol buffers. - switch v.Kind() { - case reflect.Slice: - // Should only be a []byte; repeated fields are handled in writeStruct. - if err := writeString(w, string(v.Bytes())); err != nil { - return err - } - case reflect.String: - if err := writeString(w, v.String()); err != nil { - return err - } - case reflect.Struct: - // Required/optional group/message. - var bra, ket byte = '<', '>' - if props != nil && props.Wire == "group" { - bra, ket = '{', '}' - } - if err := w.WriteByte(bra); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte('\n'); err != nil { - return err - } - } - w.indent() - if v.CanAddr() { - // Calling v.Interface on a struct causes the reflect package to - // copy the entire struct. This is racy with the new Marshaler - // since we atomically update the XXX_sizecache. - // - // Thus, we retrieve a pointer to the struct if possible to avoid - // a race since v.Interface on the pointer doesn't copy the struct. - // - // If v is not addressable, then we are not worried about a race - // since it implies that the binary Marshaler cannot possibly be - // mutating this value. - v = v.Addr() - } - if v.Type().Implements(textMarshalerType) { - text, err := v.Interface().(encoding.TextMarshaler).MarshalText() - if err != nil { - return err - } - if _, err = w.Write(text); err != nil { - return err - } - } else { - if v.Kind() == reflect.Ptr { - v = v.Elem() - } - if err := tm.writeStruct(w, v); err != nil { - return err - } - } - w.unindent() - if err := w.WriteByte(ket); err != nil { - return err - } - default: - _, err := fmt.Fprint(w, v.Interface()) - return err - } - return nil -} - -// equivalent to C's isprint. -func isprint(c byte) bool { - return c >= 0x20 && c < 0x7f -} - -// writeString writes a string in the protocol buffer text format. -// It is similar to strconv.Quote except we don't use Go escape sequences, -// we treat the string as a byte sequence, and we use octal escapes. -// These differences are to maintain interoperability with the other -// languages' implementations of the text format. -func writeString(w *textWriter, s string) error { - // use WriteByte here to get any needed indent - if err := w.WriteByte('"'); err != nil { - return err - } - // Loop over the bytes, not the runes. - for i := 0; i < len(s); i++ { - var err error - // Divergence from C++: we don't escape apostrophes. - // There's no need to escape them, and the C++ parser - // copes with a naked apostrophe. - switch c := s[i]; c { - case '\n': - _, err = w.w.Write(backslashN) - case '\r': - _, err = w.w.Write(backslashR) - case '\t': - _, err = w.w.Write(backslashT) - case '"': - _, err = w.w.Write(backslashDQ) - case '\\': - _, err = w.w.Write(backslashBS) - default: - if isprint(c) { - err = w.w.WriteByte(c) - } else { - _, err = fmt.Fprintf(w.w, "\\%03o", c) - } - } - if err != nil { - return err - } - } - return w.WriteByte('"') -} - -func writeUnknownStruct(w *textWriter, data []byte) (err error) { - if !w.compact { - if _, err := fmt.Fprintf(w, "/* %d unknown bytes */\n", len(data)); err != nil { - return err - } - } - b := NewBuffer(data) - for b.index < len(b.buf) { - x, err := b.DecodeVarint() - if err != nil { - _, ferr := fmt.Fprintf(w, "/* %v */\n", err) - return ferr - } - wire, tag := x&7, x>>3 - if wire == WireEndGroup { - w.unindent() - if _, werr := w.Write(endBraceNewline); werr != nil { - return werr - } - continue - } - if _, ferr := fmt.Fprint(w, tag); ferr != nil { - return ferr - } - if wire != WireStartGroup { - if err = w.WriteByte(':'); err != nil { - return err - } - } - if !w.compact || wire == WireStartGroup { - if err = w.WriteByte(' '); err != nil { - return err - } - } - switch wire { - case WireBytes: - buf, e := b.DecodeRawBytes(false) - if e == nil { - _, err = fmt.Fprintf(w, "%q", buf) - } else { - _, err = fmt.Fprintf(w, "/* %v */", e) - } - case WireFixed32: - x, err = b.DecodeFixed32() - err = writeUnknownInt(w, x, err) - case WireFixed64: - x, err = b.DecodeFixed64() - err = writeUnknownInt(w, x, err) - case WireStartGroup: - err = w.WriteByte('{') - w.indent() - case WireVarint: - x, err = b.DecodeVarint() - err = writeUnknownInt(w, x, err) - default: - _, err = fmt.Fprintf(w, "/* unknown wire type %d */", wire) - } - if err != nil { - return err - } - if err := w.WriteByte('\n'); err != nil { - return err - } - } - return nil -} - -func writeUnknownInt(w *textWriter, x uint64, err error) error { - if err == nil { - _, err = fmt.Fprint(w, x) - } else { - _, err = fmt.Fprintf(w, "/* %v */", err) - } - return err -} - -type int32Slice []int32 - -func (s int32Slice) Len() int { return len(s) } -func (s int32Slice) Less(i, j int) bool { return s[i] < s[j] } -func (s int32Slice) Swap(i, j int) { s[i], s[j] = s[j], s[i] } - -// writeExtensions writes all the extensions in pv. -// pv is assumed to be a pointer to a protocol message struct that is extendable. -func (tm *TextMarshaler) writeExtensions(w *textWriter, pv reflect.Value) error { - emap := extensionMaps[pv.Type().Elem()] - e := pv.Interface().(Message) - - var m map[int32]Extension - var mu sync.Locker - if em, ok := e.(extensionsBytes); ok { - eb := em.GetExtensions() - var err error - m, err = BytesToExtensionsMap(*eb) - if err != nil { - return err - } - mu = notLocker{} - } else if _, ok := e.(extendableProto); ok { - ep, _ := extendable(e) - m, mu = ep.extensionsRead() - if m == nil { - return nil - } - } - - // Order the extensions by ID. - // This isn't strictly necessary, but it will give us - // canonical output, which will also make testing easier. - - mu.Lock() - ids := make([]int32, 0, len(m)) - for id := range m { - ids = append(ids, id) - } - sort.Sort(int32Slice(ids)) - mu.Unlock() - - for _, extNum := range ids { - ext := m[extNum] - var desc *ExtensionDesc - if emap != nil { - desc = emap[extNum] - } - if desc == nil { - // Unknown extension. - if err := writeUnknownStruct(w, ext.enc); err != nil { - return err - } - continue - } - - pb, err := GetExtension(e, desc) - if err != nil { - return fmt.Errorf("failed getting extension: %v", err) - } - - // Repeated extensions will appear as a slice. - if !desc.repeated() { - if err := tm.writeExtension(w, desc.Name, pb); err != nil { - return err - } - } else { - v := reflect.ValueOf(pb) - for i := 0; i < v.Len(); i++ { - if err := tm.writeExtension(w, desc.Name, v.Index(i).Interface()); err != nil { - return err - } - } - } - } - return nil -} - -func (tm *TextMarshaler) writeExtension(w *textWriter, name string, pb interface{}) error { - if _, err := fmt.Fprintf(w, "[%s]:", name); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte(' '); err != nil { - return err - } - } - if err := tm.writeAny(w, reflect.ValueOf(pb), nil); err != nil { - return err - } - if err := w.WriteByte('\n'); err != nil { - return err - } - return nil -} - -func (w *textWriter) writeIndent() { - if !w.complete { - return - } - remain := w.ind * 2 - for remain > 0 { - n := remain - if n > len(spaces) { - n = len(spaces) - } - w.w.Write(spaces[:n]) - remain -= n - } - w.complete = false -} - -// TextMarshaler is a configurable text format marshaler. -type TextMarshaler struct { - Compact bool // use compact text format (one line). - ExpandAny bool // expand google.protobuf.Any messages of known types -} - -// Marshal writes a given protocol buffer in text format. -// The only errors returned are from w. -func (tm *TextMarshaler) Marshal(w io.Writer, pb Message) error { - val := reflect.ValueOf(pb) - if pb == nil || val.IsNil() { - w.Write([]byte("")) - return nil - } - var bw *bufio.Writer - ww, ok := w.(writer) - if !ok { - bw = bufio.NewWriter(w) - ww = bw - } - aw := &textWriter{ - w: ww, - complete: true, - compact: tm.Compact, - } - - if etm, ok := pb.(encoding.TextMarshaler); ok { - text, err := etm.MarshalText() - if err != nil { - return err - } - if _, err = aw.Write(text); err != nil { - return err - } - if bw != nil { - return bw.Flush() - } - return nil - } - // Dereference the received pointer so we don't have outer < and >. - v := reflect.Indirect(val) - if err := tm.writeStruct(aw, v); err != nil { - return err - } - if bw != nil { - return bw.Flush() - } - return nil -} - -// Text is the same as Marshal, but returns the string directly. -func (tm *TextMarshaler) Text(pb Message) string { - var buf bytes.Buffer - tm.Marshal(&buf, pb) - return buf.String() -} - -var ( - defaultTextMarshaler = TextMarshaler{} - compactTextMarshaler = TextMarshaler{Compact: true} -) - -// TODO: consider removing some of the Marshal functions below. - -// MarshalText writes a given protocol buffer in text format. -// The only errors returned are from w. -func MarshalText(w io.Writer, pb Message) error { return defaultTextMarshaler.Marshal(w, pb) } - -// MarshalTextString is the same as MarshalText, but returns the string directly. -func MarshalTextString(pb Message) string { return defaultTextMarshaler.Text(pb) } - -// CompactText writes a given protocol buffer in compact text format (one line). -func CompactText(w io.Writer, pb Message) error { return compactTextMarshaler.Marshal(w, pb) } - -// CompactTextString is the same as CompactText, but returns the string directly. -func CompactTextString(pb Message) string { return compactTextMarshaler.Text(pb) } diff --git a/vendor/github.com/gogo/protobuf/proto/text_gogo.go b/vendor/github.com/gogo/protobuf/proto/text_gogo.go deleted file mode 100644 index 1d6c6aa0e..000000000 --- a/vendor/github.com/gogo/protobuf/proto/text_gogo.go +++ /dev/null @@ -1,57 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -import ( - "fmt" - "reflect" -) - -func (tm *TextMarshaler) writeEnum(w *textWriter, v reflect.Value, props *Properties) error { - m, ok := enumStringMaps[props.Enum] - if !ok { - if err := tm.writeAny(w, v, props); err != nil { - return err - } - } - key := int32(0) - if v.Kind() == reflect.Ptr { - key = int32(v.Elem().Int()) - } else { - key = int32(v.Int()) - } - s, ok := m[key] - if !ok { - if err := tm.writeAny(w, v, props); err != nil { - return err - } - } - _, err := fmt.Fprint(w, s) - return err -} diff --git a/vendor/github.com/gogo/protobuf/proto/text_parser.go b/vendor/github.com/gogo/protobuf/proto/text_parser.go deleted file mode 100644 index f85c0cc81..000000000 --- a/vendor/github.com/gogo/protobuf/proto/text_parser.go +++ /dev/null @@ -1,1018 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -// Functions for parsing the Text protocol buffer format. -// TODO: message sets. - -import ( - "encoding" - "errors" - "fmt" - "reflect" - "strconv" - "strings" - "time" - "unicode/utf8" -) - -// Error string emitted when deserializing Any and fields are already set -const anyRepeatedlyUnpacked = "Any message unpacked multiple times, or %q already set" - -type ParseError struct { - Message string - Line int // 1-based line number - Offset int // 0-based byte offset from start of input -} - -func (p *ParseError) Error() string { - if p.Line == 1 { - // show offset only for first line - return fmt.Sprintf("line 1.%d: %v", p.Offset, p.Message) - } - return fmt.Sprintf("line %d: %v", p.Line, p.Message) -} - -type token struct { - value string - err *ParseError - line int // line number - offset int // byte number from start of input, not start of line - unquoted string // the unquoted version of value, if it was a quoted string -} - -func (t *token) String() string { - if t.err == nil { - return fmt.Sprintf("%q (line=%d, offset=%d)", t.value, t.line, t.offset) - } - return fmt.Sprintf("parse error: %v", t.err) -} - -type textParser struct { - s string // remaining input - done bool // whether the parsing is finished (success or error) - backed bool // whether back() was called - offset, line int - cur token -} - -func newTextParser(s string) *textParser { - p := new(textParser) - p.s = s - p.line = 1 - p.cur.line = 1 - return p -} - -func (p *textParser) errorf(format string, a ...interface{}) *ParseError { - pe := &ParseError{fmt.Sprintf(format, a...), p.cur.line, p.cur.offset} - p.cur.err = pe - p.done = true - return pe -} - -// Numbers and identifiers are matched by [-+._A-Za-z0-9] -func isIdentOrNumberChar(c byte) bool { - switch { - case 'A' <= c && c <= 'Z', 'a' <= c && c <= 'z': - return true - case '0' <= c && c <= '9': - return true - } - switch c { - case '-', '+', '.', '_': - return true - } - return false -} - -func isWhitespace(c byte) bool { - switch c { - case ' ', '\t', '\n', '\r': - return true - } - return false -} - -func isQuote(c byte) bool { - switch c { - case '"', '\'': - return true - } - return false -} - -func (p *textParser) skipWhitespace() { - i := 0 - for i < len(p.s) && (isWhitespace(p.s[i]) || p.s[i] == '#') { - if p.s[i] == '#' { - // comment; skip to end of line or input - for i < len(p.s) && p.s[i] != '\n' { - i++ - } - if i == len(p.s) { - break - } - } - if p.s[i] == '\n' { - p.line++ - } - i++ - } - p.offset += i - p.s = p.s[i:len(p.s)] - if len(p.s) == 0 { - p.done = true - } -} - -func (p *textParser) advance() { - // Skip whitespace - p.skipWhitespace() - if p.done { - return - } - - // Start of non-whitespace - p.cur.err = nil - p.cur.offset, p.cur.line = p.offset, p.line - p.cur.unquoted = "" - switch p.s[0] { - case '<', '>', '{', '}', ':', '[', ']', ';', ',', '/': - // Single symbol - p.cur.value, p.s = p.s[0:1], p.s[1:len(p.s)] - case '"', '\'': - // Quoted string - i := 1 - for i < len(p.s) && p.s[i] != p.s[0] && p.s[i] != '\n' { - if p.s[i] == '\\' && i+1 < len(p.s) { - // skip escaped char - i++ - } - i++ - } - if i >= len(p.s) || p.s[i] != p.s[0] { - p.errorf("unmatched quote") - return - } - unq, err := unquoteC(p.s[1:i], rune(p.s[0])) - if err != nil { - p.errorf("invalid quoted string %s: %v", p.s[0:i+1], err) - return - } - p.cur.value, p.s = p.s[0:i+1], p.s[i+1:len(p.s)] - p.cur.unquoted = unq - default: - i := 0 - for i < len(p.s) && isIdentOrNumberChar(p.s[i]) { - i++ - } - if i == 0 { - p.errorf("unexpected byte %#x", p.s[0]) - return - } - p.cur.value, p.s = p.s[0:i], p.s[i:len(p.s)] - } - p.offset += len(p.cur.value) -} - -var ( - errBadUTF8 = errors.New("proto: bad UTF-8") -) - -func unquoteC(s string, quote rune) (string, error) { - // This is based on C++'s tokenizer.cc. - // Despite its name, this is *not* parsing C syntax. - // For instance, "\0" is an invalid quoted string. - - // Avoid allocation in trivial cases. - simple := true - for _, r := range s { - if r == '\\' || r == quote { - simple = false - break - } - } - if simple { - return s, nil - } - - buf := make([]byte, 0, 3*len(s)/2) - for len(s) > 0 { - r, n := utf8.DecodeRuneInString(s) - if r == utf8.RuneError && n == 1 { - return "", errBadUTF8 - } - s = s[n:] - if r != '\\' { - if r < utf8.RuneSelf { - buf = append(buf, byte(r)) - } else { - buf = append(buf, string(r)...) - } - continue - } - - ch, tail, err := unescape(s) - if err != nil { - return "", err - } - buf = append(buf, ch...) - s = tail - } - return string(buf), nil -} - -func unescape(s string) (ch string, tail string, err error) { - r, n := utf8.DecodeRuneInString(s) - if r == utf8.RuneError && n == 1 { - return "", "", errBadUTF8 - } - s = s[n:] - switch r { - case 'a': - return "\a", s, nil - case 'b': - return "\b", s, nil - case 'f': - return "\f", s, nil - case 'n': - return "\n", s, nil - case 'r': - return "\r", s, nil - case 't': - return "\t", s, nil - case 'v': - return "\v", s, nil - case '?': - return "?", s, nil // trigraph workaround - case '\'', '"', '\\': - return string(r), s, nil - case '0', '1', '2', '3', '4', '5', '6', '7': - if len(s) < 2 { - return "", "", fmt.Errorf(`\%c requires 2 following digits`, r) - } - ss := string(r) + s[:2] - s = s[2:] - i, err := strconv.ParseUint(ss, 8, 8) - if err != nil { - return "", "", fmt.Errorf(`\%s contains non-octal digits`, ss) - } - return string([]byte{byte(i)}), s, nil - case 'x', 'X', 'u', 'U': - var n int - switch r { - case 'x', 'X': - n = 2 - case 'u': - n = 4 - case 'U': - n = 8 - } - if len(s) < n { - return "", "", fmt.Errorf(`\%c requires %d following digits`, r, n) - } - ss := s[:n] - s = s[n:] - i, err := strconv.ParseUint(ss, 16, 64) - if err != nil { - return "", "", fmt.Errorf(`\%c%s contains non-hexadecimal digits`, r, ss) - } - if r == 'x' || r == 'X' { - return string([]byte{byte(i)}), s, nil - } - if i > utf8.MaxRune { - return "", "", fmt.Errorf(`\%c%s is not a valid Unicode code point`, r, ss) - } - return string(rune(i)), s, nil - } - return "", "", fmt.Errorf(`unknown escape \%c`, r) -} - -// Back off the parser by one token. Can only be done between calls to next(). -// It makes the next advance() a no-op. -func (p *textParser) back() { p.backed = true } - -// Advances the parser and returns the new current token. -func (p *textParser) next() *token { - if p.backed || p.done { - p.backed = false - return &p.cur - } - p.advance() - if p.done { - p.cur.value = "" - } else if len(p.cur.value) > 0 && isQuote(p.cur.value[0]) { - // Look for multiple quoted strings separated by whitespace, - // and concatenate them. - cat := p.cur - for { - p.skipWhitespace() - if p.done || !isQuote(p.s[0]) { - break - } - p.advance() - if p.cur.err != nil { - return &p.cur - } - cat.value += " " + p.cur.value - cat.unquoted += p.cur.unquoted - } - p.done = false // parser may have seen EOF, but we want to return cat - p.cur = cat - } - return &p.cur -} - -func (p *textParser) consumeToken(s string) error { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value != s { - p.back() - return p.errorf("expected %q, found %q", s, tok.value) - } - return nil -} - -// Return a RequiredNotSetError indicating which required field was not set. -func (p *textParser) missingRequiredFieldError(sv reflect.Value) *RequiredNotSetError { - st := sv.Type() - sprops := GetProperties(st) - for i := 0; i < st.NumField(); i++ { - if !isNil(sv.Field(i)) { - continue - } - - props := sprops.Prop[i] - if props.Required { - return &RequiredNotSetError{fmt.Sprintf("%v.%v", st, props.OrigName)} - } - } - return &RequiredNotSetError{fmt.Sprintf("%v.", st)} // should not happen -} - -// Returns the index in the struct for the named field, as well as the parsed tag properties. -func structFieldByName(sprops *StructProperties, name string) (int, *Properties, bool) { - i, ok := sprops.decoderOrigNames[name] - if ok { - return i, sprops.Prop[i], true - } - return -1, nil, false -} - -// Consume a ':' from the input stream (if the next token is a colon), -// returning an error if a colon is needed but not present. -func (p *textParser) checkForColon(props *Properties, typ reflect.Type) *ParseError { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value != ":" { - // Colon is optional when the field is a group or message. - needColon := true - switch props.Wire { - case "group": - needColon = false - case "bytes": - // A "bytes" field is either a message, a string, or a repeated field; - // those three become *T, *string and []T respectively, so we can check for - // this field being a pointer to a non-string. - if typ.Kind() == reflect.Ptr { - // *T or *string - if typ.Elem().Kind() == reflect.String { - break - } - } else if typ.Kind() == reflect.Slice { - // []T or []*T - if typ.Elem().Kind() != reflect.Ptr { - break - } - } else if typ.Kind() == reflect.String { - // The proto3 exception is for a string field, - // which requires a colon. - break - } - needColon = false - } - if needColon { - return p.errorf("expected ':', found %q", tok.value) - } - p.back() - } - return nil -} - -func (p *textParser) readStruct(sv reflect.Value, terminator string) error { - st := sv.Type() - sprops := GetProperties(st) - reqCount := sprops.reqCount - var reqFieldErr error - fieldSet := make(map[string]bool) - // A struct is a sequence of "name: value", terminated by one of - // '>' or '}', or the end of the input. A name may also be - // "[extension]" or "[type/url]". - // - // The whole struct can also be an expanded Any message, like: - // [type/url] < ... struct contents ... > - for { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value == terminator { - break - } - if tok.value == "[" { - // Looks like an extension or an Any. - // - // TODO: Check whether we need to handle - // namespace rooted names (e.g. ".something.Foo"). - extName, err := p.consumeExtName() - if err != nil { - return err - } - - if s := strings.LastIndex(extName, "/"); s >= 0 { - // If it contains a slash, it's an Any type URL. - messageName := extName[s+1:] - mt := MessageType(messageName) - if mt == nil { - return p.errorf("unrecognized message %q in google.protobuf.Any", messageName) - } - tok = p.next() - if tok.err != nil { - return tok.err - } - // consume an optional colon - if tok.value == ":" { - tok = p.next() - if tok.err != nil { - return tok.err - } - } - var terminator string - switch tok.value { - case "<": - terminator = ">" - case "{": - terminator = "}" - default: - return p.errorf("expected '{' or '<', found %q", tok.value) - } - v := reflect.New(mt.Elem()) - if pe := p.readStruct(v.Elem(), terminator); pe != nil { - return pe - } - b, err := Marshal(v.Interface().(Message)) - if err != nil { - return p.errorf("failed to marshal message of type %q: %v", messageName, err) - } - if fieldSet["type_url"] { - return p.errorf(anyRepeatedlyUnpacked, "type_url") - } - if fieldSet["value"] { - return p.errorf(anyRepeatedlyUnpacked, "value") - } - sv.FieldByName("TypeUrl").SetString(extName) - sv.FieldByName("Value").SetBytes(b) - fieldSet["type_url"] = true - fieldSet["value"] = true - continue - } - - var desc *ExtensionDesc - // This could be faster, but it's functional. - // TODO: Do something smarter than a linear scan. - for _, d := range RegisteredExtensions(reflect.New(st).Interface().(Message)) { - if d.Name == extName { - desc = d - break - } - } - if desc == nil { - return p.errorf("unrecognized extension %q", extName) - } - - props := &Properties{} - props.Parse(desc.Tag) - - typ := reflect.TypeOf(desc.ExtensionType) - if err := p.checkForColon(props, typ); err != nil { - return err - } - - rep := desc.repeated() - - // Read the extension structure, and set it in - // the value we're constructing. - var ext reflect.Value - if !rep { - ext = reflect.New(typ).Elem() - } else { - ext = reflect.New(typ.Elem()).Elem() - } - if err := p.readAny(ext, props); err != nil { - if _, ok := err.(*RequiredNotSetError); !ok { - return err - } - reqFieldErr = err - } - ep := sv.Addr().Interface().(Message) - if !rep { - SetExtension(ep, desc, ext.Interface()) - } else { - old, err := GetExtension(ep, desc) - var sl reflect.Value - if err == nil { - sl = reflect.ValueOf(old) // existing slice - } else { - sl = reflect.MakeSlice(typ, 0, 1) - } - sl = reflect.Append(sl, ext) - SetExtension(ep, desc, sl.Interface()) - } - if err := p.consumeOptionalSeparator(); err != nil { - return err - } - continue - } - - // This is a normal, non-extension field. - name := tok.value - var dst reflect.Value - fi, props, ok := structFieldByName(sprops, name) - if ok { - dst = sv.Field(fi) - } else if oop, ok := sprops.OneofTypes[name]; ok { - // It is a oneof. - props = oop.Prop - nv := reflect.New(oop.Type.Elem()) - dst = nv.Elem().Field(0) - field := sv.Field(oop.Field) - if !field.IsNil() { - return p.errorf("field '%s' would overwrite already parsed oneof '%s'", name, sv.Type().Field(oop.Field).Name) - } - field.Set(nv) - } - if !dst.IsValid() { - return p.errorf("unknown field name %q in %v", name, st) - } - - if dst.Kind() == reflect.Map { - // Consume any colon. - if err := p.checkForColon(props, dst.Type()); err != nil { - return err - } - - // Construct the map if it doesn't already exist. - if dst.IsNil() { - dst.Set(reflect.MakeMap(dst.Type())) - } - key := reflect.New(dst.Type().Key()).Elem() - val := reflect.New(dst.Type().Elem()).Elem() - - // The map entry should be this sequence of tokens: - // < key : KEY value : VALUE > - // However, implementations may omit key or value, and technically - // we should support them in any order. See b/28924776 for a time - // this went wrong. - - tok := p.next() - var terminator string - switch tok.value { - case "<": - terminator = ">" - case "{": - terminator = "}" - default: - return p.errorf("expected '{' or '<', found %q", tok.value) - } - for { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value == terminator { - break - } - switch tok.value { - case "key": - if err := p.consumeToken(":"); err != nil { - return err - } - if err := p.readAny(key, props.MapKeyProp); err != nil { - return err - } - if err := p.consumeOptionalSeparator(); err != nil { - return err - } - case "value": - if err := p.checkForColon(props.MapValProp, dst.Type().Elem()); err != nil { - return err - } - if err := p.readAny(val, props.MapValProp); err != nil { - return err - } - if err := p.consumeOptionalSeparator(); err != nil { - return err - } - default: - p.back() - return p.errorf(`expected "key", "value", or %q, found %q`, terminator, tok.value) - } - } - - dst.SetMapIndex(key, val) - continue - } - - // Check that it's not already set if it's not a repeated field. - if !props.Repeated && fieldSet[name] { - return p.errorf("non-repeated field %q was repeated", name) - } - - if err := p.checkForColon(props, dst.Type()); err != nil { - return err - } - - // Parse into the field. - fieldSet[name] = true - if err := p.readAny(dst, props); err != nil { - if _, ok := err.(*RequiredNotSetError); !ok { - return err - } - reqFieldErr = err - } - if props.Required { - reqCount-- - } - - if err := p.consumeOptionalSeparator(); err != nil { - return err - } - - } - - if reqCount > 0 { - return p.missingRequiredFieldError(sv) - } - return reqFieldErr -} - -// consumeExtName consumes extension name or expanded Any type URL and the -// following ']'. It returns the name or URL consumed. -func (p *textParser) consumeExtName() (string, error) { - tok := p.next() - if tok.err != nil { - return "", tok.err - } - - // If extension name or type url is quoted, it's a single token. - if len(tok.value) > 2 && isQuote(tok.value[0]) && tok.value[len(tok.value)-1] == tok.value[0] { - name, err := unquoteC(tok.value[1:len(tok.value)-1], rune(tok.value[0])) - if err != nil { - return "", err - } - return name, p.consumeToken("]") - } - - // Consume everything up to "]" - var parts []string - for tok.value != "]" { - parts = append(parts, tok.value) - tok = p.next() - if tok.err != nil { - return "", p.errorf("unrecognized type_url or extension name: %s", tok.err) - } - if p.done && tok.value != "]" { - return "", p.errorf("unclosed type_url or extension name") - } - } - return strings.Join(parts, ""), nil -} - -// consumeOptionalSeparator consumes an optional semicolon or comma. -// It is used in readStruct to provide backward compatibility. -func (p *textParser) consumeOptionalSeparator() error { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value != ";" && tok.value != "," { - p.back() - } - return nil -} - -func (p *textParser) readAny(v reflect.Value, props *Properties) error { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value == "" { - return p.errorf("unexpected EOF") - } - if len(props.CustomType) > 0 { - if props.Repeated { - t := reflect.TypeOf(v.Interface()) - if t.Kind() == reflect.Slice { - tc := reflect.TypeOf(new(Marshaler)) - ok := t.Elem().Implements(tc.Elem()) - if ok { - fv := v - flen := fv.Len() - if flen == fv.Cap() { - nav := reflect.MakeSlice(v.Type(), flen, 2*flen+1) - reflect.Copy(nav, fv) - fv.Set(nav) - } - fv.SetLen(flen + 1) - - // Read one. - p.back() - return p.readAny(fv.Index(flen), props) - } - } - } - if reflect.TypeOf(v.Interface()).Kind() == reflect.Ptr { - custom := reflect.New(props.ctype.Elem()).Interface().(Unmarshaler) - err := custom.Unmarshal([]byte(tok.unquoted)) - if err != nil { - return p.errorf("%v %v: %v", err, v.Type(), tok.value) - } - v.Set(reflect.ValueOf(custom)) - } else { - custom := reflect.New(reflect.TypeOf(v.Interface())).Interface().(Unmarshaler) - err := custom.Unmarshal([]byte(tok.unquoted)) - if err != nil { - return p.errorf("%v %v: %v", err, v.Type(), tok.value) - } - v.Set(reflect.Indirect(reflect.ValueOf(custom))) - } - return nil - } - if props.StdTime { - fv := v - p.back() - props.StdTime = false - tproto := ×tamp{} - err := p.readAny(reflect.ValueOf(tproto).Elem(), props) - props.StdTime = true - if err != nil { - return err - } - tim, err := timestampFromProto(tproto) - if err != nil { - return err - } - if props.Repeated { - t := reflect.TypeOf(v.Interface()) - if t.Kind() == reflect.Slice { - if t.Elem().Kind() == reflect.Ptr { - ts := fv.Interface().([]*time.Time) - ts = append(ts, &tim) - fv.Set(reflect.ValueOf(ts)) - return nil - } else { - ts := fv.Interface().([]time.Time) - ts = append(ts, tim) - fv.Set(reflect.ValueOf(ts)) - return nil - } - } - } - if reflect.TypeOf(v.Interface()).Kind() == reflect.Ptr { - v.Set(reflect.ValueOf(&tim)) - } else { - v.Set(reflect.Indirect(reflect.ValueOf(&tim))) - } - return nil - } - if props.StdDuration { - fv := v - p.back() - props.StdDuration = false - dproto := &duration{} - err := p.readAny(reflect.ValueOf(dproto).Elem(), props) - props.StdDuration = true - if err != nil { - return err - } - dur, err := durationFromProto(dproto) - if err != nil { - return err - } - if props.Repeated { - t := reflect.TypeOf(v.Interface()) - if t.Kind() == reflect.Slice { - if t.Elem().Kind() == reflect.Ptr { - ds := fv.Interface().([]*time.Duration) - ds = append(ds, &dur) - fv.Set(reflect.ValueOf(ds)) - return nil - } else { - ds := fv.Interface().([]time.Duration) - ds = append(ds, dur) - fv.Set(reflect.ValueOf(ds)) - return nil - } - } - } - if reflect.TypeOf(v.Interface()).Kind() == reflect.Ptr { - v.Set(reflect.ValueOf(&dur)) - } else { - v.Set(reflect.Indirect(reflect.ValueOf(&dur))) - } - return nil - } - switch fv := v; fv.Kind() { - case reflect.Slice: - at := v.Type() - if at.Elem().Kind() == reflect.Uint8 { - // Special case for []byte - if tok.value[0] != '"' && tok.value[0] != '\'' { - // Deliberately written out here, as the error after - // this switch statement would write "invalid []byte: ...", - // which is not as user-friendly. - return p.errorf("invalid string: %v", tok.value) - } - bytes := []byte(tok.unquoted) - fv.Set(reflect.ValueOf(bytes)) - return nil - } - // Repeated field. - if tok.value == "[" { - // Repeated field with list notation, like [1,2,3]. - for { - fv.Set(reflect.Append(fv, reflect.New(at.Elem()).Elem())) - err := p.readAny(fv.Index(fv.Len()-1), props) - if err != nil { - return err - } - ntok := p.next() - if ntok.err != nil { - return ntok.err - } - if ntok.value == "]" { - break - } - if ntok.value != "," { - return p.errorf("Expected ']' or ',' found %q", ntok.value) - } - } - return nil - } - // One value of the repeated field. - p.back() - fv.Set(reflect.Append(fv, reflect.New(at.Elem()).Elem())) - return p.readAny(fv.Index(fv.Len()-1), props) - case reflect.Bool: - // true/1/t/True or false/f/0/False. - switch tok.value { - case "true", "1", "t", "True": - fv.SetBool(true) - return nil - case "false", "0", "f", "False": - fv.SetBool(false) - return nil - } - case reflect.Float32, reflect.Float64: - v := tok.value - // Ignore 'f' for compatibility with output generated by C++, but don't - // remove 'f' when the value is "-inf" or "inf". - if strings.HasSuffix(v, "f") && tok.value != "-inf" && tok.value != "inf" { - v = v[:len(v)-1] - } - if f, err := strconv.ParseFloat(v, fv.Type().Bits()); err == nil { - fv.SetFloat(f) - return nil - } - case reflect.Int8: - if x, err := strconv.ParseInt(tok.value, 0, 8); err == nil { - fv.SetInt(x) - return nil - } - case reflect.Int16: - if x, err := strconv.ParseInt(tok.value, 0, 16); err == nil { - fv.SetInt(x) - return nil - } - case reflect.Int32: - if x, err := strconv.ParseInt(tok.value, 0, 32); err == nil { - fv.SetInt(x) - return nil - } - - if len(props.Enum) == 0 { - break - } - m, ok := enumValueMaps[props.Enum] - if !ok { - break - } - x, ok := m[tok.value] - if !ok { - break - } - fv.SetInt(int64(x)) - return nil - case reflect.Int64: - if x, err := strconv.ParseInt(tok.value, 0, 64); err == nil { - fv.SetInt(x) - return nil - } - - case reflect.Ptr: - // A basic field (indirected through pointer), or a repeated message/group - p.back() - fv.Set(reflect.New(fv.Type().Elem())) - return p.readAny(fv.Elem(), props) - case reflect.String: - if tok.value[0] == '"' || tok.value[0] == '\'' { - fv.SetString(tok.unquoted) - return nil - } - case reflect.Struct: - var terminator string - switch tok.value { - case "{": - terminator = "}" - case "<": - terminator = ">" - default: - return p.errorf("expected '{' or '<', found %q", tok.value) - } - // TODO: Handle nested messages which implement encoding.TextUnmarshaler. - return p.readStruct(fv, terminator) - case reflect.Uint8: - if x, err := strconv.ParseUint(tok.value, 0, 8); err == nil { - fv.SetUint(x) - return nil - } - case reflect.Uint16: - if x, err := strconv.ParseUint(tok.value, 0, 16); err == nil { - fv.SetUint(x) - return nil - } - case reflect.Uint32: - if x, err := strconv.ParseUint(tok.value, 0, 32); err == nil { - fv.SetUint(uint64(x)) - return nil - } - case reflect.Uint64: - if x, err := strconv.ParseUint(tok.value, 0, 64); err == nil { - fv.SetUint(x) - return nil - } - } - return p.errorf("invalid %v: %v", v.Type(), tok.value) -} - -// UnmarshalText reads a protocol buffer in Text format. UnmarshalText resets pb -// before starting to unmarshal, so any existing data in pb is always removed. -// If a required field is not set and no other error occurs, -// UnmarshalText returns *RequiredNotSetError. -func UnmarshalText(s string, pb Message) error { - if um, ok := pb.(encoding.TextUnmarshaler); ok { - return um.UnmarshalText([]byte(s)) - } - pb.Reset() - v := reflect.ValueOf(pb) - return newTextParser(s).readStruct(v.Elem(), "") -} diff --git a/vendor/github.com/gogo/protobuf/proto/timestamp.go b/vendor/github.com/gogo/protobuf/proto/timestamp.go deleted file mode 100644 index 9324f6542..000000000 --- a/vendor/github.com/gogo/protobuf/proto/timestamp.go +++ /dev/null @@ -1,113 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2016 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -// This file implements operations on google.protobuf.Timestamp. - -import ( - "errors" - "fmt" - "time" -) - -const ( - // Seconds field of the earliest valid Timestamp. - // This is time.Date(1, 1, 1, 0, 0, 0, 0, time.UTC).Unix(). - minValidSeconds = -62135596800 - // Seconds field just after the latest valid Timestamp. - // This is time.Date(10000, 1, 1, 0, 0, 0, 0, time.UTC).Unix(). - maxValidSeconds = 253402300800 -) - -// validateTimestamp determines whether a Timestamp is valid. -// A valid timestamp represents a time in the range -// [0001-01-01, 10000-01-01) and has a Nanos field -// in the range [0, 1e9). -// -// If the Timestamp is valid, validateTimestamp returns nil. -// Otherwise, it returns an error that describes -// the problem. -// -// Every valid Timestamp can be represented by a time.Time, but the converse is not true. -func validateTimestamp(ts *timestamp) error { - if ts == nil { - return errors.New("timestamp: nil Timestamp") - } - if ts.Seconds < minValidSeconds { - return fmt.Errorf("timestamp: %#v before 0001-01-01", ts) - } - if ts.Seconds >= maxValidSeconds { - return fmt.Errorf("timestamp: %#v after 10000-01-01", ts) - } - if ts.Nanos < 0 || ts.Nanos >= 1e9 { - return fmt.Errorf("timestamp: %#v: nanos not in range [0, 1e9)", ts) - } - return nil -} - -// TimestampFromProto converts a google.protobuf.Timestamp proto to a time.Time. -// It returns an error if the argument is invalid. -// -// Unlike most Go functions, if Timestamp returns an error, the first return value -// is not the zero time.Time. Instead, it is the value obtained from the -// time.Unix function when passed the contents of the Timestamp, in the UTC -// locale. This may or may not be a meaningful time; many invalid Timestamps -// do map to valid time.Times. -// -// A nil Timestamp returns an error. The first return value in that case is -// undefined. -func timestampFromProto(ts *timestamp) (time.Time, error) { - // Don't return the zero value on error, because corresponds to a valid - // timestamp. Instead return whatever time.Unix gives us. - var t time.Time - if ts == nil { - t = time.Unix(0, 0).UTC() // treat nil like the empty Timestamp - } else { - t = time.Unix(ts.Seconds, int64(ts.Nanos)).UTC() - } - return t, validateTimestamp(ts) -} - -// TimestampProto converts the time.Time to a google.protobuf.Timestamp proto. -// It returns an error if the resulting Timestamp is invalid. -func timestampProto(t time.Time) (*timestamp, error) { - seconds := t.Unix() - nanos := int32(t.Sub(time.Unix(seconds, 0))) - ts := ×tamp{ - Seconds: seconds, - Nanos: nanos, - } - if err := validateTimestamp(ts); err != nil { - return nil, err - } - return ts, nil -} diff --git a/vendor/github.com/gogo/protobuf/proto/timestamp_gogo.go b/vendor/github.com/gogo/protobuf/proto/timestamp_gogo.go deleted file mode 100644 index 38439fa99..000000000 --- a/vendor/github.com/gogo/protobuf/proto/timestamp_gogo.go +++ /dev/null @@ -1,49 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2016, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -import ( - "reflect" - "time" -) - -var timeType = reflect.TypeOf((*time.Time)(nil)).Elem() - -type timestamp struct { - Seconds int64 `protobuf:"varint,1,opt,name=seconds,proto3" json:"seconds,omitempty"` - Nanos int32 `protobuf:"varint,2,opt,name=nanos,proto3" json:"nanos,omitempty"` -} - -func (m *timestamp) Reset() { *m = timestamp{} } -func (*timestamp) ProtoMessage() {} -func (*timestamp) String() string { return "timestamp" } - -func init() { - RegisterType((*timestamp)(nil), "gogo.protobuf.proto.timestamp") -} diff --git a/vendor/github.com/gogo/protobuf/proto/wrappers.go b/vendor/github.com/gogo/protobuf/proto/wrappers.go deleted file mode 100644 index b175d1b64..000000000 --- a/vendor/github.com/gogo/protobuf/proto/wrappers.go +++ /dev/null @@ -1,1888 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2018, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -import ( - "io" - "reflect" -) - -func makeStdDoubleValueMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - t := ptr.asPointerTo(u.typ).Interface().(*float64) - v := &float64Value{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - t := ptr.asPointerTo(u.typ).Interface().(*float64) - v := &float64Value{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdDoubleValuePtrMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - if ptr.isNil() { - return 0 - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*float64) - v := &float64Value{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - if ptr.isNil() { - return b, nil - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*float64) - v := &float64Value{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdDoubleValueSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(u.typ) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(float64) - v := &float64Value{t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(u.typ) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(float64) - v := &float64Value{t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdDoubleValuePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*float64) - v := &float64Value{*t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*float64) - v := &float64Value{*t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdDoubleValueUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &float64Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(sub.typ).Elem() - s.Set(reflect.ValueOf(m.Value)) - return b[x:], nil - } -} - -func makeStdDoubleValuePtrUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &float64Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() - s.Set(reflect.ValueOf(&m.Value)) - return b[x:], nil - } -} - -func makeStdDoubleValuePtrSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &float64Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(reflect.PtrTo(sub.typ)) - newSlice := reflect.Append(slice, reflect.ValueOf(&m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdDoubleValueSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &float64Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(sub.typ) - newSlice := reflect.Append(slice, reflect.ValueOf(m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdFloatValueMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - t := ptr.asPointerTo(u.typ).Interface().(*float32) - v := &float32Value{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - t := ptr.asPointerTo(u.typ).Interface().(*float32) - v := &float32Value{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdFloatValuePtrMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - if ptr.isNil() { - return 0 - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*float32) - v := &float32Value{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - if ptr.isNil() { - return b, nil - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*float32) - v := &float32Value{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdFloatValueSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(u.typ) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(float32) - v := &float32Value{t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(u.typ) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(float32) - v := &float32Value{t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdFloatValuePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*float32) - v := &float32Value{*t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*float32) - v := &float32Value{*t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdFloatValueUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &float32Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(sub.typ).Elem() - s.Set(reflect.ValueOf(m.Value)) - return b[x:], nil - } -} - -func makeStdFloatValuePtrUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &float32Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() - s.Set(reflect.ValueOf(&m.Value)) - return b[x:], nil - } -} - -func makeStdFloatValuePtrSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &float32Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(reflect.PtrTo(sub.typ)) - newSlice := reflect.Append(slice, reflect.ValueOf(&m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdFloatValueSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &float32Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(sub.typ) - newSlice := reflect.Append(slice, reflect.ValueOf(m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdInt64ValueMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - t := ptr.asPointerTo(u.typ).Interface().(*int64) - v := &int64Value{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - t := ptr.asPointerTo(u.typ).Interface().(*int64) - v := &int64Value{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdInt64ValuePtrMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - if ptr.isNil() { - return 0 - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*int64) - v := &int64Value{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - if ptr.isNil() { - return b, nil - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*int64) - v := &int64Value{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdInt64ValueSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(u.typ) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(int64) - v := &int64Value{t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(u.typ) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(int64) - v := &int64Value{t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdInt64ValuePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*int64) - v := &int64Value{*t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*int64) - v := &int64Value{*t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdInt64ValueUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &int64Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(sub.typ).Elem() - s.Set(reflect.ValueOf(m.Value)) - return b[x:], nil - } -} - -func makeStdInt64ValuePtrUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &int64Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() - s.Set(reflect.ValueOf(&m.Value)) - return b[x:], nil - } -} - -func makeStdInt64ValuePtrSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &int64Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(reflect.PtrTo(sub.typ)) - newSlice := reflect.Append(slice, reflect.ValueOf(&m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdInt64ValueSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &int64Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(sub.typ) - newSlice := reflect.Append(slice, reflect.ValueOf(m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdUInt64ValueMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - t := ptr.asPointerTo(u.typ).Interface().(*uint64) - v := &uint64Value{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - t := ptr.asPointerTo(u.typ).Interface().(*uint64) - v := &uint64Value{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdUInt64ValuePtrMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - if ptr.isNil() { - return 0 - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*uint64) - v := &uint64Value{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - if ptr.isNil() { - return b, nil - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*uint64) - v := &uint64Value{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdUInt64ValueSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(u.typ) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(uint64) - v := &uint64Value{t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(u.typ) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(uint64) - v := &uint64Value{t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdUInt64ValuePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*uint64) - v := &uint64Value{*t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*uint64) - v := &uint64Value{*t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdUInt64ValueUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &uint64Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(sub.typ).Elem() - s.Set(reflect.ValueOf(m.Value)) - return b[x:], nil - } -} - -func makeStdUInt64ValuePtrUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &uint64Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() - s.Set(reflect.ValueOf(&m.Value)) - return b[x:], nil - } -} - -func makeStdUInt64ValuePtrSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &uint64Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(reflect.PtrTo(sub.typ)) - newSlice := reflect.Append(slice, reflect.ValueOf(&m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdUInt64ValueSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &uint64Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(sub.typ) - newSlice := reflect.Append(slice, reflect.ValueOf(m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdInt32ValueMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - t := ptr.asPointerTo(u.typ).Interface().(*int32) - v := &int32Value{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - t := ptr.asPointerTo(u.typ).Interface().(*int32) - v := &int32Value{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdInt32ValuePtrMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - if ptr.isNil() { - return 0 - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*int32) - v := &int32Value{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - if ptr.isNil() { - return b, nil - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*int32) - v := &int32Value{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdInt32ValueSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(u.typ) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(int32) - v := &int32Value{t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(u.typ) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(int32) - v := &int32Value{t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdInt32ValuePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*int32) - v := &int32Value{*t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*int32) - v := &int32Value{*t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdInt32ValueUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &int32Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(sub.typ).Elem() - s.Set(reflect.ValueOf(m.Value)) - return b[x:], nil - } -} - -func makeStdInt32ValuePtrUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &int32Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() - s.Set(reflect.ValueOf(&m.Value)) - return b[x:], nil - } -} - -func makeStdInt32ValuePtrSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &int32Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(reflect.PtrTo(sub.typ)) - newSlice := reflect.Append(slice, reflect.ValueOf(&m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdInt32ValueSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &int32Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(sub.typ) - newSlice := reflect.Append(slice, reflect.ValueOf(m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdUInt32ValueMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - t := ptr.asPointerTo(u.typ).Interface().(*uint32) - v := &uint32Value{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - t := ptr.asPointerTo(u.typ).Interface().(*uint32) - v := &uint32Value{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdUInt32ValuePtrMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - if ptr.isNil() { - return 0 - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*uint32) - v := &uint32Value{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - if ptr.isNil() { - return b, nil - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*uint32) - v := &uint32Value{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdUInt32ValueSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(u.typ) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(uint32) - v := &uint32Value{t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(u.typ) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(uint32) - v := &uint32Value{t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdUInt32ValuePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*uint32) - v := &uint32Value{*t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*uint32) - v := &uint32Value{*t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdUInt32ValueUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &uint32Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(sub.typ).Elem() - s.Set(reflect.ValueOf(m.Value)) - return b[x:], nil - } -} - -func makeStdUInt32ValuePtrUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &uint32Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() - s.Set(reflect.ValueOf(&m.Value)) - return b[x:], nil - } -} - -func makeStdUInt32ValuePtrSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &uint32Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(reflect.PtrTo(sub.typ)) - newSlice := reflect.Append(slice, reflect.ValueOf(&m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdUInt32ValueSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &uint32Value{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(sub.typ) - newSlice := reflect.Append(slice, reflect.ValueOf(m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdBoolValueMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - t := ptr.asPointerTo(u.typ).Interface().(*bool) - v := &boolValue{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - t := ptr.asPointerTo(u.typ).Interface().(*bool) - v := &boolValue{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdBoolValuePtrMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - if ptr.isNil() { - return 0 - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*bool) - v := &boolValue{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - if ptr.isNil() { - return b, nil - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*bool) - v := &boolValue{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdBoolValueSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(u.typ) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(bool) - v := &boolValue{t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(u.typ) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(bool) - v := &boolValue{t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdBoolValuePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*bool) - v := &boolValue{*t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*bool) - v := &boolValue{*t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdBoolValueUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &boolValue{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(sub.typ).Elem() - s.Set(reflect.ValueOf(m.Value)) - return b[x:], nil - } -} - -func makeStdBoolValuePtrUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &boolValue{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() - s.Set(reflect.ValueOf(&m.Value)) - return b[x:], nil - } -} - -func makeStdBoolValuePtrSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &boolValue{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(reflect.PtrTo(sub.typ)) - newSlice := reflect.Append(slice, reflect.ValueOf(&m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdBoolValueSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &boolValue{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(sub.typ) - newSlice := reflect.Append(slice, reflect.ValueOf(m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdStringValueMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - t := ptr.asPointerTo(u.typ).Interface().(*string) - v := &stringValue{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - t := ptr.asPointerTo(u.typ).Interface().(*string) - v := &stringValue{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdStringValuePtrMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - if ptr.isNil() { - return 0 - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*string) - v := &stringValue{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - if ptr.isNil() { - return b, nil - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*string) - v := &stringValue{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdStringValueSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(u.typ) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(string) - v := &stringValue{t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(u.typ) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(string) - v := &stringValue{t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdStringValuePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*string) - v := &stringValue{*t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*string) - v := &stringValue{*t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdStringValueUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &stringValue{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(sub.typ).Elem() - s.Set(reflect.ValueOf(m.Value)) - return b[x:], nil - } -} - -func makeStdStringValuePtrUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &stringValue{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() - s.Set(reflect.ValueOf(&m.Value)) - return b[x:], nil - } -} - -func makeStdStringValuePtrSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &stringValue{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(reflect.PtrTo(sub.typ)) - newSlice := reflect.Append(slice, reflect.ValueOf(&m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdStringValueSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &stringValue{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(sub.typ) - newSlice := reflect.Append(slice, reflect.ValueOf(m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdBytesValueMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - t := ptr.asPointerTo(u.typ).Interface().(*[]byte) - v := &bytesValue{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - t := ptr.asPointerTo(u.typ).Interface().(*[]byte) - v := &bytesValue{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdBytesValuePtrMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - if ptr.isNil() { - return 0 - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*[]byte) - v := &bytesValue{*t} - siz := Size(v) - return tagsize + SizeVarint(uint64(siz)) + siz - }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - if ptr.isNil() { - return b, nil - } - t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*[]byte) - v := &bytesValue{*t} - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(buf))) - b = append(b, buf...) - return b, nil - } -} - -func makeStdBytesValueSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(u.typ) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().([]byte) - v := &bytesValue{t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(u.typ) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().([]byte) - v := &bytesValue{t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdBytesValuePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - n := 0 - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*[]byte) - v := &bytesValue{*t} - siz := Size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getSlice(reflect.PtrTo(u.typ)) - for i := 0; i < s.Len(); i++ { - elem := s.Index(i) - t := elem.Interface().(*[]byte) - v := &bytesValue{*t} - siz := Size(v) - buf, err := Marshal(v) - if err != nil { - return nil, err - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(siz)) - b = append(b, buf...) - } - - return b, nil - } -} - -func makeStdBytesValueUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &bytesValue{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(sub.typ).Elem() - s.Set(reflect.ValueOf(m.Value)) - return b[x:], nil - } -} - -func makeStdBytesValuePtrUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &bytesValue{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() - s.Set(reflect.ValueOf(&m.Value)) - return b[x:], nil - } -} - -func makeStdBytesValuePtrSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &bytesValue{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(reflect.PtrTo(sub.typ)) - newSlice := reflect.Append(slice, reflect.ValueOf(&m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} - -func makeStdBytesValueSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return nil, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - m := &bytesValue{} - if err := Unmarshal(b[:x], m); err != nil { - return nil, err - } - slice := f.getSlice(sub.typ) - newSlice := reflect.Append(slice, reflect.ValueOf(m.Value)) - slice.Set(newSlice) - return b[x:], nil - } -} diff --git a/vendor/github.com/gogo/protobuf/proto/wrappers_gogo.go b/vendor/github.com/gogo/protobuf/proto/wrappers_gogo.go deleted file mode 100644 index c1cf7bf85..000000000 --- a/vendor/github.com/gogo/protobuf/proto/wrappers_gogo.go +++ /dev/null @@ -1,113 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2018, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -type float64Value struct { - Value float64 `protobuf:"fixed64,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *float64Value) Reset() { *m = float64Value{} } -func (*float64Value) ProtoMessage() {} -func (*float64Value) String() string { return "float64" } - -type float32Value struct { - Value float32 `protobuf:"fixed32,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *float32Value) Reset() { *m = float32Value{} } -func (*float32Value) ProtoMessage() {} -func (*float32Value) String() string { return "float32" } - -type int64Value struct { - Value int64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *int64Value) Reset() { *m = int64Value{} } -func (*int64Value) ProtoMessage() {} -func (*int64Value) String() string { return "int64" } - -type uint64Value struct { - Value uint64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *uint64Value) Reset() { *m = uint64Value{} } -func (*uint64Value) ProtoMessage() {} -func (*uint64Value) String() string { return "uint64" } - -type int32Value struct { - Value int32 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *int32Value) Reset() { *m = int32Value{} } -func (*int32Value) ProtoMessage() {} -func (*int32Value) String() string { return "int32" } - -type uint32Value struct { - Value uint32 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *uint32Value) Reset() { *m = uint32Value{} } -func (*uint32Value) ProtoMessage() {} -func (*uint32Value) String() string { return "uint32" } - -type boolValue struct { - Value bool `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *boolValue) Reset() { *m = boolValue{} } -func (*boolValue) ProtoMessage() {} -func (*boolValue) String() string { return "bool" } - -type stringValue struct { - Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *stringValue) Reset() { *m = stringValue{} } -func (*stringValue) ProtoMessage() {} -func (*stringValue) String() string { return "string" } - -type bytesValue struct { - Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *bytesValue) Reset() { *m = bytesValue{} } -func (*bytesValue) ProtoMessage() {} -func (*bytesValue) String() string { return "[]byte" } - -func init() { - RegisterType((*float64Value)(nil), "gogo.protobuf.proto.DoubleValue") - RegisterType((*float32Value)(nil), "gogo.protobuf.proto.FloatValue") - RegisterType((*int64Value)(nil), "gogo.protobuf.proto.Int64Value") - RegisterType((*uint64Value)(nil), "gogo.protobuf.proto.UInt64Value") - RegisterType((*int32Value)(nil), "gogo.protobuf.proto.Int32Value") - RegisterType((*uint32Value)(nil), "gogo.protobuf.proto.UInt32Value") - RegisterType((*boolValue)(nil), "gogo.protobuf.proto.BoolValue") - RegisterType((*stringValue)(nil), "gogo.protobuf.proto.StringValue") - RegisterType((*bytesValue)(nil), "gogo.protobuf.proto.BytesValue") -} diff --git a/vendor/github.com/gogo/protobuf/sortkeys/sortkeys.go b/vendor/github.com/gogo/protobuf/sortkeys/sortkeys.go deleted file mode 100644 index ceadde6a5..000000000 --- a/vendor/github.com/gogo/protobuf/sortkeys/sortkeys.go +++ /dev/null @@ -1,101 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package sortkeys - -import ( - "sort" -) - -func Strings(l []string) { - sort.Strings(l) -} - -func Float64s(l []float64) { - sort.Float64s(l) -} - -func Float32s(l []float32) { - sort.Sort(Float32Slice(l)) -} - -func Int64s(l []int64) { - sort.Sort(Int64Slice(l)) -} - -func Int32s(l []int32) { - sort.Sort(Int32Slice(l)) -} - -func Uint64s(l []uint64) { - sort.Sort(Uint64Slice(l)) -} - -func Uint32s(l []uint32) { - sort.Sort(Uint32Slice(l)) -} - -func Bools(l []bool) { - sort.Sort(BoolSlice(l)) -} - -type BoolSlice []bool - -func (p BoolSlice) Len() int { return len(p) } -func (p BoolSlice) Less(i, j int) bool { return p[j] } -func (p BoolSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } - -type Int64Slice []int64 - -func (p Int64Slice) Len() int { return len(p) } -func (p Int64Slice) Less(i, j int) bool { return p[i] < p[j] } -func (p Int64Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } - -type Int32Slice []int32 - -func (p Int32Slice) Len() int { return len(p) } -func (p Int32Slice) Less(i, j int) bool { return p[i] < p[j] } -func (p Int32Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } - -type Uint64Slice []uint64 - -func (p Uint64Slice) Len() int { return len(p) } -func (p Uint64Slice) Less(i, j int) bool { return p[i] < p[j] } -func (p Uint64Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } - -type Uint32Slice []uint32 - -func (p Uint32Slice) Len() int { return len(p) } -func (p Uint32Slice) Less(i, j int) bool { return p[i] < p[j] } -func (p Uint32Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } - -type Float32Slice []float32 - -func (p Float32Slice) Len() int { return len(p) } -func (p Float32Slice) Less(i, j int) bool { return p[i] < p[j] } -func (p Float32Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } diff --git a/vendor/github.com/golang-jwt/jwt/v4/.gitignore b/vendor/github.com/golang-jwt/jwt/v4/.gitignore deleted file mode 100644 index 09573e016..000000000 --- a/vendor/github.com/golang-jwt/jwt/v4/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -.DS_Store -bin -.idea/ - diff --git a/vendor/github.com/golang-jwt/jwt/v4/LICENSE b/vendor/github.com/golang-jwt/jwt/v4/LICENSE deleted file mode 100644 index 35dbc2520..000000000 --- a/vendor/github.com/golang-jwt/jwt/v4/LICENSE +++ /dev/null @@ -1,9 +0,0 @@ -Copyright (c) 2012 Dave Grijalva -Copyright (c) 2021 golang-jwt maintainers - -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/vendor/github.com/golang-jwt/jwt/v4/MIGRATION_GUIDE.md b/vendor/github.com/golang-jwt/jwt/v4/MIGRATION_GUIDE.md deleted file mode 100644 index 32966f598..000000000 --- a/vendor/github.com/golang-jwt/jwt/v4/MIGRATION_GUIDE.md +++ /dev/null @@ -1,22 +0,0 @@ -## Migration Guide (v4.0.0) - -Starting from [v4.0.0](https://github.com/golang-jwt/jwt/releases/tag/v4.0.0), the import path will be: - - "github.com/golang-jwt/jwt/v4" - -The `/v4` version will be backwards compatible with existing `v3.x.y` tags in this repo, as well as -`github.com/dgrijalva/jwt-go`. For most users this should be a drop-in replacement, if you're having -troubles migrating, please open an issue. - -You can replace all occurrences of `github.com/dgrijalva/jwt-go` or `github.com/golang-jwt/jwt` with `github.com/golang-jwt/jwt/v4`, either manually or by using tools such as `sed` or `gofmt`. - -And then you'd typically run: - -``` -go get github.com/golang-jwt/jwt/v4 -go mod tidy -``` - -## Older releases (before v3.2.0) - -The original migration guide for older releases can be found at https://github.com/dgrijalva/jwt-go/blob/master/MIGRATION_GUIDE.md. diff --git a/vendor/github.com/golang-jwt/jwt/v4/README.md b/vendor/github.com/golang-jwt/jwt/v4/README.md deleted file mode 100644 index 3072d24a9..000000000 --- a/vendor/github.com/golang-jwt/jwt/v4/README.md +++ /dev/null @@ -1,114 +0,0 @@ -# jwt-go - -[![build](https://github.com/golang-jwt/jwt/actions/workflows/build.yml/badge.svg)](https://github.com/golang-jwt/jwt/actions/workflows/build.yml) -[![Go Reference](https://pkg.go.dev/badge/github.com/golang-jwt/jwt/v4.svg)](https://pkg.go.dev/github.com/golang-jwt/jwt/v4) - -A [go](http://www.golang.org) (or 'golang' for search engine friendliness) implementation of [JSON Web Tokens](https://datatracker.ietf.org/doc/html/rfc7519). - -Starting with [v4.0.0](https://github.com/golang-jwt/jwt/releases/tag/v4.0.0) this project adds Go module support, but maintains backwards compatibility with older `v3.x.y` tags and upstream `github.com/dgrijalva/jwt-go`. -See the [`MIGRATION_GUIDE.md`](./MIGRATION_GUIDE.md) for more information. - -> After the original author of the library suggested migrating the maintenance of `jwt-go`, a dedicated team of open source maintainers decided to clone the existing library into this repository. See [dgrijalva/jwt-go#462](https://github.com/dgrijalva/jwt-go/issues/462) for a detailed discussion on this topic. - - -**SECURITY NOTICE:** Some older versions of Go have a security issue in the crypto/elliptic. Recommendation is to upgrade to at least 1.15 See issue [dgrijalva/jwt-go#216](https://github.com/dgrijalva/jwt-go/issues/216) for more detail. - -**SECURITY NOTICE:** It's important that you [validate the `alg` presented is what you expect](https://auth0.com/blog/critical-vulnerabilities-in-json-web-token-libraries/). This library attempts to make it easy to do the right thing by requiring key types match the expected alg, but you should take the extra step to verify it in your usage. See the examples provided. - -### Supported Go versions - -Our support of Go versions is aligned with Go's [version release policy](https://golang.org/doc/devel/release#policy). -So we will support a major version of Go until there are two newer major releases. -We no longer support building jwt-go with unsupported Go versions, as these contain security vulnerabilities -which will not be fixed. - -## What the heck is a JWT? - -JWT.io has [a great introduction](https://jwt.io/introduction) to JSON Web Tokens. - -In short, it's a signed JSON object that does something useful (for example, authentication). It's commonly used for `Bearer` tokens in Oauth 2. A token is made of three parts, separated by `.`'s. The first two parts are JSON objects, that have been [base64url](https://datatracker.ietf.org/doc/html/rfc4648) encoded. The last part is the signature, encoded the same way. - -The first part is called the header. It contains the necessary information for verifying the last part, the signature. For example, which encryption method was used for signing and what key was used. - -The part in the middle is the interesting bit. It's called the Claims and contains the actual stuff you care about. Refer to [RFC 7519](https://datatracker.ietf.org/doc/html/rfc7519) for information about reserved keys and the proper way to add your own. - -## What's in the box? - -This library supports the parsing and verification as well as the generation and signing of JWTs. Current supported signing algorithms are HMAC SHA, RSA, RSA-PSS, and ECDSA, though hooks are present for adding your own. - -## Examples - -See [the project documentation](https://pkg.go.dev/github.com/golang-jwt/jwt) for examples of usage: - -* [Simple example of parsing and validating a token](https://pkg.go.dev/github.com/golang-jwt/jwt#example-Parse-Hmac) -* [Simple example of building and signing a token](https://pkg.go.dev/github.com/golang-jwt/jwt#example-New-Hmac) -* [Directory of Examples](https://pkg.go.dev/github.com/golang-jwt/jwt#pkg-examples) - -## Extensions - -This library publishes all the necessary components for adding your own signing methods. Simply implement the `SigningMethod` interface and register a factory method using `RegisterSigningMethod`. - -Here's an example of an extension that integrates with multiple Google Cloud Platform signing tools (AppEngine, IAM API, Cloud KMS): https://github.com/someone1/gcp-jwt-go - -## Compliance - -This library was last reviewed to comply with [RFC 7519](https://datatracker.ietf.org/doc/html/rfc7519) dated May 2015 with a few notable differences: - -* In order to protect against accidental use of [Unsecured JWTs](https://datatracker.ietf.org/doc/html/rfc7519#section-6), tokens using `alg=none` will only be accepted if the constant `jwt.UnsafeAllowNoneSignatureType` is provided as the key. - -## Project Status & Versioning - -This library is considered production ready. Feedback and feature requests are appreciated. The API should be considered stable. There should be very few backwards-incompatible changes outside of major version updates (and only with good reason). - -This project uses [Semantic Versioning 2.0.0](http://semver.org). Accepted pull requests will land on `main`. Periodically, versions will be tagged from `main`. You can find all the releases on [the project releases page](https://github.com/golang-jwt/jwt/releases). - -**BREAKING CHANGES:*** -A full list of breaking changes is available in `VERSION_HISTORY.md`. See `MIGRATION_GUIDE.md` for more information on updating your code. - -## Usage Tips - -### Signing vs Encryption - -A token is simply a JSON object that is signed by its author. this tells you exactly two things about the data: - -* The author of the token was in the possession of the signing secret -* The data has not been modified since it was signed - -It's important to know that JWT does not provide encryption, which means anyone who has access to the token can read its contents. If you need to protect (encrypt) the data, there is a companion spec, `JWE`, that provides this functionality. JWE is currently outside the scope of this library. - -### Choosing a Signing Method - -There are several signing methods available, and you should probably take the time to learn about the various options before choosing one. The principal design decision is most likely going to be symmetric vs asymmetric. - -Symmetric signing methods, such as HSA, use only a single secret. This is probably the simplest signing method to use since any `[]byte` can be used as a valid secret. They are also slightly computationally faster to use, though this rarely is enough to matter. Symmetric signing methods work the best when both producers and consumers of tokens are trusted, or even the same system. Since the same secret is used to both sign and validate tokens, you can't easily distribute the key for validation. - -Asymmetric signing methods, such as RSA, use different keys for signing and verifying tokens. This makes it possible to produce tokens with a private key, and allow any consumer to access the public key for verification. - -### Signing Methods and Key Types - -Each signing method expects a different object type for its signing keys. See the package documentation for details. Here are the most common ones: - -* The [HMAC signing method](https://pkg.go.dev/github.com/golang-jwt/jwt#SigningMethodHMAC) (`HS256`,`HS384`,`HS512`) expect `[]byte` values for signing and validation -* The [RSA signing method](https://pkg.go.dev/github.com/golang-jwt/jwt#SigningMethodRSA) (`RS256`,`RS384`,`RS512`) expect `*rsa.PrivateKey` for signing and `*rsa.PublicKey` for validation -* The [ECDSA signing method](https://pkg.go.dev/github.com/golang-jwt/jwt#SigningMethodECDSA) (`ES256`,`ES384`,`ES512`) expect `*ecdsa.PrivateKey` for signing and `*ecdsa.PublicKey` for validation -* The [EdDSA signing method](https://pkg.go.dev/github.com/golang-jwt/jwt#SigningMethodEd25519) (`Ed25519`) expect `ed25519.PrivateKey` for signing and `ed25519.PublicKey` for validation - -### JWT and OAuth - -It's worth mentioning that OAuth and JWT are not the same thing. A JWT token is simply a signed JSON object. It can be used anywhere such a thing is useful. There is some confusion, though, as JWT is the most common type of bearer token used in OAuth2 authentication. - -Without going too far down the rabbit hole, here's a description of the interaction of these technologies: - -* OAuth is a protocol for allowing an identity provider to be separate from the service a user is logging in to. For example, whenever you use Facebook to log into a different service (Yelp, Spotify, etc), you are using OAuth. -* OAuth defines several options for passing around authentication data. One popular method is called a "bearer token". A bearer token is simply a string that _should_ only be held by an authenticated user. Thus, simply presenting this token proves your identity. You can probably derive from here why a JWT might make a good bearer token. -* Because bearer tokens are used for authentication, it's important they're kept secret. This is why transactions that use bearer tokens typically happen over SSL. - -### Troubleshooting - -This library uses descriptive error messages whenever possible. If you are not getting the expected result, have a look at the errors. The most common place people get stuck is providing the correct type of key to the parser. See the above section on signing methods and key types. - -## More - -Documentation can be found [on pkg.go.dev](https://pkg.go.dev/github.com/golang-jwt/jwt). - -The command line utility included in this project (cmd/jwt) provides a straightforward example of token creation and parsing as well as a useful tool for debugging your own integration. You'll also find several implementation examples in the documentation. diff --git a/vendor/github.com/golang-jwt/jwt/v4/VERSION_HISTORY.md b/vendor/github.com/golang-jwt/jwt/v4/VERSION_HISTORY.md deleted file mode 100644 index afbfc4e40..000000000 --- a/vendor/github.com/golang-jwt/jwt/v4/VERSION_HISTORY.md +++ /dev/null @@ -1,135 +0,0 @@ -## `jwt-go` Version History - -#### 4.0.0 - -* Introduces support for Go modules. The `v4` version will be backwards compatible with `v3.x.y`. - -#### 3.2.2 - -* Starting from this release, we are adopting the policy to support the most 2 recent versions of Go currently available. By the time of this release, this is Go 1.15 and 1.16 ([#28](https://github.com/golang-jwt/jwt/pull/28)). -* Fixed a potential issue that could occur when the verification of `exp`, `iat` or `nbf` was not required and contained invalid contents, i.e. non-numeric/date. Thanks for @thaJeztah for making us aware of that and @giorgos-f3 for originally reporting it to the formtech fork ([#40](https://github.com/golang-jwt/jwt/pull/40)). -* Added support for EdDSA / ED25519 ([#36](https://github.com/golang-jwt/jwt/pull/36)). -* Optimized allocations ([#33](https://github.com/golang-jwt/jwt/pull/33)). - -#### 3.2.1 - -* **Import Path Change**: See MIGRATION_GUIDE.md for tips on updating your code - * Changed the import path from `github.com/dgrijalva/jwt-go` to `github.com/golang-jwt/jwt` -* Fixed type confusing issue between `string` and `[]string` in `VerifyAudience` ([#12](https://github.com/golang-jwt/jwt/pull/12)). This fixes CVE-2020-26160 - -#### 3.2.0 - -* Added method `ParseUnverified` to allow users to split up the tasks of parsing and validation -* HMAC signing method returns `ErrInvalidKeyType` instead of `ErrInvalidKey` where appropriate -* Added options to `request.ParseFromRequest`, which allows for an arbitrary list of modifiers to parsing behavior. Initial set include `WithClaims` and `WithParser`. Existing usage of this function will continue to work as before. -* Deprecated `ParseFromRequestWithClaims` to simplify API in the future. - -#### 3.1.0 - -* Improvements to `jwt` command line tool -* Added `SkipClaimsValidation` option to `Parser` -* Documentation updates - -#### 3.0.0 - -* **Compatibility Breaking Changes**: See MIGRATION_GUIDE.md for tips on updating your code - * Dropped support for `[]byte` keys when using RSA signing methods. This convenience feature could contribute to security vulnerabilities involving mismatched key types with signing methods. - * `ParseFromRequest` has been moved to `request` subpackage and usage has changed - * The `Claims` property on `Token` is now type `Claims` instead of `map[string]interface{}`. The default value is type `MapClaims`, which is an alias to `map[string]interface{}`. This makes it possible to use a custom type when decoding claims. -* Other Additions and Changes - * Added `Claims` interface type to allow users to decode the claims into a custom type - * Added `ParseWithClaims`, which takes a third argument of type `Claims`. Use this function instead of `Parse` if you have a custom type you'd like to decode into. - * Dramatically improved the functionality and flexibility of `ParseFromRequest`, which is now in the `request` subpackage - * Added `ParseFromRequestWithClaims` which is the `FromRequest` equivalent of `ParseWithClaims` - * Added new interface type `Extractor`, which is used for extracting JWT strings from http requests. Used with `ParseFromRequest` and `ParseFromRequestWithClaims`. - * Added several new, more specific, validation errors to error type bitmask - * Moved examples from README to executable example files - * Signing method registry is now thread safe - * Added new property to `ValidationError`, which contains the raw error returned by calls made by parse/verify (such as those returned by keyfunc or json parser) - -#### 2.7.0 - -This will likely be the last backwards compatible release before 3.0.0, excluding essential bug fixes. - -* Added new option `-show` to the `jwt` command that will just output the decoded token without verifying -* Error text for expired tokens includes how long it's been expired -* Fixed incorrect error returned from `ParseRSAPublicKeyFromPEM` -* Documentation updates - -#### 2.6.0 - -* Exposed inner error within ValidationError -* Fixed validation errors when using UseJSONNumber flag -* Added several unit tests - -#### 2.5.0 - -* Added support for signing method none. You shouldn't use this. The API tries to make this clear. -* Updated/fixed some documentation -* Added more helpful error message when trying to parse tokens that begin with `BEARER ` - -#### 2.4.0 - -* Added new type, Parser, to allow for configuration of various parsing parameters - * You can now specify a list of valid signing methods. Anything outside this set will be rejected. - * You can now opt to use the `json.Number` type instead of `float64` when parsing token JSON -* Added support for [Travis CI](https://travis-ci.org/dgrijalva/jwt-go) -* Fixed some bugs with ECDSA parsing - -#### 2.3.0 - -* Added support for ECDSA signing methods -* Added support for RSA PSS signing methods (requires go v1.4) - -#### 2.2.0 - -* Gracefully handle a `nil` `Keyfunc` being passed to `Parse`. Result will now be the parsed token and an error, instead of a panic. - -#### 2.1.0 - -Backwards compatible API change that was missed in 2.0.0. - -* The `SignedString` method on `Token` now takes `interface{}` instead of `[]byte` - -#### 2.0.0 - -There were two major reasons for breaking backwards compatibility with this update. The first was a refactor required to expand the width of the RSA and HMAC-SHA signing implementations. There will likely be no required code changes to support this change. - -The second update, while unfortunately requiring a small change in integration, is required to open up this library to other signing methods. Not all keys used for all signing methods have a single standard on-disk representation. Requiring `[]byte` as the type for all keys proved too limiting. Additionally, this implementation allows for pre-parsed tokens to be reused, which might matter in an application that parses a high volume of tokens with a small set of keys. Backwards compatibilty has been maintained for passing `[]byte` to the RSA signing methods, but they will also accept `*rsa.PublicKey` and `*rsa.PrivateKey`. - -It is likely the only integration change required here will be to change `func(t *jwt.Token) ([]byte, error)` to `func(t *jwt.Token) (interface{}, error)` when calling `Parse`. - -* **Compatibility Breaking Changes** - * `SigningMethodHS256` is now `*SigningMethodHMAC` instead of `type struct` - * `SigningMethodRS256` is now `*SigningMethodRSA` instead of `type struct` - * `KeyFunc` now returns `interface{}` instead of `[]byte` - * `SigningMethod.Sign` now takes `interface{}` instead of `[]byte` for the key - * `SigningMethod.Verify` now takes `interface{}` instead of `[]byte` for the key -* Renamed type `SigningMethodHS256` to `SigningMethodHMAC`. Specific sizes are now just instances of this type. - * Added public package global `SigningMethodHS256` - * Added public package global `SigningMethodHS384` - * Added public package global `SigningMethodHS512` -* Renamed type `SigningMethodRS256` to `SigningMethodRSA`. Specific sizes are now just instances of this type. - * Added public package global `SigningMethodRS256` - * Added public package global `SigningMethodRS384` - * Added public package global `SigningMethodRS512` -* Moved sample private key for HMAC tests from an inline value to a file on disk. Value is unchanged. -* Refactored the RSA implementation to be easier to read -* Exposed helper methods `ParseRSAPrivateKeyFromPEM` and `ParseRSAPublicKeyFromPEM` - -#### 1.0.2 - -* Fixed bug in parsing public keys from certificates -* Added more tests around the parsing of keys for RS256 -* Code refactoring in RS256 implementation. No functional changes - -#### 1.0.1 - -* Fixed panic if RS256 signing method was passed an invalid key - -#### 1.0.0 - -* First versioned release -* API stabilized -* Supports creating, signing, parsing, and validating JWT tokens -* Supports RS256 and HS256 signing methods diff --git a/vendor/github.com/golang-jwt/jwt/v4/claims.go b/vendor/github.com/golang-jwt/jwt/v4/claims.go deleted file mode 100644 index 41cc82656..000000000 --- a/vendor/github.com/golang-jwt/jwt/v4/claims.go +++ /dev/null @@ -1,273 +0,0 @@ -package jwt - -import ( - "crypto/subtle" - "fmt" - "time" -) - -// Claims must just have a Valid method that determines -// if the token is invalid for any supported reason -type Claims interface { - Valid() error -} - -// RegisteredClaims are a structured version of the JWT Claims Set, -// restricted to Registered Claim Names, as referenced at -// https://datatracker.ietf.org/doc/html/rfc7519#section-4.1 -// -// This type can be used on its own, but then additional private and -// public claims embedded in the JWT will not be parsed. The typical usecase -// therefore is to embedded this in a user-defined claim type. -// -// See examples for how to use this with your own claim types. -type RegisteredClaims struct { - // the `iss` (Issuer) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.1 - Issuer string `json:"iss,omitempty"` - - // the `sub` (Subject) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.2 - Subject string `json:"sub,omitempty"` - - // the `aud` (Audience) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.3 - Audience ClaimStrings `json:"aud,omitempty"` - - // the `exp` (Expiration Time) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.4 - ExpiresAt *NumericDate `json:"exp,omitempty"` - - // the `nbf` (Not Before) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.5 - NotBefore *NumericDate `json:"nbf,omitempty"` - - // the `iat` (Issued At) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.6 - IssuedAt *NumericDate `json:"iat,omitempty"` - - // the `jti` (JWT ID) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.7 - ID string `json:"jti,omitempty"` -} - -// Valid validates time based claims "exp, iat, nbf". -// There is no accounting for clock skew. -// As well, if any of the above claims are not in the token, it will still -// be considered a valid claim. -func (c RegisteredClaims) Valid() error { - vErr := new(ValidationError) - now := TimeFunc() - - // The claims below are optional, by default, so if they are set to the - // default value in Go, let's not fail the verification for them. - if !c.VerifyExpiresAt(now, false) { - delta := now.Sub(c.ExpiresAt.Time) - vErr.Inner = fmt.Errorf("token is expired by %v", delta) - vErr.Errors |= ValidationErrorExpired - } - - if !c.VerifyIssuedAt(now, false) { - vErr.Inner = fmt.Errorf("token used before issued") - vErr.Errors |= ValidationErrorIssuedAt - } - - if !c.VerifyNotBefore(now, false) { - vErr.Inner = fmt.Errorf("token is not valid yet") - vErr.Errors |= ValidationErrorNotValidYet - } - - if vErr.valid() { - return nil - } - - return vErr -} - -// VerifyAudience compares the aud claim against cmp. -// If required is false, this method will return true if the value matches or is unset -func (c *RegisteredClaims) VerifyAudience(cmp string, req bool) bool { - return verifyAud(c.Audience, cmp, req) -} - -// VerifyExpiresAt compares the exp claim against cmp (cmp < exp). -// If req is false, it will return true, if exp is unset. -func (c *RegisteredClaims) VerifyExpiresAt(cmp time.Time, req bool) bool { - if c.ExpiresAt == nil { - return verifyExp(nil, cmp, req) - } - - return verifyExp(&c.ExpiresAt.Time, cmp, req) -} - -// VerifyIssuedAt compares the iat claim against cmp (cmp >= iat). -// If req is false, it will return true, if iat is unset. -func (c *RegisteredClaims) VerifyIssuedAt(cmp time.Time, req bool) bool { - if c.IssuedAt == nil { - return verifyIat(nil, cmp, req) - } - - return verifyIat(&c.IssuedAt.Time, cmp, req) -} - -// VerifyNotBefore compares the nbf claim against cmp (cmp >= nbf). -// If req is false, it will return true, if nbf is unset. -func (c *RegisteredClaims) VerifyNotBefore(cmp time.Time, req bool) bool { - if c.NotBefore == nil { - return verifyNbf(nil, cmp, req) - } - - return verifyNbf(&c.NotBefore.Time, cmp, req) -} - -// VerifyIssuer compares the iss claim against cmp. -// If required is false, this method will return true if the value matches or is unset -func (c *RegisteredClaims) VerifyIssuer(cmp string, req bool) bool { - return verifyIss(c.Issuer, cmp, req) -} - -// StandardClaims are a structured version of the JWT Claims Set, as referenced at -// https://datatracker.ietf.org/doc/html/rfc7519#section-4. They do not follow the -// specification exactly, since they were based on an earlier draft of the -// specification and not updated. The main difference is that they only -// support integer-based date fields and singular audiences. This might lead to -// incompatibilities with other JWT implementations. The use of this is discouraged, instead -// the newer RegisteredClaims struct should be used. -// -// Deprecated: Use RegisteredClaims instead for a forward-compatible way to access registered claims in a struct. -type StandardClaims struct { - Audience string `json:"aud,omitempty"` - ExpiresAt int64 `json:"exp,omitempty"` - Id string `json:"jti,omitempty"` - IssuedAt int64 `json:"iat,omitempty"` - Issuer string `json:"iss,omitempty"` - NotBefore int64 `json:"nbf,omitempty"` - Subject string `json:"sub,omitempty"` -} - -// Valid validates time based claims "exp, iat, nbf". There is no accounting for clock skew. -// As well, if any of the above claims are not in the token, it will still -// be considered a valid claim. -func (c StandardClaims) Valid() error { - vErr := new(ValidationError) - now := TimeFunc().Unix() - - // The claims below are optional, by default, so if they are set to the - // default value in Go, let's not fail the verification for them. - if !c.VerifyExpiresAt(now, false) { - delta := time.Unix(now, 0).Sub(time.Unix(c.ExpiresAt, 0)) - vErr.Inner = fmt.Errorf("token is expired by %v", delta) - vErr.Errors |= ValidationErrorExpired - } - - if !c.VerifyIssuedAt(now, false) { - vErr.Inner = fmt.Errorf("token used before issued") - vErr.Errors |= ValidationErrorIssuedAt - } - - if !c.VerifyNotBefore(now, false) { - vErr.Inner = fmt.Errorf("token is not valid yet") - vErr.Errors |= ValidationErrorNotValidYet - } - - if vErr.valid() { - return nil - } - - return vErr -} - -// VerifyAudience compares the aud claim against cmp. -// If required is false, this method will return true if the value matches or is unset -func (c *StandardClaims) VerifyAudience(cmp string, req bool) bool { - return verifyAud([]string{c.Audience}, cmp, req) -} - -// VerifyExpiresAt compares the exp claim against cmp (cmp < exp). -// If req is false, it will return true, if exp is unset. -func (c *StandardClaims) VerifyExpiresAt(cmp int64, req bool) bool { - if c.ExpiresAt == 0 { - return verifyExp(nil, time.Unix(cmp, 0), req) - } - - t := time.Unix(c.ExpiresAt, 0) - return verifyExp(&t, time.Unix(cmp, 0), req) -} - -// VerifyIssuedAt compares the iat claim against cmp (cmp >= iat). -// If req is false, it will return true, if iat is unset. -func (c *StandardClaims) VerifyIssuedAt(cmp int64, req bool) bool { - if c.IssuedAt == 0 { - return verifyIat(nil, time.Unix(cmp, 0), req) - } - - t := time.Unix(c.IssuedAt, 0) - return verifyIat(&t, time.Unix(cmp, 0), req) -} - -// VerifyNotBefore compares the nbf claim against cmp (cmp >= nbf). -// If req is false, it will return true, if nbf is unset. -func (c *StandardClaims) VerifyNotBefore(cmp int64, req bool) bool { - if c.NotBefore == 0 { - return verifyNbf(nil, time.Unix(cmp, 0), req) - } - - t := time.Unix(c.NotBefore, 0) - return verifyNbf(&t, time.Unix(cmp, 0), req) -} - -// VerifyIssuer compares the iss claim against cmp. -// If required is false, this method will return true if the value matches or is unset -func (c *StandardClaims) VerifyIssuer(cmp string, req bool) bool { - return verifyIss(c.Issuer, cmp, req) -} - -// ----- helpers - -func verifyAud(aud []string, cmp string, required bool) bool { - if len(aud) == 0 { - return !required - } - // use a var here to keep constant time compare when looping over a number of claims - result := false - - var stringClaims string - for _, a := range aud { - if subtle.ConstantTimeCompare([]byte(a), []byte(cmp)) != 0 { - result = true - } - stringClaims = stringClaims + a - } - - // case where "" is sent in one or many aud claims - if len(stringClaims) == 0 { - return !required - } - - return result -} - -func verifyExp(exp *time.Time, now time.Time, required bool) bool { - if exp == nil { - return !required - } - return now.Before(*exp) -} - -func verifyIat(iat *time.Time, now time.Time, required bool) bool { - if iat == nil { - return !required - } - return now.After(*iat) || now.Equal(*iat) -} - -func verifyNbf(nbf *time.Time, now time.Time, required bool) bool { - if nbf == nil { - return !required - } - return now.After(*nbf) || now.Equal(*nbf) -} - -func verifyIss(iss string, cmp string, required bool) bool { - if iss == "" { - return !required - } - if subtle.ConstantTimeCompare([]byte(iss), []byte(cmp)) != 0 { - return true - } else { - return false - } -} diff --git a/vendor/github.com/golang-jwt/jwt/v4/doc.go b/vendor/github.com/golang-jwt/jwt/v4/doc.go deleted file mode 100644 index a86dc1a3b..000000000 --- a/vendor/github.com/golang-jwt/jwt/v4/doc.go +++ /dev/null @@ -1,4 +0,0 @@ -// Package jwt is a Go implementation of JSON Web Tokens: http://self-issued.info/docs/draft-jones-json-web-token.html -// -// See README.md for more info. -package jwt diff --git a/vendor/github.com/golang-jwt/jwt/v4/ecdsa.go b/vendor/github.com/golang-jwt/jwt/v4/ecdsa.go deleted file mode 100644 index eac023fc6..000000000 --- a/vendor/github.com/golang-jwt/jwt/v4/ecdsa.go +++ /dev/null @@ -1,142 +0,0 @@ -package jwt - -import ( - "crypto" - "crypto/ecdsa" - "crypto/rand" - "errors" - "math/big" -) - -var ( - // Sadly this is missing from crypto/ecdsa compared to crypto/rsa - ErrECDSAVerification = errors.New("crypto/ecdsa: verification error") -) - -// SigningMethodECDSA implements the ECDSA family of signing methods. -// Expects *ecdsa.PrivateKey for signing and *ecdsa.PublicKey for verification -type SigningMethodECDSA struct { - Name string - Hash crypto.Hash - KeySize int - CurveBits int -} - -// Specific instances for EC256 and company -var ( - SigningMethodES256 *SigningMethodECDSA - SigningMethodES384 *SigningMethodECDSA - SigningMethodES512 *SigningMethodECDSA -) - -func init() { - // ES256 - SigningMethodES256 = &SigningMethodECDSA{"ES256", crypto.SHA256, 32, 256} - RegisterSigningMethod(SigningMethodES256.Alg(), func() SigningMethod { - return SigningMethodES256 - }) - - // ES384 - SigningMethodES384 = &SigningMethodECDSA{"ES384", crypto.SHA384, 48, 384} - RegisterSigningMethod(SigningMethodES384.Alg(), func() SigningMethod { - return SigningMethodES384 - }) - - // ES512 - SigningMethodES512 = &SigningMethodECDSA{"ES512", crypto.SHA512, 66, 521} - RegisterSigningMethod(SigningMethodES512.Alg(), func() SigningMethod { - return SigningMethodES512 - }) -} - -func (m *SigningMethodECDSA) Alg() string { - return m.Name -} - -// Verify implements token verification for the SigningMethod. -// For this verify method, key must be an ecdsa.PublicKey struct -func (m *SigningMethodECDSA) Verify(signingString, signature string, key interface{}) error { - var err error - - // Decode the signature - var sig []byte - if sig, err = DecodeSegment(signature); err != nil { - return err - } - - // Get the key - var ecdsaKey *ecdsa.PublicKey - switch k := key.(type) { - case *ecdsa.PublicKey: - ecdsaKey = k - default: - return ErrInvalidKeyType - } - - if len(sig) != 2*m.KeySize { - return ErrECDSAVerification - } - - r := big.NewInt(0).SetBytes(sig[:m.KeySize]) - s := big.NewInt(0).SetBytes(sig[m.KeySize:]) - - // Create hasher - if !m.Hash.Available() { - return ErrHashUnavailable - } - hasher := m.Hash.New() - hasher.Write([]byte(signingString)) - - // Verify the signature - if verifystatus := ecdsa.Verify(ecdsaKey, hasher.Sum(nil), r, s); verifystatus { - return nil - } - - return ErrECDSAVerification -} - -// Sign implements token signing for the SigningMethod. -// For this signing method, key must be an ecdsa.PrivateKey struct -func (m *SigningMethodECDSA) Sign(signingString string, key interface{}) (string, error) { - // Get the key - var ecdsaKey *ecdsa.PrivateKey - switch k := key.(type) { - case *ecdsa.PrivateKey: - ecdsaKey = k - default: - return "", ErrInvalidKeyType - } - - // Create the hasher - if !m.Hash.Available() { - return "", ErrHashUnavailable - } - - hasher := m.Hash.New() - hasher.Write([]byte(signingString)) - - // Sign the string and return r, s - if r, s, err := ecdsa.Sign(rand.Reader, ecdsaKey, hasher.Sum(nil)); err == nil { - curveBits := ecdsaKey.Curve.Params().BitSize - - if m.CurveBits != curveBits { - return "", ErrInvalidKey - } - - keyBytes := curveBits / 8 - if curveBits%8 > 0 { - keyBytes += 1 - } - - // We serialize the outputs (r and s) into big-endian byte arrays - // padded with zeros on the left to make sure the sizes work out. - // Output must be 2*keyBytes long. - out := make([]byte, 2*keyBytes) - r.FillBytes(out[0:keyBytes]) // r is assigned to the first half of output. - s.FillBytes(out[keyBytes:]) // s is assigned to the second half of output. - - return EncodeSegment(out), nil - } else { - return "", err - } -} diff --git a/vendor/github.com/golang-jwt/jwt/v4/ecdsa_utils.go b/vendor/github.com/golang-jwt/jwt/v4/ecdsa_utils.go deleted file mode 100644 index 5700636d3..000000000 --- a/vendor/github.com/golang-jwt/jwt/v4/ecdsa_utils.go +++ /dev/null @@ -1,69 +0,0 @@ -package jwt - -import ( - "crypto/ecdsa" - "crypto/x509" - "encoding/pem" - "errors" -) - -var ( - ErrNotECPublicKey = errors.New("key is not a valid ECDSA public key") - ErrNotECPrivateKey = errors.New("key is not a valid ECDSA private key") -) - -// ParseECPrivateKeyFromPEM parses a PEM encoded Elliptic Curve Private Key Structure -func ParseECPrivateKeyFromPEM(key []byte) (*ecdsa.PrivateKey, error) { - var err error - - // Parse PEM block - var block *pem.Block - if block, _ = pem.Decode(key); block == nil { - return nil, ErrKeyMustBePEMEncoded - } - - // Parse the key - var parsedKey interface{} - if parsedKey, err = x509.ParseECPrivateKey(block.Bytes); err != nil { - if parsedKey, err = x509.ParsePKCS8PrivateKey(block.Bytes); err != nil { - return nil, err - } - } - - var pkey *ecdsa.PrivateKey - var ok bool - if pkey, ok = parsedKey.(*ecdsa.PrivateKey); !ok { - return nil, ErrNotECPrivateKey - } - - return pkey, nil -} - -// ParseECPublicKeyFromPEM parses a PEM encoded PKCS1 or PKCS8 public key -func ParseECPublicKeyFromPEM(key []byte) (*ecdsa.PublicKey, error) { - var err error - - // Parse PEM block - var block *pem.Block - if block, _ = pem.Decode(key); block == nil { - return nil, ErrKeyMustBePEMEncoded - } - - // Parse the key - var parsedKey interface{} - if parsedKey, err = x509.ParsePKIXPublicKey(block.Bytes); err != nil { - if cert, err := x509.ParseCertificate(block.Bytes); err == nil { - parsedKey = cert.PublicKey - } else { - return nil, err - } - } - - var pkey *ecdsa.PublicKey - var ok bool - if pkey, ok = parsedKey.(*ecdsa.PublicKey); !ok { - return nil, ErrNotECPublicKey - } - - return pkey, nil -} diff --git a/vendor/github.com/golang-jwt/jwt/v4/ed25519.go b/vendor/github.com/golang-jwt/jwt/v4/ed25519.go deleted file mode 100644 index 07d3aacd6..000000000 --- a/vendor/github.com/golang-jwt/jwt/v4/ed25519.go +++ /dev/null @@ -1,85 +0,0 @@ -package jwt - -import ( - "errors" - - "crypto" - "crypto/ed25519" - "crypto/rand" -) - -var ( - ErrEd25519Verification = errors.New("ed25519: verification error") -) - -// SigningMethodEd25519 implements the EdDSA family. -// Expects ed25519.PrivateKey for signing and ed25519.PublicKey for verification -type SigningMethodEd25519 struct{} - -// Specific instance for EdDSA -var ( - SigningMethodEdDSA *SigningMethodEd25519 -) - -func init() { - SigningMethodEdDSA = &SigningMethodEd25519{} - RegisterSigningMethod(SigningMethodEdDSA.Alg(), func() SigningMethod { - return SigningMethodEdDSA - }) -} - -func (m *SigningMethodEd25519) Alg() string { - return "EdDSA" -} - -// Verify implements token verification for the SigningMethod. -// For this verify method, key must be an ed25519.PublicKey -func (m *SigningMethodEd25519) Verify(signingString, signature string, key interface{}) error { - var err error - var ed25519Key ed25519.PublicKey - var ok bool - - if ed25519Key, ok = key.(ed25519.PublicKey); !ok { - return ErrInvalidKeyType - } - - if len(ed25519Key) != ed25519.PublicKeySize { - return ErrInvalidKey - } - - // Decode the signature - var sig []byte - if sig, err = DecodeSegment(signature); err != nil { - return err - } - - // Verify the signature - if !ed25519.Verify(ed25519Key, []byte(signingString), sig) { - return ErrEd25519Verification - } - - return nil -} - -// Sign implements token signing for the SigningMethod. -// For this signing method, key must be an ed25519.PrivateKey -func (m *SigningMethodEd25519) Sign(signingString string, key interface{}) (string, error) { - var ed25519Key crypto.Signer - var ok bool - - if ed25519Key, ok = key.(crypto.Signer); !ok { - return "", ErrInvalidKeyType - } - - if _, ok := ed25519Key.Public().(ed25519.PublicKey); !ok { - return "", ErrInvalidKey - } - - // Sign the string and return the encoded result - // ed25519 performs a two-pass hash as part of its algorithm. Therefore, we need to pass a non-prehashed message into the Sign function, as indicated by crypto.Hash(0) - sig, err := ed25519Key.Sign(rand.Reader, []byte(signingString), crypto.Hash(0)) - if err != nil { - return "", err - } - return EncodeSegment(sig), nil -} diff --git a/vendor/github.com/golang-jwt/jwt/v4/ed25519_utils.go b/vendor/github.com/golang-jwt/jwt/v4/ed25519_utils.go deleted file mode 100644 index cdb5e68e8..000000000 --- a/vendor/github.com/golang-jwt/jwt/v4/ed25519_utils.go +++ /dev/null @@ -1,64 +0,0 @@ -package jwt - -import ( - "crypto" - "crypto/ed25519" - "crypto/x509" - "encoding/pem" - "errors" -) - -var ( - ErrNotEdPrivateKey = errors.New("key is not a valid Ed25519 private key") - ErrNotEdPublicKey = errors.New("key is not a valid Ed25519 public key") -) - -// ParseEdPrivateKeyFromPEM parses a PEM-encoded Edwards curve private key -func ParseEdPrivateKeyFromPEM(key []byte) (crypto.PrivateKey, error) { - var err error - - // Parse PEM block - var block *pem.Block - if block, _ = pem.Decode(key); block == nil { - return nil, ErrKeyMustBePEMEncoded - } - - // Parse the key - var parsedKey interface{} - if parsedKey, err = x509.ParsePKCS8PrivateKey(block.Bytes); err != nil { - return nil, err - } - - var pkey ed25519.PrivateKey - var ok bool - if pkey, ok = parsedKey.(ed25519.PrivateKey); !ok { - return nil, ErrNotEdPrivateKey - } - - return pkey, nil -} - -// ParseEdPublicKeyFromPEM parses a PEM-encoded Edwards curve public key -func ParseEdPublicKeyFromPEM(key []byte) (crypto.PublicKey, error) { - var err error - - // Parse PEM block - var block *pem.Block - if block, _ = pem.Decode(key); block == nil { - return nil, ErrKeyMustBePEMEncoded - } - - // Parse the key - var parsedKey interface{} - if parsedKey, err = x509.ParsePKIXPublicKey(block.Bytes); err != nil { - return nil, err - } - - var pkey ed25519.PublicKey - var ok bool - if pkey, ok = parsedKey.(ed25519.PublicKey); !ok { - return nil, ErrNotEdPublicKey - } - - return pkey, nil -} diff --git a/vendor/github.com/golang-jwt/jwt/v4/errors.go b/vendor/github.com/golang-jwt/jwt/v4/errors.go deleted file mode 100644 index b9d18e498..000000000 --- a/vendor/github.com/golang-jwt/jwt/v4/errors.go +++ /dev/null @@ -1,64 +0,0 @@ -package jwt - -import ( - "errors" -) - -// Error constants -var ( - ErrInvalidKey = errors.New("key is invalid") - ErrInvalidKeyType = errors.New("key is of invalid type") - ErrHashUnavailable = errors.New("the requested hash function is unavailable") -) - -// The errors that might occur when parsing and validating a token -const ( - ValidationErrorMalformed uint32 = 1 << iota // Token is malformed - ValidationErrorUnverifiable // Token could not be verified because of signing problems - ValidationErrorSignatureInvalid // Signature validation failed - - // Standard Claim validation errors - ValidationErrorAudience // AUD validation failed - ValidationErrorExpired // EXP validation failed - ValidationErrorIssuedAt // IAT validation failed - ValidationErrorIssuer // ISS validation failed - ValidationErrorNotValidYet // NBF validation failed - ValidationErrorId // JTI validation failed - ValidationErrorClaimsInvalid // Generic claims validation error -) - -// NewValidationError is a helper for constructing a ValidationError with a string error message -func NewValidationError(errorText string, errorFlags uint32) *ValidationError { - return &ValidationError{ - text: errorText, - Errors: errorFlags, - } -} - -// ValidationError represents an error from Parse if token is not valid -type ValidationError struct { - Inner error // stores the error returned by external dependencies, i.e.: KeyFunc - Errors uint32 // bitfield. see ValidationError... constants - text string // errors that do not have a valid error just have text -} - -// Error is the implementation of the err interface. -func (e ValidationError) Error() string { - if e.Inner != nil { - return e.Inner.Error() - } else if e.text != "" { - return e.text - } else { - return "token is invalid" - } -} - -// Unwrap gives errors.Is and errors.As access to the inner error. -func (e *ValidationError) Unwrap() error { - return e.Inner -} - -// No errors -func (e *ValidationError) valid() bool { - return e.Errors == 0 -} diff --git a/vendor/github.com/golang-jwt/jwt/v4/hmac.go b/vendor/github.com/golang-jwt/jwt/v4/hmac.go deleted file mode 100644 index 011f68a27..000000000 --- a/vendor/github.com/golang-jwt/jwt/v4/hmac.go +++ /dev/null @@ -1,95 +0,0 @@ -package jwt - -import ( - "crypto" - "crypto/hmac" - "errors" -) - -// SigningMethodHMAC implements the HMAC-SHA family of signing methods. -// Expects key type of []byte for both signing and validation -type SigningMethodHMAC struct { - Name string - Hash crypto.Hash -} - -// Specific instances for HS256 and company -var ( - SigningMethodHS256 *SigningMethodHMAC - SigningMethodHS384 *SigningMethodHMAC - SigningMethodHS512 *SigningMethodHMAC - ErrSignatureInvalid = errors.New("signature is invalid") -) - -func init() { - // HS256 - SigningMethodHS256 = &SigningMethodHMAC{"HS256", crypto.SHA256} - RegisterSigningMethod(SigningMethodHS256.Alg(), func() SigningMethod { - return SigningMethodHS256 - }) - - // HS384 - SigningMethodHS384 = &SigningMethodHMAC{"HS384", crypto.SHA384} - RegisterSigningMethod(SigningMethodHS384.Alg(), func() SigningMethod { - return SigningMethodHS384 - }) - - // HS512 - SigningMethodHS512 = &SigningMethodHMAC{"HS512", crypto.SHA512} - RegisterSigningMethod(SigningMethodHS512.Alg(), func() SigningMethod { - return SigningMethodHS512 - }) -} - -func (m *SigningMethodHMAC) Alg() string { - return m.Name -} - -// Verify implements token verification for the SigningMethod. Returns nil if the signature is valid. -func (m *SigningMethodHMAC) Verify(signingString, signature string, key interface{}) error { - // Verify the key is the right type - keyBytes, ok := key.([]byte) - if !ok { - return ErrInvalidKeyType - } - - // Decode signature, for comparison - sig, err := DecodeSegment(signature) - if err != nil { - return err - } - - // Can we use the specified hashing method? - if !m.Hash.Available() { - return ErrHashUnavailable - } - - // This signing method is symmetric, so we validate the signature - // by reproducing the signature from the signing string and key, then - // comparing that against the provided signature. - hasher := hmac.New(m.Hash.New, keyBytes) - hasher.Write([]byte(signingString)) - if !hmac.Equal(sig, hasher.Sum(nil)) { - return ErrSignatureInvalid - } - - // No validation errors. Signature is good. - return nil -} - -// Sign implements token signing for the SigningMethod. -// Key must be []byte -func (m *SigningMethodHMAC) Sign(signingString string, key interface{}) (string, error) { - if keyBytes, ok := key.([]byte); ok { - if !m.Hash.Available() { - return "", ErrHashUnavailable - } - - hasher := hmac.New(m.Hash.New, keyBytes) - hasher.Write([]byte(signingString)) - - return EncodeSegment(hasher.Sum(nil)), nil - } - - return "", ErrInvalidKeyType -} diff --git a/vendor/github.com/golang-jwt/jwt/v4/map_claims.go b/vendor/github.com/golang-jwt/jwt/v4/map_claims.go deleted file mode 100644 index e7da633b9..000000000 --- a/vendor/github.com/golang-jwt/jwt/v4/map_claims.go +++ /dev/null @@ -1,148 +0,0 @@ -package jwt - -import ( - "encoding/json" - "errors" - "time" - // "fmt" -) - -// MapClaims is a claims type that uses the map[string]interface{} for JSON decoding. -// This is the default claims type if you don't supply one -type MapClaims map[string]interface{} - -// VerifyAudience Compares the aud claim against cmp. -// If required is false, this method will return true if the value matches or is unset -func (m MapClaims) VerifyAudience(cmp string, req bool) bool { - var aud []string - switch v := m["aud"].(type) { - case string: - aud = append(aud, v) - case []string: - aud = v - case []interface{}: - for _, a := range v { - vs, ok := a.(string) - if !ok { - return false - } - aud = append(aud, vs) - } - } - return verifyAud(aud, cmp, req) -} - -// VerifyExpiresAt compares the exp claim against cmp (cmp <= exp). -// If req is false, it will return true, if exp is unset. -func (m MapClaims) VerifyExpiresAt(cmp int64, req bool) bool { - cmpTime := time.Unix(cmp, 0) - - v, ok := m["exp"] - if !ok { - return !req - } - - switch exp := v.(type) { - case float64: - if exp == 0 { - return verifyExp(nil, cmpTime, req) - } - - return verifyExp(&newNumericDateFromSeconds(exp).Time, cmpTime, req) - case json.Number: - v, _ := exp.Float64() - - return verifyExp(&newNumericDateFromSeconds(v).Time, cmpTime, req) - } - - return false -} - -// VerifyIssuedAt compares the exp claim against cmp (cmp >= iat). -// If req is false, it will return true, if iat is unset. -func (m MapClaims) VerifyIssuedAt(cmp int64, req bool) bool { - cmpTime := time.Unix(cmp, 0) - - v, ok := m["iat"] - if !ok { - return !req - } - - switch iat := v.(type) { - case float64: - if iat == 0 { - return verifyIat(nil, cmpTime, req) - } - - return verifyIat(&newNumericDateFromSeconds(iat).Time, cmpTime, req) - case json.Number: - v, _ := iat.Float64() - - return verifyIat(&newNumericDateFromSeconds(v).Time, cmpTime, req) - } - - return false -} - -// VerifyNotBefore compares the nbf claim against cmp (cmp >= nbf). -// If req is false, it will return true, if nbf is unset. -func (m MapClaims) VerifyNotBefore(cmp int64, req bool) bool { - cmpTime := time.Unix(cmp, 0) - - v, ok := m["nbf"] - if !ok { - return !req - } - - switch nbf := v.(type) { - case float64: - if nbf == 0 { - return verifyNbf(nil, cmpTime, req) - } - - return verifyNbf(&newNumericDateFromSeconds(nbf).Time, cmpTime, req) - case json.Number: - v, _ := nbf.Float64() - - return verifyNbf(&newNumericDateFromSeconds(v).Time, cmpTime, req) - } - - return false -} - -// VerifyIssuer compares the iss claim against cmp. -// If required is false, this method will return true if the value matches or is unset -func (m MapClaims) VerifyIssuer(cmp string, req bool) bool { - iss, _ := m["iss"].(string) - return verifyIss(iss, cmp, req) -} - -// Valid validates time based claims "exp, iat, nbf". -// There is no accounting for clock skew. -// As well, if any of the above claims are not in the token, it will still -// be considered a valid claim. -func (m MapClaims) Valid() error { - vErr := new(ValidationError) - now := TimeFunc().Unix() - - if !m.VerifyExpiresAt(now, false) { - vErr.Inner = errors.New("Token is expired") - vErr.Errors |= ValidationErrorExpired - } - - if !m.VerifyIssuedAt(now, false) { - vErr.Inner = errors.New("Token used before issued") - vErr.Errors |= ValidationErrorIssuedAt - } - - if !m.VerifyNotBefore(now, false) { - vErr.Inner = errors.New("Token is not valid yet") - vErr.Errors |= ValidationErrorNotValidYet - } - - if vErr.valid() { - return nil - } - - return vErr -} diff --git a/vendor/github.com/golang-jwt/jwt/v4/none.go b/vendor/github.com/golang-jwt/jwt/v4/none.go deleted file mode 100644 index f19835d20..000000000 --- a/vendor/github.com/golang-jwt/jwt/v4/none.go +++ /dev/null @@ -1,52 +0,0 @@ -package jwt - -// SigningMethodNone implements the none signing method. This is required by the spec -// but you probably should never use it. -var SigningMethodNone *signingMethodNone - -const UnsafeAllowNoneSignatureType unsafeNoneMagicConstant = "none signing method allowed" - -var NoneSignatureTypeDisallowedError error - -type signingMethodNone struct{} -type unsafeNoneMagicConstant string - -func init() { - SigningMethodNone = &signingMethodNone{} - NoneSignatureTypeDisallowedError = NewValidationError("'none' signature type is not allowed", ValidationErrorSignatureInvalid) - - RegisterSigningMethod(SigningMethodNone.Alg(), func() SigningMethod { - return SigningMethodNone - }) -} - -func (m *signingMethodNone) Alg() string { - return "none" -} - -// Only allow 'none' alg type if UnsafeAllowNoneSignatureType is specified as the key -func (m *signingMethodNone) Verify(signingString, signature string, key interface{}) (err error) { - // Key must be UnsafeAllowNoneSignatureType to prevent accidentally - // accepting 'none' signing method - if _, ok := key.(unsafeNoneMagicConstant); !ok { - return NoneSignatureTypeDisallowedError - } - // If signing method is none, signature must be an empty string - if signature != "" { - return NewValidationError( - "'none' signing method with non-empty signature", - ValidationErrorSignatureInvalid, - ) - } - - // Accept 'none' signing method. - return nil -} - -// Only allow 'none' signing if UnsafeAllowNoneSignatureType is specified as the key -func (m *signingMethodNone) Sign(signingString string, key interface{}) (string, error) { - if _, ok := key.(unsafeNoneMagicConstant); ok { - return "", nil - } - return "", NoneSignatureTypeDisallowedError -} diff --git a/vendor/github.com/golang-jwt/jwt/v4/parser.go b/vendor/github.com/golang-jwt/jwt/v4/parser.go deleted file mode 100644 index 2f61a69d7..000000000 --- a/vendor/github.com/golang-jwt/jwt/v4/parser.go +++ /dev/null @@ -1,170 +0,0 @@ -package jwt - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" -) - -type Parser struct { - // If populated, only these methods will be considered valid. - // - // Deprecated: In future releases, this field will not be exported anymore and should be set with an option to NewParser instead. - ValidMethods []string - - // Use JSON Number format in JSON decoder. - // - // Deprecated: In future releases, this field will not be exported anymore and should be set with an option to NewParser instead. - UseJSONNumber bool - - // Skip claims validation during token parsing. - // - // Deprecated: In future releases, this field will not be exported anymore and should be set with an option to NewParser instead. - SkipClaimsValidation bool -} - -// NewParser creates a new Parser with the specified options -func NewParser(options ...ParserOption) *Parser { - p := &Parser{} - - // loop through our parsing options and apply them - for _, option := range options { - option(p) - } - - return p -} - -// Parse parses, validates, verifies the signature and returns the parsed token. -// keyFunc will receive the parsed token and should return the key for validating. -func (p *Parser) Parse(tokenString string, keyFunc Keyfunc) (*Token, error) { - return p.ParseWithClaims(tokenString, MapClaims{}, keyFunc) -} - -func (p *Parser) ParseWithClaims(tokenString string, claims Claims, keyFunc Keyfunc) (*Token, error) { - token, parts, err := p.ParseUnverified(tokenString, claims) - if err != nil { - return token, err - } - - // Verify signing method is in the required set - if p.ValidMethods != nil { - var signingMethodValid = false - var alg = token.Method.Alg() - for _, m := range p.ValidMethods { - if m == alg { - signingMethodValid = true - break - } - } - if !signingMethodValid { - // signing method is not in the listed set - return token, NewValidationError(fmt.Sprintf("signing method %v is invalid", alg), ValidationErrorSignatureInvalid) - } - } - - // Lookup key - var key interface{} - if keyFunc == nil { - // keyFunc was not provided. short circuiting validation - return token, NewValidationError("no Keyfunc was provided.", ValidationErrorUnverifiable) - } - if key, err = keyFunc(token); err != nil { - // keyFunc returned an error - if ve, ok := err.(*ValidationError); ok { - return token, ve - } - return token, &ValidationError{Inner: err, Errors: ValidationErrorUnverifiable} - } - - vErr := &ValidationError{} - - // Validate Claims - if !p.SkipClaimsValidation { - if err := token.Claims.Valid(); err != nil { - - // If the Claims Valid returned an error, check if it is a validation error, - // If it was another error type, create a ValidationError with a generic ClaimsInvalid flag set - if e, ok := err.(*ValidationError); !ok { - vErr = &ValidationError{Inner: err, Errors: ValidationErrorClaimsInvalid} - } else { - vErr = e - } - } - } - - // Perform validation - token.Signature = parts[2] - if err = token.Method.Verify(strings.Join(parts[0:2], "."), token.Signature, key); err != nil { - vErr.Inner = err - vErr.Errors |= ValidationErrorSignatureInvalid - } - - if vErr.valid() { - token.Valid = true - return token, nil - } - - return token, vErr -} - -// ParseUnverified parses the token but doesn't validate the signature. -// -// WARNING: Don't use this method unless you know what you're doing. -// -// It's only ever useful in cases where you know the signature is valid (because it has -// been checked previously in the stack) and you want to extract values from it. -func (p *Parser) ParseUnverified(tokenString string, claims Claims) (token *Token, parts []string, err error) { - parts = strings.Split(tokenString, ".") - if len(parts) != 3 { - return nil, parts, NewValidationError("token contains an invalid number of segments", ValidationErrorMalformed) - } - - token = &Token{Raw: tokenString} - - // parse Header - var headerBytes []byte - if headerBytes, err = DecodeSegment(parts[0]); err != nil { - if strings.HasPrefix(strings.ToLower(tokenString), "bearer ") { - return token, parts, NewValidationError("tokenstring should not contain 'bearer '", ValidationErrorMalformed) - } - return token, parts, &ValidationError{Inner: err, Errors: ValidationErrorMalformed} - } - if err = json.Unmarshal(headerBytes, &token.Header); err != nil { - return token, parts, &ValidationError{Inner: err, Errors: ValidationErrorMalformed} - } - - // parse Claims - var claimBytes []byte - token.Claims = claims - - if claimBytes, err = DecodeSegment(parts[1]); err != nil { - return token, parts, &ValidationError{Inner: err, Errors: ValidationErrorMalformed} - } - dec := json.NewDecoder(bytes.NewBuffer(claimBytes)) - if p.UseJSONNumber { - dec.UseNumber() - } - // JSON Decode. Special case for map type to avoid weird pointer behavior - if c, ok := token.Claims.(MapClaims); ok { - err = dec.Decode(&c) - } else { - err = dec.Decode(&claims) - } - // Handle decode error - if err != nil { - return token, parts, &ValidationError{Inner: err, Errors: ValidationErrorMalformed} - } - - // Lookup signature method - if method, ok := token.Header["alg"].(string); ok { - if token.Method = GetSigningMethod(method); token.Method == nil { - return token, parts, NewValidationError("signing method (alg) is unavailable.", ValidationErrorUnverifiable) - } - } else { - return token, parts, NewValidationError("signing method (alg) is unspecified.", ValidationErrorUnverifiable) - } - - return token, parts, nil -} diff --git a/vendor/github.com/golang-jwt/jwt/v4/parser_option.go b/vendor/github.com/golang-jwt/jwt/v4/parser_option.go deleted file mode 100644 index 0fede4f15..000000000 --- a/vendor/github.com/golang-jwt/jwt/v4/parser_option.go +++ /dev/null @@ -1,29 +0,0 @@ -package jwt - -// ParserOption is used to implement functional-style options that modify the behaviour of the parser. To add -// new options, just create a function (ideally beginning with With or Without) that returns an anonymous function that -// takes a *Parser type as input and manipulates its configuration accordingly. -type ParserOption func(*Parser) - -// WithValidMethods is an option to supply algorithm methods that the parser will check. Only those methods will be considered valid. -// It is heavily encouraged to use this option in order to prevent attacks such as https://auth0.com/blog/critical-vulnerabilities-in-json-web-token-libraries/. -func WithValidMethods(methods []string) ParserOption { - return func(p *Parser) { - p.ValidMethods = methods - } -} - -// WithJSONNumber is an option to configure the underyling JSON parser with UseNumber -func WithJSONNumber() ParserOption { - return func(p *Parser) { - p.UseJSONNumber = true - } -} - -// WithoutClaimsValidation is an option to disable claims validation. This option should only be used if you exactly know -// what you are doing. -func WithoutClaimsValidation() ParserOption { - return func(p *Parser) { - p.SkipClaimsValidation = true - } -} diff --git a/vendor/github.com/golang-jwt/jwt/v4/rsa.go b/vendor/github.com/golang-jwt/jwt/v4/rsa.go deleted file mode 100644 index b910b19c0..000000000 --- a/vendor/github.com/golang-jwt/jwt/v4/rsa.go +++ /dev/null @@ -1,101 +0,0 @@ -package jwt - -import ( - "crypto" - "crypto/rand" - "crypto/rsa" -) - -// SigningMethodRSA implements the RSA family of signing methods. -// Expects *rsa.PrivateKey for signing and *rsa.PublicKey for validation -type SigningMethodRSA struct { - Name string - Hash crypto.Hash -} - -// Specific instances for RS256 and company -var ( - SigningMethodRS256 *SigningMethodRSA - SigningMethodRS384 *SigningMethodRSA - SigningMethodRS512 *SigningMethodRSA -) - -func init() { - // RS256 - SigningMethodRS256 = &SigningMethodRSA{"RS256", crypto.SHA256} - RegisterSigningMethod(SigningMethodRS256.Alg(), func() SigningMethod { - return SigningMethodRS256 - }) - - // RS384 - SigningMethodRS384 = &SigningMethodRSA{"RS384", crypto.SHA384} - RegisterSigningMethod(SigningMethodRS384.Alg(), func() SigningMethod { - return SigningMethodRS384 - }) - - // RS512 - SigningMethodRS512 = &SigningMethodRSA{"RS512", crypto.SHA512} - RegisterSigningMethod(SigningMethodRS512.Alg(), func() SigningMethod { - return SigningMethodRS512 - }) -} - -func (m *SigningMethodRSA) Alg() string { - return m.Name -} - -// Verify implements token verification for the SigningMethod -// For this signing method, must be an *rsa.PublicKey structure. -func (m *SigningMethodRSA) Verify(signingString, signature string, key interface{}) error { - var err error - - // Decode the signature - var sig []byte - if sig, err = DecodeSegment(signature); err != nil { - return err - } - - var rsaKey *rsa.PublicKey - var ok bool - - if rsaKey, ok = key.(*rsa.PublicKey); !ok { - return ErrInvalidKeyType - } - - // Create hasher - if !m.Hash.Available() { - return ErrHashUnavailable - } - hasher := m.Hash.New() - hasher.Write([]byte(signingString)) - - // Verify the signature - return rsa.VerifyPKCS1v15(rsaKey, m.Hash, hasher.Sum(nil), sig) -} - -// Sign implements token signing for the SigningMethod -// For this signing method, must be an *rsa.PrivateKey structure. -func (m *SigningMethodRSA) Sign(signingString string, key interface{}) (string, error) { - var rsaKey *rsa.PrivateKey - var ok bool - - // Validate type of key - if rsaKey, ok = key.(*rsa.PrivateKey); !ok { - return "", ErrInvalidKey - } - - // Create the hasher - if !m.Hash.Available() { - return "", ErrHashUnavailable - } - - hasher := m.Hash.New() - hasher.Write([]byte(signingString)) - - // Sign the string and return the encoded bytes - if sigBytes, err := rsa.SignPKCS1v15(rand.Reader, rsaKey, m.Hash, hasher.Sum(nil)); err == nil { - return EncodeSegment(sigBytes), nil - } else { - return "", err - } -} diff --git a/vendor/github.com/golang-jwt/jwt/v4/rsa_pss.go b/vendor/github.com/golang-jwt/jwt/v4/rsa_pss.go deleted file mode 100644 index 5a8502feb..000000000 --- a/vendor/github.com/golang-jwt/jwt/v4/rsa_pss.go +++ /dev/null @@ -1,142 +0,0 @@ -// +build go1.4 - -package jwt - -import ( - "crypto" - "crypto/rand" - "crypto/rsa" -) - -// SigningMethodRSAPSS implements the RSAPSS family of signing methods signing methods -type SigningMethodRSAPSS struct { - *SigningMethodRSA - Options *rsa.PSSOptions - // VerifyOptions is optional. If set overrides Options for rsa.VerifyPPS. - // Used to accept tokens signed with rsa.PSSSaltLengthAuto, what doesn't follow - // https://tools.ietf.org/html/rfc7518#section-3.5 but was used previously. - // See https://github.com/dgrijalva/jwt-go/issues/285#issuecomment-437451244 for details. - VerifyOptions *rsa.PSSOptions -} - -// Specific instances for RS/PS and company. -var ( - SigningMethodPS256 *SigningMethodRSAPSS - SigningMethodPS384 *SigningMethodRSAPSS - SigningMethodPS512 *SigningMethodRSAPSS -) - -func init() { - // PS256 - SigningMethodPS256 = &SigningMethodRSAPSS{ - SigningMethodRSA: &SigningMethodRSA{ - Name: "PS256", - Hash: crypto.SHA256, - }, - Options: &rsa.PSSOptions{ - SaltLength: rsa.PSSSaltLengthEqualsHash, - }, - VerifyOptions: &rsa.PSSOptions{ - SaltLength: rsa.PSSSaltLengthAuto, - }, - } - RegisterSigningMethod(SigningMethodPS256.Alg(), func() SigningMethod { - return SigningMethodPS256 - }) - - // PS384 - SigningMethodPS384 = &SigningMethodRSAPSS{ - SigningMethodRSA: &SigningMethodRSA{ - Name: "PS384", - Hash: crypto.SHA384, - }, - Options: &rsa.PSSOptions{ - SaltLength: rsa.PSSSaltLengthEqualsHash, - }, - VerifyOptions: &rsa.PSSOptions{ - SaltLength: rsa.PSSSaltLengthAuto, - }, - } - RegisterSigningMethod(SigningMethodPS384.Alg(), func() SigningMethod { - return SigningMethodPS384 - }) - - // PS512 - SigningMethodPS512 = &SigningMethodRSAPSS{ - SigningMethodRSA: &SigningMethodRSA{ - Name: "PS512", - Hash: crypto.SHA512, - }, - Options: &rsa.PSSOptions{ - SaltLength: rsa.PSSSaltLengthEqualsHash, - }, - VerifyOptions: &rsa.PSSOptions{ - SaltLength: rsa.PSSSaltLengthAuto, - }, - } - RegisterSigningMethod(SigningMethodPS512.Alg(), func() SigningMethod { - return SigningMethodPS512 - }) -} - -// Verify implements token verification for the SigningMethod. -// For this verify method, key must be an rsa.PublicKey struct -func (m *SigningMethodRSAPSS) Verify(signingString, signature string, key interface{}) error { - var err error - - // Decode the signature - var sig []byte - if sig, err = DecodeSegment(signature); err != nil { - return err - } - - var rsaKey *rsa.PublicKey - switch k := key.(type) { - case *rsa.PublicKey: - rsaKey = k - default: - return ErrInvalidKey - } - - // Create hasher - if !m.Hash.Available() { - return ErrHashUnavailable - } - hasher := m.Hash.New() - hasher.Write([]byte(signingString)) - - opts := m.Options - if m.VerifyOptions != nil { - opts = m.VerifyOptions - } - - return rsa.VerifyPSS(rsaKey, m.Hash, hasher.Sum(nil), sig, opts) -} - -// Sign implements token signing for the SigningMethod. -// For this signing method, key must be an rsa.PrivateKey struct -func (m *SigningMethodRSAPSS) Sign(signingString string, key interface{}) (string, error) { - var rsaKey *rsa.PrivateKey - - switch k := key.(type) { - case *rsa.PrivateKey: - rsaKey = k - default: - return "", ErrInvalidKeyType - } - - // Create the hasher - if !m.Hash.Available() { - return "", ErrHashUnavailable - } - - hasher := m.Hash.New() - hasher.Write([]byte(signingString)) - - // Sign the string and return the encoded bytes - if sigBytes, err := rsa.SignPSS(rand.Reader, rsaKey, m.Hash, hasher.Sum(nil), m.Options); err == nil { - return EncodeSegment(sigBytes), nil - } else { - return "", err - } -} diff --git a/vendor/github.com/golang-jwt/jwt/v4/rsa_utils.go b/vendor/github.com/golang-jwt/jwt/v4/rsa_utils.go deleted file mode 100644 index 1966c450b..000000000 --- a/vendor/github.com/golang-jwt/jwt/v4/rsa_utils.go +++ /dev/null @@ -1,105 +0,0 @@ -package jwt - -import ( - "crypto/rsa" - "crypto/x509" - "encoding/pem" - "errors" -) - -var ( - ErrKeyMustBePEMEncoded = errors.New("invalid key: Key must be a PEM encoded PKCS1 or PKCS8 key") - ErrNotRSAPrivateKey = errors.New("key is not a valid RSA private key") - ErrNotRSAPublicKey = errors.New("key is not a valid RSA public key") -) - -// ParseRSAPrivateKeyFromPEM parses a PEM encoded PKCS1 or PKCS8 private key -func ParseRSAPrivateKeyFromPEM(key []byte) (*rsa.PrivateKey, error) { - var err error - - // Parse PEM block - var block *pem.Block - if block, _ = pem.Decode(key); block == nil { - return nil, ErrKeyMustBePEMEncoded - } - - var parsedKey interface{} - if parsedKey, err = x509.ParsePKCS1PrivateKey(block.Bytes); err != nil { - if parsedKey, err = x509.ParsePKCS8PrivateKey(block.Bytes); err != nil { - return nil, err - } - } - - var pkey *rsa.PrivateKey - var ok bool - if pkey, ok = parsedKey.(*rsa.PrivateKey); !ok { - return nil, ErrNotRSAPrivateKey - } - - return pkey, nil -} - -// ParseRSAPrivateKeyFromPEMWithPassword parses a PEM encoded PKCS1 or PKCS8 private key protected with password -// -// Deprecated: This function is deprecated and should not be used anymore. It uses the deprecated x509.DecryptPEMBlock -// function, which was deprecated since RFC 1423 is regarded insecure by design. Unfortunately, there is no alternative -// in the Go standard library for now. See https://github.com/golang/go/issues/8860. -func ParseRSAPrivateKeyFromPEMWithPassword(key []byte, password string) (*rsa.PrivateKey, error) { - var err error - - // Parse PEM block - var block *pem.Block - if block, _ = pem.Decode(key); block == nil { - return nil, ErrKeyMustBePEMEncoded - } - - var parsedKey interface{} - - var blockDecrypted []byte - if blockDecrypted, err = x509.DecryptPEMBlock(block, []byte(password)); err != nil { - return nil, err - } - - if parsedKey, err = x509.ParsePKCS1PrivateKey(blockDecrypted); err != nil { - if parsedKey, err = x509.ParsePKCS8PrivateKey(blockDecrypted); err != nil { - return nil, err - } - } - - var pkey *rsa.PrivateKey - var ok bool - if pkey, ok = parsedKey.(*rsa.PrivateKey); !ok { - return nil, ErrNotRSAPrivateKey - } - - return pkey, nil -} - -// ParseRSAPublicKeyFromPEM parses a PEM encoded PKCS1 or PKCS8 public key -func ParseRSAPublicKeyFromPEM(key []byte) (*rsa.PublicKey, error) { - var err error - - // Parse PEM block - var block *pem.Block - if block, _ = pem.Decode(key); block == nil { - return nil, ErrKeyMustBePEMEncoded - } - - // Parse the key - var parsedKey interface{} - if parsedKey, err = x509.ParsePKIXPublicKey(block.Bytes); err != nil { - if cert, err := x509.ParseCertificate(block.Bytes); err == nil { - parsedKey = cert.PublicKey - } else { - return nil, err - } - } - - var pkey *rsa.PublicKey - var ok bool - if pkey, ok = parsedKey.(*rsa.PublicKey); !ok { - return nil, ErrNotRSAPublicKey - } - - return pkey, nil -} diff --git a/vendor/github.com/golang-jwt/jwt/v4/signing_method.go b/vendor/github.com/golang-jwt/jwt/v4/signing_method.go deleted file mode 100644 index 241ae9c60..000000000 --- a/vendor/github.com/golang-jwt/jwt/v4/signing_method.go +++ /dev/null @@ -1,46 +0,0 @@ -package jwt - -import ( - "sync" -) - -var signingMethods = map[string]func() SigningMethod{} -var signingMethodLock = new(sync.RWMutex) - -// SigningMethod can be used add new methods for signing or verifying tokens. -type SigningMethod interface { - Verify(signingString, signature string, key interface{}) error // Returns nil if signature is valid - Sign(signingString string, key interface{}) (string, error) // Returns encoded signature or error - Alg() string // returns the alg identifier for this method (example: 'HS256') -} - -// RegisterSigningMethod registers the "alg" name and a factory function for signing method. -// This is typically done during init() in the method's implementation -func RegisterSigningMethod(alg string, f func() SigningMethod) { - signingMethodLock.Lock() - defer signingMethodLock.Unlock() - - signingMethods[alg] = f -} - -// GetSigningMethod retrieves a signing method from an "alg" string -func GetSigningMethod(alg string) (method SigningMethod) { - signingMethodLock.RLock() - defer signingMethodLock.RUnlock() - - if methodF, ok := signingMethods[alg]; ok { - method = methodF() - } - return -} - -// GetAlgorithms returns a list of registered "alg" names -func GetAlgorithms() (algs []string) { - signingMethodLock.RLock() - defer signingMethodLock.RUnlock() - - for alg := range signingMethods { - algs = append(algs, alg) - } - return -} diff --git a/vendor/github.com/golang-jwt/jwt/v4/staticcheck.conf b/vendor/github.com/golang-jwt/jwt/v4/staticcheck.conf deleted file mode 100644 index 53745d51d..000000000 --- a/vendor/github.com/golang-jwt/jwt/v4/staticcheck.conf +++ /dev/null @@ -1 +0,0 @@ -checks = ["all", "-ST1000", "-ST1003", "-ST1016", "-ST1023"] diff --git a/vendor/github.com/golang-jwt/jwt/v4/token.go b/vendor/github.com/golang-jwt/jwt/v4/token.go deleted file mode 100644 index 12344138b..000000000 --- a/vendor/github.com/golang-jwt/jwt/v4/token.go +++ /dev/null @@ -1,131 +0,0 @@ -package jwt - -import ( - "encoding/base64" - "encoding/json" - "strings" - "time" -) - - -// DecodePaddingAllowed will switch the codec used for decoding JWTs respectively. Note that the JWS RFC7515 -// states that the tokens will utilize a Base64url encoding with no padding. Unfortunately, some implementations -// of JWT are producing non-standard tokens, and thus require support for decoding. Note that this is a global -// variable, and updating it will change the behavior on a package level, and is also NOT go-routine safe. -// To use the non-recommended decoding, set this boolean to `true` prior to using this package. -var DecodePaddingAllowed bool - -// TimeFunc provides the current time when parsing token to validate "exp" claim (expiration time). -// You can override it to use another time value. This is useful for testing or if your -// server uses a different time zone than your tokens. -var TimeFunc = time.Now - -// Keyfunc will be used by the Parse methods as a callback function to supply -// the key for verification. The function receives the parsed, -// but unverified Token. This allows you to use properties in the -// Header of the token (such as `kid`) to identify which key to use. -type Keyfunc func(*Token) (interface{}, error) - -// Token represents a JWT Token. Different fields will be used depending on whether you're -// creating or parsing/verifying a token. -type Token struct { - Raw string // The raw token. Populated when you Parse a token - Method SigningMethod // The signing method used or to be used - Header map[string]interface{} // The first segment of the token - Claims Claims // The second segment of the token - Signature string // The third segment of the token. Populated when you Parse a token - Valid bool // Is the token valid? Populated when you Parse/Verify a token -} - -// New creates a new Token with the specified signing method and an empty map of claims. -func New(method SigningMethod) *Token { - return NewWithClaims(method, MapClaims{}) -} - -// NewWithClaims creates a new Token with the specified signing method and claims. -func NewWithClaims(method SigningMethod, claims Claims) *Token { - return &Token{ - Header: map[string]interface{}{ - "typ": "JWT", - "alg": method.Alg(), - }, - Claims: claims, - Method: method, - } -} - -// SignedString creates and returns a complete, signed JWT. -// The token is signed using the SigningMethod specified in the token. -func (t *Token) SignedString(key interface{}) (string, error) { - var sig, sstr string - var err error - if sstr, err = t.SigningString(); err != nil { - return "", err - } - if sig, err = t.Method.Sign(sstr, key); err != nil { - return "", err - } - return strings.Join([]string{sstr, sig}, "."), nil -} - -// SigningString generates the signing string. This is the -// most expensive part of the whole deal. Unless you -// need this for something special, just go straight for -// the SignedString. -func (t *Token) SigningString() (string, error) { - var err error - parts := make([]string, 2) - for i := range parts { - var jsonValue []byte - if i == 0 { - if jsonValue, err = json.Marshal(t.Header); err != nil { - return "", err - } - } else { - if jsonValue, err = json.Marshal(t.Claims); err != nil { - return "", err - } - } - - parts[i] = EncodeSegment(jsonValue) - } - return strings.Join(parts, "."), nil -} - -// Parse parses, validates, verifies the signature and returns the parsed token. -// keyFunc will receive the parsed token and should return the cryptographic key -// for verifying the signature. -// The caller is strongly encouraged to set the WithValidMethods option to -// validate the 'alg' claim in the token matches the expected algorithm. -// For more details about the importance of validating the 'alg' claim, -// see https://auth0.com/blog/critical-vulnerabilities-in-json-web-token-libraries/ -func Parse(tokenString string, keyFunc Keyfunc, options ...ParserOption) (*Token, error) { - return NewParser(options...).Parse(tokenString, keyFunc) -} - -func ParseWithClaims(tokenString string, claims Claims, keyFunc Keyfunc, options ...ParserOption) (*Token, error) { - return NewParser(options...).ParseWithClaims(tokenString, claims, keyFunc) -} - -// EncodeSegment encodes a JWT specific base64url encoding with padding stripped -// -// Deprecated: In a future release, we will demote this function to a non-exported function, since it -// should only be used internally -func EncodeSegment(seg []byte) string { - return base64.RawURLEncoding.EncodeToString(seg) -} - -// DecodeSegment decodes a JWT specific base64url encoding with padding stripped -// -// Deprecated: In a future release, we will demote this function to a non-exported function, since it -// should only be used internally -func DecodeSegment(seg string) ([]byte, error) { - if DecodePaddingAllowed { - if l := len(seg) % 4; l > 0 { - seg += strings.Repeat("=", 4-l) - } - return base64.URLEncoding.DecodeString(seg) - } - - return base64.RawURLEncoding.DecodeString(seg) -} diff --git a/vendor/github.com/golang-jwt/jwt/v4/types.go b/vendor/github.com/golang-jwt/jwt/v4/types.go deleted file mode 100644 index 80b1b9694..000000000 --- a/vendor/github.com/golang-jwt/jwt/v4/types.go +++ /dev/null @@ -1,127 +0,0 @@ -package jwt - -import ( - "encoding/json" - "fmt" - "math" - "reflect" - "strconv" - "time" -) - -// TimePrecision sets the precision of times and dates within this library. -// This has an influence on the precision of times when comparing expiry or -// other related time fields. Furthermore, it is also the precision of times -// when serializing. -// -// For backwards compatibility the default precision is set to seconds, so that -// no fractional timestamps are generated. -var TimePrecision = time.Second - -// MarshalSingleStringAsArray modifies the behaviour of the ClaimStrings type, especially -// its MarshalJSON function. -// -// If it is set to true (the default), it will always serialize the type as an -// array of strings, even if it just contains one element, defaulting to the behaviour -// of the underlying []string. If it is set to false, it will serialize to a single -// string, if it contains one element. Otherwise, it will serialize to an array of strings. -var MarshalSingleStringAsArray = true - -// NumericDate represents a JSON numeric date value, as referenced at -// https://datatracker.ietf.org/doc/html/rfc7519#section-2. -type NumericDate struct { - time.Time -} - -// NewNumericDate constructs a new *NumericDate from a standard library time.Time struct. -// It will truncate the timestamp according to the precision specified in TimePrecision. -func NewNumericDate(t time.Time) *NumericDate { - return &NumericDate{t.Truncate(TimePrecision)} -} - -// newNumericDateFromSeconds creates a new *NumericDate out of a float64 representing a -// UNIX epoch with the float fraction representing non-integer seconds. -func newNumericDateFromSeconds(f float64) *NumericDate { - round, frac := math.Modf(f) - return NewNumericDate(time.Unix(int64(round), int64(frac*1e9))) -} - -// MarshalJSON is an implementation of the json.RawMessage interface and serializes the UNIX epoch -// represented in NumericDate to a byte array, using the precision specified in TimePrecision. -func (date NumericDate) MarshalJSON() (b []byte, err error) { - f := float64(date.Truncate(TimePrecision).UnixNano()) / float64(time.Second) - - return []byte(strconv.FormatFloat(f, 'f', -1, 64)), nil -} - -// UnmarshalJSON is an implementation of the json.RawMessage interface and deserializses a -// NumericDate from a JSON representation, i.e. a json.Number. This number represents an UNIX epoch -// with either integer or non-integer seconds. -func (date *NumericDate) UnmarshalJSON(b []byte) (err error) { - var ( - number json.Number - f float64 - ) - - if err = json.Unmarshal(b, &number); err != nil { - return fmt.Errorf("could not parse NumericData: %w", err) - } - - if f, err = number.Float64(); err != nil { - return fmt.Errorf("could not convert json number value to float: %w", err) - } - - n := newNumericDateFromSeconds(f) - *date = *n - - return nil -} - -// ClaimStrings is basically just a slice of strings, but it can be either serialized from a string array or just a string. -// This type is necessary, since the "aud" claim can either be a single string or an array. -type ClaimStrings []string - -func (s *ClaimStrings) UnmarshalJSON(data []byte) (err error) { - var value interface{} - - if err = json.Unmarshal(data, &value); err != nil { - return err - } - - var aud []string - - switch v := value.(type) { - case string: - aud = append(aud, v) - case []string: - aud = ClaimStrings(v) - case []interface{}: - for _, vv := range v { - vs, ok := vv.(string) - if !ok { - return &json.UnsupportedTypeError{Type: reflect.TypeOf(vv)} - } - aud = append(aud, vs) - } - case nil: - return nil - default: - return &json.UnsupportedTypeError{Type: reflect.TypeOf(v)} - } - - *s = aud - - return -} - -func (s ClaimStrings) MarshalJSON() (b []byte, err error) { - // This handles a special case in the JWT RFC. If the string array, e.g. used by the "aud" field, - // only contains one element, it MAY be serialized as a single string. This may or may not be - // desired based on the ecosystem of other JWT library used, so we make it configurable by the - // variable MarshalSingleStringAsArray. - if len(s) == 1 && !MarshalSingleStringAsArray { - return json.Marshal(s[0]) - } - - return json.Marshal([]string(s)) -} diff --git a/vendor/github.com/golang/protobuf/AUTHORS b/vendor/github.com/golang/protobuf/AUTHORS deleted file mode 100644 index 15167cd74..000000000 --- a/vendor/github.com/golang/protobuf/AUTHORS +++ /dev/null @@ -1,3 +0,0 @@ -# This source code refers to The Go Authors for copyright purposes. -# The master list of authors is in the main Go distribution, -# visible at http://tip.golang.org/AUTHORS. diff --git a/vendor/github.com/golang/protobuf/CONTRIBUTORS b/vendor/github.com/golang/protobuf/CONTRIBUTORS deleted file mode 100644 index 1c4577e96..000000000 --- a/vendor/github.com/golang/protobuf/CONTRIBUTORS +++ /dev/null @@ -1,3 +0,0 @@ -# This source code was written by the Go contributors. -# The master list of contributors is in the main Go distribution, -# visible at http://tip.golang.org/CONTRIBUTORS. diff --git a/vendor/github.com/golang/protobuf/LICENSE b/vendor/github.com/golang/protobuf/LICENSE deleted file mode 100644 index 0f646931a..000000000 --- a/vendor/github.com/golang/protobuf/LICENSE +++ /dev/null @@ -1,28 +0,0 @@ -Copyright 2010 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - diff --git a/vendor/github.com/golang/protobuf/proto/buffer.go b/vendor/github.com/golang/protobuf/proto/buffer.go deleted file mode 100644 index e810e6fea..000000000 --- a/vendor/github.com/golang/protobuf/proto/buffer.go +++ /dev/null @@ -1,324 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package proto - -import ( - "errors" - "fmt" - - "google.golang.org/protobuf/encoding/prototext" - "google.golang.org/protobuf/encoding/protowire" - "google.golang.org/protobuf/runtime/protoimpl" -) - -const ( - WireVarint = 0 - WireFixed32 = 5 - WireFixed64 = 1 - WireBytes = 2 - WireStartGroup = 3 - WireEndGroup = 4 -) - -// EncodeVarint returns the varint encoded bytes of v. -func EncodeVarint(v uint64) []byte { - return protowire.AppendVarint(nil, v) -} - -// SizeVarint returns the length of the varint encoded bytes of v. -// This is equal to len(EncodeVarint(v)). -func SizeVarint(v uint64) int { - return protowire.SizeVarint(v) -} - -// DecodeVarint parses a varint encoded integer from b, -// returning the integer value and the length of the varint. -// It returns (0, 0) if there is a parse error. -func DecodeVarint(b []byte) (uint64, int) { - v, n := protowire.ConsumeVarint(b) - if n < 0 { - return 0, 0 - } - return v, n -} - -// Buffer is a buffer for encoding and decoding the protobuf wire format. -// It may be reused between invocations to reduce memory usage. -type Buffer struct { - buf []byte - idx int - deterministic bool -} - -// NewBuffer allocates a new Buffer initialized with buf, -// where the contents of buf are considered the unread portion of the buffer. -func NewBuffer(buf []byte) *Buffer { - return &Buffer{buf: buf} -} - -// SetDeterministic specifies whether to use deterministic serialization. -// -// Deterministic serialization guarantees that for a given binary, equal -// messages will always be serialized to the same bytes. This implies: -// -// - Repeated serialization of a message will return the same bytes. -// - Different processes of the same binary (which may be executing on -// different machines) will serialize equal messages to the same bytes. -// -// Note that the deterministic serialization is NOT canonical across -// languages. It is not guaranteed to remain stable over time. It is unstable -// across different builds with schema changes due to unknown fields. -// Users who need canonical serialization (e.g., persistent storage in a -// canonical form, fingerprinting, etc.) should define their own -// canonicalization specification and implement their own serializer rather -// than relying on this API. -// -// If deterministic serialization is requested, map entries will be sorted -// by keys in lexographical order. This is an implementation detail and -// subject to change. -func (b *Buffer) SetDeterministic(deterministic bool) { - b.deterministic = deterministic -} - -// SetBuf sets buf as the internal buffer, -// where the contents of buf are considered the unread portion of the buffer. -func (b *Buffer) SetBuf(buf []byte) { - b.buf = buf - b.idx = 0 -} - -// Reset clears the internal buffer of all written and unread data. -func (b *Buffer) Reset() { - b.buf = b.buf[:0] - b.idx = 0 -} - -// Bytes returns the internal buffer. -func (b *Buffer) Bytes() []byte { - return b.buf -} - -// Unread returns the unread portion of the buffer. -func (b *Buffer) Unread() []byte { - return b.buf[b.idx:] -} - -// Marshal appends the wire-format encoding of m to the buffer. -func (b *Buffer) Marshal(m Message) error { - var err error - b.buf, err = marshalAppend(b.buf, m, b.deterministic) - return err -} - -// Unmarshal parses the wire-format message in the buffer and -// places the decoded results in m. -// It does not reset m before unmarshaling. -func (b *Buffer) Unmarshal(m Message) error { - err := UnmarshalMerge(b.Unread(), m) - b.idx = len(b.buf) - return err -} - -type unknownFields struct{ XXX_unrecognized protoimpl.UnknownFields } - -func (m *unknownFields) String() string { panic("not implemented") } -func (m *unknownFields) Reset() { panic("not implemented") } -func (m *unknownFields) ProtoMessage() { panic("not implemented") } - -// DebugPrint dumps the encoded bytes of b with a header and footer including s -// to stdout. This is only intended for debugging. -func (*Buffer) DebugPrint(s string, b []byte) { - m := MessageReflect(new(unknownFields)) - m.SetUnknown(b) - b, _ = prototext.MarshalOptions{AllowPartial: true, Indent: "\t"}.Marshal(m.Interface()) - fmt.Printf("==== %s ====\n%s==== %s ====\n", s, b, s) -} - -// EncodeVarint appends an unsigned varint encoding to the buffer. -func (b *Buffer) EncodeVarint(v uint64) error { - b.buf = protowire.AppendVarint(b.buf, v) - return nil -} - -// EncodeZigzag32 appends a 32-bit zig-zag varint encoding to the buffer. -func (b *Buffer) EncodeZigzag32(v uint64) error { - return b.EncodeVarint(uint64((uint32(v) << 1) ^ uint32((int32(v) >> 31)))) -} - -// EncodeZigzag64 appends a 64-bit zig-zag varint encoding to the buffer. -func (b *Buffer) EncodeZigzag64(v uint64) error { - return b.EncodeVarint(uint64((uint64(v) << 1) ^ uint64((int64(v) >> 63)))) -} - -// EncodeFixed32 appends a 32-bit little-endian integer to the buffer. -func (b *Buffer) EncodeFixed32(v uint64) error { - b.buf = protowire.AppendFixed32(b.buf, uint32(v)) - return nil -} - -// EncodeFixed64 appends a 64-bit little-endian integer to the buffer. -func (b *Buffer) EncodeFixed64(v uint64) error { - b.buf = protowire.AppendFixed64(b.buf, uint64(v)) - return nil -} - -// EncodeRawBytes appends a length-prefixed raw bytes to the buffer. -func (b *Buffer) EncodeRawBytes(v []byte) error { - b.buf = protowire.AppendBytes(b.buf, v) - return nil -} - -// EncodeStringBytes appends a length-prefixed raw bytes to the buffer. -// It does not validate whether v contains valid UTF-8. -func (b *Buffer) EncodeStringBytes(v string) error { - b.buf = protowire.AppendString(b.buf, v) - return nil -} - -// EncodeMessage appends a length-prefixed encoded message to the buffer. -func (b *Buffer) EncodeMessage(m Message) error { - var err error - b.buf = protowire.AppendVarint(b.buf, uint64(Size(m))) - b.buf, err = marshalAppend(b.buf, m, b.deterministic) - return err -} - -// DecodeVarint consumes an encoded unsigned varint from the buffer. -func (b *Buffer) DecodeVarint() (uint64, error) { - v, n := protowire.ConsumeVarint(b.buf[b.idx:]) - if n < 0 { - return 0, protowire.ParseError(n) - } - b.idx += n - return uint64(v), nil -} - -// DecodeZigzag32 consumes an encoded 32-bit zig-zag varint from the buffer. -func (b *Buffer) DecodeZigzag32() (uint64, error) { - v, err := b.DecodeVarint() - if err != nil { - return 0, err - } - return uint64((uint32(v) >> 1) ^ uint32((int32(v&1)<<31)>>31)), nil -} - -// DecodeZigzag64 consumes an encoded 64-bit zig-zag varint from the buffer. -func (b *Buffer) DecodeZigzag64() (uint64, error) { - v, err := b.DecodeVarint() - if err != nil { - return 0, err - } - return uint64((uint64(v) >> 1) ^ uint64((int64(v&1)<<63)>>63)), nil -} - -// DecodeFixed32 consumes a 32-bit little-endian integer from the buffer. -func (b *Buffer) DecodeFixed32() (uint64, error) { - v, n := protowire.ConsumeFixed32(b.buf[b.idx:]) - if n < 0 { - return 0, protowire.ParseError(n) - } - b.idx += n - return uint64(v), nil -} - -// DecodeFixed64 consumes a 64-bit little-endian integer from the buffer. -func (b *Buffer) DecodeFixed64() (uint64, error) { - v, n := protowire.ConsumeFixed64(b.buf[b.idx:]) - if n < 0 { - return 0, protowire.ParseError(n) - } - b.idx += n - return uint64(v), nil -} - -// DecodeRawBytes consumes a length-prefixed raw bytes from the buffer. -// If alloc is specified, it returns a copy the raw bytes -// rather than a sub-slice of the buffer. -func (b *Buffer) DecodeRawBytes(alloc bool) ([]byte, error) { - v, n := protowire.ConsumeBytes(b.buf[b.idx:]) - if n < 0 { - return nil, protowire.ParseError(n) - } - b.idx += n - if alloc { - v = append([]byte(nil), v...) - } - return v, nil -} - -// DecodeStringBytes consumes a length-prefixed raw bytes from the buffer. -// It does not validate whether the raw bytes contain valid UTF-8. -func (b *Buffer) DecodeStringBytes() (string, error) { - v, n := protowire.ConsumeString(b.buf[b.idx:]) - if n < 0 { - return "", protowire.ParseError(n) - } - b.idx += n - return v, nil -} - -// DecodeMessage consumes a length-prefixed message from the buffer. -// It does not reset m before unmarshaling. -func (b *Buffer) DecodeMessage(m Message) error { - v, err := b.DecodeRawBytes(false) - if err != nil { - return err - } - return UnmarshalMerge(v, m) -} - -// DecodeGroup consumes a message group from the buffer. -// It assumes that the start group marker has already been consumed and -// consumes all bytes until (and including the end group marker). -// It does not reset m before unmarshaling. -func (b *Buffer) DecodeGroup(m Message) error { - v, n, err := consumeGroup(b.buf[b.idx:]) - if err != nil { - return err - } - b.idx += n - return UnmarshalMerge(v, m) -} - -// consumeGroup parses b until it finds an end group marker, returning -// the raw bytes of the message (excluding the end group marker) and the -// the total length of the message (including the end group marker). -func consumeGroup(b []byte) ([]byte, int, error) { - b0 := b - depth := 1 // assume this follows a start group marker - for { - _, wtyp, tagLen := protowire.ConsumeTag(b) - if tagLen < 0 { - return nil, 0, protowire.ParseError(tagLen) - } - b = b[tagLen:] - - var valLen int - switch wtyp { - case protowire.VarintType: - _, valLen = protowire.ConsumeVarint(b) - case protowire.Fixed32Type: - _, valLen = protowire.ConsumeFixed32(b) - case protowire.Fixed64Type: - _, valLen = protowire.ConsumeFixed64(b) - case protowire.BytesType: - _, valLen = protowire.ConsumeBytes(b) - case protowire.StartGroupType: - depth++ - case protowire.EndGroupType: - depth-- - default: - return nil, 0, errors.New("proto: cannot parse reserved wire type") - } - if valLen < 0 { - return nil, 0, protowire.ParseError(valLen) - } - b = b[valLen:] - - if depth == 0 { - return b0[:len(b0)-len(b)-tagLen], len(b0) - len(b), nil - } - } -} diff --git a/vendor/github.com/golang/protobuf/proto/defaults.go b/vendor/github.com/golang/protobuf/proto/defaults.go deleted file mode 100644 index d399bf069..000000000 --- a/vendor/github.com/golang/protobuf/proto/defaults.go +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package proto - -import ( - "google.golang.org/protobuf/reflect/protoreflect" -) - -// SetDefaults sets unpopulated scalar fields to their default values. -// Fields within a oneof are not set even if they have a default value. -// SetDefaults is recursively called upon any populated message fields. -func SetDefaults(m Message) { - if m != nil { - setDefaults(MessageReflect(m)) - } -} - -func setDefaults(m protoreflect.Message) { - fds := m.Descriptor().Fields() - for i := 0; i < fds.Len(); i++ { - fd := fds.Get(i) - if !m.Has(fd) { - if fd.HasDefault() && fd.ContainingOneof() == nil { - v := fd.Default() - if fd.Kind() == protoreflect.BytesKind { - v = protoreflect.ValueOf(append([]byte(nil), v.Bytes()...)) // copy the default bytes - } - m.Set(fd, v) - } - continue - } - } - - m.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool { - switch { - // Handle singular message. - case fd.Cardinality() != protoreflect.Repeated: - if fd.Message() != nil { - setDefaults(m.Get(fd).Message()) - } - // Handle list of messages. - case fd.IsList(): - if fd.Message() != nil { - ls := m.Get(fd).List() - for i := 0; i < ls.Len(); i++ { - setDefaults(ls.Get(i).Message()) - } - } - // Handle map of messages. - case fd.IsMap(): - if fd.MapValue().Message() != nil { - ms := m.Get(fd).Map() - ms.Range(func(_ protoreflect.MapKey, v protoreflect.Value) bool { - setDefaults(v.Message()) - return true - }) - } - } - return true - }) -} diff --git a/vendor/github.com/golang/protobuf/proto/deprecated.go b/vendor/github.com/golang/protobuf/proto/deprecated.go deleted file mode 100644 index e8db57e09..000000000 --- a/vendor/github.com/golang/protobuf/proto/deprecated.go +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package proto - -import ( - "encoding/json" - "errors" - "fmt" - "strconv" - - protoV2 "google.golang.org/protobuf/proto" -) - -var ( - // Deprecated: No longer returned. - ErrNil = errors.New("proto: Marshal called with nil") - - // Deprecated: No longer returned. - ErrTooLarge = errors.New("proto: message encodes to over 2 GB") - - // Deprecated: No longer returned. - ErrInternalBadWireType = errors.New("proto: internal error: bad wiretype for oneof") -) - -// Deprecated: Do not use. -type Stats struct{ Emalloc, Dmalloc, Encode, Decode, Chit, Cmiss, Size uint64 } - -// Deprecated: Do not use. -func GetStats() Stats { return Stats{} } - -// Deprecated: Do not use. -func MarshalMessageSet(interface{}) ([]byte, error) { - return nil, errors.New("proto: not implemented") -} - -// Deprecated: Do not use. -func UnmarshalMessageSet([]byte, interface{}) error { - return errors.New("proto: not implemented") -} - -// Deprecated: Do not use. -func MarshalMessageSetJSON(interface{}) ([]byte, error) { - return nil, errors.New("proto: not implemented") -} - -// Deprecated: Do not use. -func UnmarshalMessageSetJSON([]byte, interface{}) error { - return errors.New("proto: not implemented") -} - -// Deprecated: Do not use. -func RegisterMessageSetType(Message, int32, string) {} - -// Deprecated: Do not use. -func EnumName(m map[int32]string, v int32) string { - s, ok := m[v] - if ok { - return s - } - return strconv.Itoa(int(v)) -} - -// Deprecated: Do not use. -func UnmarshalJSONEnum(m map[string]int32, data []byte, enumName string) (int32, error) { - if data[0] == '"' { - // New style: enums are strings. - var repr string - if err := json.Unmarshal(data, &repr); err != nil { - return -1, err - } - val, ok := m[repr] - if !ok { - return 0, fmt.Errorf("unrecognized enum %s value %q", enumName, repr) - } - return val, nil - } - // Old style: enums are ints. - var val int32 - if err := json.Unmarshal(data, &val); err != nil { - return 0, fmt.Errorf("cannot unmarshal %#q into enum %s", data, enumName) - } - return val, nil -} - -// Deprecated: Do not use; this type existed for intenal-use only. -type InternalMessageInfo struct{} - -// Deprecated: Do not use; this method existed for intenal-use only. -func (*InternalMessageInfo) DiscardUnknown(m Message) { - DiscardUnknown(m) -} - -// Deprecated: Do not use; this method existed for intenal-use only. -func (*InternalMessageInfo) Marshal(b []byte, m Message, deterministic bool) ([]byte, error) { - return protoV2.MarshalOptions{Deterministic: deterministic}.MarshalAppend(b, MessageV2(m)) -} - -// Deprecated: Do not use; this method existed for intenal-use only. -func (*InternalMessageInfo) Merge(dst, src Message) { - protoV2.Merge(MessageV2(dst), MessageV2(src)) -} - -// Deprecated: Do not use; this method existed for intenal-use only. -func (*InternalMessageInfo) Size(m Message) int { - return protoV2.Size(MessageV2(m)) -} - -// Deprecated: Do not use; this method existed for intenal-use only. -func (*InternalMessageInfo) Unmarshal(m Message, b []byte) error { - return protoV2.UnmarshalOptions{Merge: true}.Unmarshal(b, MessageV2(m)) -} diff --git a/vendor/github.com/golang/protobuf/proto/discard.go b/vendor/github.com/golang/protobuf/proto/discard.go deleted file mode 100644 index 2187e877f..000000000 --- a/vendor/github.com/golang/protobuf/proto/discard.go +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package proto - -import ( - "google.golang.org/protobuf/reflect/protoreflect" -) - -// DiscardUnknown recursively discards all unknown fields from this message -// and all embedded messages. -// -// When unmarshaling a message with unrecognized fields, the tags and values -// of such fields are preserved in the Message. This allows a later call to -// marshal to be able to produce a message that continues to have those -// unrecognized fields. To avoid this, DiscardUnknown is used to -// explicitly clear the unknown fields after unmarshaling. -func DiscardUnknown(m Message) { - if m != nil { - discardUnknown(MessageReflect(m)) - } -} - -func discardUnknown(m protoreflect.Message) { - m.Range(func(fd protoreflect.FieldDescriptor, val protoreflect.Value) bool { - switch { - // Handle singular message. - case fd.Cardinality() != protoreflect.Repeated: - if fd.Message() != nil { - discardUnknown(m.Get(fd).Message()) - } - // Handle list of messages. - case fd.IsList(): - if fd.Message() != nil { - ls := m.Get(fd).List() - for i := 0; i < ls.Len(); i++ { - discardUnknown(ls.Get(i).Message()) - } - } - // Handle map of messages. - case fd.IsMap(): - if fd.MapValue().Message() != nil { - ms := m.Get(fd).Map() - ms.Range(func(_ protoreflect.MapKey, v protoreflect.Value) bool { - discardUnknown(v.Message()) - return true - }) - } - } - return true - }) - - // Discard unknown fields. - if len(m.GetUnknown()) > 0 { - m.SetUnknown(nil) - } -} diff --git a/vendor/github.com/golang/protobuf/proto/extensions.go b/vendor/github.com/golang/protobuf/proto/extensions.go deleted file mode 100644 index 42fc120c9..000000000 --- a/vendor/github.com/golang/protobuf/proto/extensions.go +++ /dev/null @@ -1,356 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package proto - -import ( - "errors" - "fmt" - "reflect" - - "google.golang.org/protobuf/encoding/protowire" - "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/reflect/protoregistry" - "google.golang.org/protobuf/runtime/protoiface" - "google.golang.org/protobuf/runtime/protoimpl" -) - -type ( - // ExtensionDesc represents an extension descriptor and - // is used to interact with an extension field in a message. - // - // Variables of this type are generated in code by protoc-gen-go. - ExtensionDesc = protoimpl.ExtensionInfo - - // ExtensionRange represents a range of message extensions. - // Used in code generated by protoc-gen-go. - ExtensionRange = protoiface.ExtensionRangeV1 - - // Deprecated: Do not use; this is an internal type. - Extension = protoimpl.ExtensionFieldV1 - - // Deprecated: Do not use; this is an internal type. - XXX_InternalExtensions = protoimpl.ExtensionFields -) - -// ErrMissingExtension reports whether the extension was not present. -var ErrMissingExtension = errors.New("proto: missing extension") - -var errNotExtendable = errors.New("proto: not an extendable proto.Message") - -// HasExtension reports whether the extension field is present in m -// either as an explicitly populated field or as an unknown field. -func HasExtension(m Message, xt *ExtensionDesc) (has bool) { - mr := MessageReflect(m) - if mr == nil || !mr.IsValid() { - return false - } - - // Check whether any populated known field matches the field number. - xtd := xt.TypeDescriptor() - if isValidExtension(mr.Descriptor(), xtd) { - has = mr.Has(xtd) - } else { - mr.Range(func(fd protoreflect.FieldDescriptor, _ protoreflect.Value) bool { - has = int32(fd.Number()) == xt.Field - return !has - }) - } - - // Check whether any unknown field matches the field number. - for b := mr.GetUnknown(); !has && len(b) > 0; { - num, _, n := protowire.ConsumeField(b) - has = int32(num) == xt.Field - b = b[n:] - } - return has -} - -// ClearExtension removes the extension field from m -// either as an explicitly populated field or as an unknown field. -func ClearExtension(m Message, xt *ExtensionDesc) { - mr := MessageReflect(m) - if mr == nil || !mr.IsValid() { - return - } - - xtd := xt.TypeDescriptor() - if isValidExtension(mr.Descriptor(), xtd) { - mr.Clear(xtd) - } else { - mr.Range(func(fd protoreflect.FieldDescriptor, _ protoreflect.Value) bool { - if int32(fd.Number()) == xt.Field { - mr.Clear(fd) - return false - } - return true - }) - } - clearUnknown(mr, fieldNum(xt.Field)) -} - -// ClearAllExtensions clears all extensions from m. -// This includes populated fields and unknown fields in the extension range. -func ClearAllExtensions(m Message) { - mr := MessageReflect(m) - if mr == nil || !mr.IsValid() { - return - } - - mr.Range(func(fd protoreflect.FieldDescriptor, _ protoreflect.Value) bool { - if fd.IsExtension() { - mr.Clear(fd) - } - return true - }) - clearUnknown(mr, mr.Descriptor().ExtensionRanges()) -} - -// GetExtension retrieves a proto2 extended field from m. -// -// If the descriptor is type complete (i.e., ExtensionDesc.ExtensionType is non-nil), -// then GetExtension parses the encoded field and returns a Go value of the specified type. -// If the field is not present, then the default value is returned (if one is specified), -// otherwise ErrMissingExtension is reported. -// -// If the descriptor is type incomplete (i.e., ExtensionDesc.ExtensionType is nil), -// then GetExtension returns the raw encoded bytes for the extension field. -func GetExtension(m Message, xt *ExtensionDesc) (interface{}, error) { - mr := MessageReflect(m) - if mr == nil || !mr.IsValid() || mr.Descriptor().ExtensionRanges().Len() == 0 { - return nil, errNotExtendable - } - - // Retrieve the unknown fields for this extension field. - var bo protoreflect.RawFields - for bi := mr.GetUnknown(); len(bi) > 0; { - num, _, n := protowire.ConsumeField(bi) - if int32(num) == xt.Field { - bo = append(bo, bi[:n]...) - } - bi = bi[n:] - } - - // For type incomplete descriptors, only retrieve the unknown fields. - if xt.ExtensionType == nil { - return []byte(bo), nil - } - - // If the extension field only exists as unknown fields, unmarshal it. - // This is rarely done since proto.Unmarshal eagerly unmarshals extensions. - xtd := xt.TypeDescriptor() - if !isValidExtension(mr.Descriptor(), xtd) { - return nil, fmt.Errorf("proto: bad extended type; %T does not extend %T", xt.ExtendedType, m) - } - if !mr.Has(xtd) && len(bo) > 0 { - m2 := mr.New() - if err := (proto.UnmarshalOptions{ - Resolver: extensionResolver{xt}, - }.Unmarshal(bo, m2.Interface())); err != nil { - return nil, err - } - if m2.Has(xtd) { - mr.Set(xtd, m2.Get(xtd)) - clearUnknown(mr, fieldNum(xt.Field)) - } - } - - // Check whether the message has the extension field set or a default. - var pv protoreflect.Value - switch { - case mr.Has(xtd): - pv = mr.Get(xtd) - case xtd.HasDefault(): - pv = xtd.Default() - default: - return nil, ErrMissingExtension - } - - v := xt.InterfaceOf(pv) - rv := reflect.ValueOf(v) - if isScalarKind(rv.Kind()) { - rv2 := reflect.New(rv.Type()) - rv2.Elem().Set(rv) - v = rv2.Interface() - } - return v, nil -} - -// extensionResolver is a custom extension resolver that stores a single -// extension type that takes precedence over the global registry. -type extensionResolver struct{ xt protoreflect.ExtensionType } - -func (r extensionResolver) FindExtensionByName(field protoreflect.FullName) (protoreflect.ExtensionType, error) { - if xtd := r.xt.TypeDescriptor(); xtd.FullName() == field { - return r.xt, nil - } - return protoregistry.GlobalTypes.FindExtensionByName(field) -} - -func (r extensionResolver) FindExtensionByNumber(message protoreflect.FullName, field protoreflect.FieldNumber) (protoreflect.ExtensionType, error) { - if xtd := r.xt.TypeDescriptor(); xtd.ContainingMessage().FullName() == message && xtd.Number() == field { - return r.xt, nil - } - return protoregistry.GlobalTypes.FindExtensionByNumber(message, field) -} - -// GetExtensions returns a list of the extensions values present in m, -// corresponding with the provided list of extension descriptors, xts. -// If an extension is missing in m, the corresponding value is nil. -func GetExtensions(m Message, xts []*ExtensionDesc) ([]interface{}, error) { - mr := MessageReflect(m) - if mr == nil || !mr.IsValid() { - return nil, errNotExtendable - } - - vs := make([]interface{}, len(xts)) - for i, xt := range xts { - v, err := GetExtension(m, xt) - if err != nil { - if err == ErrMissingExtension { - continue - } - return vs, err - } - vs[i] = v - } - return vs, nil -} - -// SetExtension sets an extension field in m to the provided value. -func SetExtension(m Message, xt *ExtensionDesc, v interface{}) error { - mr := MessageReflect(m) - if mr == nil || !mr.IsValid() || mr.Descriptor().ExtensionRanges().Len() == 0 { - return errNotExtendable - } - - rv := reflect.ValueOf(v) - if reflect.TypeOf(v) != reflect.TypeOf(xt.ExtensionType) { - return fmt.Errorf("proto: bad extension value type. got: %T, want: %T", v, xt.ExtensionType) - } - if rv.Kind() == reflect.Ptr { - if rv.IsNil() { - return fmt.Errorf("proto: SetExtension called with nil value of type %T", v) - } - if isScalarKind(rv.Elem().Kind()) { - v = rv.Elem().Interface() - } - } - - xtd := xt.TypeDescriptor() - if !isValidExtension(mr.Descriptor(), xtd) { - return fmt.Errorf("proto: bad extended type; %T does not extend %T", xt.ExtendedType, m) - } - mr.Set(xtd, xt.ValueOf(v)) - clearUnknown(mr, fieldNum(xt.Field)) - return nil -} - -// SetRawExtension inserts b into the unknown fields of m. -// -// Deprecated: Use Message.ProtoReflect.SetUnknown instead. -func SetRawExtension(m Message, fnum int32, b []byte) { - mr := MessageReflect(m) - if mr == nil || !mr.IsValid() { - return - } - - // Verify that the raw field is valid. - for b0 := b; len(b0) > 0; { - num, _, n := protowire.ConsumeField(b0) - if int32(num) != fnum { - panic(fmt.Sprintf("mismatching field number: got %d, want %d", num, fnum)) - } - b0 = b0[n:] - } - - ClearExtension(m, &ExtensionDesc{Field: fnum}) - mr.SetUnknown(append(mr.GetUnknown(), b...)) -} - -// ExtensionDescs returns a list of extension descriptors found in m, -// containing descriptors for both populated extension fields in m and -// also unknown fields of m that are in the extension range. -// For the later case, an type incomplete descriptor is provided where only -// the ExtensionDesc.Field field is populated. -// The order of the extension descriptors is undefined. -func ExtensionDescs(m Message) ([]*ExtensionDesc, error) { - mr := MessageReflect(m) - if mr == nil || !mr.IsValid() || mr.Descriptor().ExtensionRanges().Len() == 0 { - return nil, errNotExtendable - } - - // Collect a set of known extension descriptors. - extDescs := make(map[protoreflect.FieldNumber]*ExtensionDesc) - mr.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool { - if fd.IsExtension() { - xt := fd.(protoreflect.ExtensionTypeDescriptor) - if xd, ok := xt.Type().(*ExtensionDesc); ok { - extDescs[fd.Number()] = xd - } - } - return true - }) - - // Collect a set of unknown extension descriptors. - extRanges := mr.Descriptor().ExtensionRanges() - for b := mr.GetUnknown(); len(b) > 0; { - num, _, n := protowire.ConsumeField(b) - if extRanges.Has(num) && extDescs[num] == nil { - extDescs[num] = nil - } - b = b[n:] - } - - // Transpose the set of descriptors into a list. - var xts []*ExtensionDesc - for num, xt := range extDescs { - if xt == nil { - xt = &ExtensionDesc{Field: int32(num)} - } - xts = append(xts, xt) - } - return xts, nil -} - -// isValidExtension reports whether xtd is a valid extension descriptor for md. -func isValidExtension(md protoreflect.MessageDescriptor, xtd protoreflect.ExtensionTypeDescriptor) bool { - return xtd.ContainingMessage() == md && md.ExtensionRanges().Has(xtd.Number()) -} - -// isScalarKind reports whether k is a protobuf scalar kind (except bytes). -// This function exists for historical reasons since the representation of -// scalars differs between v1 and v2, where v1 uses *T and v2 uses T. -func isScalarKind(k reflect.Kind) bool { - switch k { - case reflect.Bool, reflect.Int32, reflect.Int64, reflect.Uint32, reflect.Uint64, reflect.Float32, reflect.Float64, reflect.String: - return true - default: - return false - } -} - -// clearUnknown removes unknown fields from m where remover.Has reports true. -func clearUnknown(m protoreflect.Message, remover interface { - Has(protoreflect.FieldNumber) bool -}) { - var bo protoreflect.RawFields - for bi := m.GetUnknown(); len(bi) > 0; { - num, _, n := protowire.ConsumeField(bi) - if !remover.Has(num) { - bo = append(bo, bi[:n]...) - } - bi = bi[n:] - } - if bi := m.GetUnknown(); len(bi) != len(bo) { - m.SetUnknown(bo) - } -} - -type fieldNum protoreflect.FieldNumber - -func (n1 fieldNum) Has(n2 protoreflect.FieldNumber) bool { - return protoreflect.FieldNumber(n1) == n2 -} diff --git a/vendor/github.com/golang/protobuf/proto/properties.go b/vendor/github.com/golang/protobuf/proto/properties.go deleted file mode 100644 index dcdc2202f..000000000 --- a/vendor/github.com/golang/protobuf/proto/properties.go +++ /dev/null @@ -1,306 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package proto - -import ( - "fmt" - "reflect" - "strconv" - "strings" - "sync" - - "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/runtime/protoimpl" -) - -// StructProperties represents protocol buffer type information for a -// generated protobuf message in the open-struct API. -// -// Deprecated: Do not use. -type StructProperties struct { - // Prop are the properties for each field. - // - // Fields belonging to a oneof are stored in OneofTypes instead, with a - // single Properties representing the parent oneof held here. - // - // The order of Prop matches the order of fields in the Go struct. - // Struct fields that are not related to protobufs have a "XXX_" prefix - // in the Properties.Name and must be ignored by the user. - Prop []*Properties - - // OneofTypes contains information about the oneof fields in this message. - // It is keyed by the protobuf field name. - OneofTypes map[string]*OneofProperties -} - -// Properties represents the type information for a protobuf message field. -// -// Deprecated: Do not use. -type Properties struct { - // Name is a placeholder name with little meaningful semantic value. - // If the name has an "XXX_" prefix, the entire Properties must be ignored. - Name string - // OrigName is the protobuf field name or oneof name. - OrigName string - // JSONName is the JSON name for the protobuf field. - JSONName string - // Enum is a placeholder name for enums. - // For historical reasons, this is neither the Go name for the enum, - // nor the protobuf name for the enum. - Enum string // Deprecated: Do not use. - // Weak contains the full name of the weakly referenced message. - Weak string - // Wire is a string representation of the wire type. - Wire string - // WireType is the protobuf wire type for the field. - WireType int - // Tag is the protobuf field number. - Tag int - // Required reports whether this is a required field. - Required bool - // Optional reports whether this is a optional field. - Optional bool - // Repeated reports whether this is a repeated field. - Repeated bool - // Packed reports whether this is a packed repeated field of scalars. - Packed bool - // Proto3 reports whether this field operates under the proto3 syntax. - Proto3 bool - // Oneof reports whether this field belongs within a oneof. - Oneof bool - - // Default is the default value in string form. - Default string - // HasDefault reports whether the field has a default value. - HasDefault bool - - // MapKeyProp is the properties for the key field for a map field. - MapKeyProp *Properties - // MapValProp is the properties for the value field for a map field. - MapValProp *Properties -} - -// OneofProperties represents the type information for a protobuf oneof. -// -// Deprecated: Do not use. -type OneofProperties struct { - // Type is a pointer to the generated wrapper type for the field value. - // This is nil for messages that are not in the open-struct API. - Type reflect.Type - // Field is the index into StructProperties.Prop for the containing oneof. - Field int - // Prop is the properties for the field. - Prop *Properties -} - -// String formats the properties in the protobuf struct field tag style. -func (p *Properties) String() string { - s := p.Wire - s += "," + strconv.Itoa(p.Tag) - if p.Required { - s += ",req" - } - if p.Optional { - s += ",opt" - } - if p.Repeated { - s += ",rep" - } - if p.Packed { - s += ",packed" - } - s += ",name=" + p.OrigName - if p.JSONName != "" { - s += ",json=" + p.JSONName - } - if len(p.Enum) > 0 { - s += ",enum=" + p.Enum - } - if len(p.Weak) > 0 { - s += ",weak=" + p.Weak - } - if p.Proto3 { - s += ",proto3" - } - if p.Oneof { - s += ",oneof" - } - if p.HasDefault { - s += ",def=" + p.Default - } - return s -} - -// Parse populates p by parsing a string in the protobuf struct field tag style. -func (p *Properties) Parse(tag string) { - // For example: "bytes,49,opt,name=foo,def=hello!" - for len(tag) > 0 { - i := strings.IndexByte(tag, ',') - if i < 0 { - i = len(tag) - } - switch s := tag[:i]; { - case strings.HasPrefix(s, "name="): - p.OrigName = s[len("name="):] - case strings.HasPrefix(s, "json="): - p.JSONName = s[len("json="):] - case strings.HasPrefix(s, "enum="): - p.Enum = s[len("enum="):] - case strings.HasPrefix(s, "weak="): - p.Weak = s[len("weak="):] - case strings.Trim(s, "0123456789") == "": - n, _ := strconv.ParseUint(s, 10, 32) - p.Tag = int(n) - case s == "opt": - p.Optional = true - case s == "req": - p.Required = true - case s == "rep": - p.Repeated = true - case s == "varint" || s == "zigzag32" || s == "zigzag64": - p.Wire = s - p.WireType = WireVarint - case s == "fixed32": - p.Wire = s - p.WireType = WireFixed32 - case s == "fixed64": - p.Wire = s - p.WireType = WireFixed64 - case s == "bytes": - p.Wire = s - p.WireType = WireBytes - case s == "group": - p.Wire = s - p.WireType = WireStartGroup - case s == "packed": - p.Packed = true - case s == "proto3": - p.Proto3 = true - case s == "oneof": - p.Oneof = true - case strings.HasPrefix(s, "def="): - // The default tag is special in that everything afterwards is the - // default regardless of the presence of commas. - p.HasDefault = true - p.Default, i = tag[len("def="):], len(tag) - } - tag = strings.TrimPrefix(tag[i:], ",") - } -} - -// Init populates the properties from a protocol buffer struct tag. -// -// Deprecated: Do not use. -func (p *Properties) Init(typ reflect.Type, name, tag string, f *reflect.StructField) { - p.Name = name - p.OrigName = name - if tag == "" { - return - } - p.Parse(tag) - - if typ != nil && typ.Kind() == reflect.Map { - p.MapKeyProp = new(Properties) - p.MapKeyProp.Init(nil, "Key", f.Tag.Get("protobuf_key"), nil) - p.MapValProp = new(Properties) - p.MapValProp.Init(nil, "Value", f.Tag.Get("protobuf_val"), nil) - } -} - -var propertiesCache sync.Map // map[reflect.Type]*StructProperties - -// GetProperties returns the list of properties for the type represented by t, -// which must be a generated protocol buffer message in the open-struct API, -// where protobuf message fields are represented by exported Go struct fields. -// -// Deprecated: Use protobuf reflection instead. -func GetProperties(t reflect.Type) *StructProperties { - if p, ok := propertiesCache.Load(t); ok { - return p.(*StructProperties) - } - p, _ := propertiesCache.LoadOrStore(t, newProperties(t)) - return p.(*StructProperties) -} - -func newProperties(t reflect.Type) *StructProperties { - if t.Kind() != reflect.Struct { - panic(fmt.Sprintf("%v is not a generated message in the open-struct API", t)) - } - - var hasOneof bool - prop := new(StructProperties) - - // Construct a list of properties for each field in the struct. - for i := 0; i < t.NumField(); i++ { - p := new(Properties) - f := t.Field(i) - tagField := f.Tag.Get("protobuf") - p.Init(f.Type, f.Name, tagField, &f) - - tagOneof := f.Tag.Get("protobuf_oneof") - if tagOneof != "" { - hasOneof = true - p.OrigName = tagOneof - } - - // Rename unrelated struct fields with the "XXX_" prefix since so much - // user code simply checks for this to exclude special fields. - if tagField == "" && tagOneof == "" && !strings.HasPrefix(p.Name, "XXX_") { - p.Name = "XXX_" + p.Name - p.OrigName = "XXX_" + p.OrigName - } else if p.Weak != "" { - p.Name = p.OrigName // avoid possible "XXX_" prefix on weak field - } - - prop.Prop = append(prop.Prop, p) - } - - // Construct a mapping of oneof field names to properties. - if hasOneof { - var oneofWrappers []interface{} - if fn, ok := reflect.PtrTo(t).MethodByName("XXX_OneofFuncs"); ok { - oneofWrappers = fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))})[3].Interface().([]interface{}) - } - if fn, ok := reflect.PtrTo(t).MethodByName("XXX_OneofWrappers"); ok { - oneofWrappers = fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))})[0].Interface().([]interface{}) - } - if m, ok := reflect.Zero(reflect.PtrTo(t)).Interface().(protoreflect.ProtoMessage); ok { - if m, ok := m.ProtoReflect().(interface{ ProtoMessageInfo() *protoimpl.MessageInfo }); ok { - oneofWrappers = m.ProtoMessageInfo().OneofWrappers - } - } - - prop.OneofTypes = make(map[string]*OneofProperties) - for _, wrapper := range oneofWrappers { - p := &OneofProperties{ - Type: reflect.ValueOf(wrapper).Type(), // *T - Prop: new(Properties), - } - f := p.Type.Elem().Field(0) - p.Prop.Name = f.Name - p.Prop.Parse(f.Tag.Get("protobuf")) - - // Determine the struct field that contains this oneof. - // Each wrapper is assignable to exactly one parent field. - var foundOneof bool - for i := 0; i < t.NumField() && !foundOneof; i++ { - if p.Type.AssignableTo(t.Field(i).Type) { - p.Field = i - foundOneof = true - } - } - if !foundOneof { - panic(fmt.Sprintf("%v is not a generated message in the open-struct API", t)) - } - prop.OneofTypes[p.Prop.OrigName] = p - } - } - - return prop -} - -func (sp *StructProperties) Len() int { return len(sp.Prop) } -func (sp *StructProperties) Less(i, j int) bool { return false } -func (sp *StructProperties) Swap(i, j int) { return } diff --git a/vendor/github.com/golang/protobuf/proto/proto.go b/vendor/github.com/golang/protobuf/proto/proto.go deleted file mode 100644 index 5aee89c32..000000000 --- a/vendor/github.com/golang/protobuf/proto/proto.go +++ /dev/null @@ -1,167 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package proto provides functionality for handling protocol buffer messages. -// In particular, it provides marshaling and unmarshaling between a protobuf -// message and the binary wire format. -// -// See https://developers.google.com/protocol-buffers/docs/gotutorial for -// more information. -// -// Deprecated: Use the "google.golang.org/protobuf/proto" package instead. -package proto - -import ( - protoV2 "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/runtime/protoiface" - "google.golang.org/protobuf/runtime/protoimpl" -) - -const ( - ProtoPackageIsVersion1 = true - ProtoPackageIsVersion2 = true - ProtoPackageIsVersion3 = true - ProtoPackageIsVersion4 = true -) - -// GeneratedEnum is any enum type generated by protoc-gen-go -// which is a named int32 kind. -// This type exists for documentation purposes. -type GeneratedEnum interface{} - -// GeneratedMessage is any message type generated by protoc-gen-go -// which is a pointer to a named struct kind. -// This type exists for documentation purposes. -type GeneratedMessage interface{} - -// Message is a protocol buffer message. -// -// This is the v1 version of the message interface and is marginally better -// than an empty interface as it lacks any method to programatically interact -// with the contents of the message. -// -// A v2 message is declared in "google.golang.org/protobuf/proto".Message and -// exposes protobuf reflection as a first-class feature of the interface. -// -// To convert a v1 message to a v2 message, use the MessageV2 function. -// To convert a v2 message to a v1 message, use the MessageV1 function. -type Message = protoiface.MessageV1 - -// MessageV1 converts either a v1 or v2 message to a v1 message. -// It returns nil if m is nil. -func MessageV1(m GeneratedMessage) protoiface.MessageV1 { - return protoimpl.X.ProtoMessageV1Of(m) -} - -// MessageV2 converts either a v1 or v2 message to a v2 message. -// It returns nil if m is nil. -func MessageV2(m GeneratedMessage) protoV2.Message { - return protoimpl.X.ProtoMessageV2Of(m) -} - -// MessageReflect returns a reflective view for a message. -// It returns nil if m is nil. -func MessageReflect(m Message) protoreflect.Message { - return protoimpl.X.MessageOf(m) -} - -// Marshaler is implemented by messages that can marshal themselves. -// This interface is used by the following functions: Size, Marshal, -// Buffer.Marshal, and Buffer.EncodeMessage. -// -// Deprecated: Do not implement. -type Marshaler interface { - // Marshal formats the encoded bytes of the message. - // It should be deterministic and emit valid protobuf wire data. - // The caller takes ownership of the returned buffer. - Marshal() ([]byte, error) -} - -// Unmarshaler is implemented by messages that can unmarshal themselves. -// This interface is used by the following functions: Unmarshal, UnmarshalMerge, -// Buffer.Unmarshal, Buffer.DecodeMessage, and Buffer.DecodeGroup. -// -// Deprecated: Do not implement. -type Unmarshaler interface { - // Unmarshal parses the encoded bytes of the protobuf wire input. - // The provided buffer is only valid for during method call. - // It should not reset the receiver message. - Unmarshal([]byte) error -} - -// Merger is implemented by messages that can merge themselves. -// This interface is used by the following functions: Clone and Merge. -// -// Deprecated: Do not implement. -type Merger interface { - // Merge merges the contents of src into the receiver message. - // It clones all data structures in src such that it aliases no mutable - // memory referenced by src. - Merge(src Message) -} - -// RequiredNotSetError is an error type returned when -// marshaling or unmarshaling a message with missing required fields. -type RequiredNotSetError struct { - err error -} - -func (e *RequiredNotSetError) Error() string { - if e.err != nil { - return e.err.Error() - } - return "proto: required field not set" -} -func (e *RequiredNotSetError) RequiredNotSet() bool { - return true -} - -func checkRequiredNotSet(m protoV2.Message) error { - if err := protoV2.CheckInitialized(m); err != nil { - return &RequiredNotSetError{err: err} - } - return nil -} - -// Clone returns a deep copy of src. -func Clone(src Message) Message { - return MessageV1(protoV2.Clone(MessageV2(src))) -} - -// Merge merges src into dst, which must be messages of the same type. -// -// Populated scalar fields in src are copied to dst, while populated -// singular messages in src are merged into dst by recursively calling Merge. -// The elements of every list field in src is appended to the corresponded -// list fields in dst. The entries of every map field in src is copied into -// the corresponding map field in dst, possibly replacing existing entries. -// The unknown fields of src are appended to the unknown fields of dst. -func Merge(dst, src Message) { - protoV2.Merge(MessageV2(dst), MessageV2(src)) -} - -// Equal reports whether two messages are equal. -// If two messages marshal to the same bytes under deterministic serialization, -// then Equal is guaranteed to report true. -// -// Two messages are equal if they are the same protobuf message type, -// have the same set of populated known and extension field values, -// and the same set of unknown fields values. -// -// Scalar values are compared with the equivalent of the == operator in Go, -// except bytes values which are compared using bytes.Equal and -// floating point values which specially treat NaNs as equal. -// Message values are compared by recursively calling Equal. -// Lists are equal if each element value is also equal. -// Maps are equal if they have the same set of keys, where the pair of values -// for each key is also equal. -func Equal(x, y Message) bool { - return protoV2.Equal(MessageV2(x), MessageV2(y)) -} - -func isMessageSet(md protoreflect.MessageDescriptor) bool { - ms, ok := md.(interface{ IsMessageSet() bool }) - return ok && ms.IsMessageSet() -} diff --git a/vendor/github.com/golang/protobuf/proto/registry.go b/vendor/github.com/golang/protobuf/proto/registry.go deleted file mode 100644 index 066b4323b..000000000 --- a/vendor/github.com/golang/protobuf/proto/registry.go +++ /dev/null @@ -1,317 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package proto - -import ( - "bytes" - "compress/gzip" - "fmt" - "io/ioutil" - "reflect" - "strings" - "sync" - - "google.golang.org/protobuf/reflect/protodesc" - "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/reflect/protoregistry" - "google.golang.org/protobuf/runtime/protoimpl" -) - -// filePath is the path to the proto source file. -type filePath = string // e.g., "google/protobuf/descriptor.proto" - -// fileDescGZIP is the compressed contents of the encoded FileDescriptorProto. -type fileDescGZIP = []byte - -var fileCache sync.Map // map[filePath]fileDescGZIP - -// RegisterFile is called from generated code to register the compressed -// FileDescriptorProto with the file path for a proto source file. -// -// Deprecated: Use protoregistry.GlobalFiles.RegisterFile instead. -func RegisterFile(s filePath, d fileDescGZIP) { - // Decompress the descriptor. - zr, err := gzip.NewReader(bytes.NewReader(d)) - if err != nil { - panic(fmt.Sprintf("proto: invalid compressed file descriptor: %v", err)) - } - b, err := ioutil.ReadAll(zr) - if err != nil { - panic(fmt.Sprintf("proto: invalid compressed file descriptor: %v", err)) - } - - // Construct a protoreflect.FileDescriptor from the raw descriptor. - // Note that DescBuilder.Build automatically registers the constructed - // file descriptor with the v2 registry. - protoimpl.DescBuilder{RawDescriptor: b}.Build() - - // Locally cache the raw descriptor form for the file. - fileCache.Store(s, d) -} - -// FileDescriptor returns the compressed FileDescriptorProto given the file path -// for a proto source file. It returns nil if not found. -// -// Deprecated: Use protoregistry.GlobalFiles.FindFileByPath instead. -func FileDescriptor(s filePath) fileDescGZIP { - if v, ok := fileCache.Load(s); ok { - return v.(fileDescGZIP) - } - - // Find the descriptor in the v2 registry. - var b []byte - if fd, _ := protoregistry.GlobalFiles.FindFileByPath(s); fd != nil { - b, _ = Marshal(protodesc.ToFileDescriptorProto(fd)) - } - - // Locally cache the raw descriptor form for the file. - if len(b) > 0 { - v, _ := fileCache.LoadOrStore(s, protoimpl.X.CompressGZIP(b)) - return v.(fileDescGZIP) - } - return nil -} - -// enumName is the name of an enum. For historical reasons, the enum name is -// neither the full Go name nor the full protobuf name of the enum. -// The name is the dot-separated combination of just the proto package that the -// enum is declared within followed by the Go type name of the generated enum. -type enumName = string // e.g., "my.proto.package.GoMessage_GoEnum" - -// enumsByName maps enum values by name to their numeric counterpart. -type enumsByName = map[string]int32 - -// enumsByNumber maps enum values by number to their name counterpart. -type enumsByNumber = map[int32]string - -var enumCache sync.Map // map[enumName]enumsByName -var numFilesCache sync.Map // map[protoreflect.FullName]int - -// RegisterEnum is called from the generated code to register the mapping of -// enum value names to enum numbers for the enum identified by s. -// -// Deprecated: Use protoregistry.GlobalTypes.RegisterEnum instead. -func RegisterEnum(s enumName, _ enumsByNumber, m enumsByName) { - if _, ok := enumCache.Load(s); ok { - panic("proto: duplicate enum registered: " + s) - } - enumCache.Store(s, m) - - // This does not forward registration to the v2 registry since this API - // lacks sufficient information to construct a complete v2 enum descriptor. -} - -// EnumValueMap returns the mapping from enum value names to enum numbers for -// the enum of the given name. It returns nil if not found. -// -// Deprecated: Use protoregistry.GlobalTypes.FindEnumByName instead. -func EnumValueMap(s enumName) enumsByName { - if v, ok := enumCache.Load(s); ok { - return v.(enumsByName) - } - - // Check whether the cache is stale. If the number of files in the current - // package differs, then it means that some enums may have been recently - // registered upstream that we do not know about. - var protoPkg protoreflect.FullName - if i := strings.LastIndexByte(s, '.'); i >= 0 { - protoPkg = protoreflect.FullName(s[:i]) - } - v, _ := numFilesCache.Load(protoPkg) - numFiles, _ := v.(int) - if protoregistry.GlobalFiles.NumFilesByPackage(protoPkg) == numFiles { - return nil // cache is up-to-date; was not found earlier - } - - // Update the enum cache for all enums declared in the given proto package. - numFiles = 0 - protoregistry.GlobalFiles.RangeFilesByPackage(protoPkg, func(fd protoreflect.FileDescriptor) bool { - walkEnums(fd, func(ed protoreflect.EnumDescriptor) { - name := protoimpl.X.LegacyEnumName(ed) - if _, ok := enumCache.Load(name); !ok { - m := make(enumsByName) - evs := ed.Values() - for i := evs.Len() - 1; i >= 0; i-- { - ev := evs.Get(i) - m[string(ev.Name())] = int32(ev.Number()) - } - enumCache.LoadOrStore(name, m) - } - }) - numFiles++ - return true - }) - numFilesCache.Store(protoPkg, numFiles) - - // Check cache again for enum map. - if v, ok := enumCache.Load(s); ok { - return v.(enumsByName) - } - return nil -} - -// walkEnums recursively walks all enums declared in d. -func walkEnums(d interface { - Enums() protoreflect.EnumDescriptors - Messages() protoreflect.MessageDescriptors -}, f func(protoreflect.EnumDescriptor)) { - eds := d.Enums() - for i := eds.Len() - 1; i >= 0; i-- { - f(eds.Get(i)) - } - mds := d.Messages() - for i := mds.Len() - 1; i >= 0; i-- { - walkEnums(mds.Get(i), f) - } -} - -// messageName is the full name of protobuf message. -type messageName = string - -var messageTypeCache sync.Map // map[messageName]reflect.Type - -// RegisterType is called from generated code to register the message Go type -// for a message of the given name. -// -// Deprecated: Use protoregistry.GlobalTypes.RegisterMessage instead. -func RegisterType(m Message, s messageName) { - mt := protoimpl.X.LegacyMessageTypeOf(m, protoreflect.FullName(s)) - if err := protoregistry.GlobalTypes.RegisterMessage(mt); err != nil { - panic(err) - } - messageTypeCache.Store(s, reflect.TypeOf(m)) -} - -// RegisterMapType is called from generated code to register the Go map type -// for a protobuf message representing a map entry. -// -// Deprecated: Do not use. -func RegisterMapType(m interface{}, s messageName) { - t := reflect.TypeOf(m) - if t.Kind() != reflect.Map { - panic(fmt.Sprintf("invalid map kind: %v", t)) - } - if _, ok := messageTypeCache.Load(s); ok { - panic(fmt.Errorf("proto: duplicate proto message registered: %s", s)) - } - messageTypeCache.Store(s, t) -} - -// MessageType returns the message type for a named message. -// It returns nil if not found. -// -// Deprecated: Use protoregistry.GlobalTypes.FindMessageByName instead. -func MessageType(s messageName) reflect.Type { - if v, ok := messageTypeCache.Load(s); ok { - return v.(reflect.Type) - } - - // Derive the message type from the v2 registry. - var t reflect.Type - if mt, _ := protoregistry.GlobalTypes.FindMessageByName(protoreflect.FullName(s)); mt != nil { - t = messageGoType(mt) - } - - // If we could not get a concrete type, it is possible that it is a - // pseudo-message for a map entry. - if t == nil { - d, _ := protoregistry.GlobalFiles.FindDescriptorByName(protoreflect.FullName(s)) - if md, _ := d.(protoreflect.MessageDescriptor); md != nil && md.IsMapEntry() { - kt := goTypeForField(md.Fields().ByNumber(1)) - vt := goTypeForField(md.Fields().ByNumber(2)) - t = reflect.MapOf(kt, vt) - } - } - - // Locally cache the message type for the given name. - if t != nil { - v, _ := messageTypeCache.LoadOrStore(s, t) - return v.(reflect.Type) - } - return nil -} - -func goTypeForField(fd protoreflect.FieldDescriptor) reflect.Type { - switch k := fd.Kind(); k { - case protoreflect.EnumKind: - if et, _ := protoregistry.GlobalTypes.FindEnumByName(fd.Enum().FullName()); et != nil { - return enumGoType(et) - } - return reflect.TypeOf(protoreflect.EnumNumber(0)) - case protoreflect.MessageKind, protoreflect.GroupKind: - if mt, _ := protoregistry.GlobalTypes.FindMessageByName(fd.Message().FullName()); mt != nil { - return messageGoType(mt) - } - return reflect.TypeOf((*protoreflect.Message)(nil)).Elem() - default: - return reflect.TypeOf(fd.Default().Interface()) - } -} - -func enumGoType(et protoreflect.EnumType) reflect.Type { - return reflect.TypeOf(et.New(0)) -} - -func messageGoType(mt protoreflect.MessageType) reflect.Type { - return reflect.TypeOf(MessageV1(mt.Zero().Interface())) -} - -// MessageName returns the full protobuf name for the given message type. -// -// Deprecated: Use protoreflect.MessageDescriptor.FullName instead. -func MessageName(m Message) messageName { - if m == nil { - return "" - } - if m, ok := m.(interface{ XXX_MessageName() messageName }); ok { - return m.XXX_MessageName() - } - return messageName(protoimpl.X.MessageDescriptorOf(m).FullName()) -} - -// RegisterExtension is called from the generated code to register -// the extension descriptor. -// -// Deprecated: Use protoregistry.GlobalTypes.RegisterExtension instead. -func RegisterExtension(d *ExtensionDesc) { - if err := protoregistry.GlobalTypes.RegisterExtension(d); err != nil { - panic(err) - } -} - -type extensionsByNumber = map[int32]*ExtensionDesc - -var extensionCache sync.Map // map[messageName]extensionsByNumber - -// RegisteredExtensions returns a map of the registered extensions for the -// provided protobuf message, indexed by the extension field number. -// -// Deprecated: Use protoregistry.GlobalTypes.RangeExtensionsByMessage instead. -func RegisteredExtensions(m Message) extensionsByNumber { - // Check whether the cache is stale. If the number of extensions for - // the given message differs, then it means that some extensions were - // recently registered upstream that we do not know about. - s := MessageName(m) - v, _ := extensionCache.Load(s) - xs, _ := v.(extensionsByNumber) - if protoregistry.GlobalTypes.NumExtensionsByMessage(protoreflect.FullName(s)) == len(xs) { - return xs // cache is up-to-date - } - - // Cache is stale, re-compute the extensions map. - xs = make(extensionsByNumber) - protoregistry.GlobalTypes.RangeExtensionsByMessage(protoreflect.FullName(s), func(xt protoreflect.ExtensionType) bool { - if xd, ok := xt.(*ExtensionDesc); ok { - xs[int32(xt.TypeDescriptor().Number())] = xd - } else { - // TODO: This implies that the protoreflect.ExtensionType is a - // custom type not generated by protoc-gen-go. We could try and - // convert the type to an ExtensionDesc. - } - return true - }) - extensionCache.Store(s, xs) - return xs -} diff --git a/vendor/github.com/golang/protobuf/proto/text_decode.go b/vendor/github.com/golang/protobuf/proto/text_decode.go deleted file mode 100644 index 47eb3e445..000000000 --- a/vendor/github.com/golang/protobuf/proto/text_decode.go +++ /dev/null @@ -1,801 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package proto - -import ( - "encoding" - "errors" - "fmt" - "reflect" - "strconv" - "strings" - "unicode/utf8" - - "google.golang.org/protobuf/encoding/prototext" - protoV2 "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/reflect/protoregistry" -) - -const wrapTextUnmarshalV2 = false - -// ParseError is returned by UnmarshalText. -type ParseError struct { - Message string - - // Deprecated: Do not use. - Line, Offset int -} - -func (e *ParseError) Error() string { - if wrapTextUnmarshalV2 { - return e.Message - } - if e.Line == 1 { - return fmt.Sprintf("line 1.%d: %v", e.Offset, e.Message) - } - return fmt.Sprintf("line %d: %v", e.Line, e.Message) -} - -// UnmarshalText parses a proto text formatted string into m. -func UnmarshalText(s string, m Message) error { - if u, ok := m.(encoding.TextUnmarshaler); ok { - return u.UnmarshalText([]byte(s)) - } - - m.Reset() - mi := MessageV2(m) - - if wrapTextUnmarshalV2 { - err := prototext.UnmarshalOptions{ - AllowPartial: true, - }.Unmarshal([]byte(s), mi) - if err != nil { - return &ParseError{Message: err.Error()} - } - return checkRequiredNotSet(mi) - } else { - if err := newTextParser(s).unmarshalMessage(mi.ProtoReflect(), ""); err != nil { - return err - } - return checkRequiredNotSet(mi) - } -} - -type textParser struct { - s string // remaining input - done bool // whether the parsing is finished (success or error) - backed bool // whether back() was called - offset, line int - cur token -} - -type token struct { - value string - err *ParseError - line int // line number - offset int // byte number from start of input, not start of line - unquoted string // the unquoted version of value, if it was a quoted string -} - -func newTextParser(s string) *textParser { - p := new(textParser) - p.s = s - p.line = 1 - p.cur.line = 1 - return p -} - -func (p *textParser) unmarshalMessage(m protoreflect.Message, terminator string) (err error) { - md := m.Descriptor() - fds := md.Fields() - - // A struct is a sequence of "name: value", terminated by one of - // '>' or '}', or the end of the input. A name may also be - // "[extension]" or "[type/url]". - // - // The whole struct can also be an expanded Any message, like: - // [type/url] < ... struct contents ... > - seen := make(map[protoreflect.FieldNumber]bool) - for { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value == terminator { - break - } - if tok.value == "[" { - if err := p.unmarshalExtensionOrAny(m, seen); err != nil { - return err - } - continue - } - - // This is a normal, non-extension field. - name := protoreflect.Name(tok.value) - fd := fds.ByName(name) - switch { - case fd == nil: - gd := fds.ByName(protoreflect.Name(strings.ToLower(string(name)))) - if gd != nil && gd.Kind() == protoreflect.GroupKind && gd.Message().Name() == name { - fd = gd - } - case fd.Kind() == protoreflect.GroupKind && fd.Message().Name() != name: - fd = nil - case fd.IsWeak() && fd.Message().IsPlaceholder(): - fd = nil - } - if fd == nil { - typeName := string(md.FullName()) - if m, ok := m.Interface().(Message); ok { - t := reflect.TypeOf(m) - if t.Kind() == reflect.Ptr { - typeName = t.Elem().String() - } - } - return p.errorf("unknown field name %q in %v", name, typeName) - } - if od := fd.ContainingOneof(); od != nil && m.WhichOneof(od) != nil { - return p.errorf("field '%s' would overwrite already parsed oneof '%s'", name, od.Name()) - } - if fd.Cardinality() != protoreflect.Repeated && seen[fd.Number()] { - return p.errorf("non-repeated field %q was repeated", fd.Name()) - } - seen[fd.Number()] = true - - // Consume any colon. - if err := p.checkForColon(fd); err != nil { - return err - } - - // Parse into the field. - v := m.Get(fd) - if !m.Has(fd) && (fd.IsList() || fd.IsMap() || fd.Message() != nil) { - v = m.Mutable(fd) - } - if v, err = p.unmarshalValue(v, fd); err != nil { - return err - } - m.Set(fd, v) - - if err := p.consumeOptionalSeparator(); err != nil { - return err - } - } - return nil -} - -func (p *textParser) unmarshalExtensionOrAny(m protoreflect.Message, seen map[protoreflect.FieldNumber]bool) error { - name, err := p.consumeExtensionOrAnyName() - if err != nil { - return err - } - - // If it contains a slash, it's an Any type URL. - if slashIdx := strings.LastIndex(name, "/"); slashIdx >= 0 { - tok := p.next() - if tok.err != nil { - return tok.err - } - // consume an optional colon - if tok.value == ":" { - tok = p.next() - if tok.err != nil { - return tok.err - } - } - - var terminator string - switch tok.value { - case "<": - terminator = ">" - case "{": - terminator = "}" - default: - return p.errorf("expected '{' or '<', found %q", tok.value) - } - - mt, err := protoregistry.GlobalTypes.FindMessageByURL(name) - if err != nil { - return p.errorf("unrecognized message %q in google.protobuf.Any", name[slashIdx+len("/"):]) - } - m2 := mt.New() - if err := p.unmarshalMessage(m2, terminator); err != nil { - return err - } - b, err := protoV2.Marshal(m2.Interface()) - if err != nil { - return p.errorf("failed to marshal message of type %q: %v", name[slashIdx+len("/"):], err) - } - - urlFD := m.Descriptor().Fields().ByName("type_url") - valFD := m.Descriptor().Fields().ByName("value") - if seen[urlFD.Number()] { - return p.errorf("Any message unpacked multiple times, or %q already set", urlFD.Name()) - } - if seen[valFD.Number()] { - return p.errorf("Any message unpacked multiple times, or %q already set", valFD.Name()) - } - m.Set(urlFD, protoreflect.ValueOfString(name)) - m.Set(valFD, protoreflect.ValueOfBytes(b)) - seen[urlFD.Number()] = true - seen[valFD.Number()] = true - return nil - } - - xname := protoreflect.FullName(name) - xt, _ := protoregistry.GlobalTypes.FindExtensionByName(xname) - if xt == nil && isMessageSet(m.Descriptor()) { - xt, _ = protoregistry.GlobalTypes.FindExtensionByName(xname.Append("message_set_extension")) - } - if xt == nil { - return p.errorf("unrecognized extension %q", name) - } - fd := xt.TypeDescriptor() - if fd.ContainingMessage().FullName() != m.Descriptor().FullName() { - return p.errorf("extension field %q does not extend message %q", name, m.Descriptor().FullName()) - } - - if err := p.checkForColon(fd); err != nil { - return err - } - - v := m.Get(fd) - if !m.Has(fd) && (fd.IsList() || fd.IsMap() || fd.Message() != nil) { - v = m.Mutable(fd) - } - v, err = p.unmarshalValue(v, fd) - if err != nil { - return err - } - m.Set(fd, v) - return p.consumeOptionalSeparator() -} - -func (p *textParser) unmarshalValue(v protoreflect.Value, fd protoreflect.FieldDescriptor) (protoreflect.Value, error) { - tok := p.next() - if tok.err != nil { - return v, tok.err - } - if tok.value == "" { - return v, p.errorf("unexpected EOF") - } - - switch { - case fd.IsList(): - lv := v.List() - var err error - if tok.value == "[" { - // Repeated field with list notation, like [1,2,3]. - for { - vv := lv.NewElement() - vv, err = p.unmarshalSingularValue(vv, fd) - if err != nil { - return v, err - } - lv.Append(vv) - - tok := p.next() - if tok.err != nil { - return v, tok.err - } - if tok.value == "]" { - break - } - if tok.value != "," { - return v, p.errorf("Expected ']' or ',' found %q", tok.value) - } - } - return v, nil - } - - // One value of the repeated field. - p.back() - vv := lv.NewElement() - vv, err = p.unmarshalSingularValue(vv, fd) - if err != nil { - return v, err - } - lv.Append(vv) - return v, nil - case fd.IsMap(): - // The map entry should be this sequence of tokens: - // < key : KEY value : VALUE > - // However, implementations may omit key or value, and technically - // we should support them in any order. - var terminator string - switch tok.value { - case "<": - terminator = ">" - case "{": - terminator = "}" - default: - return v, p.errorf("expected '{' or '<', found %q", tok.value) - } - - keyFD := fd.MapKey() - valFD := fd.MapValue() - - mv := v.Map() - kv := keyFD.Default() - vv := mv.NewValue() - for { - tok := p.next() - if tok.err != nil { - return v, tok.err - } - if tok.value == terminator { - break - } - var err error - switch tok.value { - case "key": - if err := p.consumeToken(":"); err != nil { - return v, err - } - if kv, err = p.unmarshalSingularValue(kv, keyFD); err != nil { - return v, err - } - if err := p.consumeOptionalSeparator(); err != nil { - return v, err - } - case "value": - if err := p.checkForColon(valFD); err != nil { - return v, err - } - if vv, err = p.unmarshalSingularValue(vv, valFD); err != nil { - return v, err - } - if err := p.consumeOptionalSeparator(); err != nil { - return v, err - } - default: - p.back() - return v, p.errorf(`expected "key", "value", or %q, found %q`, terminator, tok.value) - } - } - mv.Set(kv.MapKey(), vv) - return v, nil - default: - p.back() - return p.unmarshalSingularValue(v, fd) - } -} - -func (p *textParser) unmarshalSingularValue(v protoreflect.Value, fd protoreflect.FieldDescriptor) (protoreflect.Value, error) { - tok := p.next() - if tok.err != nil { - return v, tok.err - } - if tok.value == "" { - return v, p.errorf("unexpected EOF") - } - - switch fd.Kind() { - case protoreflect.BoolKind: - switch tok.value { - case "true", "1", "t", "True": - return protoreflect.ValueOfBool(true), nil - case "false", "0", "f", "False": - return protoreflect.ValueOfBool(false), nil - } - case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind: - if x, err := strconv.ParseInt(tok.value, 0, 32); err == nil { - return protoreflect.ValueOfInt32(int32(x)), nil - } - - // The C++ parser accepts large positive hex numbers that uses - // two's complement arithmetic to represent negative numbers. - // This feature is here for backwards compatibility with C++. - if strings.HasPrefix(tok.value, "0x") { - if x, err := strconv.ParseUint(tok.value, 0, 32); err == nil { - return protoreflect.ValueOfInt32(int32(-(int64(^x) + 1))), nil - } - } - case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind: - if x, err := strconv.ParseInt(tok.value, 0, 64); err == nil { - return protoreflect.ValueOfInt64(int64(x)), nil - } - - // The C++ parser accepts large positive hex numbers that uses - // two's complement arithmetic to represent negative numbers. - // This feature is here for backwards compatibility with C++. - if strings.HasPrefix(tok.value, "0x") { - if x, err := strconv.ParseUint(tok.value, 0, 64); err == nil { - return protoreflect.ValueOfInt64(int64(-(int64(^x) + 1))), nil - } - } - case protoreflect.Uint32Kind, protoreflect.Fixed32Kind: - if x, err := strconv.ParseUint(tok.value, 0, 32); err == nil { - return protoreflect.ValueOfUint32(uint32(x)), nil - } - case protoreflect.Uint64Kind, protoreflect.Fixed64Kind: - if x, err := strconv.ParseUint(tok.value, 0, 64); err == nil { - return protoreflect.ValueOfUint64(uint64(x)), nil - } - case protoreflect.FloatKind: - // Ignore 'f' for compatibility with output generated by C++, - // but don't remove 'f' when the value is "-inf" or "inf". - v := tok.value - if strings.HasSuffix(v, "f") && v != "-inf" && v != "inf" { - v = v[:len(v)-len("f")] - } - if x, err := strconv.ParseFloat(v, 32); err == nil { - return protoreflect.ValueOfFloat32(float32(x)), nil - } - case protoreflect.DoubleKind: - // Ignore 'f' for compatibility with output generated by C++, - // but don't remove 'f' when the value is "-inf" or "inf". - v := tok.value - if strings.HasSuffix(v, "f") && v != "-inf" && v != "inf" { - v = v[:len(v)-len("f")] - } - if x, err := strconv.ParseFloat(v, 64); err == nil { - return protoreflect.ValueOfFloat64(float64(x)), nil - } - case protoreflect.StringKind: - if isQuote(tok.value[0]) { - return protoreflect.ValueOfString(tok.unquoted), nil - } - case protoreflect.BytesKind: - if isQuote(tok.value[0]) { - return protoreflect.ValueOfBytes([]byte(tok.unquoted)), nil - } - case protoreflect.EnumKind: - if x, err := strconv.ParseInt(tok.value, 0, 32); err == nil { - return protoreflect.ValueOfEnum(protoreflect.EnumNumber(x)), nil - } - vd := fd.Enum().Values().ByName(protoreflect.Name(tok.value)) - if vd != nil { - return protoreflect.ValueOfEnum(vd.Number()), nil - } - case protoreflect.MessageKind, protoreflect.GroupKind: - var terminator string - switch tok.value { - case "{": - terminator = "}" - case "<": - terminator = ">" - default: - return v, p.errorf("expected '{' or '<', found %q", tok.value) - } - err := p.unmarshalMessage(v.Message(), terminator) - return v, err - default: - panic(fmt.Sprintf("invalid kind %v", fd.Kind())) - } - return v, p.errorf("invalid %v: %v", fd.Kind(), tok.value) -} - -// Consume a ':' from the input stream (if the next token is a colon), -// returning an error if a colon is needed but not present. -func (p *textParser) checkForColon(fd protoreflect.FieldDescriptor) *ParseError { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value != ":" { - if fd.Message() == nil { - return p.errorf("expected ':', found %q", tok.value) - } - p.back() - } - return nil -} - -// consumeExtensionOrAnyName consumes an extension name or an Any type URL and -// the following ']'. It returns the name or URL consumed. -func (p *textParser) consumeExtensionOrAnyName() (string, error) { - tok := p.next() - if tok.err != nil { - return "", tok.err - } - - // If extension name or type url is quoted, it's a single token. - if len(tok.value) > 2 && isQuote(tok.value[0]) && tok.value[len(tok.value)-1] == tok.value[0] { - name, err := unquoteC(tok.value[1:len(tok.value)-1], rune(tok.value[0])) - if err != nil { - return "", err - } - return name, p.consumeToken("]") - } - - // Consume everything up to "]" - var parts []string - for tok.value != "]" { - parts = append(parts, tok.value) - tok = p.next() - if tok.err != nil { - return "", p.errorf("unrecognized type_url or extension name: %s", tok.err) - } - if p.done && tok.value != "]" { - return "", p.errorf("unclosed type_url or extension name") - } - } - return strings.Join(parts, ""), nil -} - -// consumeOptionalSeparator consumes an optional semicolon or comma. -// It is used in unmarshalMessage to provide backward compatibility. -func (p *textParser) consumeOptionalSeparator() error { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value != ";" && tok.value != "," { - p.back() - } - return nil -} - -func (p *textParser) errorf(format string, a ...interface{}) *ParseError { - pe := &ParseError{fmt.Sprintf(format, a...), p.cur.line, p.cur.offset} - p.cur.err = pe - p.done = true - return pe -} - -func (p *textParser) skipWhitespace() { - i := 0 - for i < len(p.s) && (isWhitespace(p.s[i]) || p.s[i] == '#') { - if p.s[i] == '#' { - // comment; skip to end of line or input - for i < len(p.s) && p.s[i] != '\n' { - i++ - } - if i == len(p.s) { - break - } - } - if p.s[i] == '\n' { - p.line++ - } - i++ - } - p.offset += i - p.s = p.s[i:len(p.s)] - if len(p.s) == 0 { - p.done = true - } -} - -func (p *textParser) advance() { - // Skip whitespace - p.skipWhitespace() - if p.done { - return - } - - // Start of non-whitespace - p.cur.err = nil - p.cur.offset, p.cur.line = p.offset, p.line - p.cur.unquoted = "" - switch p.s[0] { - case '<', '>', '{', '}', ':', '[', ']', ';', ',', '/': - // Single symbol - p.cur.value, p.s = p.s[0:1], p.s[1:len(p.s)] - case '"', '\'': - // Quoted string - i := 1 - for i < len(p.s) && p.s[i] != p.s[0] && p.s[i] != '\n' { - if p.s[i] == '\\' && i+1 < len(p.s) { - // skip escaped char - i++ - } - i++ - } - if i >= len(p.s) || p.s[i] != p.s[0] { - p.errorf("unmatched quote") - return - } - unq, err := unquoteC(p.s[1:i], rune(p.s[0])) - if err != nil { - p.errorf("invalid quoted string %s: %v", p.s[0:i+1], err) - return - } - p.cur.value, p.s = p.s[0:i+1], p.s[i+1:len(p.s)] - p.cur.unquoted = unq - default: - i := 0 - for i < len(p.s) && isIdentOrNumberChar(p.s[i]) { - i++ - } - if i == 0 { - p.errorf("unexpected byte %#x", p.s[0]) - return - } - p.cur.value, p.s = p.s[0:i], p.s[i:len(p.s)] - } - p.offset += len(p.cur.value) -} - -// Back off the parser by one token. Can only be done between calls to next(). -// It makes the next advance() a no-op. -func (p *textParser) back() { p.backed = true } - -// Advances the parser and returns the new current token. -func (p *textParser) next() *token { - if p.backed || p.done { - p.backed = false - return &p.cur - } - p.advance() - if p.done { - p.cur.value = "" - } else if len(p.cur.value) > 0 && isQuote(p.cur.value[0]) { - // Look for multiple quoted strings separated by whitespace, - // and concatenate them. - cat := p.cur - for { - p.skipWhitespace() - if p.done || !isQuote(p.s[0]) { - break - } - p.advance() - if p.cur.err != nil { - return &p.cur - } - cat.value += " " + p.cur.value - cat.unquoted += p.cur.unquoted - } - p.done = false // parser may have seen EOF, but we want to return cat - p.cur = cat - } - return &p.cur -} - -func (p *textParser) consumeToken(s string) error { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value != s { - p.back() - return p.errorf("expected %q, found %q", s, tok.value) - } - return nil -} - -var errBadUTF8 = errors.New("proto: bad UTF-8") - -func unquoteC(s string, quote rune) (string, error) { - // This is based on C++'s tokenizer.cc. - // Despite its name, this is *not* parsing C syntax. - // For instance, "\0" is an invalid quoted string. - - // Avoid allocation in trivial cases. - simple := true - for _, r := range s { - if r == '\\' || r == quote { - simple = false - break - } - } - if simple { - return s, nil - } - - buf := make([]byte, 0, 3*len(s)/2) - for len(s) > 0 { - r, n := utf8.DecodeRuneInString(s) - if r == utf8.RuneError && n == 1 { - return "", errBadUTF8 - } - s = s[n:] - if r != '\\' { - if r < utf8.RuneSelf { - buf = append(buf, byte(r)) - } else { - buf = append(buf, string(r)...) - } - continue - } - - ch, tail, err := unescape(s) - if err != nil { - return "", err - } - buf = append(buf, ch...) - s = tail - } - return string(buf), nil -} - -func unescape(s string) (ch string, tail string, err error) { - r, n := utf8.DecodeRuneInString(s) - if r == utf8.RuneError && n == 1 { - return "", "", errBadUTF8 - } - s = s[n:] - switch r { - case 'a': - return "\a", s, nil - case 'b': - return "\b", s, nil - case 'f': - return "\f", s, nil - case 'n': - return "\n", s, nil - case 'r': - return "\r", s, nil - case 't': - return "\t", s, nil - case 'v': - return "\v", s, nil - case '?': - return "?", s, nil // trigraph workaround - case '\'', '"', '\\': - return string(r), s, nil - case '0', '1', '2', '3', '4', '5', '6', '7': - if len(s) < 2 { - return "", "", fmt.Errorf(`\%c requires 2 following digits`, r) - } - ss := string(r) + s[:2] - s = s[2:] - i, err := strconv.ParseUint(ss, 8, 8) - if err != nil { - return "", "", fmt.Errorf(`\%s contains non-octal digits`, ss) - } - return string([]byte{byte(i)}), s, nil - case 'x', 'X', 'u', 'U': - var n int - switch r { - case 'x', 'X': - n = 2 - case 'u': - n = 4 - case 'U': - n = 8 - } - if len(s) < n { - return "", "", fmt.Errorf(`\%c requires %d following digits`, r, n) - } - ss := s[:n] - s = s[n:] - i, err := strconv.ParseUint(ss, 16, 64) - if err != nil { - return "", "", fmt.Errorf(`\%c%s contains non-hexadecimal digits`, r, ss) - } - if r == 'x' || r == 'X' { - return string([]byte{byte(i)}), s, nil - } - if i > utf8.MaxRune { - return "", "", fmt.Errorf(`\%c%s is not a valid Unicode code point`, r, ss) - } - return string(rune(i)), s, nil - } - return "", "", fmt.Errorf(`unknown escape \%c`, r) -} - -func isIdentOrNumberChar(c byte) bool { - switch { - case 'A' <= c && c <= 'Z', 'a' <= c && c <= 'z': - return true - case '0' <= c && c <= '9': - return true - } - switch c { - case '-', '+', '.', '_': - return true - } - return false -} - -func isWhitespace(c byte) bool { - switch c { - case ' ', '\t', '\n', '\r': - return true - } - return false -} - -func isQuote(c byte) bool { - switch c { - case '"', '\'': - return true - } - return false -} diff --git a/vendor/github.com/golang/protobuf/proto/text_encode.go b/vendor/github.com/golang/protobuf/proto/text_encode.go deleted file mode 100644 index a31134eeb..000000000 --- a/vendor/github.com/golang/protobuf/proto/text_encode.go +++ /dev/null @@ -1,560 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package proto - -import ( - "bytes" - "encoding" - "fmt" - "io" - "math" - "sort" - "strings" - - "google.golang.org/protobuf/encoding/prototext" - "google.golang.org/protobuf/encoding/protowire" - "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/reflect/protoregistry" -) - -const wrapTextMarshalV2 = false - -// TextMarshaler is a configurable text format marshaler. -type TextMarshaler struct { - Compact bool // use compact text format (one line) - ExpandAny bool // expand google.protobuf.Any messages of known types -} - -// Marshal writes the proto text format of m to w. -func (tm *TextMarshaler) Marshal(w io.Writer, m Message) error { - b, err := tm.marshal(m) - if len(b) > 0 { - if _, err := w.Write(b); err != nil { - return err - } - } - return err -} - -// Text returns a proto text formatted string of m. -func (tm *TextMarshaler) Text(m Message) string { - b, _ := tm.marshal(m) - return string(b) -} - -func (tm *TextMarshaler) marshal(m Message) ([]byte, error) { - mr := MessageReflect(m) - if mr == nil || !mr.IsValid() { - return []byte(""), nil - } - - if wrapTextMarshalV2 { - if m, ok := m.(encoding.TextMarshaler); ok { - return m.MarshalText() - } - - opts := prototext.MarshalOptions{ - AllowPartial: true, - EmitUnknown: true, - } - if !tm.Compact { - opts.Indent = " " - } - if !tm.ExpandAny { - opts.Resolver = (*protoregistry.Types)(nil) - } - return opts.Marshal(mr.Interface()) - } else { - w := &textWriter{ - compact: tm.Compact, - expandAny: tm.ExpandAny, - complete: true, - } - - if m, ok := m.(encoding.TextMarshaler); ok { - b, err := m.MarshalText() - if err != nil { - return nil, err - } - w.Write(b) - return w.buf, nil - } - - err := w.writeMessage(mr) - return w.buf, err - } -} - -var ( - defaultTextMarshaler = TextMarshaler{} - compactTextMarshaler = TextMarshaler{Compact: true} -) - -// MarshalText writes the proto text format of m to w. -func MarshalText(w io.Writer, m Message) error { return defaultTextMarshaler.Marshal(w, m) } - -// MarshalTextString returns a proto text formatted string of m. -func MarshalTextString(m Message) string { return defaultTextMarshaler.Text(m) } - -// CompactText writes the compact proto text format of m to w. -func CompactText(w io.Writer, m Message) error { return compactTextMarshaler.Marshal(w, m) } - -// CompactTextString returns a compact proto text formatted string of m. -func CompactTextString(m Message) string { return compactTextMarshaler.Text(m) } - -var ( - newline = []byte("\n") - endBraceNewline = []byte("}\n") - posInf = []byte("inf") - negInf = []byte("-inf") - nan = []byte("nan") -) - -// textWriter is an io.Writer that tracks its indentation level. -type textWriter struct { - compact bool // same as TextMarshaler.Compact - expandAny bool // same as TextMarshaler.ExpandAny - complete bool // whether the current position is a complete line - indent int // indentation level; never negative - buf []byte -} - -func (w *textWriter) Write(p []byte) (n int, _ error) { - newlines := bytes.Count(p, newline) - if newlines == 0 { - if !w.compact && w.complete { - w.writeIndent() - } - w.buf = append(w.buf, p...) - w.complete = false - return len(p), nil - } - - frags := bytes.SplitN(p, newline, newlines+1) - if w.compact { - for i, frag := range frags { - if i > 0 { - w.buf = append(w.buf, ' ') - n++ - } - w.buf = append(w.buf, frag...) - n += len(frag) - } - return n, nil - } - - for i, frag := range frags { - if w.complete { - w.writeIndent() - } - w.buf = append(w.buf, frag...) - n += len(frag) - if i+1 < len(frags) { - w.buf = append(w.buf, '\n') - n++ - } - } - w.complete = len(frags[len(frags)-1]) == 0 - return n, nil -} - -func (w *textWriter) WriteByte(c byte) error { - if w.compact && c == '\n' { - c = ' ' - } - if !w.compact && w.complete { - w.writeIndent() - } - w.buf = append(w.buf, c) - w.complete = c == '\n' - return nil -} - -func (w *textWriter) writeName(fd protoreflect.FieldDescriptor) { - if !w.compact && w.complete { - w.writeIndent() - } - w.complete = false - - if fd.Kind() != protoreflect.GroupKind { - w.buf = append(w.buf, fd.Name()...) - w.WriteByte(':') - } else { - // Use message type name for group field name. - w.buf = append(w.buf, fd.Message().Name()...) - } - - if !w.compact { - w.WriteByte(' ') - } -} - -func requiresQuotes(u string) bool { - // When type URL contains any characters except [0-9A-Za-z./\-]*, it must be quoted. - for _, ch := range u { - switch { - case ch == '.' || ch == '/' || ch == '_': - continue - case '0' <= ch && ch <= '9': - continue - case 'A' <= ch && ch <= 'Z': - continue - case 'a' <= ch && ch <= 'z': - continue - default: - return true - } - } - return false -} - -// writeProto3Any writes an expanded google.protobuf.Any message. -// -// It returns (false, nil) if sv value can't be unmarshaled (e.g. because -// required messages are not linked in). -// -// It returns (true, error) when sv was written in expanded format or an error -// was encountered. -func (w *textWriter) writeProto3Any(m protoreflect.Message) (bool, error) { - md := m.Descriptor() - fdURL := md.Fields().ByName("type_url") - fdVal := md.Fields().ByName("value") - - url := m.Get(fdURL).String() - mt, err := protoregistry.GlobalTypes.FindMessageByURL(url) - if err != nil { - return false, nil - } - - b := m.Get(fdVal).Bytes() - m2 := mt.New() - if err := proto.Unmarshal(b, m2.Interface()); err != nil { - return false, nil - } - w.Write([]byte("[")) - if requiresQuotes(url) { - w.writeQuotedString(url) - } else { - w.Write([]byte(url)) - } - if w.compact { - w.Write([]byte("]:<")) - } else { - w.Write([]byte("]: <\n")) - w.indent++ - } - if err := w.writeMessage(m2); err != nil { - return true, err - } - if w.compact { - w.Write([]byte("> ")) - } else { - w.indent-- - w.Write([]byte(">\n")) - } - return true, nil -} - -func (w *textWriter) writeMessage(m protoreflect.Message) error { - md := m.Descriptor() - if w.expandAny && md.FullName() == "google.protobuf.Any" { - if canExpand, err := w.writeProto3Any(m); canExpand { - return err - } - } - - fds := md.Fields() - for i := 0; i < fds.Len(); { - fd := fds.Get(i) - if od := fd.ContainingOneof(); od != nil { - fd = m.WhichOneof(od) - i += od.Fields().Len() - } else { - i++ - } - if fd == nil || !m.Has(fd) { - continue - } - - switch { - case fd.IsList(): - lv := m.Get(fd).List() - for j := 0; j < lv.Len(); j++ { - w.writeName(fd) - v := lv.Get(j) - if err := w.writeSingularValue(v, fd); err != nil { - return err - } - w.WriteByte('\n') - } - case fd.IsMap(): - kfd := fd.MapKey() - vfd := fd.MapValue() - mv := m.Get(fd).Map() - - type entry struct{ key, val protoreflect.Value } - var entries []entry - mv.Range(func(k protoreflect.MapKey, v protoreflect.Value) bool { - entries = append(entries, entry{k.Value(), v}) - return true - }) - sort.Slice(entries, func(i, j int) bool { - switch kfd.Kind() { - case protoreflect.BoolKind: - return !entries[i].key.Bool() && entries[j].key.Bool() - case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind, protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind: - return entries[i].key.Int() < entries[j].key.Int() - case protoreflect.Uint32Kind, protoreflect.Fixed32Kind, protoreflect.Uint64Kind, protoreflect.Fixed64Kind: - return entries[i].key.Uint() < entries[j].key.Uint() - case protoreflect.StringKind: - return entries[i].key.String() < entries[j].key.String() - default: - panic("invalid kind") - } - }) - for _, entry := range entries { - w.writeName(fd) - w.WriteByte('<') - if !w.compact { - w.WriteByte('\n') - } - w.indent++ - w.writeName(kfd) - if err := w.writeSingularValue(entry.key, kfd); err != nil { - return err - } - w.WriteByte('\n') - w.writeName(vfd) - if err := w.writeSingularValue(entry.val, vfd); err != nil { - return err - } - w.WriteByte('\n') - w.indent-- - w.WriteByte('>') - w.WriteByte('\n') - } - default: - w.writeName(fd) - if err := w.writeSingularValue(m.Get(fd), fd); err != nil { - return err - } - w.WriteByte('\n') - } - } - - if b := m.GetUnknown(); len(b) > 0 { - w.writeUnknownFields(b) - } - return w.writeExtensions(m) -} - -func (w *textWriter) writeSingularValue(v protoreflect.Value, fd protoreflect.FieldDescriptor) error { - switch fd.Kind() { - case protoreflect.FloatKind, protoreflect.DoubleKind: - switch vf := v.Float(); { - case math.IsInf(vf, +1): - w.Write(posInf) - case math.IsInf(vf, -1): - w.Write(negInf) - case math.IsNaN(vf): - w.Write(nan) - default: - fmt.Fprint(w, v.Interface()) - } - case protoreflect.StringKind: - // NOTE: This does not validate UTF-8 for historical reasons. - w.writeQuotedString(string(v.String())) - case protoreflect.BytesKind: - w.writeQuotedString(string(v.Bytes())) - case protoreflect.MessageKind, protoreflect.GroupKind: - var bra, ket byte = '<', '>' - if fd.Kind() == protoreflect.GroupKind { - bra, ket = '{', '}' - } - w.WriteByte(bra) - if !w.compact { - w.WriteByte('\n') - } - w.indent++ - m := v.Message() - if m2, ok := m.Interface().(encoding.TextMarshaler); ok { - b, err := m2.MarshalText() - if err != nil { - return err - } - w.Write(b) - } else { - w.writeMessage(m) - } - w.indent-- - w.WriteByte(ket) - case protoreflect.EnumKind: - if ev := fd.Enum().Values().ByNumber(v.Enum()); ev != nil { - fmt.Fprint(w, ev.Name()) - } else { - fmt.Fprint(w, v.Enum()) - } - default: - fmt.Fprint(w, v.Interface()) - } - return nil -} - -// writeQuotedString writes a quoted string in the protocol buffer text format. -func (w *textWriter) writeQuotedString(s string) { - w.WriteByte('"') - for i := 0; i < len(s); i++ { - switch c := s[i]; c { - case '\n': - w.buf = append(w.buf, `\n`...) - case '\r': - w.buf = append(w.buf, `\r`...) - case '\t': - w.buf = append(w.buf, `\t`...) - case '"': - w.buf = append(w.buf, `\"`...) - case '\\': - w.buf = append(w.buf, `\\`...) - default: - if isPrint := c >= 0x20 && c < 0x7f; isPrint { - w.buf = append(w.buf, c) - } else { - w.buf = append(w.buf, fmt.Sprintf(`\%03o`, c)...) - } - } - } - w.WriteByte('"') -} - -func (w *textWriter) writeUnknownFields(b []byte) { - if !w.compact { - fmt.Fprintf(w, "/* %d unknown bytes */\n", len(b)) - } - - for len(b) > 0 { - num, wtyp, n := protowire.ConsumeTag(b) - if n < 0 { - return - } - b = b[n:] - - if wtyp == protowire.EndGroupType { - w.indent-- - w.Write(endBraceNewline) - continue - } - fmt.Fprint(w, num) - if wtyp != protowire.StartGroupType { - w.WriteByte(':') - } - if !w.compact || wtyp == protowire.StartGroupType { - w.WriteByte(' ') - } - switch wtyp { - case protowire.VarintType: - v, n := protowire.ConsumeVarint(b) - if n < 0 { - return - } - b = b[n:] - fmt.Fprint(w, v) - case protowire.Fixed32Type: - v, n := protowire.ConsumeFixed32(b) - if n < 0 { - return - } - b = b[n:] - fmt.Fprint(w, v) - case protowire.Fixed64Type: - v, n := protowire.ConsumeFixed64(b) - if n < 0 { - return - } - b = b[n:] - fmt.Fprint(w, v) - case protowire.BytesType: - v, n := protowire.ConsumeBytes(b) - if n < 0 { - return - } - b = b[n:] - fmt.Fprintf(w, "%q", v) - case protowire.StartGroupType: - w.WriteByte('{') - w.indent++ - default: - fmt.Fprintf(w, "/* unknown wire type %d */", wtyp) - } - w.WriteByte('\n') - } -} - -// writeExtensions writes all the extensions in m. -func (w *textWriter) writeExtensions(m protoreflect.Message) error { - md := m.Descriptor() - if md.ExtensionRanges().Len() == 0 { - return nil - } - - type ext struct { - desc protoreflect.FieldDescriptor - val protoreflect.Value - } - var exts []ext - m.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool { - if fd.IsExtension() { - exts = append(exts, ext{fd, v}) - } - return true - }) - sort.Slice(exts, func(i, j int) bool { - return exts[i].desc.Number() < exts[j].desc.Number() - }) - - for _, ext := range exts { - // For message set, use the name of the message as the extension name. - name := string(ext.desc.FullName()) - if isMessageSet(ext.desc.ContainingMessage()) { - name = strings.TrimSuffix(name, ".message_set_extension") - } - - if !ext.desc.IsList() { - if err := w.writeSingularExtension(name, ext.val, ext.desc); err != nil { - return err - } - } else { - lv := ext.val.List() - for i := 0; i < lv.Len(); i++ { - if err := w.writeSingularExtension(name, lv.Get(i), ext.desc); err != nil { - return err - } - } - } - } - return nil -} - -func (w *textWriter) writeSingularExtension(name string, v protoreflect.Value, fd protoreflect.FieldDescriptor) error { - fmt.Fprintf(w, "[%s]:", name) - if !w.compact { - w.WriteByte(' ') - } - if err := w.writeSingularValue(v, fd); err != nil { - return err - } - w.WriteByte('\n') - return nil -} - -func (w *textWriter) writeIndent() { - if !w.complete { - return - } - for i := 0; i < w.indent*2; i++ { - w.buf = append(w.buf, ' ') - } - w.complete = false -} diff --git a/vendor/github.com/golang/protobuf/proto/wire.go b/vendor/github.com/golang/protobuf/proto/wire.go deleted file mode 100644 index d7c28da5a..000000000 --- a/vendor/github.com/golang/protobuf/proto/wire.go +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package proto - -import ( - protoV2 "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/runtime/protoiface" -) - -// Size returns the size in bytes of the wire-format encoding of m. -func Size(m Message) int { - if m == nil { - return 0 - } - mi := MessageV2(m) - return protoV2.Size(mi) -} - -// Marshal returns the wire-format encoding of m. -func Marshal(m Message) ([]byte, error) { - b, err := marshalAppend(nil, m, false) - if b == nil { - b = zeroBytes - } - return b, err -} - -var zeroBytes = make([]byte, 0, 0) - -func marshalAppend(buf []byte, m Message, deterministic bool) ([]byte, error) { - if m == nil { - return nil, ErrNil - } - mi := MessageV2(m) - nbuf, err := protoV2.MarshalOptions{ - Deterministic: deterministic, - AllowPartial: true, - }.MarshalAppend(buf, mi) - if err != nil { - return buf, err - } - if len(buf) == len(nbuf) { - if !mi.ProtoReflect().IsValid() { - return buf, ErrNil - } - } - return nbuf, checkRequiredNotSet(mi) -} - -// Unmarshal parses a wire-format message in b and places the decoded results in m. -// -// Unmarshal resets m before starting to unmarshal, so any existing data in m is always -// removed. Use UnmarshalMerge to preserve and append to existing data. -func Unmarshal(b []byte, m Message) error { - m.Reset() - return UnmarshalMerge(b, m) -} - -// UnmarshalMerge parses a wire-format message in b and places the decoded results in m. -func UnmarshalMerge(b []byte, m Message) error { - mi := MessageV2(m) - out, err := protoV2.UnmarshalOptions{ - AllowPartial: true, - Merge: true, - }.UnmarshalState(protoiface.UnmarshalInput{ - Buf: b, - Message: mi.ProtoReflect(), - }) - if err != nil { - return err - } - if out.Flags&protoiface.UnmarshalInitialized > 0 { - return nil - } - return checkRequiredNotSet(mi) -} diff --git a/vendor/github.com/golang/protobuf/proto/wrappers.go b/vendor/github.com/golang/protobuf/proto/wrappers.go deleted file mode 100644 index 398e34859..000000000 --- a/vendor/github.com/golang/protobuf/proto/wrappers.go +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package proto - -// Bool stores v in a new bool value and returns a pointer to it. -func Bool(v bool) *bool { return &v } - -// Int stores v in a new int32 value and returns a pointer to it. -// -// Deprecated: Use Int32 instead. -func Int(v int) *int32 { return Int32(int32(v)) } - -// Int32 stores v in a new int32 value and returns a pointer to it. -func Int32(v int32) *int32 { return &v } - -// Int64 stores v in a new int64 value and returns a pointer to it. -func Int64(v int64) *int64 { return &v } - -// Uint32 stores v in a new uint32 value and returns a pointer to it. -func Uint32(v uint32) *uint32 { return &v } - -// Uint64 stores v in a new uint64 value and returns a pointer to it. -func Uint64(v uint64) *uint64 { return &v } - -// Float32 stores v in a new float32 value and returns a pointer to it. -func Float32(v float32) *float32 { return &v } - -// Float64 stores v in a new float64 value and returns a pointer to it. -func Float64(v float64) *float64 { return &v } - -// String stores v in a new string value and returns a pointer to it. -func String(v string) *string { return &v } diff --git a/vendor/github.com/golang/protobuf/ptypes/any.go b/vendor/github.com/golang/protobuf/ptypes/any.go deleted file mode 100644 index 85f9f5736..000000000 --- a/vendor/github.com/golang/protobuf/ptypes/any.go +++ /dev/null @@ -1,179 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ptypes - -import ( - "fmt" - "strings" - - "github.com/golang/protobuf/proto" - "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/reflect/protoregistry" - - anypb "github.com/golang/protobuf/ptypes/any" -) - -const urlPrefix = "type.googleapis.com/" - -// AnyMessageName returns the message name contained in an anypb.Any message. -// Most type assertions should use the Is function instead. -// -// Deprecated: Call the any.MessageName method instead. -func AnyMessageName(any *anypb.Any) (string, error) { - name, err := anyMessageName(any) - return string(name), err -} -func anyMessageName(any *anypb.Any) (protoreflect.FullName, error) { - if any == nil { - return "", fmt.Errorf("message is nil") - } - name := protoreflect.FullName(any.TypeUrl) - if i := strings.LastIndex(any.TypeUrl, "/"); i >= 0 { - name = name[i+len("/"):] - } - if !name.IsValid() { - return "", fmt.Errorf("message type url %q is invalid", any.TypeUrl) - } - return name, nil -} - -// MarshalAny marshals the given message m into an anypb.Any message. -// -// Deprecated: Call the anypb.New function instead. -func MarshalAny(m proto.Message) (*anypb.Any, error) { - switch dm := m.(type) { - case DynamicAny: - m = dm.Message - case *DynamicAny: - if dm == nil { - return nil, proto.ErrNil - } - m = dm.Message - } - b, err := proto.Marshal(m) - if err != nil { - return nil, err - } - return &anypb.Any{TypeUrl: urlPrefix + proto.MessageName(m), Value: b}, nil -} - -// Empty returns a new message of the type specified in an anypb.Any message. -// It returns protoregistry.NotFound if the corresponding message type could not -// be resolved in the global registry. -// -// Deprecated: Use protoregistry.GlobalTypes.FindMessageByName instead -// to resolve the message name and create a new instance of it. -func Empty(any *anypb.Any) (proto.Message, error) { - name, err := anyMessageName(any) - if err != nil { - return nil, err - } - mt, err := protoregistry.GlobalTypes.FindMessageByName(name) - if err != nil { - return nil, err - } - return proto.MessageV1(mt.New().Interface()), nil -} - -// UnmarshalAny unmarshals the encoded value contained in the anypb.Any message -// into the provided message m. It returns an error if the target message -// does not match the type in the Any message or if an unmarshal error occurs. -// -// The target message m may be a *DynamicAny message. If the underlying message -// type could not be resolved, then this returns protoregistry.NotFound. -// -// Deprecated: Call the any.UnmarshalTo method instead. -func UnmarshalAny(any *anypb.Any, m proto.Message) error { - if dm, ok := m.(*DynamicAny); ok { - if dm.Message == nil { - var err error - dm.Message, err = Empty(any) - if err != nil { - return err - } - } - m = dm.Message - } - - anyName, err := AnyMessageName(any) - if err != nil { - return err - } - msgName := proto.MessageName(m) - if anyName != msgName { - return fmt.Errorf("mismatched message type: got %q want %q", anyName, msgName) - } - return proto.Unmarshal(any.Value, m) -} - -// Is reports whether the Any message contains a message of the specified type. -// -// Deprecated: Call the any.MessageIs method instead. -func Is(any *anypb.Any, m proto.Message) bool { - if any == nil || m == nil { - return false - } - name := proto.MessageName(m) - if !strings.HasSuffix(any.TypeUrl, name) { - return false - } - return len(any.TypeUrl) == len(name) || any.TypeUrl[len(any.TypeUrl)-len(name)-1] == '/' -} - -// DynamicAny is a value that can be passed to UnmarshalAny to automatically -// allocate a proto.Message for the type specified in an anypb.Any message. -// The allocated message is stored in the embedded proto.Message. -// -// Example: -// var x ptypes.DynamicAny -// if err := ptypes.UnmarshalAny(a, &x); err != nil { ... } -// fmt.Printf("unmarshaled message: %v", x.Message) -// -// Deprecated: Use the any.UnmarshalNew method instead to unmarshal -// the any message contents into a new instance of the underlying message. -type DynamicAny struct{ proto.Message } - -func (m DynamicAny) String() string { - if m.Message == nil { - return "" - } - return m.Message.String() -} -func (m DynamicAny) Reset() { - if m.Message == nil { - return - } - m.Message.Reset() -} -func (m DynamicAny) ProtoMessage() { - return -} -func (m DynamicAny) ProtoReflect() protoreflect.Message { - if m.Message == nil { - return nil - } - return dynamicAny{proto.MessageReflect(m.Message)} -} - -type dynamicAny struct{ protoreflect.Message } - -func (m dynamicAny) Type() protoreflect.MessageType { - return dynamicAnyType{m.Message.Type()} -} -func (m dynamicAny) New() protoreflect.Message { - return dynamicAnyType{m.Message.Type()}.New() -} -func (m dynamicAny) Interface() protoreflect.ProtoMessage { - return DynamicAny{proto.MessageV1(m.Message.Interface())} -} - -type dynamicAnyType struct{ protoreflect.MessageType } - -func (t dynamicAnyType) New() protoreflect.Message { - return dynamicAny{t.MessageType.New()} -} -func (t dynamicAnyType) Zero() protoreflect.Message { - return dynamicAny{t.MessageType.Zero()} -} diff --git a/vendor/github.com/golang/protobuf/ptypes/any/any.pb.go b/vendor/github.com/golang/protobuf/ptypes/any/any.pb.go deleted file mode 100644 index 0ef27d33d..000000000 --- a/vendor/github.com/golang/protobuf/ptypes/any/any.pb.go +++ /dev/null @@ -1,62 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: github.com/golang/protobuf/ptypes/any/any.proto - -package any - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - anypb "google.golang.org/protobuf/types/known/anypb" - reflect "reflect" -) - -// Symbols defined in public import of google/protobuf/any.proto. - -type Any = anypb.Any - -var File_github_com_golang_protobuf_ptypes_any_any_proto protoreflect.FileDescriptor - -var file_github_com_golang_protobuf_ptypes_any_any_proto_rawDesc = []byte{ - 0x0a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, - 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, - 0x70, 0x65, 0x73, 0x2f, 0x61, 0x6e, 0x79, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x42, 0x2b, 0x5a, 0x29, - 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, - 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, - 0x73, 0x2f, 0x61, 0x6e, 0x79, 0x3b, 0x61, 0x6e, 0x79, 0x50, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, -} - -var file_github_com_golang_protobuf_ptypes_any_any_proto_goTypes = []interface{}{} -var file_github_com_golang_protobuf_ptypes_any_any_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_github_com_golang_protobuf_ptypes_any_any_proto_init() } -func file_github_com_golang_protobuf_ptypes_any_any_proto_init() { - if File_github_com_golang_protobuf_ptypes_any_any_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_github_com_golang_protobuf_ptypes_any_any_proto_rawDesc, - NumEnums: 0, - NumMessages: 0, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_github_com_golang_protobuf_ptypes_any_any_proto_goTypes, - DependencyIndexes: file_github_com_golang_protobuf_ptypes_any_any_proto_depIdxs, - }.Build() - File_github_com_golang_protobuf_ptypes_any_any_proto = out.File - file_github_com_golang_protobuf_ptypes_any_any_proto_rawDesc = nil - file_github_com_golang_protobuf_ptypes_any_any_proto_goTypes = nil - file_github_com_golang_protobuf_ptypes_any_any_proto_depIdxs = nil -} diff --git a/vendor/github.com/golang/protobuf/ptypes/doc.go b/vendor/github.com/golang/protobuf/ptypes/doc.go deleted file mode 100644 index d3c33259d..000000000 --- a/vendor/github.com/golang/protobuf/ptypes/doc.go +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package ptypes provides functionality for interacting with well-known types. -// -// Deprecated: Well-known types have specialized functionality directly -// injected into the generated packages for each message type. -// See the deprecation notice for each function for the suggested alternative. -package ptypes diff --git a/vendor/github.com/golang/protobuf/ptypes/duration.go b/vendor/github.com/golang/protobuf/ptypes/duration.go deleted file mode 100644 index b2b55dd85..000000000 --- a/vendor/github.com/golang/protobuf/ptypes/duration.go +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ptypes - -import ( - "errors" - "fmt" - "time" - - durationpb "github.com/golang/protobuf/ptypes/duration" -) - -// Range of google.protobuf.Duration as specified in duration.proto. -// This is about 10,000 years in seconds. -const ( - maxSeconds = int64(10000 * 365.25 * 24 * 60 * 60) - minSeconds = -maxSeconds -) - -// Duration converts a durationpb.Duration to a time.Duration. -// Duration returns an error if dur is invalid or overflows a time.Duration. -// -// Deprecated: Call the dur.AsDuration and dur.CheckValid methods instead. -func Duration(dur *durationpb.Duration) (time.Duration, error) { - if err := validateDuration(dur); err != nil { - return 0, err - } - d := time.Duration(dur.Seconds) * time.Second - if int64(d/time.Second) != dur.Seconds { - return 0, fmt.Errorf("duration: %v is out of range for time.Duration", dur) - } - if dur.Nanos != 0 { - d += time.Duration(dur.Nanos) * time.Nanosecond - if (d < 0) != (dur.Nanos < 0) { - return 0, fmt.Errorf("duration: %v is out of range for time.Duration", dur) - } - } - return d, nil -} - -// DurationProto converts a time.Duration to a durationpb.Duration. -// -// Deprecated: Call the durationpb.New function instead. -func DurationProto(d time.Duration) *durationpb.Duration { - nanos := d.Nanoseconds() - secs := nanos / 1e9 - nanos -= secs * 1e9 - return &durationpb.Duration{ - Seconds: int64(secs), - Nanos: int32(nanos), - } -} - -// validateDuration determines whether the durationpb.Duration is valid -// according to the definition in google/protobuf/duration.proto. -// A valid durpb.Duration may still be too large to fit into a time.Duration -// Note that the range of durationpb.Duration is about 10,000 years, -// while the range of time.Duration is about 290 years. -func validateDuration(dur *durationpb.Duration) error { - if dur == nil { - return errors.New("duration: nil Duration") - } - if dur.Seconds < minSeconds || dur.Seconds > maxSeconds { - return fmt.Errorf("duration: %v: seconds out of range", dur) - } - if dur.Nanos <= -1e9 || dur.Nanos >= 1e9 { - return fmt.Errorf("duration: %v: nanos out of range", dur) - } - // Seconds and Nanos must have the same sign, unless d.Nanos is zero. - if (dur.Seconds < 0 && dur.Nanos > 0) || (dur.Seconds > 0 && dur.Nanos < 0) { - return fmt.Errorf("duration: %v: seconds and nanos have different signs", dur) - } - return nil -} diff --git a/vendor/github.com/golang/protobuf/ptypes/duration/duration.pb.go b/vendor/github.com/golang/protobuf/ptypes/duration/duration.pb.go deleted file mode 100644 index d0079ee3e..000000000 --- a/vendor/github.com/golang/protobuf/ptypes/duration/duration.pb.go +++ /dev/null @@ -1,63 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: github.com/golang/protobuf/ptypes/duration/duration.proto - -package duration - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - durationpb "google.golang.org/protobuf/types/known/durationpb" - reflect "reflect" -) - -// Symbols defined in public import of google/protobuf/duration.proto. - -type Duration = durationpb.Duration - -var File_github_com_golang_protobuf_ptypes_duration_duration_proto protoreflect.FileDescriptor - -var file_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDesc = []byte{ - 0x0a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, - 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, - 0x70, 0x65, 0x73, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x64, 0x75, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x42, 0x35, 0x5a, 0x33, 0x67, - 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, - 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, 0x73, - 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x50, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var file_github_com_golang_protobuf_ptypes_duration_duration_proto_goTypes = []interface{}{} -var file_github_com_golang_protobuf_ptypes_duration_duration_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_github_com_golang_protobuf_ptypes_duration_duration_proto_init() } -func file_github_com_golang_protobuf_ptypes_duration_duration_proto_init() { - if File_github_com_golang_protobuf_ptypes_duration_duration_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDesc, - NumEnums: 0, - NumMessages: 0, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_github_com_golang_protobuf_ptypes_duration_duration_proto_goTypes, - DependencyIndexes: file_github_com_golang_protobuf_ptypes_duration_duration_proto_depIdxs, - }.Build() - File_github_com_golang_protobuf_ptypes_duration_duration_proto = out.File - file_github_com_golang_protobuf_ptypes_duration_duration_proto_rawDesc = nil - file_github_com_golang_protobuf_ptypes_duration_duration_proto_goTypes = nil - file_github_com_golang_protobuf_ptypes_duration_duration_proto_depIdxs = nil -} diff --git a/vendor/github.com/golang/protobuf/ptypes/timestamp.go b/vendor/github.com/golang/protobuf/ptypes/timestamp.go deleted file mode 100644 index 8368a3f70..000000000 --- a/vendor/github.com/golang/protobuf/ptypes/timestamp.go +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ptypes - -import ( - "errors" - "fmt" - "time" - - timestamppb "github.com/golang/protobuf/ptypes/timestamp" -) - -// Range of google.protobuf.Duration as specified in timestamp.proto. -const ( - // Seconds field of the earliest valid Timestamp. - // This is time.Date(1, 1, 1, 0, 0, 0, 0, time.UTC).Unix(). - minValidSeconds = -62135596800 - // Seconds field just after the latest valid Timestamp. - // This is time.Date(10000, 1, 1, 0, 0, 0, 0, time.UTC).Unix(). - maxValidSeconds = 253402300800 -) - -// Timestamp converts a timestamppb.Timestamp to a time.Time. -// It returns an error if the argument is invalid. -// -// Unlike most Go functions, if Timestamp returns an error, the first return -// value is not the zero time.Time. Instead, it is the value obtained from the -// time.Unix function when passed the contents of the Timestamp, in the UTC -// locale. This may or may not be a meaningful time; many invalid Timestamps -// do map to valid time.Times. -// -// A nil Timestamp returns an error. The first return value in that case is -// undefined. -// -// Deprecated: Call the ts.AsTime and ts.CheckValid methods instead. -func Timestamp(ts *timestamppb.Timestamp) (time.Time, error) { - // Don't return the zero value on error, because corresponds to a valid - // timestamp. Instead return whatever time.Unix gives us. - var t time.Time - if ts == nil { - t = time.Unix(0, 0).UTC() // treat nil like the empty Timestamp - } else { - t = time.Unix(ts.Seconds, int64(ts.Nanos)).UTC() - } - return t, validateTimestamp(ts) -} - -// TimestampNow returns a google.protobuf.Timestamp for the current time. -// -// Deprecated: Call the timestamppb.Now function instead. -func TimestampNow() *timestamppb.Timestamp { - ts, err := TimestampProto(time.Now()) - if err != nil { - panic("ptypes: time.Now() out of Timestamp range") - } - return ts -} - -// TimestampProto converts the time.Time to a google.protobuf.Timestamp proto. -// It returns an error if the resulting Timestamp is invalid. -// -// Deprecated: Call the timestamppb.New function instead. -func TimestampProto(t time.Time) (*timestamppb.Timestamp, error) { - ts := ×tamppb.Timestamp{ - Seconds: t.Unix(), - Nanos: int32(t.Nanosecond()), - } - if err := validateTimestamp(ts); err != nil { - return nil, err - } - return ts, nil -} - -// TimestampString returns the RFC 3339 string for valid Timestamps. -// For invalid Timestamps, it returns an error message in parentheses. -// -// Deprecated: Call the ts.AsTime method instead, -// followed by a call to the Format method on the time.Time value. -func TimestampString(ts *timestamppb.Timestamp) string { - t, err := Timestamp(ts) - if err != nil { - return fmt.Sprintf("(%v)", err) - } - return t.Format(time.RFC3339Nano) -} - -// validateTimestamp determines whether a Timestamp is valid. -// A valid timestamp represents a time in the range [0001-01-01, 10000-01-01) -// and has a Nanos field in the range [0, 1e9). -// -// If the Timestamp is valid, validateTimestamp returns nil. -// Otherwise, it returns an error that describes the problem. -// -// Every valid Timestamp can be represented by a time.Time, -// but the converse is not true. -func validateTimestamp(ts *timestamppb.Timestamp) error { - if ts == nil { - return errors.New("timestamp: nil Timestamp") - } - if ts.Seconds < minValidSeconds { - return fmt.Errorf("timestamp: %v before 0001-01-01", ts) - } - if ts.Seconds >= maxValidSeconds { - return fmt.Errorf("timestamp: %v after 10000-01-01", ts) - } - if ts.Nanos < 0 || ts.Nanos >= 1e9 { - return fmt.Errorf("timestamp: %v: nanos not in range [0, 1e9)", ts) - } - return nil -} diff --git a/vendor/github.com/golang/protobuf/ptypes/timestamp/timestamp.pb.go b/vendor/github.com/golang/protobuf/ptypes/timestamp/timestamp.pb.go deleted file mode 100644 index a76f80760..000000000 --- a/vendor/github.com/golang/protobuf/ptypes/timestamp/timestamp.pb.go +++ /dev/null @@ -1,64 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: github.com/golang/protobuf/ptypes/timestamp/timestamp.proto - -package timestamp - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - timestamppb "google.golang.org/protobuf/types/known/timestamppb" - reflect "reflect" -) - -// Symbols defined in public import of google/protobuf/timestamp.proto. - -type Timestamp = timestamppb.Timestamp - -var File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto protoreflect.FileDescriptor - -var file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDesc = []byte{ - 0x0a, 0x3b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, - 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, - 0x70, 0x65, 0x73, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2f, 0x74, 0x69, - 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, - 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x42, 0x37, - 0x5a, 0x35, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, - 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, - 0x70, 0x65, 0x73, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x3b, 0x74, 0x69, - 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x50, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, -} - -var file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_goTypes = []interface{}{} -var file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_init() } -func file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_init() { - if File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDesc, - NumEnums: 0, - NumMessages: 0, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_goTypes, - DependencyIndexes: file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_depIdxs, - }.Build() - File_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto = out.File - file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_rawDesc = nil - file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_goTypes = nil - file_github_com_golang_protobuf_ptypes_timestamp_timestamp_proto_depIdxs = nil -} diff --git a/vendor/github.com/google/gnostic/LICENSE b/vendor/github.com/google/gnostic/LICENSE deleted file mode 100644 index 6b0b1270f..000000000 --- a/vendor/github.com/google/gnostic/LICENSE +++ /dev/null @@ -1,203 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - diff --git a/vendor/github.com/google/gnostic/compiler/README.md b/vendor/github.com/google/gnostic/compiler/README.md deleted file mode 100644 index ee9783d23..000000000 --- a/vendor/github.com/google/gnostic/compiler/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# Compiler support code - -This directory contains compiler support code used by Gnostic and Gnostic -extensions. diff --git a/vendor/github.com/google/gnostic/compiler/context.go b/vendor/github.com/google/gnostic/compiler/context.go deleted file mode 100644 index 1bfe96121..000000000 --- a/vendor/github.com/google/gnostic/compiler/context.go +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2017 Google LLC. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package compiler - -import ( - yaml "gopkg.in/yaml.v3" -) - -// Context contains state of the compiler as it traverses a document. -type Context struct { - Parent *Context - Name string - Node *yaml.Node - ExtensionHandlers *[]ExtensionHandler -} - -// NewContextWithExtensions returns a new object representing the compiler state -func NewContextWithExtensions(name string, node *yaml.Node, parent *Context, extensionHandlers *[]ExtensionHandler) *Context { - return &Context{Name: name, Node: node, Parent: parent, ExtensionHandlers: extensionHandlers} -} - -// NewContext returns a new object representing the compiler state -func NewContext(name string, node *yaml.Node, parent *Context) *Context { - if parent != nil { - return &Context{Name: name, Node: node, Parent: parent, ExtensionHandlers: parent.ExtensionHandlers} - } - return &Context{Name: name, Parent: parent, ExtensionHandlers: nil} -} - -// Description returns a text description of the compiler state -func (context *Context) Description() string { - name := context.Name - if context.Parent != nil { - name = context.Parent.Description() + "." + name - } - return name -} diff --git a/vendor/github.com/google/gnostic/compiler/error.go b/vendor/github.com/google/gnostic/compiler/error.go deleted file mode 100644 index 6f40515d6..000000000 --- a/vendor/github.com/google/gnostic/compiler/error.go +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2017 Google LLC. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package compiler - -import "fmt" - -// Error represents compiler errors and their location in the document. -type Error struct { - Context *Context - Message string -} - -// NewError creates an Error. -func NewError(context *Context, message string) *Error { - return &Error{Context: context, Message: message} -} - -func (err *Error) locationDescription() string { - if err.Context.Node != nil { - return fmt.Sprintf("[%d,%d] %s", err.Context.Node.Line, err.Context.Node.Column, err.Context.Description()) - } - return err.Context.Description() -} - -// Error returns the string value of an Error. -func (err *Error) Error() string { - if err.Context == nil { - return err.Message - } - return err.locationDescription() + " " + err.Message -} - -// ErrorGroup is a container for groups of Error values. -type ErrorGroup struct { - Errors []error -} - -// NewErrorGroupOrNil returns a new ErrorGroup for a slice of errors or nil if the slice is empty. -func NewErrorGroupOrNil(errors []error) error { - if len(errors) == 0 { - return nil - } else if len(errors) == 1 { - return errors[0] - } else { - return &ErrorGroup{Errors: errors} - } -} - -func (group *ErrorGroup) Error() string { - result := "" - for i, err := range group.Errors { - if i > 0 { - result += "\n" - } - result += err.Error() - } - return result -} diff --git a/vendor/github.com/google/gnostic/compiler/extensions.go b/vendor/github.com/google/gnostic/compiler/extensions.go deleted file mode 100644 index 5b5a916d2..000000000 --- a/vendor/github.com/google/gnostic/compiler/extensions.go +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2017 Google LLC. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package compiler - -import ( - "bytes" - "fmt" - "os/exec" - "strings" - - "github.com/golang/protobuf/proto" - "github.com/golang/protobuf/ptypes/any" - yaml "gopkg.in/yaml.v3" - - extensions "github.com/google/gnostic/extensions" -) - -// ExtensionHandler describes a binary that is called by the compiler to handle specification extensions. -type ExtensionHandler struct { - Name string -} - -// CallExtension calls a binary extension handler. -func CallExtension(context *Context, in *yaml.Node, extensionName string) (handled bool, response *any.Any, err error) { - if context == nil || context.ExtensionHandlers == nil { - return false, nil, nil - } - handled = false - for _, handler := range *(context.ExtensionHandlers) { - response, err = handler.handle(in, extensionName) - if response == nil { - continue - } else { - handled = true - break - } - } - return handled, response, err -} - -func (extensionHandlers *ExtensionHandler) handle(in *yaml.Node, extensionName string) (*any.Any, error) { - if extensionHandlers.Name != "" { - yamlData, _ := yaml.Marshal(in) - request := &extensions.ExtensionHandlerRequest{ - CompilerVersion: &extensions.Version{ - Major: 0, - Minor: 1, - Patch: 0, - }, - Wrapper: &extensions.Wrapper{ - Version: "unknown", // TODO: set this to the type/version of spec being parsed. - Yaml: string(yamlData), - ExtensionName: extensionName, - }, - } - requestBytes, _ := proto.Marshal(request) - cmd := exec.Command(extensionHandlers.Name) - cmd.Stdin = bytes.NewReader(requestBytes) - output, err := cmd.Output() - if err != nil { - return nil, err - } - response := &extensions.ExtensionHandlerResponse{} - err = proto.Unmarshal(output, response) - if err != nil || !response.Handled { - return nil, err - } - if len(response.Errors) != 0 { - return nil, fmt.Errorf("Errors when parsing: %+v for field %s by vendor extension handler %s. Details %+v", in, extensionName, extensionHandlers.Name, strings.Join(response.Errors, ",")) - } - return response.Value, nil - } - return nil, nil -} diff --git a/vendor/github.com/google/gnostic/compiler/helpers.go b/vendor/github.com/google/gnostic/compiler/helpers.go deleted file mode 100644 index 97ffaa513..000000000 --- a/vendor/github.com/google/gnostic/compiler/helpers.go +++ /dev/null @@ -1,397 +0,0 @@ -// Copyright 2017 Google LLC. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package compiler - -import ( - "fmt" - "regexp" - "sort" - "strconv" - - "gopkg.in/yaml.v3" - - "github.com/google/gnostic/jsonschema" -) - -// compiler helper functions, usually called from generated code - -// UnpackMap gets a *yaml.Node if possible. -func UnpackMap(in *yaml.Node) (*yaml.Node, bool) { - if in == nil { - return nil, false - } - return in, true -} - -// SortedKeysForMap returns the sorted keys of a yamlv2.MapSlice. -func SortedKeysForMap(m *yaml.Node) []string { - keys := make([]string, 0) - if m.Kind == yaml.MappingNode { - for i := 0; i < len(m.Content); i += 2 { - keys = append(keys, m.Content[i].Value) - } - } - sort.Strings(keys) - return keys -} - -// MapHasKey returns true if a yamlv2.MapSlice contains a specified key. -func MapHasKey(m *yaml.Node, key string) bool { - if m == nil { - return false - } - if m.Kind == yaml.MappingNode { - for i := 0; i < len(m.Content); i += 2 { - itemKey := m.Content[i].Value - if key == itemKey { - return true - } - } - } - return false -} - -// MapValueForKey gets the value of a map value for a specified key. -func MapValueForKey(m *yaml.Node, key string) *yaml.Node { - if m == nil { - return nil - } - if m.Kind == yaml.MappingNode { - for i := 0; i < len(m.Content); i += 2 { - itemKey := m.Content[i].Value - if key == itemKey { - return m.Content[i+1] - } - } - } - return nil -} - -// ConvertInterfaceArrayToStringArray converts an array of interfaces to an array of strings, if possible. -func ConvertInterfaceArrayToStringArray(interfaceArray []interface{}) []string { - stringArray := make([]string, 0) - for _, item := range interfaceArray { - v, ok := item.(string) - if ok { - stringArray = append(stringArray, v) - } - } - return stringArray -} - -// SequenceNodeForNode returns a node if it is a SequenceNode. -func SequenceNodeForNode(node *yaml.Node) (*yaml.Node, bool) { - if node.Kind != yaml.SequenceNode { - return nil, false - } - return node, true -} - -// BoolForScalarNode returns the bool value of a node. -func BoolForScalarNode(node *yaml.Node) (bool, bool) { - if node == nil { - return false, false - } - if node.Kind == yaml.DocumentNode { - return BoolForScalarNode(node.Content[0]) - } - if node.Kind != yaml.ScalarNode { - return false, false - } - if node.Tag != "!!bool" { - return false, false - } - v, err := strconv.ParseBool(node.Value) - if err != nil { - return false, false - } - return v, true -} - -// IntForScalarNode returns the integer value of a node. -func IntForScalarNode(node *yaml.Node) (int64, bool) { - if node == nil { - return 0, false - } - if node.Kind == yaml.DocumentNode { - return IntForScalarNode(node.Content[0]) - } - if node.Kind != yaml.ScalarNode { - return 0, false - } - if node.Tag != "!!int" { - return 0, false - } - v, err := strconv.ParseInt(node.Value, 10, 64) - if err != nil { - return 0, false - } - return v, true -} - -// FloatForScalarNode returns the float value of a node. -func FloatForScalarNode(node *yaml.Node) (float64, bool) { - if node == nil { - return 0.0, false - } - if node.Kind == yaml.DocumentNode { - return FloatForScalarNode(node.Content[0]) - } - if node.Kind != yaml.ScalarNode { - return 0.0, false - } - if (node.Tag != "!!int") && (node.Tag != "!!float") { - return 0.0, false - } - v, err := strconv.ParseFloat(node.Value, 64) - if err != nil { - return 0.0, false - } - return v, true -} - -// StringForScalarNode returns the string value of a node. -func StringForScalarNode(node *yaml.Node) (string, bool) { - if node == nil { - return "", false - } - if node.Kind == yaml.DocumentNode { - return StringForScalarNode(node.Content[0]) - } - switch node.Kind { - case yaml.ScalarNode: - switch node.Tag { - case "!!int": - return node.Value, true - case "!!str": - return node.Value, true - case "!!timestamp": - return node.Value, true - case "!!null": - return "", true - default: - return "", false - } - default: - return "", false - } -} - -// StringArrayForSequenceNode converts a sequence node to an array of strings, if possible. -func StringArrayForSequenceNode(node *yaml.Node) []string { - stringArray := make([]string, 0) - for _, item := range node.Content { - v, ok := StringForScalarNode(item) - if ok { - stringArray = append(stringArray, v) - } - } - return stringArray -} - -// MissingKeysInMap identifies which keys from a list of required keys are not in a map. -func MissingKeysInMap(m *yaml.Node, requiredKeys []string) []string { - missingKeys := make([]string, 0) - for _, k := range requiredKeys { - if !MapHasKey(m, k) { - missingKeys = append(missingKeys, k) - } - } - return missingKeys -} - -// InvalidKeysInMap returns keys in a map that don't match a list of allowed keys and patterns. -func InvalidKeysInMap(m *yaml.Node, allowedKeys []string, allowedPatterns []*regexp.Regexp) []string { - invalidKeys := make([]string, 0) - if m == nil || m.Kind != yaml.MappingNode { - return invalidKeys - } - for i := 0; i < len(m.Content); i += 2 { - key := m.Content[i].Value - found := false - // does the key match an allowed key? - for _, allowedKey := range allowedKeys { - if key == allowedKey { - found = true - break - } - } - if !found { - // does the key match an allowed pattern? - for _, allowedPattern := range allowedPatterns { - if allowedPattern.MatchString(key) { - found = true - break - } - } - if !found { - invalidKeys = append(invalidKeys, key) - } - } - } - return invalidKeys -} - -// NewNullNode creates a new Null node. -func NewNullNode() *yaml.Node { - node := &yaml.Node{ - Kind: yaml.ScalarNode, - Tag: "!!null", - } - return node -} - -// NewMappingNode creates a new Mapping node. -func NewMappingNode() *yaml.Node { - return &yaml.Node{ - Kind: yaml.MappingNode, - Content: make([]*yaml.Node, 0), - } -} - -// NewSequenceNode creates a new Sequence node. -func NewSequenceNode() *yaml.Node { - node := &yaml.Node{ - Kind: yaml.SequenceNode, - Content: make([]*yaml.Node, 0), - } - return node -} - -// NewScalarNodeForString creates a new node to hold a string. -func NewScalarNodeForString(s string) *yaml.Node { - return &yaml.Node{ - Kind: yaml.ScalarNode, - Tag: "!!str", - Value: s, - } -} - -// NewSequenceNodeForStringArray creates a new node to hold an array of strings. -func NewSequenceNodeForStringArray(strings []string) *yaml.Node { - node := &yaml.Node{ - Kind: yaml.SequenceNode, - Content: make([]*yaml.Node, 0), - } - for _, s := range strings { - node.Content = append(node.Content, NewScalarNodeForString(s)) - } - return node -} - -// NewScalarNodeForBool creates a new node to hold a bool. -func NewScalarNodeForBool(b bool) *yaml.Node { - return &yaml.Node{ - Kind: yaml.ScalarNode, - Tag: "!!bool", - Value: fmt.Sprintf("%t", b), - } -} - -// NewScalarNodeForFloat creates a new node to hold a float. -func NewScalarNodeForFloat(f float64) *yaml.Node { - return &yaml.Node{ - Kind: yaml.ScalarNode, - Tag: "!!float", - Value: fmt.Sprintf("%g", f), - } -} - -// NewScalarNodeForInt creates a new node to hold an integer. -func NewScalarNodeForInt(i int64) *yaml.Node { - return &yaml.Node{ - Kind: yaml.ScalarNode, - Tag: "!!int", - Value: fmt.Sprintf("%d", i), - } -} - -// PluralProperties returns the string "properties" pluralized. -func PluralProperties(count int) string { - if count == 1 { - return "property" - } - return "properties" -} - -// StringArrayContainsValue returns true if a string array contains a specified value. -func StringArrayContainsValue(array []string, value string) bool { - for _, item := range array { - if item == value { - return true - } - } - return false -} - -// StringArrayContainsValues returns true if a string array contains all of a list of specified values. -func StringArrayContainsValues(array []string, values []string) bool { - for _, value := range values { - if !StringArrayContainsValue(array, value) { - return false - } - } - return true -} - -// StringValue returns the string value of an item. -func StringValue(item interface{}) (value string, ok bool) { - value, ok = item.(string) - if ok { - return value, ok - } - intValue, ok := item.(int) - if ok { - return strconv.Itoa(intValue), true - } - return "", false -} - -// Description returns a human-readable represention of an item. -func Description(item interface{}) string { - value, ok := item.(*yaml.Node) - if ok { - return jsonschema.Render(value) - } - return fmt.Sprintf("%+v", item) -} - -// Display returns a description of a node for use in error messages. -func Display(node *yaml.Node) string { - switch node.Kind { - case yaml.ScalarNode: - switch node.Tag { - case "!!str": - return fmt.Sprintf("%s (string)", node.Value) - } - } - return fmt.Sprintf("%+v (%T)", node, node) -} - -// Marshal creates a yaml version of a structure in our preferred style -func Marshal(in *yaml.Node) []byte { - clearStyle(in) - //bytes, _ := yaml.Marshal(&yaml.Node{Kind: yaml.DocumentNode, Content: []*yaml.Node{in}}) - bytes, _ := yaml.Marshal(in) - - return bytes -} - -func clearStyle(node *yaml.Node) { - node.Style = 0 - for _, c := range node.Content { - clearStyle(c) - } -} diff --git a/vendor/github.com/google/gnostic/compiler/main.go b/vendor/github.com/google/gnostic/compiler/main.go deleted file mode 100644 index ce9fcc456..000000000 --- a/vendor/github.com/google/gnostic/compiler/main.go +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2017 Google LLC. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package compiler provides support functions to generated compiler code. -package compiler diff --git a/vendor/github.com/google/gnostic/compiler/reader.go b/vendor/github.com/google/gnostic/compiler/reader.go deleted file mode 100644 index be0e8b40c..000000000 --- a/vendor/github.com/google/gnostic/compiler/reader.go +++ /dev/null @@ -1,307 +0,0 @@ -// Copyright 2017 Google LLC. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package compiler - -import ( - "fmt" - "io/ioutil" - "log" - "net/http" - "net/url" - "path/filepath" - "strings" - "sync" - - yaml "gopkg.in/yaml.v3" -) - -var verboseReader = false - -var fileCache map[string][]byte -var infoCache map[string]*yaml.Node - -var fileCacheEnable = true -var infoCacheEnable = true - -// These locks are used to synchronize accesses to the fileCache and infoCache -// maps (above). They are global state and can throw thread-related errors -// when modified from separate goroutines. The general strategy is to protect -// all public functions in this file with mutex Lock() calls. As a result, to -// avoid deadlock, these public functions should not call other public -// functions, so some public functions have private equivalents. -// In the future, we might consider replacing the maps with sync.Map and -// eliminating these mutexes. -var fileCacheMutex sync.Mutex -var infoCacheMutex sync.Mutex - -func initializeFileCache() { - if fileCache == nil { - fileCache = make(map[string][]byte, 0) - } -} - -func initializeInfoCache() { - if infoCache == nil { - infoCache = make(map[string]*yaml.Node, 0) - } -} - -// EnableFileCache turns on file caching. -func EnableFileCache() { - fileCacheMutex.Lock() - defer fileCacheMutex.Unlock() - fileCacheEnable = true -} - -// EnableInfoCache turns on parsed info caching. -func EnableInfoCache() { - infoCacheMutex.Lock() - defer infoCacheMutex.Unlock() - infoCacheEnable = true -} - -// DisableFileCache turns off file caching. -func DisableFileCache() { - fileCacheMutex.Lock() - defer fileCacheMutex.Unlock() - fileCacheEnable = false -} - -// DisableInfoCache turns off parsed info caching. -func DisableInfoCache() { - infoCacheMutex.Lock() - defer infoCacheMutex.Unlock() - infoCacheEnable = false -} - -// RemoveFromFileCache removes an entry from the file cache. -func RemoveFromFileCache(fileurl string) { - fileCacheMutex.Lock() - defer fileCacheMutex.Unlock() - if !fileCacheEnable { - return - } - initializeFileCache() - delete(fileCache, fileurl) -} - -// RemoveFromInfoCache removes an entry from the info cache. -func RemoveFromInfoCache(filename string) { - infoCacheMutex.Lock() - defer infoCacheMutex.Unlock() - if !infoCacheEnable { - return - } - initializeInfoCache() - delete(infoCache, filename) -} - -// GetInfoCache returns the info cache map. -func GetInfoCache() map[string]*yaml.Node { - infoCacheMutex.Lock() - defer infoCacheMutex.Unlock() - if infoCache == nil { - initializeInfoCache() - } - return infoCache -} - -// ClearFileCache clears the file cache. -func ClearFileCache() { - fileCacheMutex.Lock() - defer fileCacheMutex.Unlock() - fileCache = make(map[string][]byte, 0) -} - -// ClearInfoCache clears the info cache. -func ClearInfoCache() { - infoCacheMutex.Lock() - defer infoCacheMutex.Unlock() - infoCache = make(map[string]*yaml.Node) -} - -// ClearCaches clears all caches. -func ClearCaches() { - ClearFileCache() - ClearInfoCache() -} - -// FetchFile gets a specified file from the local filesystem or a remote location. -func FetchFile(fileurl string) ([]byte, error) { - fileCacheMutex.Lock() - defer fileCacheMutex.Unlock() - return fetchFile(fileurl) -} - -func fetchFile(fileurl string) ([]byte, error) { - var bytes []byte - initializeFileCache() - if fileCacheEnable { - bytes, ok := fileCache[fileurl] - if ok { - if verboseReader { - log.Printf("Cache hit %s", fileurl) - } - return bytes, nil - } - if verboseReader { - log.Printf("Fetching %s", fileurl) - } - } - response, err := http.Get(fileurl) - if err != nil { - return nil, err - } - defer response.Body.Close() - if response.StatusCode != 200 { - return nil, fmt.Errorf("Error downloading %s: %s", fileurl, response.Status) - } - bytes, err = ioutil.ReadAll(response.Body) - if fileCacheEnable && err == nil { - fileCache[fileurl] = bytes - } - return bytes, err -} - -// ReadBytesForFile reads the bytes of a file. -func ReadBytesForFile(filename string) ([]byte, error) { - fileCacheMutex.Lock() - defer fileCacheMutex.Unlock() - return readBytesForFile(filename) -} - -func readBytesForFile(filename string) ([]byte, error) { - // is the filename a url? - fileurl, _ := url.Parse(filename) - if fileurl.Scheme != "" { - // yes, fetch it - bytes, err := fetchFile(filename) - if err != nil { - return nil, err - } - return bytes, nil - } - // no, it's a local filename - bytes, err := ioutil.ReadFile(filename) - if err != nil { - return nil, err - } - return bytes, nil -} - -// ReadInfoFromBytes unmarshals a file as a *yaml.Node. -func ReadInfoFromBytes(filename string, bytes []byte) (*yaml.Node, error) { - infoCacheMutex.Lock() - defer infoCacheMutex.Unlock() - return readInfoFromBytes(filename, bytes) -} - -func readInfoFromBytes(filename string, bytes []byte) (*yaml.Node, error) { - initializeInfoCache() - if infoCacheEnable { - cachedInfo, ok := infoCache[filename] - if ok { - if verboseReader { - log.Printf("Cache hit info for file %s", filename) - } - return cachedInfo, nil - } - if verboseReader { - log.Printf("Reading info for file %s", filename) - } - } - var info yaml.Node - err := yaml.Unmarshal(bytes, &info) - if err != nil { - return nil, err - } - if infoCacheEnable && len(filename) > 0 { - infoCache[filename] = &info - } - return &info, nil -} - -// ReadInfoForRef reads a file and return the fragment needed to resolve a $ref. -func ReadInfoForRef(basefile string, ref string) (*yaml.Node, error) { - fileCacheMutex.Lock() - defer fileCacheMutex.Unlock() - infoCacheMutex.Lock() - defer infoCacheMutex.Unlock() - initializeInfoCache() - if infoCacheEnable { - info, ok := infoCache[ref] - if ok { - if verboseReader { - log.Printf("Cache hit for ref %s#%s", basefile, ref) - } - return info, nil - } - if verboseReader { - log.Printf("Reading info for ref %s#%s", basefile, ref) - } - } - basedir, _ := filepath.Split(basefile) - parts := strings.Split(ref, "#") - var filename string - if parts[0] != "" { - filename = parts[0] - if _, err := url.ParseRequestURI(parts[0]); err != nil { - // It is not an URL, so the file is local - filename = basedir + parts[0] - } - } else { - filename = basefile - } - bytes, err := readBytesForFile(filename) - if err != nil { - return nil, err - } - info, err := readInfoFromBytes(filename, bytes) - if info != nil && info.Kind == yaml.DocumentNode { - info = info.Content[0] - } - if err != nil { - log.Printf("File error: %v\n", err) - } else { - if info == nil { - return nil, NewError(nil, fmt.Sprintf("could not resolve %s", ref)) - } - if len(parts) > 1 { - path := strings.Split(parts[1], "/") - for i, key := range path { - if i > 0 { - m := info - if true { - found := false - for i := 0; i < len(m.Content); i += 2 { - if m.Content[i].Value == key { - info = m.Content[i+1] - found = true - } - } - if !found { - infoCache[ref] = nil - return nil, NewError(nil, fmt.Sprintf("could not resolve %s", ref)) - } - } - } - } - } - } - if infoCacheEnable { - infoCache[ref] = info - } - return info, nil -} diff --git a/vendor/github.com/google/gnostic/extensions/README.md b/vendor/github.com/google/gnostic/extensions/README.md deleted file mode 100644 index 4b5d63e58..000000000 --- a/vendor/github.com/google/gnostic/extensions/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# Extensions - -**Extension Support is experimental.** - -This directory contains support code for building Gnostic extensio handlers and -associated examples. - -Extension handlers can be used to compile vendor or specification extensions -into protocol buffer structures. - -Like plugins, extension handlers are built as separate executables. Extension -bodies are written to extension handlers as serialized -ExtensionHandlerRequests. diff --git a/vendor/github.com/google/gnostic/extensions/extension.pb.go b/vendor/github.com/google/gnostic/extensions/extension.pb.go deleted file mode 100644 index a6a4ccca6..000000000 --- a/vendor/github.com/google/gnostic/extensions/extension.pb.go +++ /dev/null @@ -1,461 +0,0 @@ -// Copyright 2017 Google LLC. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.26.0 -// protoc v3.18.1 -// source: extensions/extension.proto - -package gnostic_extension_v1 - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - anypb "google.golang.org/protobuf/types/known/anypb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// The version number of Gnostic. -type Version struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Major int32 `protobuf:"varint,1,opt,name=major,proto3" json:"major,omitempty"` - Minor int32 `protobuf:"varint,2,opt,name=minor,proto3" json:"minor,omitempty"` - Patch int32 `protobuf:"varint,3,opt,name=patch,proto3" json:"patch,omitempty"` - // A suffix for alpha, beta or rc release, e.g., "alpha-1", "rc2". It should - // be empty for mainline stable releases. - Suffix string `protobuf:"bytes,4,opt,name=suffix,proto3" json:"suffix,omitempty"` -} - -func (x *Version) Reset() { - *x = Version{} - if protoimpl.UnsafeEnabled { - mi := &file_extensions_extension_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Version) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Version) ProtoMessage() {} - -func (x *Version) ProtoReflect() protoreflect.Message { - mi := &file_extensions_extension_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Version.ProtoReflect.Descriptor instead. -func (*Version) Descriptor() ([]byte, []int) { - return file_extensions_extension_proto_rawDescGZIP(), []int{0} -} - -func (x *Version) GetMajor() int32 { - if x != nil { - return x.Major - } - return 0 -} - -func (x *Version) GetMinor() int32 { - if x != nil { - return x.Minor - } - return 0 -} - -func (x *Version) GetPatch() int32 { - if x != nil { - return x.Patch - } - return 0 -} - -func (x *Version) GetSuffix() string { - if x != nil { - return x.Suffix - } - return "" -} - -// An encoded Request is written to the ExtensionHandler's stdin. -type ExtensionHandlerRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The extension to process. - Wrapper *Wrapper `protobuf:"bytes,1,opt,name=wrapper,proto3" json:"wrapper,omitempty"` - // The version number of Gnostic. - CompilerVersion *Version `protobuf:"bytes,2,opt,name=compiler_version,json=compilerVersion,proto3" json:"compiler_version,omitempty"` -} - -func (x *ExtensionHandlerRequest) Reset() { - *x = ExtensionHandlerRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_extensions_extension_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ExtensionHandlerRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ExtensionHandlerRequest) ProtoMessage() {} - -func (x *ExtensionHandlerRequest) ProtoReflect() protoreflect.Message { - mi := &file_extensions_extension_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ExtensionHandlerRequest.ProtoReflect.Descriptor instead. -func (*ExtensionHandlerRequest) Descriptor() ([]byte, []int) { - return file_extensions_extension_proto_rawDescGZIP(), []int{1} -} - -func (x *ExtensionHandlerRequest) GetWrapper() *Wrapper { - if x != nil { - return x.Wrapper - } - return nil -} - -func (x *ExtensionHandlerRequest) GetCompilerVersion() *Version { - if x != nil { - return x.CompilerVersion - } - return nil -} - -// The extensions writes an encoded ExtensionHandlerResponse to stdout. -type ExtensionHandlerResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // true if the extension is handled by the extension handler; false otherwise - Handled bool `protobuf:"varint,1,opt,name=handled,proto3" json:"handled,omitempty"` - // Error message(s). If non-empty, the extension handling failed. - // The extension handler process should exit with status code zero - // even if it reports an error in this way. - // - // This should be used to indicate errors which prevent the extension from - // operating as intended. Errors which indicate a problem in gnostic - // itself -- such as the input Document being unparseable -- should be - // reported by writing a message to stderr and exiting with a non-zero - // status code. - Errors []string `protobuf:"bytes,2,rep,name=errors,proto3" json:"errors,omitempty"` - // text output - Value *anypb.Any `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *ExtensionHandlerResponse) Reset() { - *x = ExtensionHandlerResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_extensions_extension_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ExtensionHandlerResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ExtensionHandlerResponse) ProtoMessage() {} - -func (x *ExtensionHandlerResponse) ProtoReflect() protoreflect.Message { - mi := &file_extensions_extension_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ExtensionHandlerResponse.ProtoReflect.Descriptor instead. -func (*ExtensionHandlerResponse) Descriptor() ([]byte, []int) { - return file_extensions_extension_proto_rawDescGZIP(), []int{2} -} - -func (x *ExtensionHandlerResponse) GetHandled() bool { - if x != nil { - return x.Handled - } - return false -} - -func (x *ExtensionHandlerResponse) GetErrors() []string { - if x != nil { - return x.Errors - } - return nil -} - -func (x *ExtensionHandlerResponse) GetValue() *anypb.Any { - if x != nil { - return x.Value - } - return nil -} - -type Wrapper struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // version of the OpenAPI specification in which this extension was written. - Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` - // Name of the extension. - ExtensionName string `protobuf:"bytes,2,opt,name=extension_name,json=extensionName,proto3" json:"extension_name,omitempty"` - // YAML-formatted extension value. - Yaml string `protobuf:"bytes,3,opt,name=yaml,proto3" json:"yaml,omitempty"` -} - -func (x *Wrapper) Reset() { - *x = Wrapper{} - if protoimpl.UnsafeEnabled { - mi := &file_extensions_extension_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Wrapper) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Wrapper) ProtoMessage() {} - -func (x *Wrapper) ProtoReflect() protoreflect.Message { - mi := &file_extensions_extension_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Wrapper.ProtoReflect.Descriptor instead. -func (*Wrapper) Descriptor() ([]byte, []int) { - return file_extensions_extension_proto_rawDescGZIP(), []int{3} -} - -func (x *Wrapper) GetVersion() string { - if x != nil { - return x.Version - } - return "" -} - -func (x *Wrapper) GetExtensionName() string { - if x != nil { - return x.ExtensionName - } - return "" -} - -func (x *Wrapper) GetYaml() string { - if x != nil { - return x.Yaml - } - return "" -} - -var File_extensions_extension_proto protoreflect.FileDescriptor - -var file_extensions_extension_proto_rawDesc = []byte{ - 0x0a, 0x1a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x65, 0x78, 0x74, - 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x14, 0x67, 0x6e, - 0x6f, 0x73, 0x74, 0x69, 0x63, 0x2e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x2e, - 0x76, 0x31, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x63, 0x0a, - 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x61, 0x6a, 0x6f, - 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x12, 0x14, - 0x0a, 0x05, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6d, - 0x69, 0x6e, 0x6f, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x61, 0x74, 0x63, 0x68, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x05, 0x70, 0x61, 0x74, 0x63, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x75, - 0x66, 0x66, 0x69, 0x78, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x75, 0x66, 0x66, - 0x69, 0x78, 0x22, 0x9c, 0x01, 0x0a, 0x17, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, - 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x37, - 0x0a, 0x07, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1d, 0x2e, 0x67, 0x6e, 0x6f, 0x73, 0x74, 0x69, 0x63, 0x2e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, - 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x52, 0x07, - 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x12, 0x48, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x70, 0x69, - 0x6c, 0x65, 0x72, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1d, 0x2e, 0x67, 0x6e, 0x6f, 0x73, 0x74, 0x69, 0x63, 0x2e, 0x65, 0x78, 0x74, 0x65, - 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, - 0x52, 0x0f, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x22, 0x78, 0x0a, 0x18, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x61, - 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, - 0x07, 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, - 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x72, 0x72, 0x6f, 0x72, - 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x12, - 0x2a, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x5e, 0x0a, 0x07, 0x57, - 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, - 0x12, 0x25, 0x0a, 0x0e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, - 0x69, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x79, 0x61, 0x6d, 0x6c, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x79, 0x61, 0x6d, 0x6c, 0x42, 0x4d, 0x0a, 0x0e, 0x6f, - 0x72, 0x67, 0x2e, 0x67, 0x6e, 0x6f, 0x73, 0x74, 0x69, 0x63, 0x2e, 0x76, 0x31, 0x42, 0x10, 0x47, - 0x6e, 0x6f, 0x73, 0x74, 0x69, 0x63, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x50, - 0x01, 0x5a, 0x21, 0x2e, 0x2f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x3b, - 0x67, 0x6e, 0x6f, 0x73, 0x74, 0x69, 0x63, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, - 0x6e, 0x5f, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x47, 0x4e, 0x58, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, -} - -var ( - file_extensions_extension_proto_rawDescOnce sync.Once - file_extensions_extension_proto_rawDescData = file_extensions_extension_proto_rawDesc -) - -func file_extensions_extension_proto_rawDescGZIP() []byte { - file_extensions_extension_proto_rawDescOnce.Do(func() { - file_extensions_extension_proto_rawDescData = protoimpl.X.CompressGZIP(file_extensions_extension_proto_rawDescData) - }) - return file_extensions_extension_proto_rawDescData -} - -var file_extensions_extension_proto_msgTypes = make([]protoimpl.MessageInfo, 4) -var file_extensions_extension_proto_goTypes = []interface{}{ - (*Version)(nil), // 0: gnostic.extension.v1.Version - (*ExtensionHandlerRequest)(nil), // 1: gnostic.extension.v1.ExtensionHandlerRequest - (*ExtensionHandlerResponse)(nil), // 2: gnostic.extension.v1.ExtensionHandlerResponse - (*Wrapper)(nil), // 3: gnostic.extension.v1.Wrapper - (*anypb.Any)(nil), // 4: google.protobuf.Any -} -var file_extensions_extension_proto_depIdxs = []int32{ - 3, // 0: gnostic.extension.v1.ExtensionHandlerRequest.wrapper:type_name -> gnostic.extension.v1.Wrapper - 0, // 1: gnostic.extension.v1.ExtensionHandlerRequest.compiler_version:type_name -> gnostic.extension.v1.Version - 4, // 2: gnostic.extension.v1.ExtensionHandlerResponse.value:type_name -> google.protobuf.Any - 3, // [3:3] is the sub-list for method output_type - 3, // [3:3] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name -} - -func init() { file_extensions_extension_proto_init() } -func file_extensions_extension_proto_init() { - if File_extensions_extension_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_extensions_extension_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Version); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_extensions_extension_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ExtensionHandlerRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_extensions_extension_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ExtensionHandlerResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_extensions_extension_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Wrapper); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_extensions_extension_proto_rawDesc, - NumEnums: 0, - NumMessages: 4, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_extensions_extension_proto_goTypes, - DependencyIndexes: file_extensions_extension_proto_depIdxs, - MessageInfos: file_extensions_extension_proto_msgTypes, - }.Build() - File_extensions_extension_proto = out.File - file_extensions_extension_proto_rawDesc = nil - file_extensions_extension_proto_goTypes = nil - file_extensions_extension_proto_depIdxs = nil -} diff --git a/vendor/github.com/google/gnostic/extensions/extension.proto b/vendor/github.com/google/gnostic/extensions/extension.proto deleted file mode 100644 index 875137c1a..000000000 --- a/vendor/github.com/google/gnostic/extensions/extension.proto +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright 2017 Google LLC. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package gnostic.extension.v1; - -import "google/protobuf/any.proto"; - -// This option lets the proto compiler generate Java code inside the package -// name (see below) instead of inside an outer class. It creates a simpler -// developer experience by reducing one-level of name nesting and be -// consistent with most programming languages that don't support outer classes. -option java_multiple_files = true; - -// The Java outer classname should be the filename in UpperCamelCase. This -// class is only used to hold proto descriptor, so developers don't need to -// work with it directly. -option java_outer_classname = "GnosticExtension"; - -// The Java package name must be proto package name with proper prefix. -option java_package = "org.gnostic.v1"; - -// A reasonable prefix for the Objective-C symbols generated from the package. -// It should at a minimum be 3 characters long, all uppercase, and convention -// is to use an abbreviation of the package name. Something short, but -// hopefully unique enough to not conflict with things that may come along in -// the future. 'GPB' is reserved for the protocol buffer implementation itself. -// -// "Gnostic Extension" -option objc_class_prefix = "GNX"; - -// The Go package name. -option go_package = "./extensions;gnostic_extension_v1"; - -// The version number of Gnostic. -message Version { - int32 major = 1; - int32 minor = 2; - int32 patch = 3; - // A suffix for alpha, beta or rc release, e.g., "alpha-1", "rc2". It should - // be empty for mainline stable releases. - string suffix = 4; -} - -// An encoded Request is written to the ExtensionHandler's stdin. -message ExtensionHandlerRequest { - - // The extension to process. - Wrapper wrapper = 1; - - // The version number of Gnostic. - Version compiler_version = 2; -} - -// The extensions writes an encoded ExtensionHandlerResponse to stdout. -message ExtensionHandlerResponse { - - // true if the extension is handled by the extension handler; false otherwise - bool handled = 1; - - // Error message(s). If non-empty, the extension handling failed. - // The extension handler process should exit with status code zero - // even if it reports an error in this way. - // - // This should be used to indicate errors which prevent the extension from - // operating as intended. Errors which indicate a problem in gnostic - // itself -- such as the input Document being unparseable -- should be - // reported by writing a message to stderr and exiting with a non-zero - // status code. - repeated string errors = 2; - - // text output - google.protobuf.Any value = 3; -} - -message Wrapper { - // version of the OpenAPI specification in which this extension was written. - string version = 1; - - // Name of the extension. - string extension_name = 2; - - // YAML-formatted extension value. - string yaml = 3; -} diff --git a/vendor/github.com/google/gnostic/extensions/extensions.go b/vendor/github.com/google/gnostic/extensions/extensions.go deleted file mode 100644 index ec8afd009..000000000 --- a/vendor/github.com/google/gnostic/extensions/extensions.go +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2017 Google LLC. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package gnostic_extension_v1 - -import ( - "io/ioutil" - "log" - "os" - - "github.com/golang/protobuf/proto" - "github.com/golang/protobuf/ptypes" -) - -type extensionHandler func(name string, yamlInput string) (bool, proto.Message, error) - -// Main implements the main program of an extension handler. -func Main(handler extensionHandler) { - // unpack the request - data, err := ioutil.ReadAll(os.Stdin) - if err != nil { - log.Println("File error:", err.Error()) - os.Exit(1) - } - if len(data) == 0 { - log.Println("No input data.") - os.Exit(1) - } - request := &ExtensionHandlerRequest{} - err = proto.Unmarshal(data, request) - if err != nil { - log.Println("Input error:", err.Error()) - os.Exit(1) - } - // call the handler - handled, output, err := handler(request.Wrapper.ExtensionName, request.Wrapper.Yaml) - // respond with the output of the handler - response := &ExtensionHandlerResponse{ - Handled: false, // default assumption - Errors: make([]string, 0), - } - if err != nil { - response.Errors = append(response.Errors, err.Error()) - } else if handled { - response.Handled = true - response.Value, err = ptypes.MarshalAny(output) - if err != nil { - response.Errors = append(response.Errors, err.Error()) - } - } - responseBytes, _ := proto.Marshal(response) - os.Stdout.Write(responseBytes) -} diff --git a/vendor/github.com/google/gnostic/jsonschema/README.md b/vendor/github.com/google/gnostic/jsonschema/README.md deleted file mode 100644 index 6793c5179..000000000 --- a/vendor/github.com/google/gnostic/jsonschema/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# jsonschema - -This directory contains code for reading, writing, and manipulating JSON -schemas. diff --git a/vendor/github.com/google/gnostic/jsonschema/base.go b/vendor/github.com/google/gnostic/jsonschema/base.go deleted file mode 100644 index 0af8b148b..000000000 --- a/vendor/github.com/google/gnostic/jsonschema/base.go +++ /dev/null @@ -1,84 +0,0 @@ - -// THIS FILE IS AUTOMATICALLY GENERATED. - -package jsonschema - -import ( - "encoding/base64" -) - -func baseSchemaBytes() ([]byte, error){ - return base64.StdEncoding.DecodeString( -`ewogICAgImlkIjogImh0dHA6Ly9qc29uLXNjaGVtYS5vcmcvZHJhZnQtMDQvc2NoZW1hIyIsCiAgICAi -JHNjaGVtYSI6ICJodHRwOi8vanNvbi1zY2hlbWEub3JnL2RyYWZ0LTA0L3NjaGVtYSMiLAogICAgImRl -c2NyaXB0aW9uIjogIkNvcmUgc2NoZW1hIG1ldGEtc2NoZW1hIiwKICAgICJkZWZpbml0aW9ucyI6IHsK -ICAgICAgICAic2NoZW1hQXJyYXkiOiB7CiAgICAgICAgICAgICJ0eXBlIjogImFycmF5IiwKICAgICAg -ICAgICAgIm1pbkl0ZW1zIjogMSwKICAgICAgICAgICAgIml0ZW1zIjogeyAiJHJlZiI6ICIjIiB9CiAg -ICAgICAgfSwKICAgICAgICAicG9zaXRpdmVJbnRlZ2VyIjogewogICAgICAgICAgICAidHlwZSI6ICJp -bnRlZ2VyIiwKICAgICAgICAgICAgIm1pbmltdW0iOiAwCiAgICAgICAgfSwKICAgICAgICAicG9zaXRp -dmVJbnRlZ2VyRGVmYXVsdDAiOiB7CiAgICAgICAgICAgICJhbGxPZiI6IFsgeyAiJHJlZiI6ICIjL2Rl -ZmluaXRpb25zL3Bvc2l0aXZlSW50ZWdlciIgfSwgeyAiZGVmYXVsdCI6IDAgfSBdCiAgICAgICAgfSwK -ICAgICAgICAic2ltcGxlVHlwZXMiOiB7CiAgICAgICAgICAgICJlbnVtIjogWyAiYXJyYXkiLCAiYm9v -bGVhbiIsICJpbnRlZ2VyIiwgIm51bGwiLCAibnVtYmVyIiwgIm9iamVjdCIsICJzdHJpbmciIF0KICAg -ICAgICB9LAogICAgICAgICJzdHJpbmdBcnJheSI6IHsKICAgICAgICAgICAgInR5cGUiOiAiYXJyYXki -LAogICAgICAgICAgICAiaXRlbXMiOiB7ICJ0eXBlIjogInN0cmluZyIgfSwKICAgICAgICAgICAgIm1p -bkl0ZW1zIjogMSwKICAgICAgICAgICAgInVuaXF1ZUl0ZW1zIjogdHJ1ZQogICAgICAgIH0KICAgIH0s -CiAgICAidHlwZSI6ICJvYmplY3QiLAogICAgInByb3BlcnRpZXMiOiB7CiAgICAgICAgImlkIjogewog -ICAgICAgICAgICAidHlwZSI6ICJzdHJpbmciLAogICAgICAgICAgICAiZm9ybWF0IjogInVyaSIKICAg -ICAgICB9LAogICAgICAgICIkc2NoZW1hIjogewogICAgICAgICAgICAidHlwZSI6ICJzdHJpbmciLAog -ICAgICAgICAgICAiZm9ybWF0IjogInVyaSIKICAgICAgICB9LAogICAgICAgICJ0aXRsZSI6IHsKICAg -ICAgICAgICAgInR5cGUiOiAic3RyaW5nIgogICAgICAgIH0sCiAgICAgICAgImRlc2NyaXB0aW9uIjog -ewogICAgICAgICAgICAidHlwZSI6ICJzdHJpbmciCiAgICAgICAgfSwKICAgICAgICAiZGVmYXVsdCI6 -IHt9LAogICAgICAgICJtdWx0aXBsZU9mIjogewogICAgICAgICAgICAidHlwZSI6ICJudW1iZXIiLAog -ICAgICAgICAgICAibWluaW11bSI6IDAsCiAgICAgICAgICAgICJleGNsdXNpdmVNaW5pbXVtIjogdHJ1 -ZQogICAgICAgIH0sCiAgICAgICAgIm1heGltdW0iOiB7CiAgICAgICAgICAgICJ0eXBlIjogIm51bWJl -ciIKICAgICAgICB9LAogICAgICAgICJleGNsdXNpdmVNYXhpbXVtIjogewogICAgICAgICAgICAidHlw -ZSI6ICJib29sZWFuIiwKICAgICAgICAgICAgImRlZmF1bHQiOiBmYWxzZQogICAgICAgIH0sCiAgICAg -ICAgIm1pbmltdW0iOiB7CiAgICAgICAgICAgICJ0eXBlIjogIm51bWJlciIKICAgICAgICB9LAogICAg -ICAgICJleGNsdXNpdmVNaW5pbXVtIjogewogICAgICAgICAgICAidHlwZSI6ICJib29sZWFuIiwKICAg -ICAgICAgICAgImRlZmF1bHQiOiBmYWxzZQogICAgICAgIH0sCiAgICAgICAgIm1heExlbmd0aCI6IHsg -IiRyZWYiOiAiIy9kZWZpbml0aW9ucy9wb3NpdGl2ZUludGVnZXIiIH0sCiAgICAgICAgIm1pbkxlbmd0 -aCI6IHsgIiRyZWYiOiAiIy9kZWZpbml0aW9ucy9wb3NpdGl2ZUludGVnZXJEZWZhdWx0MCIgfSwKICAg -ICAgICAicGF0dGVybiI6IHsKICAgICAgICAgICAgInR5cGUiOiAic3RyaW5nIiwKICAgICAgICAgICAg -ImZvcm1hdCI6ICJyZWdleCIKICAgICAgICB9LAogICAgICAgICJhZGRpdGlvbmFsSXRlbXMiOiB7CiAg -ICAgICAgICAgICJhbnlPZiI6IFsKICAgICAgICAgICAgICAgIHsgInR5cGUiOiAiYm9vbGVhbiIgfSwK -ICAgICAgICAgICAgICAgIHsgIiRyZWYiOiAiIyIgfQogICAgICAgICAgICBdLAogICAgICAgICAgICAi -ZGVmYXVsdCI6IHt9CiAgICAgICAgfSwKICAgICAgICAiaXRlbXMiOiB7CiAgICAgICAgICAgICJhbnlP -ZiI6IFsKICAgICAgICAgICAgICAgIHsgIiRyZWYiOiAiIyIgfSwKICAgICAgICAgICAgICAgIHsgIiRy -ZWYiOiAiIy9kZWZpbml0aW9ucy9zY2hlbWFBcnJheSIgfQogICAgICAgICAgICBdLAogICAgICAgICAg -ICAiZGVmYXVsdCI6IHt9CiAgICAgICAgfSwKICAgICAgICAibWF4SXRlbXMiOiB7ICIkcmVmIjogIiMv -ZGVmaW5pdGlvbnMvcG9zaXRpdmVJbnRlZ2VyIiB9LAogICAgICAgICJtaW5JdGVtcyI6IHsgIiRyZWYi -OiAiIy9kZWZpbml0aW9ucy9wb3NpdGl2ZUludGVnZXJEZWZhdWx0MCIgfSwKICAgICAgICAidW5pcXVl -SXRlbXMiOiB7CiAgICAgICAgICAgICJ0eXBlIjogImJvb2xlYW4iLAogICAgICAgICAgICAiZGVmYXVs -dCI6IGZhbHNlCiAgICAgICAgfSwKICAgICAgICAibWF4UHJvcGVydGllcyI6IHsgIiRyZWYiOiAiIy9k -ZWZpbml0aW9ucy9wb3NpdGl2ZUludGVnZXIiIH0sCiAgICAgICAgIm1pblByb3BlcnRpZXMiOiB7ICIk -cmVmIjogIiMvZGVmaW5pdGlvbnMvcG9zaXRpdmVJbnRlZ2VyRGVmYXVsdDAiIH0sCiAgICAgICAgInJl -cXVpcmVkIjogeyAiJHJlZiI6ICIjL2RlZmluaXRpb25zL3N0cmluZ0FycmF5IiB9LAogICAgICAgICJh -ZGRpdGlvbmFsUHJvcGVydGllcyI6IHsKICAgICAgICAgICAgImFueU9mIjogWwogICAgICAgICAgICAg -ICAgeyAidHlwZSI6ICJib29sZWFuIiB9LAogICAgICAgICAgICAgICAgeyAiJHJlZiI6ICIjIiB9CiAg -ICAgICAgICAgIF0sCiAgICAgICAgICAgICJkZWZhdWx0Ijoge30KICAgICAgICB9LAogICAgICAgICJk -ZWZpbml0aW9ucyI6IHsKICAgICAgICAgICAgInR5cGUiOiAib2JqZWN0IiwKICAgICAgICAgICAgImFk -ZGl0aW9uYWxQcm9wZXJ0aWVzIjogeyAiJHJlZiI6ICIjIiB9LAogICAgICAgICAgICAiZGVmYXVsdCI6 -IHt9CiAgICAgICAgfSwKICAgICAgICAicHJvcGVydGllcyI6IHsKICAgICAgICAgICAgInR5cGUiOiAi -b2JqZWN0IiwKICAgICAgICAgICAgImFkZGl0aW9uYWxQcm9wZXJ0aWVzIjogeyAiJHJlZiI6ICIjIiB9 -LAogICAgICAgICAgICAiZGVmYXVsdCI6IHt9CiAgICAgICAgfSwKICAgICAgICAicGF0dGVyblByb3Bl -cnRpZXMiOiB7CiAgICAgICAgICAgICJ0eXBlIjogIm9iamVjdCIsCiAgICAgICAgICAgICJhZGRpdGlv -bmFsUHJvcGVydGllcyI6IHsgIiRyZWYiOiAiIyIgfSwKICAgICAgICAgICAgImRlZmF1bHQiOiB7fQog -ICAgICAgIH0sCiAgICAgICAgImRlcGVuZGVuY2llcyI6IHsKICAgICAgICAgICAgInR5cGUiOiAib2Jq -ZWN0IiwKICAgICAgICAgICAgImFkZGl0aW9uYWxQcm9wZXJ0aWVzIjogewogICAgICAgICAgICAgICAg -ImFueU9mIjogWwogICAgICAgICAgICAgICAgICAgIHsgIiRyZWYiOiAiIyIgfSwKICAgICAgICAgICAg -ICAgICAgICB7ICIkcmVmIjogIiMvZGVmaW5pdGlvbnMvc3RyaW5nQXJyYXkiIH0KICAgICAgICAgICAg -ICAgIF0KICAgICAgICAgICAgfQogICAgICAgIH0sCiAgICAgICAgImVudW0iOiB7CiAgICAgICAgICAg -ICJ0eXBlIjogImFycmF5IiwKICAgICAgICAgICAgIm1pbkl0ZW1zIjogMSwKICAgICAgICAgICAgInVu -aXF1ZUl0ZW1zIjogdHJ1ZQogICAgICAgIH0sCiAgICAgICAgInR5cGUiOiB7CiAgICAgICAgICAgICJh -bnlPZiI6IFsKICAgICAgICAgICAgICAgIHsgIiRyZWYiOiAiIy9kZWZpbml0aW9ucy9zaW1wbGVUeXBl -cyIgfSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAidHlwZSI6ICJhcnJheSIs -CiAgICAgICAgICAgICAgICAgICAgIml0ZW1zIjogeyAiJHJlZiI6ICIjL2RlZmluaXRpb25zL3NpbXBs -ZVR5cGVzIiB9LAogICAgICAgICAgICAgICAgICAgICJtaW5JdGVtcyI6IDEsCiAgICAgICAgICAgICAg -ICAgICAgInVuaXF1ZUl0ZW1zIjogdHJ1ZQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICBdCiAg -ICAgICAgfSwKICAgICAgICAiYWxsT2YiOiB7ICIkcmVmIjogIiMvZGVmaW5pdGlvbnMvc2NoZW1hQXJy -YXkiIH0sCiAgICAgICAgImFueU9mIjogeyAiJHJlZiI6ICIjL2RlZmluaXRpb25zL3NjaGVtYUFycmF5 -IiB9LAogICAgICAgICJvbmVPZiI6IHsgIiRyZWYiOiAiIy9kZWZpbml0aW9ucy9zY2hlbWFBcnJheSIg -fSwKICAgICAgICAibm90IjogeyAiJHJlZiI6ICIjIiB9CiAgICB9LAogICAgImRlcGVuZGVuY2llcyI6 -IHsKICAgICAgICAiZXhjbHVzaXZlTWF4aW11bSI6IFsgIm1heGltdW0iIF0sCiAgICAgICAgImV4Y2x1 -c2l2ZU1pbmltdW0iOiBbICJtaW5pbXVtIiBdCiAgICB9LAogICAgImRlZmF1bHQiOiB7fQp9Cg==`)} \ No newline at end of file diff --git a/vendor/github.com/google/gnostic/jsonschema/display.go b/vendor/github.com/google/gnostic/jsonschema/display.go deleted file mode 100644 index 028a760a9..000000000 --- a/vendor/github.com/google/gnostic/jsonschema/display.go +++ /dev/null @@ -1,229 +0,0 @@ -// Copyright 2017 Google LLC. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package jsonschema - -import ( - "fmt" - "strings" -) - -// -// DISPLAY -// The following methods display Schemas. -// - -// Description returns a string representation of a string or string array. -func (s *StringOrStringArray) Description() string { - if s.String != nil { - return *s.String - } - if s.StringArray != nil { - return strings.Join(*s.StringArray, ", ") - } - return "" -} - -// Returns a string representation of a Schema. -func (schema *Schema) String() string { - return schema.describeSchema("") -} - -// Helper: Returns a string representation of a Schema indented by a specified string. -func (schema *Schema) describeSchema(indent string) string { - result := "" - if schema.Schema != nil { - result += indent + "$schema: " + *(schema.Schema) + "\n" - } - if schema.ID != nil { - result += indent + "id: " + *(schema.ID) + "\n" - } - if schema.MultipleOf != nil { - result += indent + fmt.Sprintf("multipleOf: %+v\n", *(schema.MultipleOf)) - } - if schema.Maximum != nil { - result += indent + fmt.Sprintf("maximum: %+v\n", *(schema.Maximum)) - } - if schema.ExclusiveMaximum != nil { - result += indent + fmt.Sprintf("exclusiveMaximum: %+v\n", *(schema.ExclusiveMaximum)) - } - if schema.Minimum != nil { - result += indent + fmt.Sprintf("minimum: %+v\n", *(schema.Minimum)) - } - if schema.ExclusiveMinimum != nil { - result += indent + fmt.Sprintf("exclusiveMinimum: %+v\n", *(schema.ExclusiveMinimum)) - } - if schema.MaxLength != nil { - result += indent + fmt.Sprintf("maxLength: %+v\n", *(schema.MaxLength)) - } - if schema.MinLength != nil { - result += indent + fmt.Sprintf("minLength: %+v\n", *(schema.MinLength)) - } - if schema.Pattern != nil { - result += indent + fmt.Sprintf("pattern: %+v\n", *(schema.Pattern)) - } - if schema.AdditionalItems != nil { - s := schema.AdditionalItems.Schema - if s != nil { - result += indent + "additionalItems:\n" - result += s.describeSchema(indent + " ") - } else { - b := *(schema.AdditionalItems.Boolean) - result += indent + fmt.Sprintf("additionalItems: %+v\n", b) - } - } - if schema.Items != nil { - result += indent + "items:\n" - items := schema.Items - if items.SchemaArray != nil { - for i, s := range *(items.SchemaArray) { - result += indent + " " + fmt.Sprintf("%d", i) + ":\n" - result += s.describeSchema(indent + " " + " ") - } - } else if items.Schema != nil { - result += items.Schema.describeSchema(indent + " " + " ") - } - } - if schema.MaxItems != nil { - result += indent + fmt.Sprintf("maxItems: %+v\n", *(schema.MaxItems)) - } - if schema.MinItems != nil { - result += indent + fmt.Sprintf("minItems: %+v\n", *(schema.MinItems)) - } - if schema.UniqueItems != nil { - result += indent + fmt.Sprintf("uniqueItems: %+v\n", *(schema.UniqueItems)) - } - if schema.MaxProperties != nil { - result += indent + fmt.Sprintf("maxProperties: %+v\n", *(schema.MaxProperties)) - } - if schema.MinProperties != nil { - result += indent + fmt.Sprintf("minProperties: %+v\n", *(schema.MinProperties)) - } - if schema.Required != nil { - result += indent + fmt.Sprintf("required: %+v\n", *(schema.Required)) - } - if schema.AdditionalProperties != nil { - s := schema.AdditionalProperties.Schema - if s != nil { - result += indent + "additionalProperties:\n" - result += s.describeSchema(indent + " ") - } else { - b := *(schema.AdditionalProperties.Boolean) - result += indent + fmt.Sprintf("additionalProperties: %+v\n", b) - } - } - if schema.Properties != nil { - result += indent + "properties:\n" - for _, pair := range *(schema.Properties) { - name := pair.Name - s := pair.Value - result += indent + " " + name + ":\n" - result += s.describeSchema(indent + " " + " ") - } - } - if schema.PatternProperties != nil { - result += indent + "patternProperties:\n" - for _, pair := range *(schema.PatternProperties) { - name := pair.Name - s := pair.Value - result += indent + " " + name + ":\n" - result += s.describeSchema(indent + " " + " ") - } - } - if schema.Dependencies != nil { - result += indent + "dependencies:\n" - for _, pair := range *(schema.Dependencies) { - name := pair.Name - schemaOrStringArray := pair.Value - s := schemaOrStringArray.Schema - if s != nil { - result += indent + " " + name + ":\n" - result += s.describeSchema(indent + " " + " ") - } else { - a := schemaOrStringArray.StringArray - if a != nil { - result += indent + " " + name + ":\n" - for _, s2 := range *a { - result += indent + " " + " " + s2 + "\n" - } - } - } - - } - } - if schema.Enumeration != nil { - result += indent + "enumeration:\n" - for _, value := range *(schema.Enumeration) { - if value.String != nil { - result += indent + " " + fmt.Sprintf("%+v\n", *value.String) - } else { - result += indent + " " + fmt.Sprintf("%+v\n", *value.Bool) - } - } - } - if schema.Type != nil { - result += indent + fmt.Sprintf("type: %+v\n", schema.Type.Description()) - } - if schema.AllOf != nil { - result += indent + "allOf:\n" - for _, s := range *(schema.AllOf) { - result += s.describeSchema(indent + " ") - result += indent + "-\n" - } - } - if schema.AnyOf != nil { - result += indent + "anyOf:\n" - for _, s := range *(schema.AnyOf) { - result += s.describeSchema(indent + " ") - result += indent + "-\n" - } - } - if schema.OneOf != nil { - result += indent + "oneOf:\n" - for _, s := range *(schema.OneOf) { - result += s.describeSchema(indent + " ") - result += indent + "-\n" - } - } - if schema.Not != nil { - result += indent + "not:\n" - result += schema.Not.describeSchema(indent + " ") - } - if schema.Definitions != nil { - result += indent + "definitions:\n" - for _, pair := range *(schema.Definitions) { - name := pair.Name - s := pair.Value - result += indent + " " + name + ":\n" - result += s.describeSchema(indent + " " + " ") - } - } - if schema.Title != nil { - result += indent + "title: " + *(schema.Title) + "\n" - } - if schema.Description != nil { - result += indent + "description: " + *(schema.Description) + "\n" - } - if schema.Default != nil { - result += indent + "default:\n" - result += indent + fmt.Sprintf(" %+v\n", *(schema.Default)) - } - if schema.Format != nil { - result += indent + "format: " + *(schema.Format) + "\n" - } - if schema.Ref != nil { - result += indent + "$ref: " + *(schema.Ref) + "\n" - } - return result -} diff --git a/vendor/github.com/google/gnostic/jsonschema/models.go b/vendor/github.com/google/gnostic/jsonschema/models.go deleted file mode 100644 index 4781bdc5f..000000000 --- a/vendor/github.com/google/gnostic/jsonschema/models.go +++ /dev/null @@ -1,228 +0,0 @@ -// Copyright 2017 Google LLC. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package jsonschema supports the reading, writing, and manipulation -// of JSON Schemas. -package jsonschema - -import "gopkg.in/yaml.v3" - -// The Schema struct models a JSON Schema and, because schemas are -// defined hierarchically, contains many references to itself. -// All fields are pointers and are nil if the associated values -// are not specified. -type Schema struct { - Schema *string // $schema - ID *string // id keyword used for $ref resolution scope - Ref *string // $ref, i.e. JSON Pointers - - // http://json-schema.org/latest/json-schema-validation.html - // 5.1. Validation keywords for numeric instances (number and integer) - MultipleOf *SchemaNumber - Maximum *SchemaNumber - ExclusiveMaximum *bool - Minimum *SchemaNumber - ExclusiveMinimum *bool - - // 5.2. Validation keywords for strings - MaxLength *int64 - MinLength *int64 - Pattern *string - - // 5.3. Validation keywords for arrays - AdditionalItems *SchemaOrBoolean - Items *SchemaOrSchemaArray - MaxItems *int64 - MinItems *int64 - UniqueItems *bool - - // 5.4. Validation keywords for objects - MaxProperties *int64 - MinProperties *int64 - Required *[]string - AdditionalProperties *SchemaOrBoolean - Properties *[]*NamedSchema - PatternProperties *[]*NamedSchema - Dependencies *[]*NamedSchemaOrStringArray - - // 5.5. Validation keywords for any instance type - Enumeration *[]SchemaEnumValue - Type *StringOrStringArray - AllOf *[]*Schema - AnyOf *[]*Schema - OneOf *[]*Schema - Not *Schema - Definitions *[]*NamedSchema - - // 6. Metadata keywords - Title *string - Description *string - Default *yaml.Node - - // 7. Semantic validation with "format" - Format *string -} - -// These helper structs represent "combination" types that generally can -// have values of one type or another. All are used to represent parts -// of Schemas. - -// SchemaNumber represents a value that can be either an Integer or a Float. -type SchemaNumber struct { - Integer *int64 - Float *float64 -} - -// NewSchemaNumberWithInteger creates and returns a new object -func NewSchemaNumberWithInteger(i int64) *SchemaNumber { - result := &SchemaNumber{} - result.Integer = &i - return result -} - -// NewSchemaNumberWithFloat creates and returns a new object -func NewSchemaNumberWithFloat(f float64) *SchemaNumber { - result := &SchemaNumber{} - result.Float = &f - return result -} - -// SchemaOrBoolean represents a value that can be either a Schema or a Boolean. -type SchemaOrBoolean struct { - Schema *Schema - Boolean *bool -} - -// NewSchemaOrBooleanWithSchema creates and returns a new object -func NewSchemaOrBooleanWithSchema(s *Schema) *SchemaOrBoolean { - result := &SchemaOrBoolean{} - result.Schema = s - return result -} - -// NewSchemaOrBooleanWithBoolean creates and returns a new object -func NewSchemaOrBooleanWithBoolean(b bool) *SchemaOrBoolean { - result := &SchemaOrBoolean{} - result.Boolean = &b - return result -} - -// StringOrStringArray represents a value that can be either -// a String or an Array of Strings. -type StringOrStringArray struct { - String *string - StringArray *[]string -} - -// NewStringOrStringArrayWithString creates and returns a new object -func NewStringOrStringArrayWithString(s string) *StringOrStringArray { - result := &StringOrStringArray{} - result.String = &s - return result -} - -// NewStringOrStringArrayWithStringArray creates and returns a new object -func NewStringOrStringArrayWithStringArray(a []string) *StringOrStringArray { - result := &StringOrStringArray{} - result.StringArray = &a - return result -} - -// SchemaOrStringArray represents a value that can be either -// a Schema or an Array of Strings. -type SchemaOrStringArray struct { - Schema *Schema - StringArray *[]string -} - -// SchemaOrSchemaArray represents a value that can be either -// a Schema or an Array of Schemas. -type SchemaOrSchemaArray struct { - Schema *Schema - SchemaArray *[]*Schema -} - -// NewSchemaOrSchemaArrayWithSchema creates and returns a new object -func NewSchemaOrSchemaArrayWithSchema(s *Schema) *SchemaOrSchemaArray { - result := &SchemaOrSchemaArray{} - result.Schema = s - return result -} - -// NewSchemaOrSchemaArrayWithSchemaArray creates and returns a new object -func NewSchemaOrSchemaArrayWithSchemaArray(a []*Schema) *SchemaOrSchemaArray { - result := &SchemaOrSchemaArray{} - result.SchemaArray = &a - return result -} - -// SchemaEnumValue represents a value that can be part of an -// enumeration in a Schema. -type SchemaEnumValue struct { - String *string - Bool *bool -} - -// NamedSchema is a name-value pair that is used to emulate maps -// with ordered keys. -type NamedSchema struct { - Name string - Value *Schema -} - -// NewNamedSchema creates and returns a new object -func NewNamedSchema(name string, value *Schema) *NamedSchema { - return &NamedSchema{Name: name, Value: value} -} - -// NamedSchemaOrStringArray is a name-value pair that is used -// to emulate maps with ordered keys. -type NamedSchemaOrStringArray struct { - Name string - Value *SchemaOrStringArray -} - -// Access named subschemas by name - -func namedSchemaArrayElementWithName(array *[]*NamedSchema, name string) *Schema { - if array == nil { - return nil - } - for _, pair := range *array { - if pair.Name == name { - return pair.Value - } - } - return nil -} - -// PropertyWithName returns the selected element. -func (s *Schema) PropertyWithName(name string) *Schema { - return namedSchemaArrayElementWithName(s.Properties, name) -} - -// PatternPropertyWithName returns the selected element. -func (s *Schema) PatternPropertyWithName(name string) *Schema { - return namedSchemaArrayElementWithName(s.PatternProperties, name) -} - -// DefinitionWithName returns the selected element. -func (s *Schema) DefinitionWithName(name string) *Schema { - return namedSchemaArrayElementWithName(s.Definitions, name) -} - -// AddProperty adds a named property. -func (s *Schema) AddProperty(name string, property *Schema) { - *s.Properties = append(*s.Properties, NewNamedSchema(name, property)) -} diff --git a/vendor/github.com/google/gnostic/jsonschema/operations.go b/vendor/github.com/google/gnostic/jsonschema/operations.go deleted file mode 100644 index ba8dd4a91..000000000 --- a/vendor/github.com/google/gnostic/jsonschema/operations.go +++ /dev/null @@ -1,394 +0,0 @@ -// Copyright 2017 Google LLC. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package jsonschema - -import ( - "fmt" - "log" - "strings" -) - -// -// OPERATIONS -// The following methods perform operations on Schemas. -// - -// IsEmpty returns true if no members of the Schema are specified. -func (schema *Schema) IsEmpty() bool { - return (schema.Schema == nil) && - (schema.ID == nil) && - (schema.MultipleOf == nil) && - (schema.Maximum == nil) && - (schema.ExclusiveMaximum == nil) && - (schema.Minimum == nil) && - (schema.ExclusiveMinimum == nil) && - (schema.MaxLength == nil) && - (schema.MinLength == nil) && - (schema.Pattern == nil) && - (schema.AdditionalItems == nil) && - (schema.Items == nil) && - (schema.MaxItems == nil) && - (schema.MinItems == nil) && - (schema.UniqueItems == nil) && - (schema.MaxProperties == nil) && - (schema.MinProperties == nil) && - (schema.Required == nil) && - (schema.AdditionalProperties == nil) && - (schema.Properties == nil) && - (schema.PatternProperties == nil) && - (schema.Dependencies == nil) && - (schema.Enumeration == nil) && - (schema.Type == nil) && - (schema.AllOf == nil) && - (schema.AnyOf == nil) && - (schema.OneOf == nil) && - (schema.Not == nil) && - (schema.Definitions == nil) && - (schema.Title == nil) && - (schema.Description == nil) && - (schema.Default == nil) && - (schema.Format == nil) && - (schema.Ref == nil) -} - -// IsEqual returns true if two schemas are equal. -func (schema *Schema) IsEqual(schema2 *Schema) bool { - return schema.String() == schema2.String() -} - -// SchemaOperation represents a function that can be applied to a Schema. -type SchemaOperation func(schema *Schema, context string) - -// Applies a specified function to a Schema and all of the Schemas that it contains. -func (schema *Schema) applyToSchemas(operation SchemaOperation, context string) { - - if schema.AdditionalItems != nil { - s := schema.AdditionalItems.Schema - if s != nil { - s.applyToSchemas(operation, "AdditionalItems") - } - } - - if schema.Items != nil { - if schema.Items.SchemaArray != nil { - for _, s := range *(schema.Items.SchemaArray) { - s.applyToSchemas(operation, "Items.SchemaArray") - } - } else if schema.Items.Schema != nil { - schema.Items.Schema.applyToSchemas(operation, "Items.Schema") - } - } - - if schema.AdditionalProperties != nil { - s := schema.AdditionalProperties.Schema - if s != nil { - s.applyToSchemas(operation, "AdditionalProperties") - } - } - - if schema.Properties != nil { - for _, pair := range *(schema.Properties) { - s := pair.Value - s.applyToSchemas(operation, "Properties") - } - } - if schema.PatternProperties != nil { - for _, pair := range *(schema.PatternProperties) { - s := pair.Value - s.applyToSchemas(operation, "PatternProperties") - } - } - - if schema.Dependencies != nil { - for _, pair := range *(schema.Dependencies) { - schemaOrStringArray := pair.Value - s := schemaOrStringArray.Schema - if s != nil { - s.applyToSchemas(operation, "Dependencies") - } - } - } - - if schema.AllOf != nil { - for _, s := range *(schema.AllOf) { - s.applyToSchemas(operation, "AllOf") - } - } - if schema.AnyOf != nil { - for _, s := range *(schema.AnyOf) { - s.applyToSchemas(operation, "AnyOf") - } - } - if schema.OneOf != nil { - for _, s := range *(schema.OneOf) { - s.applyToSchemas(operation, "OneOf") - } - } - if schema.Not != nil { - schema.Not.applyToSchemas(operation, "Not") - } - - if schema.Definitions != nil { - for _, pair := range *(schema.Definitions) { - s := pair.Value - s.applyToSchemas(operation, "Definitions") - } - } - - operation(schema, context) -} - -// CopyProperties copies all non-nil properties from the source Schema to the schema Schema. -func (schema *Schema) CopyProperties(source *Schema) { - if source.Schema != nil { - schema.Schema = source.Schema - } - if source.ID != nil { - schema.ID = source.ID - } - if source.MultipleOf != nil { - schema.MultipleOf = source.MultipleOf - } - if source.Maximum != nil { - schema.Maximum = source.Maximum - } - if source.ExclusiveMaximum != nil { - schema.ExclusiveMaximum = source.ExclusiveMaximum - } - if source.Minimum != nil { - schema.Minimum = source.Minimum - } - if source.ExclusiveMinimum != nil { - schema.ExclusiveMinimum = source.ExclusiveMinimum - } - if source.MaxLength != nil { - schema.MaxLength = source.MaxLength - } - if source.MinLength != nil { - schema.MinLength = source.MinLength - } - if source.Pattern != nil { - schema.Pattern = source.Pattern - } - if source.AdditionalItems != nil { - schema.AdditionalItems = source.AdditionalItems - } - if source.Items != nil { - schema.Items = source.Items - } - if source.MaxItems != nil { - schema.MaxItems = source.MaxItems - } - if source.MinItems != nil { - schema.MinItems = source.MinItems - } - if source.UniqueItems != nil { - schema.UniqueItems = source.UniqueItems - } - if source.MaxProperties != nil { - schema.MaxProperties = source.MaxProperties - } - if source.MinProperties != nil { - schema.MinProperties = source.MinProperties - } - if source.Required != nil { - schema.Required = source.Required - } - if source.AdditionalProperties != nil { - schema.AdditionalProperties = source.AdditionalProperties - } - if source.Properties != nil { - schema.Properties = source.Properties - } - if source.PatternProperties != nil { - schema.PatternProperties = source.PatternProperties - } - if source.Dependencies != nil { - schema.Dependencies = source.Dependencies - } - if source.Enumeration != nil { - schema.Enumeration = source.Enumeration - } - if source.Type != nil { - schema.Type = source.Type - } - if source.AllOf != nil { - schema.AllOf = source.AllOf - } - if source.AnyOf != nil { - schema.AnyOf = source.AnyOf - } - if source.OneOf != nil { - schema.OneOf = source.OneOf - } - if source.Not != nil { - schema.Not = source.Not - } - if source.Definitions != nil { - schema.Definitions = source.Definitions - } - if source.Title != nil { - schema.Title = source.Title - } - if source.Description != nil { - schema.Description = source.Description - } - if source.Default != nil { - schema.Default = source.Default - } - if source.Format != nil { - schema.Format = source.Format - } - if source.Ref != nil { - schema.Ref = source.Ref - } -} - -// TypeIs returns true if the Type of a Schema includes the specified type -func (schema *Schema) TypeIs(typeName string) bool { - if schema.Type != nil { - // the schema Type is either a string or an array of strings - if schema.Type.String != nil { - return (*(schema.Type.String) == typeName) - } else if schema.Type.StringArray != nil { - for _, n := range *(schema.Type.StringArray) { - if n == typeName { - return true - } - } - } - } - return false -} - -// ResolveRefs resolves "$ref" elements in a Schema and its children. -// But if a reference refers to an object type, is inside a oneOf, or contains a oneOf, -// the reference is kept and we expect downstream tools to separately model these -// referenced schemas. -func (schema *Schema) ResolveRefs() { - rootSchema := schema - count := 1 - for count > 0 { - count = 0 - schema.applyToSchemas( - func(schema *Schema, context string) { - if schema.Ref != nil { - resolvedRef, err := rootSchema.resolveJSONPointer(*(schema.Ref)) - if err != nil { - log.Printf("%+v", err) - } else if resolvedRef.TypeIs("object") { - // don't substitute for objects, we'll model the referenced schema with a class - } else if context == "OneOf" { - // don't substitute for references inside oneOf declarations - } else if resolvedRef.OneOf != nil { - // don't substitute for references that contain oneOf declarations - } else if resolvedRef.AdditionalProperties != nil { - // don't substitute for references that look like objects - } else { - schema.Ref = nil - schema.CopyProperties(resolvedRef) - count++ - } - } - }, "") - } -} - -// resolveJSONPointer resolves JSON pointers. -// This current implementation is very crude and custom for OpenAPI 2.0 schemas. -// It panics for any pointer that it is unable to resolve. -func (schema *Schema) resolveJSONPointer(ref string) (result *Schema, err error) { - parts := strings.Split(ref, "#") - if len(parts) == 2 { - documentName := parts[0] + "#" - if documentName == "#" && schema.ID != nil { - documentName = *(schema.ID) - } - path := parts[1] - document := schemas[documentName] - pathParts := strings.Split(path, "/") - - // we currently do a very limited (hard-coded) resolution of certain paths and log errors for missed cases - if len(pathParts) == 1 { - return document, nil - } else if len(pathParts) == 3 { - switch pathParts[1] { - case "definitions": - dictionary := document.Definitions - for _, pair := range *dictionary { - if pair.Name == pathParts[2] { - result = pair.Value - } - } - case "properties": - dictionary := document.Properties - for _, pair := range *dictionary { - if pair.Name == pathParts[2] { - result = pair.Value - } - } - default: - break - } - } - } - if result == nil { - return nil, fmt.Errorf("unresolved pointer: %+v", ref) - } - return result, nil -} - -// ResolveAllOfs replaces "allOf" elements by merging their properties into the parent Schema. -func (schema *Schema) ResolveAllOfs() { - schema.applyToSchemas( - func(schema *Schema, context string) { - if schema.AllOf != nil { - for _, allOf := range *(schema.AllOf) { - schema.CopyProperties(allOf) - } - schema.AllOf = nil - } - }, "resolveAllOfs") -} - -// ResolveAnyOfs replaces all "anyOf" elements with "oneOf". -func (schema *Schema) ResolveAnyOfs() { - schema.applyToSchemas( - func(schema *Schema, context string) { - if schema.AnyOf != nil { - schema.OneOf = schema.AnyOf - schema.AnyOf = nil - } - }, "resolveAnyOfs") -} - -// return a pointer to a copy of a passed-in string -func stringptr(input string) (output *string) { - return &input -} - -// CopyOfficialSchemaProperty copies a named property from the official JSON Schema definition -func (schema *Schema) CopyOfficialSchemaProperty(name string) { - *schema.Properties = append(*schema.Properties, - NewNamedSchema(name, - &Schema{Ref: stringptr("http://json-schema.org/draft-04/schema#/properties/" + name)})) -} - -// CopyOfficialSchemaProperties copies named properties from the official JSON Schema definition -func (schema *Schema) CopyOfficialSchemaProperties(names []string) { - for _, name := range names { - schema.CopyOfficialSchemaProperty(name) - } -} diff --git a/vendor/github.com/google/gnostic/jsonschema/reader.go b/vendor/github.com/google/gnostic/jsonschema/reader.go deleted file mode 100644 index b8583d466..000000000 --- a/vendor/github.com/google/gnostic/jsonschema/reader.go +++ /dev/null @@ -1,442 +0,0 @@ -// Copyright 2017 Google LLC. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//go:generate go run generate-base.go - -package jsonschema - -import ( - "fmt" - "io/ioutil" - "strconv" - - "gopkg.in/yaml.v3" -) - -// This is a global map of all known Schemas. -// It is initialized when the first Schema is created and inserted. -var schemas map[string]*Schema - -// NewBaseSchema builds a schema object from an embedded json representation. -func NewBaseSchema() (schema *Schema, err error) { - b, err := baseSchemaBytes() - if err != nil { - return nil, err - } - var node yaml.Node - err = yaml.Unmarshal(b, &node) - if err != nil { - return nil, err - } - return NewSchemaFromObject(&node), nil -} - -// NewSchemaFromFile reads a schema from a file. -// Currently this assumes that schemas are stored in the source distribution of this project. -func NewSchemaFromFile(filename string) (schema *Schema, err error) { - file, err := ioutil.ReadFile(filename) - if err != nil { - return nil, err - } - var node yaml.Node - err = yaml.Unmarshal(file, &node) - if err != nil { - return nil, err - } - return NewSchemaFromObject(&node), nil -} - -// NewSchemaFromObject constructs a schema from a parsed JSON object. -// Due to the complexity of the schema representation, this is a -// custom reader and not the standard Go JSON reader (encoding/json). -func NewSchemaFromObject(jsonData *yaml.Node) *Schema { - switch jsonData.Kind { - case yaml.DocumentNode: - return NewSchemaFromObject(jsonData.Content[0]) - case yaml.MappingNode: - schema := &Schema{} - - for i := 0; i < len(jsonData.Content); i += 2 { - k := jsonData.Content[i].Value - v := jsonData.Content[i+1] - - switch k { - case "$schema": - schema.Schema = schema.stringValue(v) - case "id": - schema.ID = schema.stringValue(v) - - case "multipleOf": - schema.MultipleOf = schema.numberValue(v) - case "maximum": - schema.Maximum = schema.numberValue(v) - case "exclusiveMaximum": - schema.ExclusiveMaximum = schema.boolValue(v) - case "minimum": - schema.Minimum = schema.numberValue(v) - case "exclusiveMinimum": - schema.ExclusiveMinimum = schema.boolValue(v) - - case "maxLength": - schema.MaxLength = schema.intValue(v) - case "minLength": - schema.MinLength = schema.intValue(v) - case "pattern": - schema.Pattern = schema.stringValue(v) - - case "additionalItems": - schema.AdditionalItems = schema.schemaOrBooleanValue(v) - case "items": - schema.Items = schema.schemaOrSchemaArrayValue(v) - case "maxItems": - schema.MaxItems = schema.intValue(v) - case "minItems": - schema.MinItems = schema.intValue(v) - case "uniqueItems": - schema.UniqueItems = schema.boolValue(v) - - case "maxProperties": - schema.MaxProperties = schema.intValue(v) - case "minProperties": - schema.MinProperties = schema.intValue(v) - case "required": - schema.Required = schema.arrayOfStringsValue(v) - case "additionalProperties": - schema.AdditionalProperties = schema.schemaOrBooleanValue(v) - case "properties": - schema.Properties = schema.mapOfSchemasValue(v) - case "patternProperties": - schema.PatternProperties = schema.mapOfSchemasValue(v) - case "dependencies": - schema.Dependencies = schema.mapOfSchemasOrStringArraysValue(v) - - case "enum": - schema.Enumeration = schema.arrayOfEnumValuesValue(v) - - case "type": - schema.Type = schema.stringOrStringArrayValue(v) - case "allOf": - schema.AllOf = schema.arrayOfSchemasValue(v) - case "anyOf": - schema.AnyOf = schema.arrayOfSchemasValue(v) - case "oneOf": - schema.OneOf = schema.arrayOfSchemasValue(v) - case "not": - schema.Not = NewSchemaFromObject(v) - case "definitions": - schema.Definitions = schema.mapOfSchemasValue(v) - - case "title": - schema.Title = schema.stringValue(v) - case "description": - schema.Description = schema.stringValue(v) - - case "default": - schema.Default = v - - case "format": - schema.Format = schema.stringValue(v) - case "$ref": - schema.Ref = schema.stringValue(v) - default: - fmt.Printf("UNSUPPORTED (%s)\n", k) - } - } - - // insert schema in global map - if schema.ID != nil { - if schemas == nil { - schemas = make(map[string]*Schema, 0) - } - schemas[*(schema.ID)] = schema - } - return schema - - default: - fmt.Printf("schemaValue: unexpected node %+v\n", jsonData) - return nil - } - - return nil -} - -// -// BUILDERS -// The following methods build elements of Schemas from interface{} values. -// Each returns nil if it is unable to build the desired element. -// - -// Gets the string value of an interface{} value if possible. -func (schema *Schema) stringValue(v *yaml.Node) *string { - switch v.Kind { - case yaml.ScalarNode: - return &v.Value - default: - fmt.Printf("stringValue: unexpected node %+v\n", v) - } - return nil -} - -// Gets the numeric value of an interface{} value if possible. -func (schema *Schema) numberValue(v *yaml.Node) *SchemaNumber { - number := &SchemaNumber{} - switch v.Kind { - case yaml.ScalarNode: - switch v.Tag { - case "!!float": - v2, _ := strconv.ParseFloat(v.Value, 64) - number.Float = &v2 - return number - case "!!int": - v2, _ := strconv.ParseInt(v.Value, 10, 64) - number.Integer = &v2 - return number - default: - fmt.Printf("stringValue: unexpected node %+v\n", v) - } - default: - fmt.Printf("stringValue: unexpected node %+v\n", v) - } - return nil -} - -// Gets the integer value of an interface{} value if possible. -func (schema *Schema) intValue(v *yaml.Node) *int64 { - switch v.Kind { - case yaml.ScalarNode: - switch v.Tag { - case "!!float": - v2, _ := strconv.ParseFloat(v.Value, 64) - v3 := int64(v2) - return &v3 - case "!!int": - v2, _ := strconv.ParseInt(v.Value, 10, 64) - return &v2 - default: - fmt.Printf("intValue: unexpected node %+v\n", v) - } - default: - fmt.Printf("intValue: unexpected node %+v\n", v) - } - return nil -} - -// Gets the bool value of an interface{} value if possible. -func (schema *Schema) boolValue(v *yaml.Node) *bool { - switch v.Kind { - case yaml.ScalarNode: - switch v.Tag { - case "!!bool": - v2, _ := strconv.ParseBool(v.Value) - return &v2 - default: - fmt.Printf("boolValue: unexpected node %+v\n", v) - } - default: - fmt.Printf("boolValue: unexpected node %+v\n", v) - } - return nil -} - -// Gets a map of Schemas from an interface{} value if possible. -func (schema *Schema) mapOfSchemasValue(v *yaml.Node) *[]*NamedSchema { - switch v.Kind { - case yaml.MappingNode: - m := make([]*NamedSchema, 0) - for i := 0; i < len(v.Content); i += 2 { - k2 := v.Content[i].Value - v2 := v.Content[i+1] - pair := &NamedSchema{Name: k2, Value: NewSchemaFromObject(v2)} - m = append(m, pair) - } - return &m - default: - fmt.Printf("mapOfSchemasValue: unexpected node %+v\n", v) - } - return nil -} - -// Gets an array of Schemas from an interface{} value if possible. -func (schema *Schema) arrayOfSchemasValue(v *yaml.Node) *[]*Schema { - switch v.Kind { - case yaml.SequenceNode: - m := make([]*Schema, 0) - for _, v2 := range v.Content { - switch v2.Kind { - case yaml.MappingNode: - s := NewSchemaFromObject(v2) - m = append(m, s) - default: - fmt.Printf("arrayOfSchemasValue: unexpected node %+v\n", v2) - } - } - return &m - case yaml.MappingNode: - m := make([]*Schema, 0) - s := NewSchemaFromObject(v) - m = append(m, s) - return &m - default: - fmt.Printf("arrayOfSchemasValue: unexpected node %+v\n", v) - } - return nil -} - -// Gets a Schema or an array of Schemas from an interface{} value if possible. -func (schema *Schema) schemaOrSchemaArrayValue(v *yaml.Node) *SchemaOrSchemaArray { - switch v.Kind { - case yaml.SequenceNode: - m := make([]*Schema, 0) - for _, v2 := range v.Content { - switch v2.Kind { - case yaml.MappingNode: - s := NewSchemaFromObject(v2) - m = append(m, s) - default: - fmt.Printf("schemaOrSchemaArrayValue: unexpected node %+v\n", v2) - } - } - return &SchemaOrSchemaArray{SchemaArray: &m} - case yaml.MappingNode: - s := NewSchemaFromObject(v) - return &SchemaOrSchemaArray{Schema: s} - default: - fmt.Printf("schemaOrSchemaArrayValue: unexpected node %+v\n", v) - } - return nil -} - -// Gets an array of strings from an interface{} value if possible. -func (schema *Schema) arrayOfStringsValue(v *yaml.Node) *[]string { - switch v.Kind { - case yaml.ScalarNode: - a := []string{v.Value} - return &a - case yaml.SequenceNode: - a := make([]string, 0) - for _, v2 := range v.Content { - switch v2.Kind { - case yaml.ScalarNode: - a = append(a, v2.Value) - default: - fmt.Printf("arrayOfStringsValue: unexpected node %+v\n", v2) - } - } - return &a - default: - fmt.Printf("arrayOfStringsValue: unexpected node %+v\n", v) - } - return nil -} - -// Gets a string or an array of strings from an interface{} value if possible. -func (schema *Schema) stringOrStringArrayValue(v *yaml.Node) *StringOrStringArray { - switch v.Kind { - case yaml.ScalarNode: - s := &StringOrStringArray{} - s.String = &v.Value - return s - case yaml.SequenceNode: - a := make([]string, 0) - for _, v2 := range v.Content { - switch v2.Kind { - case yaml.ScalarNode: - a = append(a, v2.Value) - default: - fmt.Printf("arrayOfStringsValue: unexpected node %+v\n", v2) - } - } - s := &StringOrStringArray{} - s.StringArray = &a - return s - default: - fmt.Printf("arrayOfStringsValue: unexpected node %+v\n", v) - } - return nil -} - -// Gets an array of enum values from an interface{} value if possible. -func (schema *Schema) arrayOfEnumValuesValue(v *yaml.Node) *[]SchemaEnumValue { - a := make([]SchemaEnumValue, 0) - switch v.Kind { - case yaml.SequenceNode: - for _, v2 := range v.Content { - switch v2.Kind { - case yaml.ScalarNode: - switch v2.Tag { - case "!!str": - a = append(a, SchemaEnumValue{String: &v2.Value}) - case "!!bool": - v3, _ := strconv.ParseBool(v2.Value) - a = append(a, SchemaEnumValue{Bool: &v3}) - default: - fmt.Printf("arrayOfEnumValuesValue: unexpected type %s\n", v2.Tag) - } - default: - fmt.Printf("arrayOfEnumValuesValue: unexpected node %+v\n", v2) - } - } - default: - fmt.Printf("arrayOfEnumValuesValue: unexpected node %+v\n", v) - } - return &a -} - -// Gets a map of schemas or string arrays from an interface{} value if possible. -func (schema *Schema) mapOfSchemasOrStringArraysValue(v *yaml.Node) *[]*NamedSchemaOrStringArray { - m := make([]*NamedSchemaOrStringArray, 0) - switch v.Kind { - case yaml.MappingNode: - for i := 0; i < len(v.Content); i += 2 { - k2 := v.Content[i].Value - v2 := v.Content[i+1] - switch v2.Kind { - case yaml.SequenceNode: - a := make([]string, 0) - for _, v3 := range v2.Content { - switch v3.Kind { - case yaml.ScalarNode: - a = append(a, v3.Value) - default: - fmt.Printf("mapOfSchemasOrStringArraysValue: unexpected node %+v\n", v3) - } - } - s := &SchemaOrStringArray{} - s.StringArray = &a - pair := &NamedSchemaOrStringArray{Name: k2, Value: s} - m = append(m, pair) - default: - fmt.Printf("mapOfSchemasOrStringArraysValue: unexpected node %+v\n", v2) - } - } - default: - fmt.Printf("mapOfSchemasOrStringArraysValue: unexpected node %+v\n", v) - } - return &m -} - -// Gets a schema or a boolean value from an interface{} value if possible. -func (schema *Schema) schemaOrBooleanValue(v *yaml.Node) *SchemaOrBoolean { - schemaOrBoolean := &SchemaOrBoolean{} - switch v.Kind { - case yaml.ScalarNode: - v2, _ := strconv.ParseBool(v.Value) - schemaOrBoolean.Boolean = &v2 - case yaml.MappingNode: - schemaOrBoolean.Schema = NewSchemaFromObject(v) - default: - fmt.Printf("schemaOrBooleanValue: unexpected node %+v\n", v) - } - return schemaOrBoolean -} diff --git a/vendor/github.com/google/gnostic/jsonschema/schema.json b/vendor/github.com/google/gnostic/jsonschema/schema.json deleted file mode 100644 index 85eb502a6..000000000 --- a/vendor/github.com/google/gnostic/jsonschema/schema.json +++ /dev/null @@ -1,150 +0,0 @@ -{ - "id": "http://json-schema.org/draft-04/schema#", - "$schema": "http://json-schema.org/draft-04/schema#", - "description": "Core schema meta-schema", - "definitions": { - "schemaArray": { - "type": "array", - "minItems": 1, - "items": { "$ref": "#" } - }, - "positiveInteger": { - "type": "integer", - "minimum": 0 - }, - "positiveIntegerDefault0": { - "allOf": [ { "$ref": "#/definitions/positiveInteger" }, { "default": 0 } ] - }, - "simpleTypes": { - "enum": [ "array", "boolean", "integer", "null", "number", "object", "string" ] - }, - "stringArray": { - "type": "array", - "items": { "type": "string" }, - "minItems": 1, - "uniqueItems": true - } - }, - "type": "object", - "properties": { - "id": { - "type": "string", - "format": "uri" - }, - "$schema": { - "type": "string", - "format": "uri" - }, - "title": { - "type": "string" - }, - "description": { - "type": "string" - }, - "default": {}, - "multipleOf": { - "type": "number", - "minimum": 0, - "exclusiveMinimum": true - }, - "maximum": { - "type": "number" - }, - "exclusiveMaximum": { - "type": "boolean", - "default": false - }, - "minimum": { - "type": "number" - }, - "exclusiveMinimum": { - "type": "boolean", - "default": false - }, - "maxLength": { "$ref": "#/definitions/positiveInteger" }, - "minLength": { "$ref": "#/definitions/positiveIntegerDefault0" }, - "pattern": { - "type": "string", - "format": "regex" - }, - "additionalItems": { - "anyOf": [ - { "type": "boolean" }, - { "$ref": "#" } - ], - "default": {} - }, - "items": { - "anyOf": [ - { "$ref": "#" }, - { "$ref": "#/definitions/schemaArray" } - ], - "default": {} - }, - "maxItems": { "$ref": "#/definitions/positiveInteger" }, - "minItems": { "$ref": "#/definitions/positiveIntegerDefault0" }, - "uniqueItems": { - "type": "boolean", - "default": false - }, - "maxProperties": { "$ref": "#/definitions/positiveInteger" }, - "minProperties": { "$ref": "#/definitions/positiveIntegerDefault0" }, - "required": { "$ref": "#/definitions/stringArray" }, - "additionalProperties": { - "anyOf": [ - { "type": "boolean" }, - { "$ref": "#" } - ], - "default": {} - }, - "definitions": { - "type": "object", - "additionalProperties": { "$ref": "#" }, - "default": {} - }, - "properties": { - "type": "object", - "additionalProperties": { "$ref": "#" }, - "default": {} - }, - "patternProperties": { - "type": "object", - "additionalProperties": { "$ref": "#" }, - "default": {} - }, - "dependencies": { - "type": "object", - "additionalProperties": { - "anyOf": [ - { "$ref": "#" }, - { "$ref": "#/definitions/stringArray" } - ] - } - }, - "enum": { - "type": "array", - "minItems": 1, - "uniqueItems": true - }, - "type": { - "anyOf": [ - { "$ref": "#/definitions/simpleTypes" }, - { - "type": "array", - "items": { "$ref": "#/definitions/simpleTypes" }, - "minItems": 1, - "uniqueItems": true - } - ] - }, - "allOf": { "$ref": "#/definitions/schemaArray" }, - "anyOf": { "$ref": "#/definitions/schemaArray" }, - "oneOf": { "$ref": "#/definitions/schemaArray" }, - "not": { "$ref": "#" } - }, - "dependencies": { - "exclusiveMaximum": [ "maximum" ], - "exclusiveMinimum": [ "minimum" ] - }, - "default": {} -} diff --git a/vendor/github.com/google/gnostic/jsonschema/writer.go b/vendor/github.com/google/gnostic/jsonschema/writer.go deleted file mode 100644 index 340dc5f93..000000000 --- a/vendor/github.com/google/gnostic/jsonschema/writer.go +++ /dev/null @@ -1,369 +0,0 @@ -// Copyright 2017 Google LLC. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package jsonschema - -import ( - "fmt" - - "gopkg.in/yaml.v3" -) - -const indentation = " " - -func renderMappingNode(node *yaml.Node, indent string) (result string) { - result = "{\n" - innerIndent := indent + indentation - for i := 0; i < len(node.Content); i += 2 { - // first print the key - key := node.Content[i].Value - result += fmt.Sprintf("%s\"%+v\": ", innerIndent, key) - // then the value - value := node.Content[i+1] - switch value.Kind { - case yaml.ScalarNode: - result += "\"" + value.Value + "\"" - case yaml.MappingNode: - result += renderMappingNode(value, innerIndent) - case yaml.SequenceNode: - result += renderSequenceNode(value, innerIndent) - default: - result += fmt.Sprintf("???MapItem(Key:%+v, Value:%T)", value, value) - } - if i < len(node.Content)-2 { - result += "," - } - result += "\n" - } - - result += indent + "}" - return result -} - -func renderSequenceNode(node *yaml.Node, indent string) (result string) { - result = "[\n" - innerIndent := indent + indentation - for i := 0; i < len(node.Content); i++ { - item := node.Content[i] - switch item.Kind { - case yaml.ScalarNode: - result += innerIndent + "\"" + item.Value + "\"" - case yaml.MappingNode: - result += innerIndent + renderMappingNode(item, innerIndent) + "" - default: - result += innerIndent + fmt.Sprintf("???ArrayItem(%+v)", item) - } - if i < len(node.Content)-1 { - result += "," - } - result += "\n" - } - result += indent + "]" - return result -} - -func renderStringArray(array []string, indent string) (result string) { - result = "[\n" - innerIndent := indent + indentation - for i, item := range array { - result += innerIndent + "\"" + item + "\"" - if i < len(array)-1 { - result += "," - } - result += "\n" - } - result += indent + "]" - return result -} - -// Render renders a yaml.Node as JSON -func Render(node *yaml.Node) string { - if node.Kind == yaml.DocumentNode { - if len(node.Content) == 1 { - return Render(node.Content[0]) - } - } else if node.Kind == yaml.MappingNode { - return renderMappingNode(node, "") + "\n" - } else if node.Kind == yaml.SequenceNode { - return renderSequenceNode(node, "") + "\n" - } - return "" -} - -func (object *SchemaNumber) nodeValue() *yaml.Node { - if object.Integer != nil { - return nodeForInt64(*object.Integer) - } else if object.Float != nil { - return nodeForFloat64(*object.Float) - } else { - return nil - } -} - -func (object *SchemaOrBoolean) nodeValue() *yaml.Node { - if object.Schema != nil { - return object.Schema.nodeValue() - } else if object.Boolean != nil { - return nodeForBoolean(*object.Boolean) - } else { - return nil - } -} - -func nodeForStringArray(array []string) *yaml.Node { - content := make([]*yaml.Node, 0) - for _, item := range array { - content = append(content, nodeForString(item)) - } - return nodeForSequence(content) -} - -func nodeForSchemaArray(array []*Schema) *yaml.Node { - content := make([]*yaml.Node, 0) - for _, item := range array { - content = append(content, item.nodeValue()) - } - return nodeForSequence(content) -} - -func (object *StringOrStringArray) nodeValue() *yaml.Node { - if object.String != nil { - return nodeForString(*object.String) - } else if object.StringArray != nil { - return nodeForStringArray(*(object.StringArray)) - } else { - return nil - } -} - -func (object *SchemaOrStringArray) nodeValue() *yaml.Node { - if object.Schema != nil { - return object.Schema.nodeValue() - } else if object.StringArray != nil { - return nodeForStringArray(*(object.StringArray)) - } else { - return nil - } -} - -func (object *SchemaOrSchemaArray) nodeValue() *yaml.Node { - if object.Schema != nil { - return object.Schema.nodeValue() - } else if object.SchemaArray != nil { - return nodeForSchemaArray(*(object.SchemaArray)) - } else { - return nil - } -} - -func (object *SchemaEnumValue) nodeValue() *yaml.Node { - if object.String != nil { - return nodeForString(*object.String) - } else if object.Bool != nil { - return nodeForBoolean(*object.Bool) - } else { - return nil - } -} - -func nodeForNamedSchemaArray(array *[]*NamedSchema) *yaml.Node { - content := make([]*yaml.Node, 0) - for _, pair := range *(array) { - content = appendPair(content, pair.Name, pair.Value.nodeValue()) - } - return nodeForMapping(content) -} - -func nodeForNamedSchemaOrStringArray(array *[]*NamedSchemaOrStringArray) *yaml.Node { - content := make([]*yaml.Node, 0) - for _, pair := range *(array) { - content = appendPair(content, pair.Name, pair.Value.nodeValue()) - } - return nodeForMapping(content) -} - -func nodeForSchemaEnumArray(array *[]SchemaEnumValue) *yaml.Node { - content := make([]*yaml.Node, 0) - for _, item := range *array { - content = append(content, item.nodeValue()) - } - return nodeForSequence(content) -} - -func nodeForMapping(content []*yaml.Node) *yaml.Node { - return &yaml.Node{ - Kind: yaml.MappingNode, - Content: content, - } -} - -func nodeForSequence(content []*yaml.Node) *yaml.Node { - return &yaml.Node{ - Kind: yaml.SequenceNode, - Content: content, - } -} - -func nodeForString(value string) *yaml.Node { - return &yaml.Node{ - Kind: yaml.ScalarNode, - Tag: "!!str", - Value: value, - } -} - -func nodeForBoolean(value bool) *yaml.Node { - return &yaml.Node{ - Kind: yaml.ScalarNode, - Tag: "!!bool", - Value: fmt.Sprintf("%t", value), - } -} - -func nodeForInt64(value int64) *yaml.Node { - return &yaml.Node{ - Kind: yaml.ScalarNode, - Tag: "!!int", - Value: fmt.Sprintf("%d", value), - } -} - -func nodeForFloat64(value float64) *yaml.Node { - return &yaml.Node{ - Kind: yaml.ScalarNode, - Tag: "!!float", - Value: fmt.Sprintf("%f", value), - } -} - -func appendPair(nodes []*yaml.Node, name string, value *yaml.Node) []*yaml.Node { - nodes = append(nodes, nodeForString(name)) - nodes = append(nodes, value) - return nodes -} - -func (schema *Schema) nodeValue() *yaml.Node { - n := &yaml.Node{Kind: yaml.MappingNode} - content := make([]*yaml.Node, 0) - if schema.Title != nil { - content = appendPair(content, "title", nodeForString(*schema.Title)) - } - if schema.ID != nil { - content = appendPair(content, "id", nodeForString(*schema.ID)) - } - if schema.Schema != nil { - content = appendPair(content, "$schema", nodeForString(*schema.Schema)) - } - if schema.Type != nil { - content = appendPair(content, "type", schema.Type.nodeValue()) - } - if schema.Items != nil { - content = appendPair(content, "items", schema.Items.nodeValue()) - } - if schema.Description != nil { - content = appendPair(content, "description", nodeForString(*schema.Description)) - } - if schema.Required != nil { - content = appendPair(content, "required", nodeForStringArray(*schema.Required)) - } - if schema.AdditionalProperties != nil { - content = appendPair(content, "additionalProperties", schema.AdditionalProperties.nodeValue()) - } - if schema.PatternProperties != nil { - content = appendPair(content, "patternProperties", nodeForNamedSchemaArray(schema.PatternProperties)) - } - if schema.Properties != nil { - content = appendPair(content, "properties", nodeForNamedSchemaArray(schema.Properties)) - } - if schema.Dependencies != nil { - content = appendPair(content, "dependencies", nodeForNamedSchemaOrStringArray(schema.Dependencies)) - } - if schema.Ref != nil { - content = appendPair(content, "$ref", nodeForString(*schema.Ref)) - } - if schema.MultipleOf != nil { - content = appendPair(content, "multipleOf", schema.MultipleOf.nodeValue()) - } - if schema.Maximum != nil { - content = appendPair(content, "maximum", schema.Maximum.nodeValue()) - } - if schema.ExclusiveMaximum != nil { - content = appendPair(content, "exclusiveMaximum", nodeForBoolean(*schema.ExclusiveMaximum)) - } - if schema.Minimum != nil { - content = appendPair(content, "minimum", schema.Minimum.nodeValue()) - } - if schema.ExclusiveMinimum != nil { - content = appendPair(content, "exclusiveMinimum", nodeForBoolean(*schema.ExclusiveMinimum)) - } - if schema.MaxLength != nil { - content = appendPair(content, "maxLength", nodeForInt64(*schema.MaxLength)) - } - if schema.MinLength != nil { - content = appendPair(content, "minLength", nodeForInt64(*schema.MinLength)) - } - if schema.Pattern != nil { - content = appendPair(content, "pattern", nodeForString(*schema.Pattern)) - } - if schema.AdditionalItems != nil { - content = appendPair(content, "additionalItems", schema.AdditionalItems.nodeValue()) - } - if schema.MaxItems != nil { - content = appendPair(content, "maxItems", nodeForInt64(*schema.MaxItems)) - } - if schema.MinItems != nil { - content = appendPair(content, "minItems", nodeForInt64(*schema.MinItems)) - } - if schema.UniqueItems != nil { - content = appendPair(content, "uniqueItems", nodeForBoolean(*schema.UniqueItems)) - } - if schema.MaxProperties != nil { - content = appendPair(content, "maxProperties", nodeForInt64(*schema.MaxProperties)) - } - if schema.MinProperties != nil { - content = appendPair(content, "minProperties", nodeForInt64(*schema.MinProperties)) - } - if schema.Enumeration != nil { - content = appendPair(content, "enum", nodeForSchemaEnumArray(schema.Enumeration)) - } - if schema.AllOf != nil { - content = appendPair(content, "allOf", nodeForSchemaArray(*schema.AllOf)) - } - if schema.AnyOf != nil { - content = appendPair(content, "anyOf", nodeForSchemaArray(*schema.AnyOf)) - } - if schema.OneOf != nil { - content = appendPair(content, "oneOf", nodeForSchemaArray(*schema.OneOf)) - } - if schema.Not != nil { - content = appendPair(content, "not", schema.Not.nodeValue()) - } - if schema.Definitions != nil { - content = appendPair(content, "definitions", nodeForNamedSchemaArray(schema.Definitions)) - } - if schema.Default != nil { - // m = append(m, yaml.MapItem{Key: "default", Value: *schema.Default}) - } - if schema.Format != nil { - content = appendPair(content, "format", nodeForString(*schema.Format)) - } - n.Content = content - return n -} - -// JSONString returns a json representation of a schema. -func (schema *Schema) JSONString() string { - node := schema.nodeValue() - return Render(node) -} diff --git a/vendor/github.com/google/gnostic/openapiv2/OpenAPIv2.go b/vendor/github.com/google/gnostic/openapiv2/OpenAPIv2.go deleted file mode 100644 index 0f1790766..000000000 --- a/vendor/github.com/google/gnostic/openapiv2/OpenAPIv2.go +++ /dev/null @@ -1,8820 +0,0 @@ -// Copyright 2020 Google LLC. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// THIS FILE IS AUTOMATICALLY GENERATED. - -package openapi_v2 - -import ( - "fmt" - "regexp" - "strings" - - "gopkg.in/yaml.v3" - - "github.com/google/gnostic/compiler" -) - -// Version returns the package name (and OpenAPI version). -func Version() string { - return "openapi_v2" -} - -// NewAdditionalPropertiesItem creates an object of type AdditionalPropertiesItem if possible, returning an error if not. -func NewAdditionalPropertiesItem(in *yaml.Node, context *compiler.Context) (*AdditionalPropertiesItem, error) { - errors := make([]error, 0) - x := &AdditionalPropertiesItem{} - matched := false - // Schema schema = 1; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewSchema(m, compiler.NewContext("schema", m, context)) - if matchingError == nil { - x.Oneof = &AdditionalPropertiesItem_Schema{Schema: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - // bool boolean = 2; - boolValue, ok := compiler.BoolForScalarNode(in) - if ok { - x.Oneof = &AdditionalPropertiesItem_Boolean{Boolean: boolValue} - matched = true - } - if matched { - // since the oneof matched one of its possibilities, discard any matching errors - errors = make([]error, 0) - } else { - message := fmt.Sprintf("contains an invalid AdditionalPropertiesItem") - err := compiler.NewError(context, message) - errors = []error{err} - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewAny creates an object of type Any if possible, returning an error if not. -func NewAny(in *yaml.Node, context *compiler.Context) (*Any, error) { - errors := make([]error, 0) - x := &Any{} - bytes := compiler.Marshal(in) - x.Yaml = string(bytes) - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewApiKeySecurity creates an object of type ApiKeySecurity if possible, returning an error if not. -func NewApiKeySecurity(in *yaml.Node, context *compiler.Context) (*ApiKeySecurity, error) { - errors := make([]error, 0) - x := &ApiKeySecurity{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"in", "name", "type"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"description", "in", "name", "type"} - allowedPatterns := []*regexp.Regexp{pattern0} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string type = 1; - v1 := compiler.MapValueForKey(m, "type") - if v1 != nil { - x.Type, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [apiKey] - if ok && !compiler.StringArrayContainsValue([]string{"apiKey"}, x.Type) { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string name = 2; - v2 := compiler.MapValueForKey(m, "name") - if v2 != nil { - x.Name, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string in = 3; - v3 := compiler.MapValueForKey(m, "in") - if v3 != nil { - x.In, ok = compiler.StringForScalarNode(v3) - if !ok { - message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [header query] - if ok && !compiler.StringArrayContainsValue([]string{"header", "query"}, x.In) { - message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string description = 4; - v4 := compiler.MapValueForKey(m, "description") - if v4 != nil { - x.Description, ok = compiler.StringForScalarNode(v4) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v4)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated NamedAny vendor_extension = 5; - // MAP: Any ^x- - x.VendorExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.VendorExtension = append(x.VendorExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewBasicAuthenticationSecurity creates an object of type BasicAuthenticationSecurity if possible, returning an error if not. -func NewBasicAuthenticationSecurity(in *yaml.Node, context *compiler.Context) (*BasicAuthenticationSecurity, error) { - errors := make([]error, 0) - x := &BasicAuthenticationSecurity{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"type"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"description", "type"} - allowedPatterns := []*regexp.Regexp{pattern0} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string type = 1; - v1 := compiler.MapValueForKey(m, "type") - if v1 != nil { - x.Type, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [basic] - if ok && !compiler.StringArrayContainsValue([]string{"basic"}, x.Type) { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string description = 2; - v2 := compiler.MapValueForKey(m, "description") - if v2 != nil { - x.Description, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated NamedAny vendor_extension = 3; - // MAP: Any ^x- - x.VendorExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.VendorExtension = append(x.VendorExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewBodyParameter creates an object of type BodyParameter if possible, returning an error if not. -func NewBodyParameter(in *yaml.Node, context *compiler.Context) (*BodyParameter, error) { - errors := make([]error, 0) - x := &BodyParameter{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"in", "name", "schema"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"description", "in", "name", "required", "schema"} - allowedPatterns := []*regexp.Regexp{pattern0} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string description = 1; - v1 := compiler.MapValueForKey(m, "description") - if v1 != nil { - x.Description, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string name = 2; - v2 := compiler.MapValueForKey(m, "name") - if v2 != nil { - x.Name, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string in = 3; - v3 := compiler.MapValueForKey(m, "in") - if v3 != nil { - x.In, ok = compiler.StringForScalarNode(v3) - if !ok { - message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [body] - if ok && !compiler.StringArrayContainsValue([]string{"body"}, x.In) { - message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool required = 4; - v4 := compiler.MapValueForKey(m, "required") - if v4 != nil { - x.Required, ok = compiler.BoolForScalarNode(v4) - if !ok { - message := fmt.Sprintf("has unexpected value for required: %s", compiler.Display(v4)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Schema schema = 5; - v5 := compiler.MapValueForKey(m, "schema") - if v5 != nil { - var err error - x.Schema, err = NewSchema(v5, compiler.NewContext("schema", v5, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated NamedAny vendor_extension = 6; - // MAP: Any ^x- - x.VendorExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.VendorExtension = append(x.VendorExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewContact creates an object of type Contact if possible, returning an error if not. -func NewContact(in *yaml.Node, context *compiler.Context) (*Contact, error) { - errors := make([]error, 0) - x := &Contact{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"email", "name", "url"} - allowedPatterns := []*regexp.Regexp{pattern0} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string url = 2; - v2 := compiler.MapValueForKey(m, "url") - if v2 != nil { - x.Url, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for url: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string email = 3; - v3 := compiler.MapValueForKey(m, "email") - if v3 != nil { - x.Email, ok = compiler.StringForScalarNode(v3) - if !ok { - message := fmt.Sprintf("has unexpected value for email: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated NamedAny vendor_extension = 4; - // MAP: Any ^x- - x.VendorExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.VendorExtension = append(x.VendorExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewDefault creates an object of type Default if possible, returning an error if not. -func NewDefault(in *yaml.Node, context *compiler.Context) (*Default, error) { - errors := make([]error, 0) - x := &Default{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedAny additional_properties = 1; - // MAP: Any - x.AdditionalProperties = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewDefinitions creates an object of type Definitions if possible, returning an error if not. -func NewDefinitions(in *yaml.Node, context *compiler.Context) (*Definitions, error) { - errors := make([]error, 0) - x := &Definitions{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedSchema additional_properties = 1; - // MAP: Schema - x.AdditionalProperties = make([]*NamedSchema, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedSchema{} - pair.Name = k - var err error - pair.Value, err = NewSchema(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewDocument creates an object of type Document if possible, returning an error if not. -func NewDocument(in *yaml.Node, context *compiler.Context) (*Document, error) { - errors := make([]error, 0) - x := &Document{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"info", "paths", "swagger"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"basePath", "consumes", "definitions", "externalDocs", "host", "info", "parameters", "paths", "produces", "responses", "schemes", "security", "securityDefinitions", "swagger", "tags"} - allowedPatterns := []*regexp.Regexp{pattern0} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string swagger = 1; - v1 := compiler.MapValueForKey(m, "swagger") - if v1 != nil { - x.Swagger, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for swagger: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [2.0] - if ok && !compiler.StringArrayContainsValue([]string{"2.0"}, x.Swagger) { - message := fmt.Sprintf("has unexpected value for swagger: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Info info = 2; - v2 := compiler.MapValueForKey(m, "info") - if v2 != nil { - var err error - x.Info, err = NewInfo(v2, compiler.NewContext("info", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - // string host = 3; - v3 := compiler.MapValueForKey(m, "host") - if v3 != nil { - x.Host, ok = compiler.StringForScalarNode(v3) - if !ok { - message := fmt.Sprintf("has unexpected value for host: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string base_path = 4; - v4 := compiler.MapValueForKey(m, "basePath") - if v4 != nil { - x.BasePath, ok = compiler.StringForScalarNode(v4) - if !ok { - message := fmt.Sprintf("has unexpected value for basePath: %s", compiler.Display(v4)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated string schemes = 5; - v5 := compiler.MapValueForKey(m, "schemes") - if v5 != nil { - v, ok := compiler.SequenceNodeForNode(v5) - if ok { - x.Schemes = compiler.StringArrayForSequenceNode(v) - } else { - message := fmt.Sprintf("has unexpected value for schemes: %s", compiler.Display(v5)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [http https ws wss] - if ok && !compiler.StringArrayContainsValues([]string{"http", "https", "ws", "wss"}, x.Schemes) { - message := fmt.Sprintf("has unexpected value for schemes: %s", compiler.Display(v5)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated string consumes = 6; - v6 := compiler.MapValueForKey(m, "consumes") - if v6 != nil { - v, ok := compiler.SequenceNodeForNode(v6) - if ok { - x.Consumes = compiler.StringArrayForSequenceNode(v) - } else { - message := fmt.Sprintf("has unexpected value for consumes: %s", compiler.Display(v6)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated string produces = 7; - v7 := compiler.MapValueForKey(m, "produces") - if v7 != nil { - v, ok := compiler.SequenceNodeForNode(v7) - if ok { - x.Produces = compiler.StringArrayForSequenceNode(v) - } else { - message := fmt.Sprintf("has unexpected value for produces: %s", compiler.Display(v7)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Paths paths = 8; - v8 := compiler.MapValueForKey(m, "paths") - if v8 != nil { - var err error - x.Paths, err = NewPaths(v8, compiler.NewContext("paths", v8, context)) - if err != nil { - errors = append(errors, err) - } - } - // Definitions definitions = 9; - v9 := compiler.MapValueForKey(m, "definitions") - if v9 != nil { - var err error - x.Definitions, err = NewDefinitions(v9, compiler.NewContext("definitions", v9, context)) - if err != nil { - errors = append(errors, err) - } - } - // ParameterDefinitions parameters = 10; - v10 := compiler.MapValueForKey(m, "parameters") - if v10 != nil { - var err error - x.Parameters, err = NewParameterDefinitions(v10, compiler.NewContext("parameters", v10, context)) - if err != nil { - errors = append(errors, err) - } - } - // ResponseDefinitions responses = 11; - v11 := compiler.MapValueForKey(m, "responses") - if v11 != nil { - var err error - x.Responses, err = NewResponseDefinitions(v11, compiler.NewContext("responses", v11, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated SecurityRequirement security = 12; - v12 := compiler.MapValueForKey(m, "security") - if v12 != nil { - // repeated SecurityRequirement - x.Security = make([]*SecurityRequirement, 0) - a, ok := compiler.SequenceNodeForNode(v12) - if ok { - for _, item := range a.Content { - y, err := NewSecurityRequirement(item, compiler.NewContext("security", item, context)) - if err != nil { - errors = append(errors, err) - } - x.Security = append(x.Security, y) - } - } - } - // SecurityDefinitions security_definitions = 13; - v13 := compiler.MapValueForKey(m, "securityDefinitions") - if v13 != nil { - var err error - x.SecurityDefinitions, err = NewSecurityDefinitions(v13, compiler.NewContext("securityDefinitions", v13, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated Tag tags = 14; - v14 := compiler.MapValueForKey(m, "tags") - if v14 != nil { - // repeated Tag - x.Tags = make([]*Tag, 0) - a, ok := compiler.SequenceNodeForNode(v14) - if ok { - for _, item := range a.Content { - y, err := NewTag(item, compiler.NewContext("tags", item, context)) - if err != nil { - errors = append(errors, err) - } - x.Tags = append(x.Tags, y) - } - } - } - // ExternalDocs external_docs = 15; - v15 := compiler.MapValueForKey(m, "externalDocs") - if v15 != nil { - var err error - x.ExternalDocs, err = NewExternalDocs(v15, compiler.NewContext("externalDocs", v15, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated NamedAny vendor_extension = 16; - // MAP: Any ^x- - x.VendorExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.VendorExtension = append(x.VendorExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewExamples creates an object of type Examples if possible, returning an error if not. -func NewExamples(in *yaml.Node, context *compiler.Context) (*Examples, error) { - errors := make([]error, 0) - x := &Examples{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedAny additional_properties = 1; - // MAP: Any - x.AdditionalProperties = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewExternalDocs creates an object of type ExternalDocs if possible, returning an error if not. -func NewExternalDocs(in *yaml.Node, context *compiler.Context) (*ExternalDocs, error) { - errors := make([]error, 0) - x := &ExternalDocs{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"url"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"description", "url"} - allowedPatterns := []*regexp.Regexp{pattern0} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string description = 1; - v1 := compiler.MapValueForKey(m, "description") - if v1 != nil { - x.Description, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string url = 2; - v2 := compiler.MapValueForKey(m, "url") - if v2 != nil { - x.Url, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for url: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated NamedAny vendor_extension = 3; - // MAP: Any ^x- - x.VendorExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.VendorExtension = append(x.VendorExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewFileSchema creates an object of type FileSchema if possible, returning an error if not. -func NewFileSchema(in *yaml.Node, context *compiler.Context) (*FileSchema, error) { - errors := make([]error, 0) - x := &FileSchema{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"type"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"default", "description", "example", "externalDocs", "format", "readOnly", "required", "title", "type"} - allowedPatterns := []*regexp.Regexp{pattern0} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string format = 1; - v1 := compiler.MapValueForKey(m, "format") - if v1 != nil { - x.Format, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for format: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string title = 2; - v2 := compiler.MapValueForKey(m, "title") - if v2 != nil { - x.Title, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for title: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string description = 3; - v3 := compiler.MapValueForKey(m, "description") - if v3 != nil { - x.Description, ok = compiler.StringForScalarNode(v3) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Any default = 4; - v4 := compiler.MapValueForKey(m, "default") - if v4 != nil { - var err error - x.Default, err = NewAny(v4, compiler.NewContext("default", v4, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated string required = 5; - v5 := compiler.MapValueForKey(m, "required") - if v5 != nil { - v, ok := compiler.SequenceNodeForNode(v5) - if ok { - x.Required = compiler.StringArrayForSequenceNode(v) - } else { - message := fmt.Sprintf("has unexpected value for required: %s", compiler.Display(v5)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string type = 6; - v6 := compiler.MapValueForKey(m, "type") - if v6 != nil { - x.Type, ok = compiler.StringForScalarNode(v6) - if !ok { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v6)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [file] - if ok && !compiler.StringArrayContainsValue([]string{"file"}, x.Type) { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v6)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool read_only = 7; - v7 := compiler.MapValueForKey(m, "readOnly") - if v7 != nil { - x.ReadOnly, ok = compiler.BoolForScalarNode(v7) - if !ok { - message := fmt.Sprintf("has unexpected value for readOnly: %s", compiler.Display(v7)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // ExternalDocs external_docs = 8; - v8 := compiler.MapValueForKey(m, "externalDocs") - if v8 != nil { - var err error - x.ExternalDocs, err = NewExternalDocs(v8, compiler.NewContext("externalDocs", v8, context)) - if err != nil { - errors = append(errors, err) - } - } - // Any example = 9; - v9 := compiler.MapValueForKey(m, "example") - if v9 != nil { - var err error - x.Example, err = NewAny(v9, compiler.NewContext("example", v9, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated NamedAny vendor_extension = 10; - // MAP: Any ^x- - x.VendorExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.VendorExtension = append(x.VendorExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewFormDataParameterSubSchema creates an object of type FormDataParameterSubSchema if possible, returning an error if not. -func NewFormDataParameterSubSchema(in *yaml.Node, context *compiler.Context) (*FormDataParameterSubSchema, error) { - errors := make([]error, 0) - x := &FormDataParameterSubSchema{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"allowEmptyValue", "collectionFormat", "default", "description", "enum", "exclusiveMaximum", "exclusiveMinimum", "format", "in", "items", "maxItems", "maxLength", "maximum", "minItems", "minLength", "minimum", "multipleOf", "name", "pattern", "required", "type", "uniqueItems"} - allowedPatterns := []*regexp.Regexp{pattern0} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // bool required = 1; - v1 := compiler.MapValueForKey(m, "required") - if v1 != nil { - x.Required, ok = compiler.BoolForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for required: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string in = 2; - v2 := compiler.MapValueForKey(m, "in") - if v2 != nil { - x.In, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [formData] - if ok && !compiler.StringArrayContainsValue([]string{"formData"}, x.In) { - message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string description = 3; - v3 := compiler.MapValueForKey(m, "description") - if v3 != nil { - x.Description, ok = compiler.StringForScalarNode(v3) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string name = 4; - v4 := compiler.MapValueForKey(m, "name") - if v4 != nil { - x.Name, ok = compiler.StringForScalarNode(v4) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v4)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool allow_empty_value = 5; - v5 := compiler.MapValueForKey(m, "allowEmptyValue") - if v5 != nil { - x.AllowEmptyValue, ok = compiler.BoolForScalarNode(v5) - if !ok { - message := fmt.Sprintf("has unexpected value for allowEmptyValue: %s", compiler.Display(v5)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string type = 6; - v6 := compiler.MapValueForKey(m, "type") - if v6 != nil { - x.Type, ok = compiler.StringForScalarNode(v6) - if !ok { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v6)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [string number boolean integer array file] - if ok && !compiler.StringArrayContainsValue([]string{"string", "number", "boolean", "integer", "array", "file"}, x.Type) { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v6)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string format = 7; - v7 := compiler.MapValueForKey(m, "format") - if v7 != nil { - x.Format, ok = compiler.StringForScalarNode(v7) - if !ok { - message := fmt.Sprintf("has unexpected value for format: %s", compiler.Display(v7)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // PrimitivesItems items = 8; - v8 := compiler.MapValueForKey(m, "items") - if v8 != nil { - var err error - x.Items, err = NewPrimitivesItems(v8, compiler.NewContext("items", v8, context)) - if err != nil { - errors = append(errors, err) - } - } - // string collection_format = 9; - v9 := compiler.MapValueForKey(m, "collectionFormat") - if v9 != nil { - x.CollectionFormat, ok = compiler.StringForScalarNode(v9) - if !ok { - message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v9)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [csv ssv tsv pipes multi] - if ok && !compiler.StringArrayContainsValue([]string{"csv", "ssv", "tsv", "pipes", "multi"}, x.CollectionFormat) { - message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v9)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Any default = 10; - v10 := compiler.MapValueForKey(m, "default") - if v10 != nil { - var err error - x.Default, err = NewAny(v10, compiler.NewContext("default", v10, context)) - if err != nil { - errors = append(errors, err) - } - } - // float maximum = 11; - v11 := compiler.MapValueForKey(m, "maximum") - if v11 != nil { - v, ok := compiler.FloatForScalarNode(v11) - if ok { - x.Maximum = v - } else { - message := fmt.Sprintf("has unexpected value for maximum: %s", compiler.Display(v11)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool exclusive_maximum = 12; - v12 := compiler.MapValueForKey(m, "exclusiveMaximum") - if v12 != nil { - x.ExclusiveMaximum, ok = compiler.BoolForScalarNode(v12) - if !ok { - message := fmt.Sprintf("has unexpected value for exclusiveMaximum: %s", compiler.Display(v12)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // float minimum = 13; - v13 := compiler.MapValueForKey(m, "minimum") - if v13 != nil { - v, ok := compiler.FloatForScalarNode(v13) - if ok { - x.Minimum = v - } else { - message := fmt.Sprintf("has unexpected value for minimum: %s", compiler.Display(v13)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool exclusive_minimum = 14; - v14 := compiler.MapValueForKey(m, "exclusiveMinimum") - if v14 != nil { - x.ExclusiveMinimum, ok = compiler.BoolForScalarNode(v14) - if !ok { - message := fmt.Sprintf("has unexpected value for exclusiveMinimum: %s", compiler.Display(v14)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 max_length = 15; - v15 := compiler.MapValueForKey(m, "maxLength") - if v15 != nil { - t, ok := compiler.IntForScalarNode(v15) - if ok { - x.MaxLength = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for maxLength: %s", compiler.Display(v15)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 min_length = 16; - v16 := compiler.MapValueForKey(m, "minLength") - if v16 != nil { - t, ok := compiler.IntForScalarNode(v16) - if ok { - x.MinLength = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for minLength: %s", compiler.Display(v16)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string pattern = 17; - v17 := compiler.MapValueForKey(m, "pattern") - if v17 != nil { - x.Pattern, ok = compiler.StringForScalarNode(v17) - if !ok { - message := fmt.Sprintf("has unexpected value for pattern: %s", compiler.Display(v17)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 max_items = 18; - v18 := compiler.MapValueForKey(m, "maxItems") - if v18 != nil { - t, ok := compiler.IntForScalarNode(v18) - if ok { - x.MaxItems = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for maxItems: %s", compiler.Display(v18)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 min_items = 19; - v19 := compiler.MapValueForKey(m, "minItems") - if v19 != nil { - t, ok := compiler.IntForScalarNode(v19) - if ok { - x.MinItems = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for minItems: %s", compiler.Display(v19)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool unique_items = 20; - v20 := compiler.MapValueForKey(m, "uniqueItems") - if v20 != nil { - x.UniqueItems, ok = compiler.BoolForScalarNode(v20) - if !ok { - message := fmt.Sprintf("has unexpected value for uniqueItems: %s", compiler.Display(v20)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated Any enum = 21; - v21 := compiler.MapValueForKey(m, "enum") - if v21 != nil { - // repeated Any - x.Enum = make([]*Any, 0) - a, ok := compiler.SequenceNodeForNode(v21) - if ok { - for _, item := range a.Content { - y, err := NewAny(item, compiler.NewContext("enum", item, context)) - if err != nil { - errors = append(errors, err) - } - x.Enum = append(x.Enum, y) - } - } - } - // float multiple_of = 22; - v22 := compiler.MapValueForKey(m, "multipleOf") - if v22 != nil { - v, ok := compiler.FloatForScalarNode(v22) - if ok { - x.MultipleOf = v - } else { - message := fmt.Sprintf("has unexpected value for multipleOf: %s", compiler.Display(v22)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated NamedAny vendor_extension = 23; - // MAP: Any ^x- - x.VendorExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.VendorExtension = append(x.VendorExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewHeader creates an object of type Header if possible, returning an error if not. -func NewHeader(in *yaml.Node, context *compiler.Context) (*Header, error) { - errors := make([]error, 0) - x := &Header{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"type"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"collectionFormat", "default", "description", "enum", "exclusiveMaximum", "exclusiveMinimum", "format", "items", "maxItems", "maxLength", "maximum", "minItems", "minLength", "minimum", "multipleOf", "pattern", "type", "uniqueItems"} - allowedPatterns := []*regexp.Regexp{pattern0} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string type = 1; - v1 := compiler.MapValueForKey(m, "type") - if v1 != nil { - x.Type, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [string number integer boolean array] - if ok && !compiler.StringArrayContainsValue([]string{"string", "number", "integer", "boolean", "array"}, x.Type) { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string format = 2; - v2 := compiler.MapValueForKey(m, "format") - if v2 != nil { - x.Format, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for format: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // PrimitivesItems items = 3; - v3 := compiler.MapValueForKey(m, "items") - if v3 != nil { - var err error - x.Items, err = NewPrimitivesItems(v3, compiler.NewContext("items", v3, context)) - if err != nil { - errors = append(errors, err) - } - } - // string collection_format = 4; - v4 := compiler.MapValueForKey(m, "collectionFormat") - if v4 != nil { - x.CollectionFormat, ok = compiler.StringForScalarNode(v4) - if !ok { - message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v4)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [csv ssv tsv pipes] - if ok && !compiler.StringArrayContainsValue([]string{"csv", "ssv", "tsv", "pipes"}, x.CollectionFormat) { - message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v4)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Any default = 5; - v5 := compiler.MapValueForKey(m, "default") - if v5 != nil { - var err error - x.Default, err = NewAny(v5, compiler.NewContext("default", v5, context)) - if err != nil { - errors = append(errors, err) - } - } - // float maximum = 6; - v6 := compiler.MapValueForKey(m, "maximum") - if v6 != nil { - v, ok := compiler.FloatForScalarNode(v6) - if ok { - x.Maximum = v - } else { - message := fmt.Sprintf("has unexpected value for maximum: %s", compiler.Display(v6)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool exclusive_maximum = 7; - v7 := compiler.MapValueForKey(m, "exclusiveMaximum") - if v7 != nil { - x.ExclusiveMaximum, ok = compiler.BoolForScalarNode(v7) - if !ok { - message := fmt.Sprintf("has unexpected value for exclusiveMaximum: %s", compiler.Display(v7)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // float minimum = 8; - v8 := compiler.MapValueForKey(m, "minimum") - if v8 != nil { - v, ok := compiler.FloatForScalarNode(v8) - if ok { - x.Minimum = v - } else { - message := fmt.Sprintf("has unexpected value for minimum: %s", compiler.Display(v8)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool exclusive_minimum = 9; - v9 := compiler.MapValueForKey(m, "exclusiveMinimum") - if v9 != nil { - x.ExclusiveMinimum, ok = compiler.BoolForScalarNode(v9) - if !ok { - message := fmt.Sprintf("has unexpected value for exclusiveMinimum: %s", compiler.Display(v9)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 max_length = 10; - v10 := compiler.MapValueForKey(m, "maxLength") - if v10 != nil { - t, ok := compiler.IntForScalarNode(v10) - if ok { - x.MaxLength = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for maxLength: %s", compiler.Display(v10)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 min_length = 11; - v11 := compiler.MapValueForKey(m, "minLength") - if v11 != nil { - t, ok := compiler.IntForScalarNode(v11) - if ok { - x.MinLength = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for minLength: %s", compiler.Display(v11)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string pattern = 12; - v12 := compiler.MapValueForKey(m, "pattern") - if v12 != nil { - x.Pattern, ok = compiler.StringForScalarNode(v12) - if !ok { - message := fmt.Sprintf("has unexpected value for pattern: %s", compiler.Display(v12)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 max_items = 13; - v13 := compiler.MapValueForKey(m, "maxItems") - if v13 != nil { - t, ok := compiler.IntForScalarNode(v13) - if ok { - x.MaxItems = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for maxItems: %s", compiler.Display(v13)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 min_items = 14; - v14 := compiler.MapValueForKey(m, "minItems") - if v14 != nil { - t, ok := compiler.IntForScalarNode(v14) - if ok { - x.MinItems = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for minItems: %s", compiler.Display(v14)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool unique_items = 15; - v15 := compiler.MapValueForKey(m, "uniqueItems") - if v15 != nil { - x.UniqueItems, ok = compiler.BoolForScalarNode(v15) - if !ok { - message := fmt.Sprintf("has unexpected value for uniqueItems: %s", compiler.Display(v15)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated Any enum = 16; - v16 := compiler.MapValueForKey(m, "enum") - if v16 != nil { - // repeated Any - x.Enum = make([]*Any, 0) - a, ok := compiler.SequenceNodeForNode(v16) - if ok { - for _, item := range a.Content { - y, err := NewAny(item, compiler.NewContext("enum", item, context)) - if err != nil { - errors = append(errors, err) - } - x.Enum = append(x.Enum, y) - } - } - } - // float multiple_of = 17; - v17 := compiler.MapValueForKey(m, "multipleOf") - if v17 != nil { - v, ok := compiler.FloatForScalarNode(v17) - if ok { - x.MultipleOf = v - } else { - message := fmt.Sprintf("has unexpected value for multipleOf: %s", compiler.Display(v17)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string description = 18; - v18 := compiler.MapValueForKey(m, "description") - if v18 != nil { - x.Description, ok = compiler.StringForScalarNode(v18) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v18)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated NamedAny vendor_extension = 19; - // MAP: Any ^x- - x.VendorExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.VendorExtension = append(x.VendorExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewHeaderParameterSubSchema creates an object of type HeaderParameterSubSchema if possible, returning an error if not. -func NewHeaderParameterSubSchema(in *yaml.Node, context *compiler.Context) (*HeaderParameterSubSchema, error) { - errors := make([]error, 0) - x := &HeaderParameterSubSchema{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"collectionFormat", "default", "description", "enum", "exclusiveMaximum", "exclusiveMinimum", "format", "in", "items", "maxItems", "maxLength", "maximum", "minItems", "minLength", "minimum", "multipleOf", "name", "pattern", "required", "type", "uniqueItems"} - allowedPatterns := []*regexp.Regexp{pattern0} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // bool required = 1; - v1 := compiler.MapValueForKey(m, "required") - if v1 != nil { - x.Required, ok = compiler.BoolForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for required: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string in = 2; - v2 := compiler.MapValueForKey(m, "in") - if v2 != nil { - x.In, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [header] - if ok && !compiler.StringArrayContainsValue([]string{"header"}, x.In) { - message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string description = 3; - v3 := compiler.MapValueForKey(m, "description") - if v3 != nil { - x.Description, ok = compiler.StringForScalarNode(v3) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string name = 4; - v4 := compiler.MapValueForKey(m, "name") - if v4 != nil { - x.Name, ok = compiler.StringForScalarNode(v4) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v4)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string type = 5; - v5 := compiler.MapValueForKey(m, "type") - if v5 != nil { - x.Type, ok = compiler.StringForScalarNode(v5) - if !ok { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v5)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [string number boolean integer array] - if ok && !compiler.StringArrayContainsValue([]string{"string", "number", "boolean", "integer", "array"}, x.Type) { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v5)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string format = 6; - v6 := compiler.MapValueForKey(m, "format") - if v6 != nil { - x.Format, ok = compiler.StringForScalarNode(v6) - if !ok { - message := fmt.Sprintf("has unexpected value for format: %s", compiler.Display(v6)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // PrimitivesItems items = 7; - v7 := compiler.MapValueForKey(m, "items") - if v7 != nil { - var err error - x.Items, err = NewPrimitivesItems(v7, compiler.NewContext("items", v7, context)) - if err != nil { - errors = append(errors, err) - } - } - // string collection_format = 8; - v8 := compiler.MapValueForKey(m, "collectionFormat") - if v8 != nil { - x.CollectionFormat, ok = compiler.StringForScalarNode(v8) - if !ok { - message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v8)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [csv ssv tsv pipes] - if ok && !compiler.StringArrayContainsValue([]string{"csv", "ssv", "tsv", "pipes"}, x.CollectionFormat) { - message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v8)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Any default = 9; - v9 := compiler.MapValueForKey(m, "default") - if v9 != nil { - var err error - x.Default, err = NewAny(v9, compiler.NewContext("default", v9, context)) - if err != nil { - errors = append(errors, err) - } - } - // float maximum = 10; - v10 := compiler.MapValueForKey(m, "maximum") - if v10 != nil { - v, ok := compiler.FloatForScalarNode(v10) - if ok { - x.Maximum = v - } else { - message := fmt.Sprintf("has unexpected value for maximum: %s", compiler.Display(v10)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool exclusive_maximum = 11; - v11 := compiler.MapValueForKey(m, "exclusiveMaximum") - if v11 != nil { - x.ExclusiveMaximum, ok = compiler.BoolForScalarNode(v11) - if !ok { - message := fmt.Sprintf("has unexpected value for exclusiveMaximum: %s", compiler.Display(v11)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // float minimum = 12; - v12 := compiler.MapValueForKey(m, "minimum") - if v12 != nil { - v, ok := compiler.FloatForScalarNode(v12) - if ok { - x.Minimum = v - } else { - message := fmt.Sprintf("has unexpected value for minimum: %s", compiler.Display(v12)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool exclusive_minimum = 13; - v13 := compiler.MapValueForKey(m, "exclusiveMinimum") - if v13 != nil { - x.ExclusiveMinimum, ok = compiler.BoolForScalarNode(v13) - if !ok { - message := fmt.Sprintf("has unexpected value for exclusiveMinimum: %s", compiler.Display(v13)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 max_length = 14; - v14 := compiler.MapValueForKey(m, "maxLength") - if v14 != nil { - t, ok := compiler.IntForScalarNode(v14) - if ok { - x.MaxLength = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for maxLength: %s", compiler.Display(v14)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 min_length = 15; - v15 := compiler.MapValueForKey(m, "minLength") - if v15 != nil { - t, ok := compiler.IntForScalarNode(v15) - if ok { - x.MinLength = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for minLength: %s", compiler.Display(v15)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string pattern = 16; - v16 := compiler.MapValueForKey(m, "pattern") - if v16 != nil { - x.Pattern, ok = compiler.StringForScalarNode(v16) - if !ok { - message := fmt.Sprintf("has unexpected value for pattern: %s", compiler.Display(v16)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 max_items = 17; - v17 := compiler.MapValueForKey(m, "maxItems") - if v17 != nil { - t, ok := compiler.IntForScalarNode(v17) - if ok { - x.MaxItems = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for maxItems: %s", compiler.Display(v17)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 min_items = 18; - v18 := compiler.MapValueForKey(m, "minItems") - if v18 != nil { - t, ok := compiler.IntForScalarNode(v18) - if ok { - x.MinItems = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for minItems: %s", compiler.Display(v18)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool unique_items = 19; - v19 := compiler.MapValueForKey(m, "uniqueItems") - if v19 != nil { - x.UniqueItems, ok = compiler.BoolForScalarNode(v19) - if !ok { - message := fmt.Sprintf("has unexpected value for uniqueItems: %s", compiler.Display(v19)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated Any enum = 20; - v20 := compiler.MapValueForKey(m, "enum") - if v20 != nil { - // repeated Any - x.Enum = make([]*Any, 0) - a, ok := compiler.SequenceNodeForNode(v20) - if ok { - for _, item := range a.Content { - y, err := NewAny(item, compiler.NewContext("enum", item, context)) - if err != nil { - errors = append(errors, err) - } - x.Enum = append(x.Enum, y) - } - } - } - // float multiple_of = 21; - v21 := compiler.MapValueForKey(m, "multipleOf") - if v21 != nil { - v, ok := compiler.FloatForScalarNode(v21) - if ok { - x.MultipleOf = v - } else { - message := fmt.Sprintf("has unexpected value for multipleOf: %s", compiler.Display(v21)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated NamedAny vendor_extension = 22; - // MAP: Any ^x- - x.VendorExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.VendorExtension = append(x.VendorExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewHeaders creates an object of type Headers if possible, returning an error if not. -func NewHeaders(in *yaml.Node, context *compiler.Context) (*Headers, error) { - errors := make([]error, 0) - x := &Headers{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedHeader additional_properties = 1; - // MAP: Header - x.AdditionalProperties = make([]*NamedHeader, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedHeader{} - pair.Name = k - var err error - pair.Value, err = NewHeader(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewInfo creates an object of type Info if possible, returning an error if not. -func NewInfo(in *yaml.Node, context *compiler.Context) (*Info, error) { - errors := make([]error, 0) - x := &Info{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"title", "version"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"contact", "description", "license", "termsOfService", "title", "version"} - allowedPatterns := []*regexp.Regexp{pattern0} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string title = 1; - v1 := compiler.MapValueForKey(m, "title") - if v1 != nil { - x.Title, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for title: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string version = 2; - v2 := compiler.MapValueForKey(m, "version") - if v2 != nil { - x.Version, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for version: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string description = 3; - v3 := compiler.MapValueForKey(m, "description") - if v3 != nil { - x.Description, ok = compiler.StringForScalarNode(v3) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string terms_of_service = 4; - v4 := compiler.MapValueForKey(m, "termsOfService") - if v4 != nil { - x.TermsOfService, ok = compiler.StringForScalarNode(v4) - if !ok { - message := fmt.Sprintf("has unexpected value for termsOfService: %s", compiler.Display(v4)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Contact contact = 5; - v5 := compiler.MapValueForKey(m, "contact") - if v5 != nil { - var err error - x.Contact, err = NewContact(v5, compiler.NewContext("contact", v5, context)) - if err != nil { - errors = append(errors, err) - } - } - // License license = 6; - v6 := compiler.MapValueForKey(m, "license") - if v6 != nil { - var err error - x.License, err = NewLicense(v6, compiler.NewContext("license", v6, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated NamedAny vendor_extension = 7; - // MAP: Any ^x- - x.VendorExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.VendorExtension = append(x.VendorExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewItemsItem creates an object of type ItemsItem if possible, returning an error if not. -func NewItemsItem(in *yaml.Node, context *compiler.Context) (*ItemsItem, error) { - errors := make([]error, 0) - x := &ItemsItem{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value for item array: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - x.Schema = make([]*Schema, 0) - y, err := NewSchema(m, compiler.NewContext("", m, context)) - if err != nil { - return nil, err - } - x.Schema = append(x.Schema, y) - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewJsonReference creates an object of type JsonReference if possible, returning an error if not. -func NewJsonReference(in *yaml.Node, context *compiler.Context) (*JsonReference, error) { - errors := make([]error, 0) - x := &JsonReference{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"$ref"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string _ref = 1; - v1 := compiler.MapValueForKey(m, "$ref") - if v1 != nil { - x.XRef, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for $ref: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string description = 2; - v2 := compiler.MapValueForKey(m, "description") - if v2 != nil { - x.Description, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewLicense creates an object of type License if possible, returning an error if not. -func NewLicense(in *yaml.Node, context *compiler.Context) (*License, error) { - errors := make([]error, 0) - x := &License{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"name"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"name", "url"} - allowedPatterns := []*regexp.Regexp{pattern0} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string url = 2; - v2 := compiler.MapValueForKey(m, "url") - if v2 != nil { - x.Url, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for url: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated NamedAny vendor_extension = 3; - // MAP: Any ^x- - x.VendorExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.VendorExtension = append(x.VendorExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewNamedAny creates an object of type NamedAny if possible, returning an error if not. -func NewNamedAny(in *yaml.Node, context *compiler.Context) (*NamedAny, error) { - errors := make([]error, 0) - x := &NamedAny{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"name", "value"} - var allowedPatterns []*regexp.Regexp - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Any value = 2; - v2 := compiler.MapValueForKey(m, "value") - if v2 != nil { - var err error - x.Value, err = NewAny(v2, compiler.NewContext("value", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewNamedHeader creates an object of type NamedHeader if possible, returning an error if not. -func NewNamedHeader(in *yaml.Node, context *compiler.Context) (*NamedHeader, error) { - errors := make([]error, 0) - x := &NamedHeader{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"name", "value"} - var allowedPatterns []*regexp.Regexp - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Header value = 2; - v2 := compiler.MapValueForKey(m, "value") - if v2 != nil { - var err error - x.Value, err = NewHeader(v2, compiler.NewContext("value", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewNamedParameter creates an object of type NamedParameter if possible, returning an error if not. -func NewNamedParameter(in *yaml.Node, context *compiler.Context) (*NamedParameter, error) { - errors := make([]error, 0) - x := &NamedParameter{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"name", "value"} - var allowedPatterns []*regexp.Regexp - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Parameter value = 2; - v2 := compiler.MapValueForKey(m, "value") - if v2 != nil { - var err error - x.Value, err = NewParameter(v2, compiler.NewContext("value", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewNamedPathItem creates an object of type NamedPathItem if possible, returning an error if not. -func NewNamedPathItem(in *yaml.Node, context *compiler.Context) (*NamedPathItem, error) { - errors := make([]error, 0) - x := &NamedPathItem{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"name", "value"} - var allowedPatterns []*regexp.Regexp - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // PathItem value = 2; - v2 := compiler.MapValueForKey(m, "value") - if v2 != nil { - var err error - x.Value, err = NewPathItem(v2, compiler.NewContext("value", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewNamedResponse creates an object of type NamedResponse if possible, returning an error if not. -func NewNamedResponse(in *yaml.Node, context *compiler.Context) (*NamedResponse, error) { - errors := make([]error, 0) - x := &NamedResponse{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"name", "value"} - var allowedPatterns []*regexp.Regexp - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Response value = 2; - v2 := compiler.MapValueForKey(m, "value") - if v2 != nil { - var err error - x.Value, err = NewResponse(v2, compiler.NewContext("value", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewNamedResponseValue creates an object of type NamedResponseValue if possible, returning an error if not. -func NewNamedResponseValue(in *yaml.Node, context *compiler.Context) (*NamedResponseValue, error) { - errors := make([]error, 0) - x := &NamedResponseValue{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"name", "value"} - var allowedPatterns []*regexp.Regexp - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // ResponseValue value = 2; - v2 := compiler.MapValueForKey(m, "value") - if v2 != nil { - var err error - x.Value, err = NewResponseValue(v2, compiler.NewContext("value", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewNamedSchema creates an object of type NamedSchema if possible, returning an error if not. -func NewNamedSchema(in *yaml.Node, context *compiler.Context) (*NamedSchema, error) { - errors := make([]error, 0) - x := &NamedSchema{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"name", "value"} - var allowedPatterns []*regexp.Regexp - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Schema value = 2; - v2 := compiler.MapValueForKey(m, "value") - if v2 != nil { - var err error - x.Value, err = NewSchema(v2, compiler.NewContext("value", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewNamedSecurityDefinitionsItem creates an object of type NamedSecurityDefinitionsItem if possible, returning an error if not. -func NewNamedSecurityDefinitionsItem(in *yaml.Node, context *compiler.Context) (*NamedSecurityDefinitionsItem, error) { - errors := make([]error, 0) - x := &NamedSecurityDefinitionsItem{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"name", "value"} - var allowedPatterns []*regexp.Regexp - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // SecurityDefinitionsItem value = 2; - v2 := compiler.MapValueForKey(m, "value") - if v2 != nil { - var err error - x.Value, err = NewSecurityDefinitionsItem(v2, compiler.NewContext("value", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewNamedString creates an object of type NamedString if possible, returning an error if not. -func NewNamedString(in *yaml.Node, context *compiler.Context) (*NamedString, error) { - errors := make([]error, 0) - x := &NamedString{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"name", "value"} - var allowedPatterns []*regexp.Regexp - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string value = 2; - v2 := compiler.MapValueForKey(m, "value") - if v2 != nil { - x.Value, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for value: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewNamedStringArray creates an object of type NamedStringArray if possible, returning an error if not. -func NewNamedStringArray(in *yaml.Node, context *compiler.Context) (*NamedStringArray, error) { - errors := make([]error, 0) - x := &NamedStringArray{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"name", "value"} - var allowedPatterns []*regexp.Regexp - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // StringArray value = 2; - v2 := compiler.MapValueForKey(m, "value") - if v2 != nil { - var err error - x.Value, err = NewStringArray(v2, compiler.NewContext("value", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewNonBodyParameter creates an object of type NonBodyParameter if possible, returning an error if not. -func NewNonBodyParameter(in *yaml.Node, context *compiler.Context) (*NonBodyParameter, error) { - errors := make([]error, 0) - x := &NonBodyParameter{} - matched := false - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"in", "name", "type"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // HeaderParameterSubSchema header_parameter_sub_schema = 1; - { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewHeaderParameterSubSchema(m, compiler.NewContext("headerParameterSubSchema", m, context)) - if matchingError == nil { - x.Oneof = &NonBodyParameter_HeaderParameterSubSchema{HeaderParameterSubSchema: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - // FormDataParameterSubSchema form_data_parameter_sub_schema = 2; - { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewFormDataParameterSubSchema(m, compiler.NewContext("formDataParameterSubSchema", m, context)) - if matchingError == nil { - x.Oneof = &NonBodyParameter_FormDataParameterSubSchema{FormDataParameterSubSchema: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - // QueryParameterSubSchema query_parameter_sub_schema = 3; - { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewQueryParameterSubSchema(m, compiler.NewContext("queryParameterSubSchema", m, context)) - if matchingError == nil { - x.Oneof = &NonBodyParameter_QueryParameterSubSchema{QueryParameterSubSchema: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - // PathParameterSubSchema path_parameter_sub_schema = 4; - { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewPathParameterSubSchema(m, compiler.NewContext("pathParameterSubSchema", m, context)) - if matchingError == nil { - x.Oneof = &NonBodyParameter_PathParameterSubSchema{PathParameterSubSchema: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - if matched { - // since the oneof matched one of its possibilities, discard any matching errors - errors = make([]error, 0) - } else { - message := fmt.Sprintf("contains an invalid NonBodyParameter") - err := compiler.NewError(context, message) - errors = []error{err} - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewOauth2AccessCodeSecurity creates an object of type Oauth2AccessCodeSecurity if possible, returning an error if not. -func NewOauth2AccessCodeSecurity(in *yaml.Node, context *compiler.Context) (*Oauth2AccessCodeSecurity, error) { - errors := make([]error, 0) - x := &Oauth2AccessCodeSecurity{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"authorizationUrl", "flow", "tokenUrl", "type"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"authorizationUrl", "description", "flow", "scopes", "tokenUrl", "type"} - allowedPatterns := []*regexp.Regexp{pattern0} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string type = 1; - v1 := compiler.MapValueForKey(m, "type") - if v1 != nil { - x.Type, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [oauth2] - if ok && !compiler.StringArrayContainsValue([]string{"oauth2"}, x.Type) { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string flow = 2; - v2 := compiler.MapValueForKey(m, "flow") - if v2 != nil { - x.Flow, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for flow: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [accessCode] - if ok && !compiler.StringArrayContainsValue([]string{"accessCode"}, x.Flow) { - message := fmt.Sprintf("has unexpected value for flow: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Oauth2Scopes scopes = 3; - v3 := compiler.MapValueForKey(m, "scopes") - if v3 != nil { - var err error - x.Scopes, err = NewOauth2Scopes(v3, compiler.NewContext("scopes", v3, context)) - if err != nil { - errors = append(errors, err) - } - } - // string authorization_url = 4; - v4 := compiler.MapValueForKey(m, "authorizationUrl") - if v4 != nil { - x.AuthorizationUrl, ok = compiler.StringForScalarNode(v4) - if !ok { - message := fmt.Sprintf("has unexpected value for authorizationUrl: %s", compiler.Display(v4)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string token_url = 5; - v5 := compiler.MapValueForKey(m, "tokenUrl") - if v5 != nil { - x.TokenUrl, ok = compiler.StringForScalarNode(v5) - if !ok { - message := fmt.Sprintf("has unexpected value for tokenUrl: %s", compiler.Display(v5)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string description = 6; - v6 := compiler.MapValueForKey(m, "description") - if v6 != nil { - x.Description, ok = compiler.StringForScalarNode(v6) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v6)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated NamedAny vendor_extension = 7; - // MAP: Any ^x- - x.VendorExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.VendorExtension = append(x.VendorExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewOauth2ApplicationSecurity creates an object of type Oauth2ApplicationSecurity if possible, returning an error if not. -func NewOauth2ApplicationSecurity(in *yaml.Node, context *compiler.Context) (*Oauth2ApplicationSecurity, error) { - errors := make([]error, 0) - x := &Oauth2ApplicationSecurity{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"flow", "tokenUrl", "type"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"description", "flow", "scopes", "tokenUrl", "type"} - allowedPatterns := []*regexp.Regexp{pattern0} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string type = 1; - v1 := compiler.MapValueForKey(m, "type") - if v1 != nil { - x.Type, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [oauth2] - if ok && !compiler.StringArrayContainsValue([]string{"oauth2"}, x.Type) { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string flow = 2; - v2 := compiler.MapValueForKey(m, "flow") - if v2 != nil { - x.Flow, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for flow: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [application] - if ok && !compiler.StringArrayContainsValue([]string{"application"}, x.Flow) { - message := fmt.Sprintf("has unexpected value for flow: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Oauth2Scopes scopes = 3; - v3 := compiler.MapValueForKey(m, "scopes") - if v3 != nil { - var err error - x.Scopes, err = NewOauth2Scopes(v3, compiler.NewContext("scopes", v3, context)) - if err != nil { - errors = append(errors, err) - } - } - // string token_url = 4; - v4 := compiler.MapValueForKey(m, "tokenUrl") - if v4 != nil { - x.TokenUrl, ok = compiler.StringForScalarNode(v4) - if !ok { - message := fmt.Sprintf("has unexpected value for tokenUrl: %s", compiler.Display(v4)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string description = 5; - v5 := compiler.MapValueForKey(m, "description") - if v5 != nil { - x.Description, ok = compiler.StringForScalarNode(v5) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v5)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated NamedAny vendor_extension = 6; - // MAP: Any ^x- - x.VendorExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.VendorExtension = append(x.VendorExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewOauth2ImplicitSecurity creates an object of type Oauth2ImplicitSecurity if possible, returning an error if not. -func NewOauth2ImplicitSecurity(in *yaml.Node, context *compiler.Context) (*Oauth2ImplicitSecurity, error) { - errors := make([]error, 0) - x := &Oauth2ImplicitSecurity{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"authorizationUrl", "flow", "type"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"authorizationUrl", "description", "flow", "scopes", "type"} - allowedPatterns := []*regexp.Regexp{pattern0} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string type = 1; - v1 := compiler.MapValueForKey(m, "type") - if v1 != nil { - x.Type, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [oauth2] - if ok && !compiler.StringArrayContainsValue([]string{"oauth2"}, x.Type) { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string flow = 2; - v2 := compiler.MapValueForKey(m, "flow") - if v2 != nil { - x.Flow, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for flow: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [implicit] - if ok && !compiler.StringArrayContainsValue([]string{"implicit"}, x.Flow) { - message := fmt.Sprintf("has unexpected value for flow: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Oauth2Scopes scopes = 3; - v3 := compiler.MapValueForKey(m, "scopes") - if v3 != nil { - var err error - x.Scopes, err = NewOauth2Scopes(v3, compiler.NewContext("scopes", v3, context)) - if err != nil { - errors = append(errors, err) - } - } - // string authorization_url = 4; - v4 := compiler.MapValueForKey(m, "authorizationUrl") - if v4 != nil { - x.AuthorizationUrl, ok = compiler.StringForScalarNode(v4) - if !ok { - message := fmt.Sprintf("has unexpected value for authorizationUrl: %s", compiler.Display(v4)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string description = 5; - v5 := compiler.MapValueForKey(m, "description") - if v5 != nil { - x.Description, ok = compiler.StringForScalarNode(v5) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v5)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated NamedAny vendor_extension = 6; - // MAP: Any ^x- - x.VendorExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.VendorExtension = append(x.VendorExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewOauth2PasswordSecurity creates an object of type Oauth2PasswordSecurity if possible, returning an error if not. -func NewOauth2PasswordSecurity(in *yaml.Node, context *compiler.Context) (*Oauth2PasswordSecurity, error) { - errors := make([]error, 0) - x := &Oauth2PasswordSecurity{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"flow", "tokenUrl", "type"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"description", "flow", "scopes", "tokenUrl", "type"} - allowedPatterns := []*regexp.Regexp{pattern0} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string type = 1; - v1 := compiler.MapValueForKey(m, "type") - if v1 != nil { - x.Type, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [oauth2] - if ok && !compiler.StringArrayContainsValue([]string{"oauth2"}, x.Type) { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string flow = 2; - v2 := compiler.MapValueForKey(m, "flow") - if v2 != nil { - x.Flow, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for flow: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [password] - if ok && !compiler.StringArrayContainsValue([]string{"password"}, x.Flow) { - message := fmt.Sprintf("has unexpected value for flow: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Oauth2Scopes scopes = 3; - v3 := compiler.MapValueForKey(m, "scopes") - if v3 != nil { - var err error - x.Scopes, err = NewOauth2Scopes(v3, compiler.NewContext("scopes", v3, context)) - if err != nil { - errors = append(errors, err) - } - } - // string token_url = 4; - v4 := compiler.MapValueForKey(m, "tokenUrl") - if v4 != nil { - x.TokenUrl, ok = compiler.StringForScalarNode(v4) - if !ok { - message := fmt.Sprintf("has unexpected value for tokenUrl: %s", compiler.Display(v4)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string description = 5; - v5 := compiler.MapValueForKey(m, "description") - if v5 != nil { - x.Description, ok = compiler.StringForScalarNode(v5) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v5)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated NamedAny vendor_extension = 6; - // MAP: Any ^x- - x.VendorExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.VendorExtension = append(x.VendorExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewOauth2Scopes creates an object of type Oauth2Scopes if possible, returning an error if not. -func NewOauth2Scopes(in *yaml.Node, context *compiler.Context) (*Oauth2Scopes, error) { - errors := make([]error, 0) - x := &Oauth2Scopes{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedString additional_properties = 1; - // MAP: string - x.AdditionalProperties = make([]*NamedString, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedString{} - pair.Name = k - pair.Value, _ = compiler.StringForScalarNode(v) - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewOperation creates an object of type Operation if possible, returning an error if not. -func NewOperation(in *yaml.Node, context *compiler.Context) (*Operation, error) { - errors := make([]error, 0) - x := &Operation{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"responses"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"consumes", "deprecated", "description", "externalDocs", "operationId", "parameters", "produces", "responses", "schemes", "security", "summary", "tags"} - allowedPatterns := []*regexp.Regexp{pattern0} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // repeated string tags = 1; - v1 := compiler.MapValueForKey(m, "tags") - if v1 != nil { - v, ok := compiler.SequenceNodeForNode(v1) - if ok { - x.Tags = compiler.StringArrayForSequenceNode(v) - } else { - message := fmt.Sprintf("has unexpected value for tags: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string summary = 2; - v2 := compiler.MapValueForKey(m, "summary") - if v2 != nil { - x.Summary, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for summary: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string description = 3; - v3 := compiler.MapValueForKey(m, "description") - if v3 != nil { - x.Description, ok = compiler.StringForScalarNode(v3) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // ExternalDocs external_docs = 4; - v4 := compiler.MapValueForKey(m, "externalDocs") - if v4 != nil { - var err error - x.ExternalDocs, err = NewExternalDocs(v4, compiler.NewContext("externalDocs", v4, context)) - if err != nil { - errors = append(errors, err) - } - } - // string operation_id = 5; - v5 := compiler.MapValueForKey(m, "operationId") - if v5 != nil { - x.OperationId, ok = compiler.StringForScalarNode(v5) - if !ok { - message := fmt.Sprintf("has unexpected value for operationId: %s", compiler.Display(v5)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated string produces = 6; - v6 := compiler.MapValueForKey(m, "produces") - if v6 != nil { - v, ok := compiler.SequenceNodeForNode(v6) - if ok { - x.Produces = compiler.StringArrayForSequenceNode(v) - } else { - message := fmt.Sprintf("has unexpected value for produces: %s", compiler.Display(v6)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated string consumes = 7; - v7 := compiler.MapValueForKey(m, "consumes") - if v7 != nil { - v, ok := compiler.SequenceNodeForNode(v7) - if ok { - x.Consumes = compiler.StringArrayForSequenceNode(v) - } else { - message := fmt.Sprintf("has unexpected value for consumes: %s", compiler.Display(v7)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated ParametersItem parameters = 8; - v8 := compiler.MapValueForKey(m, "parameters") - if v8 != nil { - // repeated ParametersItem - x.Parameters = make([]*ParametersItem, 0) - a, ok := compiler.SequenceNodeForNode(v8) - if ok { - for _, item := range a.Content { - y, err := NewParametersItem(item, compiler.NewContext("parameters", item, context)) - if err != nil { - errors = append(errors, err) - } - x.Parameters = append(x.Parameters, y) - } - } - } - // Responses responses = 9; - v9 := compiler.MapValueForKey(m, "responses") - if v9 != nil { - var err error - x.Responses, err = NewResponses(v9, compiler.NewContext("responses", v9, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated string schemes = 10; - v10 := compiler.MapValueForKey(m, "schemes") - if v10 != nil { - v, ok := compiler.SequenceNodeForNode(v10) - if ok { - x.Schemes = compiler.StringArrayForSequenceNode(v) - } else { - message := fmt.Sprintf("has unexpected value for schemes: %s", compiler.Display(v10)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [http https ws wss] - if ok && !compiler.StringArrayContainsValues([]string{"http", "https", "ws", "wss"}, x.Schemes) { - message := fmt.Sprintf("has unexpected value for schemes: %s", compiler.Display(v10)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool deprecated = 11; - v11 := compiler.MapValueForKey(m, "deprecated") - if v11 != nil { - x.Deprecated, ok = compiler.BoolForScalarNode(v11) - if !ok { - message := fmt.Sprintf("has unexpected value for deprecated: %s", compiler.Display(v11)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated SecurityRequirement security = 12; - v12 := compiler.MapValueForKey(m, "security") - if v12 != nil { - // repeated SecurityRequirement - x.Security = make([]*SecurityRequirement, 0) - a, ok := compiler.SequenceNodeForNode(v12) - if ok { - for _, item := range a.Content { - y, err := NewSecurityRequirement(item, compiler.NewContext("security", item, context)) - if err != nil { - errors = append(errors, err) - } - x.Security = append(x.Security, y) - } - } - } - // repeated NamedAny vendor_extension = 13; - // MAP: Any ^x- - x.VendorExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.VendorExtension = append(x.VendorExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewParameter creates an object of type Parameter if possible, returning an error if not. -func NewParameter(in *yaml.Node, context *compiler.Context) (*Parameter, error) { - errors := make([]error, 0) - x := &Parameter{} - matched := false - // BodyParameter body_parameter = 1; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewBodyParameter(m, compiler.NewContext("bodyParameter", m, context)) - if matchingError == nil { - x.Oneof = &Parameter_BodyParameter{BodyParameter: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - // NonBodyParameter non_body_parameter = 2; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewNonBodyParameter(m, compiler.NewContext("nonBodyParameter", m, context)) - if matchingError == nil { - x.Oneof = &Parameter_NonBodyParameter{NonBodyParameter: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - if matched { - // since the oneof matched one of its possibilities, discard any matching errors - errors = make([]error, 0) - } else { - message := fmt.Sprintf("contains an invalid Parameter") - err := compiler.NewError(context, message) - errors = []error{err} - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewParameterDefinitions creates an object of type ParameterDefinitions if possible, returning an error if not. -func NewParameterDefinitions(in *yaml.Node, context *compiler.Context) (*ParameterDefinitions, error) { - errors := make([]error, 0) - x := &ParameterDefinitions{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedParameter additional_properties = 1; - // MAP: Parameter - x.AdditionalProperties = make([]*NamedParameter, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedParameter{} - pair.Name = k - var err error - pair.Value, err = NewParameter(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewParametersItem creates an object of type ParametersItem if possible, returning an error if not. -func NewParametersItem(in *yaml.Node, context *compiler.Context) (*ParametersItem, error) { - errors := make([]error, 0) - x := &ParametersItem{} - matched := false - // Parameter parameter = 1; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewParameter(m, compiler.NewContext("parameter", m, context)) - if matchingError == nil { - x.Oneof = &ParametersItem_Parameter{Parameter: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - // JsonReference json_reference = 2; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewJsonReference(m, compiler.NewContext("jsonReference", m, context)) - if matchingError == nil { - x.Oneof = &ParametersItem_JsonReference{JsonReference: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - if matched { - // since the oneof matched one of its possibilities, discard any matching errors - errors = make([]error, 0) - } else { - message := fmt.Sprintf("contains an invalid ParametersItem") - err := compiler.NewError(context, message) - errors = []error{err} - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewPathItem creates an object of type PathItem if possible, returning an error if not. -func NewPathItem(in *yaml.Node, context *compiler.Context) (*PathItem, error) { - errors := make([]error, 0) - x := &PathItem{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"$ref", "delete", "get", "head", "options", "parameters", "patch", "post", "put"} - allowedPatterns := []*regexp.Regexp{pattern0} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string _ref = 1; - v1 := compiler.MapValueForKey(m, "$ref") - if v1 != nil { - x.XRef, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for $ref: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Operation get = 2; - v2 := compiler.MapValueForKey(m, "get") - if v2 != nil { - var err error - x.Get, err = NewOperation(v2, compiler.NewContext("get", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - // Operation put = 3; - v3 := compiler.MapValueForKey(m, "put") - if v3 != nil { - var err error - x.Put, err = NewOperation(v3, compiler.NewContext("put", v3, context)) - if err != nil { - errors = append(errors, err) - } - } - // Operation post = 4; - v4 := compiler.MapValueForKey(m, "post") - if v4 != nil { - var err error - x.Post, err = NewOperation(v4, compiler.NewContext("post", v4, context)) - if err != nil { - errors = append(errors, err) - } - } - // Operation delete = 5; - v5 := compiler.MapValueForKey(m, "delete") - if v5 != nil { - var err error - x.Delete, err = NewOperation(v5, compiler.NewContext("delete", v5, context)) - if err != nil { - errors = append(errors, err) - } - } - // Operation options = 6; - v6 := compiler.MapValueForKey(m, "options") - if v6 != nil { - var err error - x.Options, err = NewOperation(v6, compiler.NewContext("options", v6, context)) - if err != nil { - errors = append(errors, err) - } - } - // Operation head = 7; - v7 := compiler.MapValueForKey(m, "head") - if v7 != nil { - var err error - x.Head, err = NewOperation(v7, compiler.NewContext("head", v7, context)) - if err != nil { - errors = append(errors, err) - } - } - // Operation patch = 8; - v8 := compiler.MapValueForKey(m, "patch") - if v8 != nil { - var err error - x.Patch, err = NewOperation(v8, compiler.NewContext("patch", v8, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated ParametersItem parameters = 9; - v9 := compiler.MapValueForKey(m, "parameters") - if v9 != nil { - // repeated ParametersItem - x.Parameters = make([]*ParametersItem, 0) - a, ok := compiler.SequenceNodeForNode(v9) - if ok { - for _, item := range a.Content { - y, err := NewParametersItem(item, compiler.NewContext("parameters", item, context)) - if err != nil { - errors = append(errors, err) - } - x.Parameters = append(x.Parameters, y) - } - } - } - // repeated NamedAny vendor_extension = 10; - // MAP: Any ^x- - x.VendorExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.VendorExtension = append(x.VendorExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewPathParameterSubSchema creates an object of type PathParameterSubSchema if possible, returning an error if not. -func NewPathParameterSubSchema(in *yaml.Node, context *compiler.Context) (*PathParameterSubSchema, error) { - errors := make([]error, 0) - x := &PathParameterSubSchema{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"required"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"collectionFormat", "default", "description", "enum", "exclusiveMaximum", "exclusiveMinimum", "format", "in", "items", "maxItems", "maxLength", "maximum", "minItems", "minLength", "minimum", "multipleOf", "name", "pattern", "required", "type", "uniqueItems"} - allowedPatterns := []*regexp.Regexp{pattern0} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // bool required = 1; - v1 := compiler.MapValueForKey(m, "required") - if v1 != nil { - x.Required, ok = compiler.BoolForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for required: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string in = 2; - v2 := compiler.MapValueForKey(m, "in") - if v2 != nil { - x.In, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [path] - if ok && !compiler.StringArrayContainsValue([]string{"path"}, x.In) { - message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string description = 3; - v3 := compiler.MapValueForKey(m, "description") - if v3 != nil { - x.Description, ok = compiler.StringForScalarNode(v3) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string name = 4; - v4 := compiler.MapValueForKey(m, "name") - if v4 != nil { - x.Name, ok = compiler.StringForScalarNode(v4) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v4)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string type = 5; - v5 := compiler.MapValueForKey(m, "type") - if v5 != nil { - x.Type, ok = compiler.StringForScalarNode(v5) - if !ok { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v5)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [string number boolean integer array] - if ok && !compiler.StringArrayContainsValue([]string{"string", "number", "boolean", "integer", "array"}, x.Type) { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v5)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string format = 6; - v6 := compiler.MapValueForKey(m, "format") - if v6 != nil { - x.Format, ok = compiler.StringForScalarNode(v6) - if !ok { - message := fmt.Sprintf("has unexpected value for format: %s", compiler.Display(v6)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // PrimitivesItems items = 7; - v7 := compiler.MapValueForKey(m, "items") - if v7 != nil { - var err error - x.Items, err = NewPrimitivesItems(v7, compiler.NewContext("items", v7, context)) - if err != nil { - errors = append(errors, err) - } - } - // string collection_format = 8; - v8 := compiler.MapValueForKey(m, "collectionFormat") - if v8 != nil { - x.CollectionFormat, ok = compiler.StringForScalarNode(v8) - if !ok { - message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v8)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [csv ssv tsv pipes] - if ok && !compiler.StringArrayContainsValue([]string{"csv", "ssv", "tsv", "pipes"}, x.CollectionFormat) { - message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v8)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Any default = 9; - v9 := compiler.MapValueForKey(m, "default") - if v9 != nil { - var err error - x.Default, err = NewAny(v9, compiler.NewContext("default", v9, context)) - if err != nil { - errors = append(errors, err) - } - } - // float maximum = 10; - v10 := compiler.MapValueForKey(m, "maximum") - if v10 != nil { - v, ok := compiler.FloatForScalarNode(v10) - if ok { - x.Maximum = v - } else { - message := fmt.Sprintf("has unexpected value for maximum: %s", compiler.Display(v10)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool exclusive_maximum = 11; - v11 := compiler.MapValueForKey(m, "exclusiveMaximum") - if v11 != nil { - x.ExclusiveMaximum, ok = compiler.BoolForScalarNode(v11) - if !ok { - message := fmt.Sprintf("has unexpected value for exclusiveMaximum: %s", compiler.Display(v11)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // float minimum = 12; - v12 := compiler.MapValueForKey(m, "minimum") - if v12 != nil { - v, ok := compiler.FloatForScalarNode(v12) - if ok { - x.Minimum = v - } else { - message := fmt.Sprintf("has unexpected value for minimum: %s", compiler.Display(v12)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool exclusive_minimum = 13; - v13 := compiler.MapValueForKey(m, "exclusiveMinimum") - if v13 != nil { - x.ExclusiveMinimum, ok = compiler.BoolForScalarNode(v13) - if !ok { - message := fmt.Sprintf("has unexpected value for exclusiveMinimum: %s", compiler.Display(v13)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 max_length = 14; - v14 := compiler.MapValueForKey(m, "maxLength") - if v14 != nil { - t, ok := compiler.IntForScalarNode(v14) - if ok { - x.MaxLength = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for maxLength: %s", compiler.Display(v14)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 min_length = 15; - v15 := compiler.MapValueForKey(m, "minLength") - if v15 != nil { - t, ok := compiler.IntForScalarNode(v15) - if ok { - x.MinLength = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for minLength: %s", compiler.Display(v15)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string pattern = 16; - v16 := compiler.MapValueForKey(m, "pattern") - if v16 != nil { - x.Pattern, ok = compiler.StringForScalarNode(v16) - if !ok { - message := fmt.Sprintf("has unexpected value for pattern: %s", compiler.Display(v16)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 max_items = 17; - v17 := compiler.MapValueForKey(m, "maxItems") - if v17 != nil { - t, ok := compiler.IntForScalarNode(v17) - if ok { - x.MaxItems = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for maxItems: %s", compiler.Display(v17)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 min_items = 18; - v18 := compiler.MapValueForKey(m, "minItems") - if v18 != nil { - t, ok := compiler.IntForScalarNode(v18) - if ok { - x.MinItems = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for minItems: %s", compiler.Display(v18)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool unique_items = 19; - v19 := compiler.MapValueForKey(m, "uniqueItems") - if v19 != nil { - x.UniqueItems, ok = compiler.BoolForScalarNode(v19) - if !ok { - message := fmt.Sprintf("has unexpected value for uniqueItems: %s", compiler.Display(v19)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated Any enum = 20; - v20 := compiler.MapValueForKey(m, "enum") - if v20 != nil { - // repeated Any - x.Enum = make([]*Any, 0) - a, ok := compiler.SequenceNodeForNode(v20) - if ok { - for _, item := range a.Content { - y, err := NewAny(item, compiler.NewContext("enum", item, context)) - if err != nil { - errors = append(errors, err) - } - x.Enum = append(x.Enum, y) - } - } - } - // float multiple_of = 21; - v21 := compiler.MapValueForKey(m, "multipleOf") - if v21 != nil { - v, ok := compiler.FloatForScalarNode(v21) - if ok { - x.MultipleOf = v - } else { - message := fmt.Sprintf("has unexpected value for multipleOf: %s", compiler.Display(v21)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated NamedAny vendor_extension = 22; - // MAP: Any ^x- - x.VendorExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.VendorExtension = append(x.VendorExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewPaths creates an object of type Paths if possible, returning an error if not. -func NewPaths(in *yaml.Node, context *compiler.Context) (*Paths, error) { - errors := make([]error, 0) - x := &Paths{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{} - allowedPatterns := []*regexp.Regexp{pattern0, pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // repeated NamedAny vendor_extension = 1; - // MAP: Any ^x- - x.VendorExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.VendorExtension = append(x.VendorExtension, pair) - } - } - } - // repeated NamedPathItem path = 2; - // MAP: PathItem ^/ - x.Path = make([]*NamedPathItem, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "/") { - pair := &NamedPathItem{} - pair.Name = k - var err error - pair.Value, err = NewPathItem(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - x.Path = append(x.Path, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewPrimitivesItems creates an object of type PrimitivesItems if possible, returning an error if not. -func NewPrimitivesItems(in *yaml.Node, context *compiler.Context) (*PrimitivesItems, error) { - errors := make([]error, 0) - x := &PrimitivesItems{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"collectionFormat", "default", "enum", "exclusiveMaximum", "exclusiveMinimum", "format", "items", "maxItems", "maxLength", "maximum", "minItems", "minLength", "minimum", "multipleOf", "pattern", "type", "uniqueItems"} - allowedPatterns := []*regexp.Regexp{pattern0} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string type = 1; - v1 := compiler.MapValueForKey(m, "type") - if v1 != nil { - x.Type, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [string number integer boolean array] - if ok && !compiler.StringArrayContainsValue([]string{"string", "number", "integer", "boolean", "array"}, x.Type) { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string format = 2; - v2 := compiler.MapValueForKey(m, "format") - if v2 != nil { - x.Format, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for format: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // PrimitivesItems items = 3; - v3 := compiler.MapValueForKey(m, "items") - if v3 != nil { - var err error - x.Items, err = NewPrimitivesItems(v3, compiler.NewContext("items", v3, context)) - if err != nil { - errors = append(errors, err) - } - } - // string collection_format = 4; - v4 := compiler.MapValueForKey(m, "collectionFormat") - if v4 != nil { - x.CollectionFormat, ok = compiler.StringForScalarNode(v4) - if !ok { - message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v4)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [csv ssv tsv pipes] - if ok && !compiler.StringArrayContainsValue([]string{"csv", "ssv", "tsv", "pipes"}, x.CollectionFormat) { - message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v4)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Any default = 5; - v5 := compiler.MapValueForKey(m, "default") - if v5 != nil { - var err error - x.Default, err = NewAny(v5, compiler.NewContext("default", v5, context)) - if err != nil { - errors = append(errors, err) - } - } - // float maximum = 6; - v6 := compiler.MapValueForKey(m, "maximum") - if v6 != nil { - v, ok := compiler.FloatForScalarNode(v6) - if ok { - x.Maximum = v - } else { - message := fmt.Sprintf("has unexpected value for maximum: %s", compiler.Display(v6)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool exclusive_maximum = 7; - v7 := compiler.MapValueForKey(m, "exclusiveMaximum") - if v7 != nil { - x.ExclusiveMaximum, ok = compiler.BoolForScalarNode(v7) - if !ok { - message := fmt.Sprintf("has unexpected value for exclusiveMaximum: %s", compiler.Display(v7)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // float minimum = 8; - v8 := compiler.MapValueForKey(m, "minimum") - if v8 != nil { - v, ok := compiler.FloatForScalarNode(v8) - if ok { - x.Minimum = v - } else { - message := fmt.Sprintf("has unexpected value for minimum: %s", compiler.Display(v8)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool exclusive_minimum = 9; - v9 := compiler.MapValueForKey(m, "exclusiveMinimum") - if v9 != nil { - x.ExclusiveMinimum, ok = compiler.BoolForScalarNode(v9) - if !ok { - message := fmt.Sprintf("has unexpected value for exclusiveMinimum: %s", compiler.Display(v9)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 max_length = 10; - v10 := compiler.MapValueForKey(m, "maxLength") - if v10 != nil { - t, ok := compiler.IntForScalarNode(v10) - if ok { - x.MaxLength = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for maxLength: %s", compiler.Display(v10)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 min_length = 11; - v11 := compiler.MapValueForKey(m, "minLength") - if v11 != nil { - t, ok := compiler.IntForScalarNode(v11) - if ok { - x.MinLength = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for minLength: %s", compiler.Display(v11)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string pattern = 12; - v12 := compiler.MapValueForKey(m, "pattern") - if v12 != nil { - x.Pattern, ok = compiler.StringForScalarNode(v12) - if !ok { - message := fmt.Sprintf("has unexpected value for pattern: %s", compiler.Display(v12)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 max_items = 13; - v13 := compiler.MapValueForKey(m, "maxItems") - if v13 != nil { - t, ok := compiler.IntForScalarNode(v13) - if ok { - x.MaxItems = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for maxItems: %s", compiler.Display(v13)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 min_items = 14; - v14 := compiler.MapValueForKey(m, "minItems") - if v14 != nil { - t, ok := compiler.IntForScalarNode(v14) - if ok { - x.MinItems = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for minItems: %s", compiler.Display(v14)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool unique_items = 15; - v15 := compiler.MapValueForKey(m, "uniqueItems") - if v15 != nil { - x.UniqueItems, ok = compiler.BoolForScalarNode(v15) - if !ok { - message := fmt.Sprintf("has unexpected value for uniqueItems: %s", compiler.Display(v15)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated Any enum = 16; - v16 := compiler.MapValueForKey(m, "enum") - if v16 != nil { - // repeated Any - x.Enum = make([]*Any, 0) - a, ok := compiler.SequenceNodeForNode(v16) - if ok { - for _, item := range a.Content { - y, err := NewAny(item, compiler.NewContext("enum", item, context)) - if err != nil { - errors = append(errors, err) - } - x.Enum = append(x.Enum, y) - } - } - } - // float multiple_of = 17; - v17 := compiler.MapValueForKey(m, "multipleOf") - if v17 != nil { - v, ok := compiler.FloatForScalarNode(v17) - if ok { - x.MultipleOf = v - } else { - message := fmt.Sprintf("has unexpected value for multipleOf: %s", compiler.Display(v17)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated NamedAny vendor_extension = 18; - // MAP: Any ^x- - x.VendorExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.VendorExtension = append(x.VendorExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewProperties creates an object of type Properties if possible, returning an error if not. -func NewProperties(in *yaml.Node, context *compiler.Context) (*Properties, error) { - errors := make([]error, 0) - x := &Properties{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedSchema additional_properties = 1; - // MAP: Schema - x.AdditionalProperties = make([]*NamedSchema, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedSchema{} - pair.Name = k - var err error - pair.Value, err = NewSchema(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewQueryParameterSubSchema creates an object of type QueryParameterSubSchema if possible, returning an error if not. -func NewQueryParameterSubSchema(in *yaml.Node, context *compiler.Context) (*QueryParameterSubSchema, error) { - errors := make([]error, 0) - x := &QueryParameterSubSchema{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"allowEmptyValue", "collectionFormat", "default", "description", "enum", "exclusiveMaximum", "exclusiveMinimum", "format", "in", "items", "maxItems", "maxLength", "maximum", "minItems", "minLength", "minimum", "multipleOf", "name", "pattern", "required", "type", "uniqueItems"} - allowedPatterns := []*regexp.Regexp{pattern0} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // bool required = 1; - v1 := compiler.MapValueForKey(m, "required") - if v1 != nil { - x.Required, ok = compiler.BoolForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for required: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string in = 2; - v2 := compiler.MapValueForKey(m, "in") - if v2 != nil { - x.In, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [query] - if ok && !compiler.StringArrayContainsValue([]string{"query"}, x.In) { - message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string description = 3; - v3 := compiler.MapValueForKey(m, "description") - if v3 != nil { - x.Description, ok = compiler.StringForScalarNode(v3) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string name = 4; - v4 := compiler.MapValueForKey(m, "name") - if v4 != nil { - x.Name, ok = compiler.StringForScalarNode(v4) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v4)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool allow_empty_value = 5; - v5 := compiler.MapValueForKey(m, "allowEmptyValue") - if v5 != nil { - x.AllowEmptyValue, ok = compiler.BoolForScalarNode(v5) - if !ok { - message := fmt.Sprintf("has unexpected value for allowEmptyValue: %s", compiler.Display(v5)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string type = 6; - v6 := compiler.MapValueForKey(m, "type") - if v6 != nil { - x.Type, ok = compiler.StringForScalarNode(v6) - if !ok { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v6)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [string number boolean integer array] - if ok && !compiler.StringArrayContainsValue([]string{"string", "number", "boolean", "integer", "array"}, x.Type) { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v6)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string format = 7; - v7 := compiler.MapValueForKey(m, "format") - if v7 != nil { - x.Format, ok = compiler.StringForScalarNode(v7) - if !ok { - message := fmt.Sprintf("has unexpected value for format: %s", compiler.Display(v7)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // PrimitivesItems items = 8; - v8 := compiler.MapValueForKey(m, "items") - if v8 != nil { - var err error - x.Items, err = NewPrimitivesItems(v8, compiler.NewContext("items", v8, context)) - if err != nil { - errors = append(errors, err) - } - } - // string collection_format = 9; - v9 := compiler.MapValueForKey(m, "collectionFormat") - if v9 != nil { - x.CollectionFormat, ok = compiler.StringForScalarNode(v9) - if !ok { - message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v9)) - errors = append(errors, compiler.NewError(context, message)) - } - // check for valid enum values - // [csv ssv tsv pipes multi] - if ok && !compiler.StringArrayContainsValue([]string{"csv", "ssv", "tsv", "pipes", "multi"}, x.CollectionFormat) { - message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v9)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Any default = 10; - v10 := compiler.MapValueForKey(m, "default") - if v10 != nil { - var err error - x.Default, err = NewAny(v10, compiler.NewContext("default", v10, context)) - if err != nil { - errors = append(errors, err) - } - } - // float maximum = 11; - v11 := compiler.MapValueForKey(m, "maximum") - if v11 != nil { - v, ok := compiler.FloatForScalarNode(v11) - if ok { - x.Maximum = v - } else { - message := fmt.Sprintf("has unexpected value for maximum: %s", compiler.Display(v11)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool exclusive_maximum = 12; - v12 := compiler.MapValueForKey(m, "exclusiveMaximum") - if v12 != nil { - x.ExclusiveMaximum, ok = compiler.BoolForScalarNode(v12) - if !ok { - message := fmt.Sprintf("has unexpected value for exclusiveMaximum: %s", compiler.Display(v12)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // float minimum = 13; - v13 := compiler.MapValueForKey(m, "minimum") - if v13 != nil { - v, ok := compiler.FloatForScalarNode(v13) - if ok { - x.Minimum = v - } else { - message := fmt.Sprintf("has unexpected value for minimum: %s", compiler.Display(v13)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool exclusive_minimum = 14; - v14 := compiler.MapValueForKey(m, "exclusiveMinimum") - if v14 != nil { - x.ExclusiveMinimum, ok = compiler.BoolForScalarNode(v14) - if !ok { - message := fmt.Sprintf("has unexpected value for exclusiveMinimum: %s", compiler.Display(v14)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 max_length = 15; - v15 := compiler.MapValueForKey(m, "maxLength") - if v15 != nil { - t, ok := compiler.IntForScalarNode(v15) - if ok { - x.MaxLength = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for maxLength: %s", compiler.Display(v15)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 min_length = 16; - v16 := compiler.MapValueForKey(m, "minLength") - if v16 != nil { - t, ok := compiler.IntForScalarNode(v16) - if ok { - x.MinLength = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for minLength: %s", compiler.Display(v16)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string pattern = 17; - v17 := compiler.MapValueForKey(m, "pattern") - if v17 != nil { - x.Pattern, ok = compiler.StringForScalarNode(v17) - if !ok { - message := fmt.Sprintf("has unexpected value for pattern: %s", compiler.Display(v17)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 max_items = 18; - v18 := compiler.MapValueForKey(m, "maxItems") - if v18 != nil { - t, ok := compiler.IntForScalarNode(v18) - if ok { - x.MaxItems = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for maxItems: %s", compiler.Display(v18)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 min_items = 19; - v19 := compiler.MapValueForKey(m, "minItems") - if v19 != nil { - t, ok := compiler.IntForScalarNode(v19) - if ok { - x.MinItems = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for minItems: %s", compiler.Display(v19)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool unique_items = 20; - v20 := compiler.MapValueForKey(m, "uniqueItems") - if v20 != nil { - x.UniqueItems, ok = compiler.BoolForScalarNode(v20) - if !ok { - message := fmt.Sprintf("has unexpected value for uniqueItems: %s", compiler.Display(v20)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated Any enum = 21; - v21 := compiler.MapValueForKey(m, "enum") - if v21 != nil { - // repeated Any - x.Enum = make([]*Any, 0) - a, ok := compiler.SequenceNodeForNode(v21) - if ok { - for _, item := range a.Content { - y, err := NewAny(item, compiler.NewContext("enum", item, context)) - if err != nil { - errors = append(errors, err) - } - x.Enum = append(x.Enum, y) - } - } - } - // float multiple_of = 22; - v22 := compiler.MapValueForKey(m, "multipleOf") - if v22 != nil { - v, ok := compiler.FloatForScalarNode(v22) - if ok { - x.MultipleOf = v - } else { - message := fmt.Sprintf("has unexpected value for multipleOf: %s", compiler.Display(v22)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated NamedAny vendor_extension = 23; - // MAP: Any ^x- - x.VendorExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.VendorExtension = append(x.VendorExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewResponse creates an object of type Response if possible, returning an error if not. -func NewResponse(in *yaml.Node, context *compiler.Context) (*Response, error) { - errors := make([]error, 0) - x := &Response{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"description"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"description", "examples", "headers", "schema"} - allowedPatterns := []*regexp.Regexp{pattern0} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string description = 1; - v1 := compiler.MapValueForKey(m, "description") - if v1 != nil { - x.Description, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // SchemaItem schema = 2; - v2 := compiler.MapValueForKey(m, "schema") - if v2 != nil { - var err error - x.Schema, err = NewSchemaItem(v2, compiler.NewContext("schema", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - // Headers headers = 3; - v3 := compiler.MapValueForKey(m, "headers") - if v3 != nil { - var err error - x.Headers, err = NewHeaders(v3, compiler.NewContext("headers", v3, context)) - if err != nil { - errors = append(errors, err) - } - } - // Examples examples = 4; - v4 := compiler.MapValueForKey(m, "examples") - if v4 != nil { - var err error - x.Examples, err = NewExamples(v4, compiler.NewContext("examples", v4, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated NamedAny vendor_extension = 5; - // MAP: Any ^x- - x.VendorExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.VendorExtension = append(x.VendorExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewResponseDefinitions creates an object of type ResponseDefinitions if possible, returning an error if not. -func NewResponseDefinitions(in *yaml.Node, context *compiler.Context) (*ResponseDefinitions, error) { - errors := make([]error, 0) - x := &ResponseDefinitions{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedResponse additional_properties = 1; - // MAP: Response - x.AdditionalProperties = make([]*NamedResponse, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedResponse{} - pair.Name = k - var err error - pair.Value, err = NewResponse(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewResponseValue creates an object of type ResponseValue if possible, returning an error if not. -func NewResponseValue(in *yaml.Node, context *compiler.Context) (*ResponseValue, error) { - errors := make([]error, 0) - x := &ResponseValue{} - matched := false - // Response response = 1; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewResponse(m, compiler.NewContext("response", m, context)) - if matchingError == nil { - x.Oneof = &ResponseValue_Response{Response: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - // JsonReference json_reference = 2; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewJsonReference(m, compiler.NewContext("jsonReference", m, context)) - if matchingError == nil { - x.Oneof = &ResponseValue_JsonReference{JsonReference: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - if matched { - // since the oneof matched one of its possibilities, discard any matching errors - errors = make([]error, 0) - } else { - message := fmt.Sprintf("contains an invalid ResponseValue") - err := compiler.NewError(context, message) - errors = []error{err} - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewResponses creates an object of type Responses if possible, returning an error if not. -func NewResponses(in *yaml.Node, context *compiler.Context) (*Responses, error) { - errors := make([]error, 0) - x := &Responses{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{} - allowedPatterns := []*regexp.Regexp{pattern2, pattern0} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // repeated NamedResponseValue response_code = 1; - // MAP: ResponseValue ^([0-9]{3})$|^(default)$ - x.ResponseCode = make([]*NamedResponseValue, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if pattern2.MatchString(k) { - pair := &NamedResponseValue{} - pair.Name = k - var err error - pair.Value, err = NewResponseValue(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - x.ResponseCode = append(x.ResponseCode, pair) - } - } - } - // repeated NamedAny vendor_extension = 2; - // MAP: Any ^x- - x.VendorExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.VendorExtension = append(x.VendorExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewSchema creates an object of type Schema if possible, returning an error if not. -func NewSchema(in *yaml.Node, context *compiler.Context) (*Schema, error) { - errors := make([]error, 0) - x := &Schema{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"$ref", "additionalProperties", "allOf", "default", "description", "discriminator", "enum", "example", "exclusiveMaximum", "exclusiveMinimum", "externalDocs", "format", "items", "maxItems", "maxLength", "maxProperties", "maximum", "minItems", "minLength", "minProperties", "minimum", "multipleOf", "pattern", "properties", "readOnly", "required", "title", "type", "uniqueItems", "xml"} - allowedPatterns := []*regexp.Regexp{pattern0} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string _ref = 1; - v1 := compiler.MapValueForKey(m, "$ref") - if v1 != nil { - x.XRef, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for $ref: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string format = 2; - v2 := compiler.MapValueForKey(m, "format") - if v2 != nil { - x.Format, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for format: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string title = 3; - v3 := compiler.MapValueForKey(m, "title") - if v3 != nil { - x.Title, ok = compiler.StringForScalarNode(v3) - if !ok { - message := fmt.Sprintf("has unexpected value for title: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string description = 4; - v4 := compiler.MapValueForKey(m, "description") - if v4 != nil { - x.Description, ok = compiler.StringForScalarNode(v4) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v4)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Any default = 5; - v5 := compiler.MapValueForKey(m, "default") - if v5 != nil { - var err error - x.Default, err = NewAny(v5, compiler.NewContext("default", v5, context)) - if err != nil { - errors = append(errors, err) - } - } - // float multiple_of = 6; - v6 := compiler.MapValueForKey(m, "multipleOf") - if v6 != nil { - v, ok := compiler.FloatForScalarNode(v6) - if ok { - x.MultipleOf = v - } else { - message := fmt.Sprintf("has unexpected value for multipleOf: %s", compiler.Display(v6)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // float maximum = 7; - v7 := compiler.MapValueForKey(m, "maximum") - if v7 != nil { - v, ok := compiler.FloatForScalarNode(v7) - if ok { - x.Maximum = v - } else { - message := fmt.Sprintf("has unexpected value for maximum: %s", compiler.Display(v7)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool exclusive_maximum = 8; - v8 := compiler.MapValueForKey(m, "exclusiveMaximum") - if v8 != nil { - x.ExclusiveMaximum, ok = compiler.BoolForScalarNode(v8) - if !ok { - message := fmt.Sprintf("has unexpected value for exclusiveMaximum: %s", compiler.Display(v8)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // float minimum = 9; - v9 := compiler.MapValueForKey(m, "minimum") - if v9 != nil { - v, ok := compiler.FloatForScalarNode(v9) - if ok { - x.Minimum = v - } else { - message := fmt.Sprintf("has unexpected value for minimum: %s", compiler.Display(v9)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool exclusive_minimum = 10; - v10 := compiler.MapValueForKey(m, "exclusiveMinimum") - if v10 != nil { - x.ExclusiveMinimum, ok = compiler.BoolForScalarNode(v10) - if !ok { - message := fmt.Sprintf("has unexpected value for exclusiveMinimum: %s", compiler.Display(v10)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 max_length = 11; - v11 := compiler.MapValueForKey(m, "maxLength") - if v11 != nil { - t, ok := compiler.IntForScalarNode(v11) - if ok { - x.MaxLength = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for maxLength: %s", compiler.Display(v11)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 min_length = 12; - v12 := compiler.MapValueForKey(m, "minLength") - if v12 != nil { - t, ok := compiler.IntForScalarNode(v12) - if ok { - x.MinLength = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for minLength: %s", compiler.Display(v12)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string pattern = 13; - v13 := compiler.MapValueForKey(m, "pattern") - if v13 != nil { - x.Pattern, ok = compiler.StringForScalarNode(v13) - if !ok { - message := fmt.Sprintf("has unexpected value for pattern: %s", compiler.Display(v13)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 max_items = 14; - v14 := compiler.MapValueForKey(m, "maxItems") - if v14 != nil { - t, ok := compiler.IntForScalarNode(v14) - if ok { - x.MaxItems = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for maxItems: %s", compiler.Display(v14)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 min_items = 15; - v15 := compiler.MapValueForKey(m, "minItems") - if v15 != nil { - t, ok := compiler.IntForScalarNode(v15) - if ok { - x.MinItems = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for minItems: %s", compiler.Display(v15)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool unique_items = 16; - v16 := compiler.MapValueForKey(m, "uniqueItems") - if v16 != nil { - x.UniqueItems, ok = compiler.BoolForScalarNode(v16) - if !ok { - message := fmt.Sprintf("has unexpected value for uniqueItems: %s", compiler.Display(v16)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 max_properties = 17; - v17 := compiler.MapValueForKey(m, "maxProperties") - if v17 != nil { - t, ok := compiler.IntForScalarNode(v17) - if ok { - x.MaxProperties = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for maxProperties: %s", compiler.Display(v17)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 min_properties = 18; - v18 := compiler.MapValueForKey(m, "minProperties") - if v18 != nil { - t, ok := compiler.IntForScalarNode(v18) - if ok { - x.MinProperties = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for minProperties: %s", compiler.Display(v18)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated string required = 19; - v19 := compiler.MapValueForKey(m, "required") - if v19 != nil { - v, ok := compiler.SequenceNodeForNode(v19) - if ok { - x.Required = compiler.StringArrayForSequenceNode(v) - } else { - message := fmt.Sprintf("has unexpected value for required: %s", compiler.Display(v19)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated Any enum = 20; - v20 := compiler.MapValueForKey(m, "enum") - if v20 != nil { - // repeated Any - x.Enum = make([]*Any, 0) - a, ok := compiler.SequenceNodeForNode(v20) - if ok { - for _, item := range a.Content { - y, err := NewAny(item, compiler.NewContext("enum", item, context)) - if err != nil { - errors = append(errors, err) - } - x.Enum = append(x.Enum, y) - } - } - } - // AdditionalPropertiesItem additional_properties = 21; - v21 := compiler.MapValueForKey(m, "additionalProperties") - if v21 != nil { - var err error - x.AdditionalProperties, err = NewAdditionalPropertiesItem(v21, compiler.NewContext("additionalProperties", v21, context)) - if err != nil { - errors = append(errors, err) - } - } - // TypeItem type = 22; - v22 := compiler.MapValueForKey(m, "type") - if v22 != nil { - var err error - x.Type, err = NewTypeItem(v22, compiler.NewContext("type", v22, context)) - if err != nil { - errors = append(errors, err) - } - } - // ItemsItem items = 23; - v23 := compiler.MapValueForKey(m, "items") - if v23 != nil { - var err error - x.Items, err = NewItemsItem(v23, compiler.NewContext("items", v23, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated Schema all_of = 24; - v24 := compiler.MapValueForKey(m, "allOf") - if v24 != nil { - // repeated Schema - x.AllOf = make([]*Schema, 0) - a, ok := compiler.SequenceNodeForNode(v24) - if ok { - for _, item := range a.Content { - y, err := NewSchema(item, compiler.NewContext("allOf", item, context)) - if err != nil { - errors = append(errors, err) - } - x.AllOf = append(x.AllOf, y) - } - } - } - // Properties properties = 25; - v25 := compiler.MapValueForKey(m, "properties") - if v25 != nil { - var err error - x.Properties, err = NewProperties(v25, compiler.NewContext("properties", v25, context)) - if err != nil { - errors = append(errors, err) - } - } - // string discriminator = 26; - v26 := compiler.MapValueForKey(m, "discriminator") - if v26 != nil { - x.Discriminator, ok = compiler.StringForScalarNode(v26) - if !ok { - message := fmt.Sprintf("has unexpected value for discriminator: %s", compiler.Display(v26)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool read_only = 27; - v27 := compiler.MapValueForKey(m, "readOnly") - if v27 != nil { - x.ReadOnly, ok = compiler.BoolForScalarNode(v27) - if !ok { - message := fmt.Sprintf("has unexpected value for readOnly: %s", compiler.Display(v27)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Xml xml = 28; - v28 := compiler.MapValueForKey(m, "xml") - if v28 != nil { - var err error - x.Xml, err = NewXml(v28, compiler.NewContext("xml", v28, context)) - if err != nil { - errors = append(errors, err) - } - } - // ExternalDocs external_docs = 29; - v29 := compiler.MapValueForKey(m, "externalDocs") - if v29 != nil { - var err error - x.ExternalDocs, err = NewExternalDocs(v29, compiler.NewContext("externalDocs", v29, context)) - if err != nil { - errors = append(errors, err) - } - } - // Any example = 30; - v30 := compiler.MapValueForKey(m, "example") - if v30 != nil { - var err error - x.Example, err = NewAny(v30, compiler.NewContext("example", v30, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated NamedAny vendor_extension = 31; - // MAP: Any ^x- - x.VendorExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.VendorExtension = append(x.VendorExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewSchemaItem creates an object of type SchemaItem if possible, returning an error if not. -func NewSchemaItem(in *yaml.Node, context *compiler.Context) (*SchemaItem, error) { - errors := make([]error, 0) - x := &SchemaItem{} - matched := false - // Schema schema = 1; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewSchema(m, compiler.NewContext("schema", m, context)) - if matchingError == nil { - x.Oneof = &SchemaItem_Schema{Schema: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - // FileSchema file_schema = 2; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewFileSchema(m, compiler.NewContext("fileSchema", m, context)) - if matchingError == nil { - x.Oneof = &SchemaItem_FileSchema{FileSchema: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - if matched { - // since the oneof matched one of its possibilities, discard any matching errors - errors = make([]error, 0) - } else { - message := fmt.Sprintf("contains an invalid SchemaItem") - err := compiler.NewError(context, message) - errors = []error{err} - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewSecurityDefinitions creates an object of type SecurityDefinitions if possible, returning an error if not. -func NewSecurityDefinitions(in *yaml.Node, context *compiler.Context) (*SecurityDefinitions, error) { - errors := make([]error, 0) - x := &SecurityDefinitions{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedSecurityDefinitionsItem additional_properties = 1; - // MAP: SecurityDefinitionsItem - x.AdditionalProperties = make([]*NamedSecurityDefinitionsItem, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedSecurityDefinitionsItem{} - pair.Name = k - var err error - pair.Value, err = NewSecurityDefinitionsItem(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewSecurityDefinitionsItem creates an object of type SecurityDefinitionsItem if possible, returning an error if not. -func NewSecurityDefinitionsItem(in *yaml.Node, context *compiler.Context) (*SecurityDefinitionsItem, error) { - errors := make([]error, 0) - x := &SecurityDefinitionsItem{} - matched := false - // BasicAuthenticationSecurity basic_authentication_security = 1; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewBasicAuthenticationSecurity(m, compiler.NewContext("basicAuthenticationSecurity", m, context)) - if matchingError == nil { - x.Oneof = &SecurityDefinitionsItem_BasicAuthenticationSecurity{BasicAuthenticationSecurity: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - // ApiKeySecurity api_key_security = 2; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewApiKeySecurity(m, compiler.NewContext("apiKeySecurity", m, context)) - if matchingError == nil { - x.Oneof = &SecurityDefinitionsItem_ApiKeySecurity{ApiKeySecurity: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - // Oauth2ImplicitSecurity oauth2_implicit_security = 3; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewOauth2ImplicitSecurity(m, compiler.NewContext("oauth2ImplicitSecurity", m, context)) - if matchingError == nil { - x.Oneof = &SecurityDefinitionsItem_Oauth2ImplicitSecurity{Oauth2ImplicitSecurity: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - // Oauth2PasswordSecurity oauth2_password_security = 4; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewOauth2PasswordSecurity(m, compiler.NewContext("oauth2PasswordSecurity", m, context)) - if matchingError == nil { - x.Oneof = &SecurityDefinitionsItem_Oauth2PasswordSecurity{Oauth2PasswordSecurity: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - // Oauth2ApplicationSecurity oauth2_application_security = 5; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewOauth2ApplicationSecurity(m, compiler.NewContext("oauth2ApplicationSecurity", m, context)) - if matchingError == nil { - x.Oneof = &SecurityDefinitionsItem_Oauth2ApplicationSecurity{Oauth2ApplicationSecurity: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - // Oauth2AccessCodeSecurity oauth2_access_code_security = 6; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewOauth2AccessCodeSecurity(m, compiler.NewContext("oauth2AccessCodeSecurity", m, context)) - if matchingError == nil { - x.Oneof = &SecurityDefinitionsItem_Oauth2AccessCodeSecurity{Oauth2AccessCodeSecurity: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - if matched { - // since the oneof matched one of its possibilities, discard any matching errors - errors = make([]error, 0) - } else { - message := fmt.Sprintf("contains an invalid SecurityDefinitionsItem") - err := compiler.NewError(context, message) - errors = []error{err} - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewSecurityRequirement creates an object of type SecurityRequirement if possible, returning an error if not. -func NewSecurityRequirement(in *yaml.Node, context *compiler.Context) (*SecurityRequirement, error) { - errors := make([]error, 0) - x := &SecurityRequirement{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedStringArray additional_properties = 1; - // MAP: StringArray - x.AdditionalProperties = make([]*NamedStringArray, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedStringArray{} - pair.Name = k - var err error - pair.Value, err = NewStringArray(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewStringArray creates an object of type StringArray if possible, returning an error if not. -func NewStringArray(in *yaml.Node, context *compiler.Context) (*StringArray, error) { - errors := make([]error, 0) - x := &StringArray{} - x.Value = make([]string, 0) - for _, node := range in.Content { - s, _ := compiler.StringForScalarNode(node) - x.Value = append(x.Value, s) - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewTag creates an object of type Tag if possible, returning an error if not. -func NewTag(in *yaml.Node, context *compiler.Context) (*Tag, error) { - errors := make([]error, 0) - x := &Tag{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"name"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"description", "externalDocs", "name"} - allowedPatterns := []*regexp.Regexp{pattern0} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string description = 2; - v2 := compiler.MapValueForKey(m, "description") - if v2 != nil { - x.Description, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // ExternalDocs external_docs = 3; - v3 := compiler.MapValueForKey(m, "externalDocs") - if v3 != nil { - var err error - x.ExternalDocs, err = NewExternalDocs(v3, compiler.NewContext("externalDocs", v3, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated NamedAny vendor_extension = 4; - // MAP: Any ^x- - x.VendorExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.VendorExtension = append(x.VendorExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewTypeItem creates an object of type TypeItem if possible, returning an error if not. -func NewTypeItem(in *yaml.Node, context *compiler.Context) (*TypeItem, error) { - errors := make([]error, 0) - x := &TypeItem{} - v1 := in - switch v1.Kind { - case yaml.ScalarNode: - x.Value = make([]string, 0) - x.Value = append(x.Value, v1.Value) - case yaml.SequenceNode: - x.Value = make([]string, 0) - for _, v := range v1.Content { - value := v.Value - ok := v.Kind == yaml.ScalarNode - if ok { - x.Value = append(x.Value, value) - } else { - message := fmt.Sprintf("has unexpected value for string array element: %+v (%T)", value, value) - errors = append(errors, compiler.NewError(context, message)) - } - } - default: - message := fmt.Sprintf("has unexpected value for string array: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewVendorExtension creates an object of type VendorExtension if possible, returning an error if not. -func NewVendorExtension(in *yaml.Node, context *compiler.Context) (*VendorExtension, error) { - errors := make([]error, 0) - x := &VendorExtension{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedAny additional_properties = 1; - // MAP: Any - x.AdditionalProperties = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewXml creates an object of type Xml if possible, returning an error if not. -func NewXml(in *yaml.Node, context *compiler.Context) (*Xml, error) { - errors := make([]error, 0) - x := &Xml{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"attribute", "name", "namespace", "prefix", "wrapped"} - allowedPatterns := []*regexp.Regexp{pattern0} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string namespace = 2; - v2 := compiler.MapValueForKey(m, "namespace") - if v2 != nil { - x.Namespace, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for namespace: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string prefix = 3; - v3 := compiler.MapValueForKey(m, "prefix") - if v3 != nil { - x.Prefix, ok = compiler.StringForScalarNode(v3) - if !ok { - message := fmt.Sprintf("has unexpected value for prefix: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool attribute = 4; - v4 := compiler.MapValueForKey(m, "attribute") - if v4 != nil { - x.Attribute, ok = compiler.BoolForScalarNode(v4) - if !ok { - message := fmt.Sprintf("has unexpected value for attribute: %s", compiler.Display(v4)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool wrapped = 5; - v5 := compiler.MapValueForKey(m, "wrapped") - if v5 != nil { - x.Wrapped, ok = compiler.BoolForScalarNode(v5) - if !ok { - message := fmt.Sprintf("has unexpected value for wrapped: %s", compiler.Display(v5)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated NamedAny vendor_extension = 6; - // MAP: Any ^x- - x.VendorExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.VendorExtension = append(x.VendorExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside AdditionalPropertiesItem objects. -func (m *AdditionalPropertiesItem) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - { - p, ok := m.Oneof.(*AdditionalPropertiesItem_Schema) - if ok { - _, err := p.Schema.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Any objects. -func (m *Any) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside ApiKeySecurity objects. -func (m *ApiKeySecurity) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.VendorExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside BasicAuthenticationSecurity objects. -func (m *BasicAuthenticationSecurity) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.VendorExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside BodyParameter objects. -func (m *BodyParameter) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Schema != nil { - _, err := m.Schema.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.VendorExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Contact objects. -func (m *Contact) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.VendorExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Default objects. -func (m *Default) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Definitions objects. -func (m *Definitions) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Document objects. -func (m *Document) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Info != nil { - _, err := m.Info.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Paths != nil { - _, err := m.Paths.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Definitions != nil { - _, err := m.Definitions.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Parameters != nil { - _, err := m.Parameters.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Responses != nil { - _, err := m.Responses.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.Security { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - if m.SecurityDefinitions != nil { - _, err := m.SecurityDefinitions.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.Tags { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - if m.ExternalDocs != nil { - _, err := m.ExternalDocs.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.VendorExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Examples objects. -func (m *Examples) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside ExternalDocs objects. -func (m *ExternalDocs) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.VendorExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside FileSchema objects. -func (m *FileSchema) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Default != nil { - _, err := m.Default.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.ExternalDocs != nil { - _, err := m.ExternalDocs.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Example != nil { - _, err := m.Example.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.VendorExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside FormDataParameterSubSchema objects. -func (m *FormDataParameterSubSchema) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Items != nil { - _, err := m.Items.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Default != nil { - _, err := m.Default.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.Enum { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - for _, item := range m.VendorExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Header objects. -func (m *Header) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Items != nil { - _, err := m.Items.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Default != nil { - _, err := m.Default.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.Enum { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - for _, item := range m.VendorExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside HeaderParameterSubSchema objects. -func (m *HeaderParameterSubSchema) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Items != nil { - _, err := m.Items.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Default != nil { - _, err := m.Default.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.Enum { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - for _, item := range m.VendorExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Headers objects. -func (m *Headers) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Info objects. -func (m *Info) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Contact != nil { - _, err := m.Contact.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.License != nil { - _, err := m.License.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.VendorExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside ItemsItem objects. -func (m *ItemsItem) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.Schema { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside JsonReference objects. -func (m *JsonReference) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.XRef != "" { - info, err := compiler.ReadInfoForRef(root, m.XRef) - if err != nil { - return nil, err - } - if info != nil { - replacement, err := NewJsonReference(info, nil) - if err == nil { - *m = *replacement - return m.ResolveReferences(root) - } - } - return info, nil - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside License objects. -func (m *License) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.VendorExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside NamedAny objects. -func (m *NamedAny) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Value != nil { - _, err := m.Value.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside NamedHeader objects. -func (m *NamedHeader) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Value != nil { - _, err := m.Value.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside NamedParameter objects. -func (m *NamedParameter) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Value != nil { - _, err := m.Value.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside NamedPathItem objects. -func (m *NamedPathItem) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Value != nil { - _, err := m.Value.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside NamedResponse objects. -func (m *NamedResponse) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Value != nil { - _, err := m.Value.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside NamedResponseValue objects. -func (m *NamedResponseValue) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Value != nil { - _, err := m.Value.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside NamedSchema objects. -func (m *NamedSchema) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Value != nil { - _, err := m.Value.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside NamedSecurityDefinitionsItem objects. -func (m *NamedSecurityDefinitionsItem) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Value != nil { - _, err := m.Value.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside NamedString objects. -func (m *NamedString) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside NamedStringArray objects. -func (m *NamedStringArray) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Value != nil { - _, err := m.Value.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside NonBodyParameter objects. -func (m *NonBodyParameter) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - { - p, ok := m.Oneof.(*NonBodyParameter_HeaderParameterSubSchema) - if ok { - _, err := p.HeaderParameterSubSchema.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - { - p, ok := m.Oneof.(*NonBodyParameter_FormDataParameterSubSchema) - if ok { - _, err := p.FormDataParameterSubSchema.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - { - p, ok := m.Oneof.(*NonBodyParameter_QueryParameterSubSchema) - if ok { - _, err := p.QueryParameterSubSchema.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - { - p, ok := m.Oneof.(*NonBodyParameter_PathParameterSubSchema) - if ok { - _, err := p.PathParameterSubSchema.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Oauth2AccessCodeSecurity objects. -func (m *Oauth2AccessCodeSecurity) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Scopes != nil { - _, err := m.Scopes.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.VendorExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Oauth2ApplicationSecurity objects. -func (m *Oauth2ApplicationSecurity) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Scopes != nil { - _, err := m.Scopes.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.VendorExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Oauth2ImplicitSecurity objects. -func (m *Oauth2ImplicitSecurity) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Scopes != nil { - _, err := m.Scopes.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.VendorExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Oauth2PasswordSecurity objects. -func (m *Oauth2PasswordSecurity) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Scopes != nil { - _, err := m.Scopes.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.VendorExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Oauth2Scopes objects. -func (m *Oauth2Scopes) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Operation objects. -func (m *Operation) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.ExternalDocs != nil { - _, err := m.ExternalDocs.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.Parameters { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - if m.Responses != nil { - _, err := m.Responses.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.Security { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - for _, item := range m.VendorExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Parameter objects. -func (m *Parameter) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - { - p, ok := m.Oneof.(*Parameter_BodyParameter) - if ok { - _, err := p.BodyParameter.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - { - p, ok := m.Oneof.(*Parameter_NonBodyParameter) - if ok { - _, err := p.NonBodyParameter.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside ParameterDefinitions objects. -func (m *ParameterDefinitions) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside ParametersItem objects. -func (m *ParametersItem) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - { - p, ok := m.Oneof.(*ParametersItem_Parameter) - if ok { - _, err := p.Parameter.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - { - p, ok := m.Oneof.(*ParametersItem_JsonReference) - if ok { - info, err := p.JsonReference.ResolveReferences(root) - if err != nil { - return nil, err - } else if info != nil { - n, err := NewParametersItem(info, nil) - if err != nil { - return nil, err - } else if n != nil { - *m = *n - return nil, nil - } - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside PathItem objects. -func (m *PathItem) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.XRef != "" { - info, err := compiler.ReadInfoForRef(root, m.XRef) - if err != nil { - return nil, err - } - if info != nil { - replacement, err := NewPathItem(info, nil) - if err == nil { - *m = *replacement - return m.ResolveReferences(root) - } - } - return info, nil - } - if m.Get != nil { - _, err := m.Get.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Put != nil { - _, err := m.Put.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Post != nil { - _, err := m.Post.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Delete != nil { - _, err := m.Delete.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Options != nil { - _, err := m.Options.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Head != nil { - _, err := m.Head.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Patch != nil { - _, err := m.Patch.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.Parameters { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - for _, item := range m.VendorExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside PathParameterSubSchema objects. -func (m *PathParameterSubSchema) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Items != nil { - _, err := m.Items.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Default != nil { - _, err := m.Default.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.Enum { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - for _, item := range m.VendorExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Paths objects. -func (m *Paths) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.VendorExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - for _, item := range m.Path { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside PrimitivesItems objects. -func (m *PrimitivesItems) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Items != nil { - _, err := m.Items.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Default != nil { - _, err := m.Default.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.Enum { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - for _, item := range m.VendorExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Properties objects. -func (m *Properties) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside QueryParameterSubSchema objects. -func (m *QueryParameterSubSchema) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Items != nil { - _, err := m.Items.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Default != nil { - _, err := m.Default.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.Enum { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - for _, item := range m.VendorExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Response objects. -func (m *Response) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Schema != nil { - _, err := m.Schema.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Headers != nil { - _, err := m.Headers.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Examples != nil { - _, err := m.Examples.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.VendorExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside ResponseDefinitions objects. -func (m *ResponseDefinitions) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside ResponseValue objects. -func (m *ResponseValue) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - { - p, ok := m.Oneof.(*ResponseValue_Response) - if ok { - _, err := p.Response.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - { - p, ok := m.Oneof.(*ResponseValue_JsonReference) - if ok { - info, err := p.JsonReference.ResolveReferences(root) - if err != nil { - return nil, err - } else if info != nil { - n, err := NewResponseValue(info, nil) - if err != nil { - return nil, err - } else if n != nil { - *m = *n - return nil, nil - } - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Responses objects. -func (m *Responses) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.ResponseCode { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - for _, item := range m.VendorExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Schema objects. -func (m *Schema) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.XRef != "" { - info, err := compiler.ReadInfoForRef(root, m.XRef) - if err != nil { - return nil, err - } - if info != nil { - replacement, err := NewSchema(info, nil) - if err == nil { - *m = *replacement - return m.ResolveReferences(root) - } - } - return info, nil - } - if m.Default != nil { - _, err := m.Default.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.Enum { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - if m.AdditionalProperties != nil { - _, err := m.AdditionalProperties.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Type != nil { - _, err := m.Type.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Items != nil { - _, err := m.Items.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.AllOf { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - if m.Properties != nil { - _, err := m.Properties.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Xml != nil { - _, err := m.Xml.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.ExternalDocs != nil { - _, err := m.ExternalDocs.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Example != nil { - _, err := m.Example.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.VendorExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside SchemaItem objects. -func (m *SchemaItem) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - { - p, ok := m.Oneof.(*SchemaItem_Schema) - if ok { - _, err := p.Schema.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - { - p, ok := m.Oneof.(*SchemaItem_FileSchema) - if ok { - _, err := p.FileSchema.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside SecurityDefinitions objects. -func (m *SecurityDefinitions) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside SecurityDefinitionsItem objects. -func (m *SecurityDefinitionsItem) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - { - p, ok := m.Oneof.(*SecurityDefinitionsItem_BasicAuthenticationSecurity) - if ok { - _, err := p.BasicAuthenticationSecurity.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - { - p, ok := m.Oneof.(*SecurityDefinitionsItem_ApiKeySecurity) - if ok { - _, err := p.ApiKeySecurity.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - { - p, ok := m.Oneof.(*SecurityDefinitionsItem_Oauth2ImplicitSecurity) - if ok { - _, err := p.Oauth2ImplicitSecurity.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - { - p, ok := m.Oneof.(*SecurityDefinitionsItem_Oauth2PasswordSecurity) - if ok { - _, err := p.Oauth2PasswordSecurity.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - { - p, ok := m.Oneof.(*SecurityDefinitionsItem_Oauth2ApplicationSecurity) - if ok { - _, err := p.Oauth2ApplicationSecurity.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - { - p, ok := m.Oneof.(*SecurityDefinitionsItem_Oauth2AccessCodeSecurity) - if ok { - _, err := p.Oauth2AccessCodeSecurity.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside SecurityRequirement objects. -func (m *SecurityRequirement) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside StringArray objects. -func (m *StringArray) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Tag objects. -func (m *Tag) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.ExternalDocs != nil { - _, err := m.ExternalDocs.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.VendorExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside TypeItem objects. -func (m *TypeItem) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside VendorExtension objects. -func (m *VendorExtension) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Xml objects. -func (m *Xml) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.VendorExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ToRawInfo returns a description of AdditionalPropertiesItem suitable for JSON or YAML export. -func (m *AdditionalPropertiesItem) ToRawInfo() *yaml.Node { - // ONE OF WRAPPER - // AdditionalPropertiesItem - // {Name:schema Type:Schema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v0 := m.GetSchema() - if v0 != nil { - return v0.ToRawInfo() - } - // {Name:boolean Type:bool StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - if v1, ok := m.GetOneof().(*AdditionalPropertiesItem_Boolean); ok { - return compiler.NewScalarNodeForBool(v1.Boolean) - } - return compiler.NewNullNode() -} - -// ToRawInfo returns a description of Any suitable for JSON or YAML export. -func (m *Any) ToRawInfo() *yaml.Node { - var err error - var node yaml.Node - err = yaml.Unmarshal([]byte(m.Yaml), &node) - if err == nil { - if node.Kind == yaml.DocumentNode { - return node.Content[0] - } - return &node - } - return compiler.NewNullNode() -} - -// ToRawInfo returns a description of ApiKeySecurity suitable for JSON or YAML export. -func (m *ApiKeySecurity) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("type")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type)) - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("in")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.In)) - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.VendorExtension != nil { - for _, item := range m.VendorExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of BasicAuthenticationSecurity suitable for JSON or YAML export. -func (m *BasicAuthenticationSecurity) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("type")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type)) - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.VendorExtension != nil { - for _, item := range m.VendorExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of BodyParameter suitable for JSON or YAML export. -func (m *BodyParameter) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("in")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.In)) - if m.Required != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("required")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Required)) - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("schema")) - info.Content = append(info.Content, m.Schema.ToRawInfo()) - if m.VendorExtension != nil { - for _, item := range m.VendorExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Contact suitable for JSON or YAML export. -func (m *Contact) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - if m.Url != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("url")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Url)) - } - if m.Email != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("email")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Email)) - } - if m.VendorExtension != nil { - for _, item := range m.VendorExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Default suitable for JSON or YAML export. -func (m *Default) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.AdditionalProperties != nil { - for _, item := range m.AdditionalProperties { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Definitions suitable for JSON or YAML export. -func (m *Definitions) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.AdditionalProperties != nil { - for _, item := range m.AdditionalProperties { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Document suitable for JSON or YAML export. -func (m *Document) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("swagger")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Swagger)) - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("info")) - info.Content = append(info.Content, m.Info.ToRawInfo()) - if m.Host != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("host")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Host)) - } - if m.BasePath != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("basePath")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.BasePath)) - } - if len(m.Schemes) != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("schemes")) - info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Schemes)) - } - if len(m.Consumes) != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("consumes")) - info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Consumes)) - } - if len(m.Produces) != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("produces")) - info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Produces)) - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("paths")) - info.Content = append(info.Content, m.Paths.ToRawInfo()) - if m.Definitions != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("definitions")) - info.Content = append(info.Content, m.Definitions.ToRawInfo()) - } - if m.Parameters != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("parameters")) - info.Content = append(info.Content, m.Parameters.ToRawInfo()) - } - if m.Responses != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("responses")) - info.Content = append(info.Content, m.Responses.ToRawInfo()) - } - if len(m.Security) != 0 { - items := compiler.NewSequenceNode() - for _, item := range m.Security { - items.Content = append(items.Content, item.ToRawInfo()) - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("security")) - info.Content = append(info.Content, items) - } - if m.SecurityDefinitions != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("securityDefinitions")) - info.Content = append(info.Content, m.SecurityDefinitions.ToRawInfo()) - } - if len(m.Tags) != 0 { - items := compiler.NewSequenceNode() - for _, item := range m.Tags { - items.Content = append(items.Content, item.ToRawInfo()) - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("tags")) - info.Content = append(info.Content, items) - } - if m.ExternalDocs != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("externalDocs")) - info.Content = append(info.Content, m.ExternalDocs.ToRawInfo()) - } - if m.VendorExtension != nil { - for _, item := range m.VendorExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Examples suitable for JSON or YAML export. -func (m *Examples) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.AdditionalProperties != nil { - for _, item := range m.AdditionalProperties { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of ExternalDocs suitable for JSON or YAML export. -func (m *ExternalDocs) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("url")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Url)) - if m.VendorExtension != nil { - for _, item := range m.VendorExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of FileSchema suitable for JSON or YAML export. -func (m *FileSchema) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Format != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("format")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Format)) - } - if m.Title != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("title")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Title)) - } - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.Default != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("default")) - info.Content = append(info.Content, m.Default.ToRawInfo()) - } - if len(m.Required) != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("required")) - info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Required)) - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("type")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type)) - if m.ReadOnly != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("readOnly")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ReadOnly)) - } - if m.ExternalDocs != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("externalDocs")) - info.Content = append(info.Content, m.ExternalDocs.ToRawInfo()) - } - if m.Example != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("example")) - info.Content = append(info.Content, m.Example.ToRawInfo()) - } - if m.VendorExtension != nil { - for _, item := range m.VendorExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of FormDataParameterSubSchema suitable for JSON or YAML export. -func (m *FormDataParameterSubSchema) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Required != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("required")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Required)) - } - if m.In != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("in")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.In)) - } - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - if m.AllowEmptyValue != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("allowEmptyValue")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.AllowEmptyValue)) - } - if m.Type != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("type")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type)) - } - if m.Format != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("format")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Format)) - } - if m.Items != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("items")) - info.Content = append(info.Content, m.Items.ToRawInfo()) - } - if m.CollectionFormat != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("collectionFormat")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.CollectionFormat)) - } - if m.Default != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("default")) - info.Content = append(info.Content, m.Default.ToRawInfo()) - } - if m.Maximum != 0.0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("maximum")) - info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Maximum)) - } - if m.ExclusiveMaximum != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMaximum")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMaximum)) - } - if m.Minimum != 0.0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("minimum")) - info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Minimum)) - } - if m.ExclusiveMinimum != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMinimum")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMinimum)) - } - if m.MaxLength != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("maxLength")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxLength)) - } - if m.MinLength != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("minLength")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinLength)) - } - if m.Pattern != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("pattern")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Pattern)) - } - if m.MaxItems != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("maxItems")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxItems)) - } - if m.MinItems != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("minItems")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinItems)) - } - if m.UniqueItems != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("uniqueItems")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.UniqueItems)) - } - if len(m.Enum) != 0 { - items := compiler.NewSequenceNode() - for _, item := range m.Enum { - items.Content = append(items.Content, item.ToRawInfo()) - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("enum")) - info.Content = append(info.Content, items) - } - if m.MultipleOf != 0.0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("multipleOf")) - info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.MultipleOf)) - } - if m.VendorExtension != nil { - for _, item := range m.VendorExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Header suitable for JSON or YAML export. -func (m *Header) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("type")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type)) - if m.Format != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("format")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Format)) - } - if m.Items != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("items")) - info.Content = append(info.Content, m.Items.ToRawInfo()) - } - if m.CollectionFormat != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("collectionFormat")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.CollectionFormat)) - } - if m.Default != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("default")) - info.Content = append(info.Content, m.Default.ToRawInfo()) - } - if m.Maximum != 0.0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("maximum")) - info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Maximum)) - } - if m.ExclusiveMaximum != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMaximum")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMaximum)) - } - if m.Minimum != 0.0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("minimum")) - info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Minimum)) - } - if m.ExclusiveMinimum != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMinimum")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMinimum)) - } - if m.MaxLength != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("maxLength")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxLength)) - } - if m.MinLength != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("minLength")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinLength)) - } - if m.Pattern != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("pattern")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Pattern)) - } - if m.MaxItems != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("maxItems")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxItems)) - } - if m.MinItems != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("minItems")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinItems)) - } - if m.UniqueItems != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("uniqueItems")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.UniqueItems)) - } - if len(m.Enum) != 0 { - items := compiler.NewSequenceNode() - for _, item := range m.Enum { - items.Content = append(items.Content, item.ToRawInfo()) - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("enum")) - info.Content = append(info.Content, items) - } - if m.MultipleOf != 0.0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("multipleOf")) - info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.MultipleOf)) - } - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.VendorExtension != nil { - for _, item := range m.VendorExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of HeaderParameterSubSchema suitable for JSON or YAML export. -func (m *HeaderParameterSubSchema) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Required != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("required")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Required)) - } - if m.In != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("in")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.In)) - } - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - if m.Type != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("type")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type)) - } - if m.Format != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("format")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Format)) - } - if m.Items != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("items")) - info.Content = append(info.Content, m.Items.ToRawInfo()) - } - if m.CollectionFormat != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("collectionFormat")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.CollectionFormat)) - } - if m.Default != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("default")) - info.Content = append(info.Content, m.Default.ToRawInfo()) - } - if m.Maximum != 0.0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("maximum")) - info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Maximum)) - } - if m.ExclusiveMaximum != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMaximum")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMaximum)) - } - if m.Minimum != 0.0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("minimum")) - info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Minimum)) - } - if m.ExclusiveMinimum != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMinimum")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMinimum)) - } - if m.MaxLength != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("maxLength")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxLength)) - } - if m.MinLength != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("minLength")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinLength)) - } - if m.Pattern != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("pattern")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Pattern)) - } - if m.MaxItems != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("maxItems")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxItems)) - } - if m.MinItems != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("minItems")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinItems)) - } - if m.UniqueItems != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("uniqueItems")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.UniqueItems)) - } - if len(m.Enum) != 0 { - items := compiler.NewSequenceNode() - for _, item := range m.Enum { - items.Content = append(items.Content, item.ToRawInfo()) - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("enum")) - info.Content = append(info.Content, items) - } - if m.MultipleOf != 0.0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("multipleOf")) - info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.MultipleOf)) - } - if m.VendorExtension != nil { - for _, item := range m.VendorExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Headers suitable for JSON or YAML export. -func (m *Headers) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.AdditionalProperties != nil { - for _, item := range m.AdditionalProperties { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Info suitable for JSON or YAML export. -func (m *Info) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("title")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Title)) - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("version")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Version)) - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.TermsOfService != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("termsOfService")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.TermsOfService)) - } - if m.Contact != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("contact")) - info.Content = append(info.Content, m.Contact.ToRawInfo()) - } - if m.License != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("license")) - info.Content = append(info.Content, m.License.ToRawInfo()) - } - if m.VendorExtension != nil { - for _, item := range m.VendorExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of ItemsItem suitable for JSON or YAML export. -func (m *ItemsItem) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if len(m.Schema) != 0 { - items := compiler.NewSequenceNode() - for _, item := range m.Schema { - items.Content = append(items.Content, item.ToRawInfo()) - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("schema")) - info.Content = append(info.Content, items) - } - return info -} - -// ToRawInfo returns a description of JsonReference suitable for JSON or YAML export. -func (m *JsonReference) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("$ref")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.XRef)) - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - return info -} - -// ToRawInfo returns a description of License suitable for JSON or YAML export. -func (m *License) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - if m.Url != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("url")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Url)) - } - if m.VendorExtension != nil { - for _, item := range m.VendorExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of NamedAny suitable for JSON or YAML export. -func (m *NamedAny) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - if m.Value != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("value")) - info.Content = append(info.Content, m.Value.ToRawInfo()) - } - return info -} - -// ToRawInfo returns a description of NamedHeader suitable for JSON or YAML export. -func (m *NamedHeader) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - // &{Name:value Type:Header StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value} - return info -} - -// ToRawInfo returns a description of NamedParameter suitable for JSON or YAML export. -func (m *NamedParameter) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - // &{Name:value Type:Parameter StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value} - return info -} - -// ToRawInfo returns a description of NamedPathItem suitable for JSON or YAML export. -func (m *NamedPathItem) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - // &{Name:value Type:PathItem StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value} - return info -} - -// ToRawInfo returns a description of NamedResponse suitable for JSON or YAML export. -func (m *NamedResponse) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - // &{Name:value Type:Response StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value} - return info -} - -// ToRawInfo returns a description of NamedResponseValue suitable for JSON or YAML export. -func (m *NamedResponseValue) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - // &{Name:value Type:ResponseValue StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value} - return info -} - -// ToRawInfo returns a description of NamedSchema suitable for JSON or YAML export. -func (m *NamedSchema) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - // &{Name:value Type:Schema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value} - return info -} - -// ToRawInfo returns a description of NamedSecurityDefinitionsItem suitable for JSON or YAML export. -func (m *NamedSecurityDefinitionsItem) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - // &{Name:value Type:SecurityDefinitionsItem StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value} - return info -} - -// ToRawInfo returns a description of NamedString suitable for JSON or YAML export. -func (m *NamedString) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - if m.Value != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("value")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Value)) - } - return info -} - -// ToRawInfo returns a description of NamedStringArray suitable for JSON or YAML export. -func (m *NamedStringArray) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - // &{Name:value Type:StringArray StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value} - return info -} - -// ToRawInfo returns a description of NonBodyParameter suitable for JSON or YAML export. -func (m *NonBodyParameter) ToRawInfo() *yaml.Node { - // ONE OF WRAPPER - // NonBodyParameter - // {Name:headerParameterSubSchema Type:HeaderParameterSubSchema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v0 := m.GetHeaderParameterSubSchema() - if v0 != nil { - return v0.ToRawInfo() - } - // {Name:formDataParameterSubSchema Type:FormDataParameterSubSchema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v1 := m.GetFormDataParameterSubSchema() - if v1 != nil { - return v1.ToRawInfo() - } - // {Name:queryParameterSubSchema Type:QueryParameterSubSchema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v2 := m.GetQueryParameterSubSchema() - if v2 != nil { - return v2.ToRawInfo() - } - // {Name:pathParameterSubSchema Type:PathParameterSubSchema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v3 := m.GetPathParameterSubSchema() - if v3 != nil { - return v3.ToRawInfo() - } - return compiler.NewNullNode() -} - -// ToRawInfo returns a description of Oauth2AccessCodeSecurity suitable for JSON or YAML export. -func (m *Oauth2AccessCodeSecurity) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("type")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type)) - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("flow")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Flow)) - if m.Scopes != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("scopes")) - info.Content = append(info.Content, m.Scopes.ToRawInfo()) - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("authorizationUrl")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.AuthorizationUrl)) - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("tokenUrl")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.TokenUrl)) - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.VendorExtension != nil { - for _, item := range m.VendorExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Oauth2ApplicationSecurity suitable for JSON or YAML export. -func (m *Oauth2ApplicationSecurity) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("type")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type)) - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("flow")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Flow)) - if m.Scopes != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("scopes")) - info.Content = append(info.Content, m.Scopes.ToRawInfo()) - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("tokenUrl")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.TokenUrl)) - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.VendorExtension != nil { - for _, item := range m.VendorExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Oauth2ImplicitSecurity suitable for JSON or YAML export. -func (m *Oauth2ImplicitSecurity) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("type")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type)) - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("flow")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Flow)) - if m.Scopes != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("scopes")) - info.Content = append(info.Content, m.Scopes.ToRawInfo()) - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("authorizationUrl")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.AuthorizationUrl)) - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.VendorExtension != nil { - for _, item := range m.VendorExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Oauth2PasswordSecurity suitable for JSON or YAML export. -func (m *Oauth2PasswordSecurity) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("type")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type)) - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("flow")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Flow)) - if m.Scopes != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("scopes")) - info.Content = append(info.Content, m.Scopes.ToRawInfo()) - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("tokenUrl")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.TokenUrl)) - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.VendorExtension != nil { - for _, item := range m.VendorExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Oauth2Scopes suitable for JSON or YAML export. -func (m *Oauth2Scopes) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - // &{Name:additionalProperties Type:NamedString StringEnumValues:[] MapType:string Repeated:true Pattern: Implicit:true Description:} - return info -} - -// ToRawInfo returns a description of Operation suitable for JSON or YAML export. -func (m *Operation) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if len(m.Tags) != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("tags")) - info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Tags)) - } - if m.Summary != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("summary")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Summary)) - } - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.ExternalDocs != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("externalDocs")) - info.Content = append(info.Content, m.ExternalDocs.ToRawInfo()) - } - if m.OperationId != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("operationId")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.OperationId)) - } - if len(m.Produces) != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("produces")) - info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Produces)) - } - if len(m.Consumes) != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("consumes")) - info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Consumes)) - } - if len(m.Parameters) != 0 { - items := compiler.NewSequenceNode() - for _, item := range m.Parameters { - items.Content = append(items.Content, item.ToRawInfo()) - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("parameters")) - info.Content = append(info.Content, items) - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("responses")) - info.Content = append(info.Content, m.Responses.ToRawInfo()) - if len(m.Schemes) != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("schemes")) - info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Schemes)) - } - if m.Deprecated != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("deprecated")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Deprecated)) - } - if len(m.Security) != 0 { - items := compiler.NewSequenceNode() - for _, item := range m.Security { - items.Content = append(items.Content, item.ToRawInfo()) - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("security")) - info.Content = append(info.Content, items) - } - if m.VendorExtension != nil { - for _, item := range m.VendorExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Parameter suitable for JSON or YAML export. -func (m *Parameter) ToRawInfo() *yaml.Node { - // ONE OF WRAPPER - // Parameter - // {Name:bodyParameter Type:BodyParameter StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v0 := m.GetBodyParameter() - if v0 != nil { - return v0.ToRawInfo() - } - // {Name:nonBodyParameter Type:NonBodyParameter StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v1 := m.GetNonBodyParameter() - if v1 != nil { - return v1.ToRawInfo() - } - return compiler.NewNullNode() -} - -// ToRawInfo returns a description of ParameterDefinitions suitable for JSON or YAML export. -func (m *ParameterDefinitions) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.AdditionalProperties != nil { - for _, item := range m.AdditionalProperties { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of ParametersItem suitable for JSON or YAML export. -func (m *ParametersItem) ToRawInfo() *yaml.Node { - // ONE OF WRAPPER - // ParametersItem - // {Name:parameter Type:Parameter StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v0 := m.GetParameter() - if v0 != nil { - return v0.ToRawInfo() - } - // {Name:jsonReference Type:JsonReference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v1 := m.GetJsonReference() - if v1 != nil { - return v1.ToRawInfo() - } - return compiler.NewNullNode() -} - -// ToRawInfo returns a description of PathItem suitable for JSON or YAML export. -func (m *PathItem) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.XRef != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("$ref")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.XRef)) - } - if m.Get != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("get")) - info.Content = append(info.Content, m.Get.ToRawInfo()) - } - if m.Put != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("put")) - info.Content = append(info.Content, m.Put.ToRawInfo()) - } - if m.Post != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("post")) - info.Content = append(info.Content, m.Post.ToRawInfo()) - } - if m.Delete != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("delete")) - info.Content = append(info.Content, m.Delete.ToRawInfo()) - } - if m.Options != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("options")) - info.Content = append(info.Content, m.Options.ToRawInfo()) - } - if m.Head != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("head")) - info.Content = append(info.Content, m.Head.ToRawInfo()) - } - if m.Patch != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("patch")) - info.Content = append(info.Content, m.Patch.ToRawInfo()) - } - if len(m.Parameters) != 0 { - items := compiler.NewSequenceNode() - for _, item := range m.Parameters { - items.Content = append(items.Content, item.ToRawInfo()) - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("parameters")) - info.Content = append(info.Content, items) - } - if m.VendorExtension != nil { - for _, item := range m.VendorExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of PathParameterSubSchema suitable for JSON or YAML export. -func (m *PathParameterSubSchema) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("required")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Required)) - if m.In != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("in")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.In)) - } - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - if m.Type != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("type")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type)) - } - if m.Format != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("format")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Format)) - } - if m.Items != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("items")) - info.Content = append(info.Content, m.Items.ToRawInfo()) - } - if m.CollectionFormat != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("collectionFormat")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.CollectionFormat)) - } - if m.Default != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("default")) - info.Content = append(info.Content, m.Default.ToRawInfo()) - } - if m.Maximum != 0.0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("maximum")) - info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Maximum)) - } - if m.ExclusiveMaximum != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMaximum")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMaximum)) - } - if m.Minimum != 0.0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("minimum")) - info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Minimum)) - } - if m.ExclusiveMinimum != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMinimum")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMinimum)) - } - if m.MaxLength != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("maxLength")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxLength)) - } - if m.MinLength != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("minLength")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinLength)) - } - if m.Pattern != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("pattern")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Pattern)) - } - if m.MaxItems != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("maxItems")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxItems)) - } - if m.MinItems != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("minItems")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinItems)) - } - if m.UniqueItems != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("uniqueItems")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.UniqueItems)) - } - if len(m.Enum) != 0 { - items := compiler.NewSequenceNode() - for _, item := range m.Enum { - items.Content = append(items.Content, item.ToRawInfo()) - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("enum")) - info.Content = append(info.Content, items) - } - if m.MultipleOf != 0.0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("multipleOf")) - info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.MultipleOf)) - } - if m.VendorExtension != nil { - for _, item := range m.VendorExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Paths suitable for JSON or YAML export. -func (m *Paths) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.VendorExtension != nil { - for _, item := range m.VendorExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - if m.Path != nil { - for _, item := range m.Path { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of PrimitivesItems suitable for JSON or YAML export. -func (m *PrimitivesItems) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Type != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("type")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type)) - } - if m.Format != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("format")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Format)) - } - if m.Items != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("items")) - info.Content = append(info.Content, m.Items.ToRawInfo()) - } - if m.CollectionFormat != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("collectionFormat")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.CollectionFormat)) - } - if m.Default != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("default")) - info.Content = append(info.Content, m.Default.ToRawInfo()) - } - if m.Maximum != 0.0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("maximum")) - info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Maximum)) - } - if m.ExclusiveMaximum != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMaximum")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMaximum)) - } - if m.Minimum != 0.0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("minimum")) - info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Minimum)) - } - if m.ExclusiveMinimum != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMinimum")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMinimum)) - } - if m.MaxLength != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("maxLength")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxLength)) - } - if m.MinLength != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("minLength")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinLength)) - } - if m.Pattern != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("pattern")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Pattern)) - } - if m.MaxItems != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("maxItems")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxItems)) - } - if m.MinItems != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("minItems")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinItems)) - } - if m.UniqueItems != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("uniqueItems")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.UniqueItems)) - } - if len(m.Enum) != 0 { - items := compiler.NewSequenceNode() - for _, item := range m.Enum { - items.Content = append(items.Content, item.ToRawInfo()) - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("enum")) - info.Content = append(info.Content, items) - } - if m.MultipleOf != 0.0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("multipleOf")) - info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.MultipleOf)) - } - if m.VendorExtension != nil { - for _, item := range m.VendorExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Properties suitable for JSON or YAML export. -func (m *Properties) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.AdditionalProperties != nil { - for _, item := range m.AdditionalProperties { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of QueryParameterSubSchema suitable for JSON or YAML export. -func (m *QueryParameterSubSchema) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Required != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("required")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Required)) - } - if m.In != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("in")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.In)) - } - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - if m.AllowEmptyValue != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("allowEmptyValue")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.AllowEmptyValue)) - } - if m.Type != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("type")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type)) - } - if m.Format != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("format")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Format)) - } - if m.Items != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("items")) - info.Content = append(info.Content, m.Items.ToRawInfo()) - } - if m.CollectionFormat != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("collectionFormat")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.CollectionFormat)) - } - if m.Default != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("default")) - info.Content = append(info.Content, m.Default.ToRawInfo()) - } - if m.Maximum != 0.0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("maximum")) - info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Maximum)) - } - if m.ExclusiveMaximum != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMaximum")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMaximum)) - } - if m.Minimum != 0.0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("minimum")) - info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Minimum)) - } - if m.ExclusiveMinimum != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMinimum")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMinimum)) - } - if m.MaxLength != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("maxLength")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxLength)) - } - if m.MinLength != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("minLength")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinLength)) - } - if m.Pattern != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("pattern")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Pattern)) - } - if m.MaxItems != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("maxItems")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxItems)) - } - if m.MinItems != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("minItems")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinItems)) - } - if m.UniqueItems != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("uniqueItems")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.UniqueItems)) - } - if len(m.Enum) != 0 { - items := compiler.NewSequenceNode() - for _, item := range m.Enum { - items.Content = append(items.Content, item.ToRawInfo()) - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("enum")) - info.Content = append(info.Content, items) - } - if m.MultipleOf != 0.0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("multipleOf")) - info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.MultipleOf)) - } - if m.VendorExtension != nil { - for _, item := range m.VendorExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Response suitable for JSON or YAML export. -func (m *Response) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - if m.Schema != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("schema")) - info.Content = append(info.Content, m.Schema.ToRawInfo()) - } - if m.Headers != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("headers")) - info.Content = append(info.Content, m.Headers.ToRawInfo()) - } - if m.Examples != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("examples")) - info.Content = append(info.Content, m.Examples.ToRawInfo()) - } - if m.VendorExtension != nil { - for _, item := range m.VendorExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of ResponseDefinitions suitable for JSON or YAML export. -func (m *ResponseDefinitions) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.AdditionalProperties != nil { - for _, item := range m.AdditionalProperties { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of ResponseValue suitable for JSON or YAML export. -func (m *ResponseValue) ToRawInfo() *yaml.Node { - // ONE OF WRAPPER - // ResponseValue - // {Name:response Type:Response StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v0 := m.GetResponse() - if v0 != nil { - return v0.ToRawInfo() - } - // {Name:jsonReference Type:JsonReference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v1 := m.GetJsonReference() - if v1 != nil { - return v1.ToRawInfo() - } - return compiler.NewNullNode() -} - -// ToRawInfo returns a description of Responses suitable for JSON or YAML export. -func (m *Responses) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.ResponseCode != nil { - for _, item := range m.ResponseCode { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - if m.VendorExtension != nil { - for _, item := range m.VendorExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Schema suitable for JSON or YAML export. -func (m *Schema) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.XRef != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("$ref")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.XRef)) - } - if m.Format != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("format")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Format)) - } - if m.Title != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("title")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Title)) - } - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.Default != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("default")) - info.Content = append(info.Content, m.Default.ToRawInfo()) - } - if m.MultipleOf != 0.0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("multipleOf")) - info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.MultipleOf)) - } - if m.Maximum != 0.0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("maximum")) - info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Maximum)) - } - if m.ExclusiveMaximum != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMaximum")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMaximum)) - } - if m.Minimum != 0.0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("minimum")) - info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Minimum)) - } - if m.ExclusiveMinimum != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMinimum")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMinimum)) - } - if m.MaxLength != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("maxLength")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxLength)) - } - if m.MinLength != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("minLength")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinLength)) - } - if m.Pattern != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("pattern")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Pattern)) - } - if m.MaxItems != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("maxItems")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxItems)) - } - if m.MinItems != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("minItems")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinItems)) - } - if m.UniqueItems != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("uniqueItems")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.UniqueItems)) - } - if m.MaxProperties != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("maxProperties")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxProperties)) - } - if m.MinProperties != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("minProperties")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinProperties)) - } - if len(m.Required) != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("required")) - info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Required)) - } - if len(m.Enum) != 0 { - items := compiler.NewSequenceNode() - for _, item := range m.Enum { - items.Content = append(items.Content, item.ToRawInfo()) - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("enum")) - info.Content = append(info.Content, items) - } - if m.AdditionalProperties != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("additionalProperties")) - info.Content = append(info.Content, m.AdditionalProperties.ToRawInfo()) - } - if m.Type != nil { - if len(m.Type.Value) == 1 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("type")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type.Value[0])) - } else { - info.Content = append(info.Content, compiler.NewScalarNodeForString("type")) - info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Type.Value)) - } - } - if m.Items != nil { - items := compiler.NewSequenceNode() - for _, item := range m.Items.Schema { - items.Content = append(items.Content, item.ToRawInfo()) - } - if len(items.Content) == 1 { - items = items.Content[0] - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("items")) - info.Content = append(info.Content, items) - } - if len(m.AllOf) != 0 { - items := compiler.NewSequenceNode() - for _, item := range m.AllOf { - items.Content = append(items.Content, item.ToRawInfo()) - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("allOf")) - info.Content = append(info.Content, items) - } - if m.Properties != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("properties")) - info.Content = append(info.Content, m.Properties.ToRawInfo()) - } - if m.Discriminator != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("discriminator")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Discriminator)) - } - if m.ReadOnly != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("readOnly")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ReadOnly)) - } - if m.Xml != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("xml")) - info.Content = append(info.Content, m.Xml.ToRawInfo()) - } - if m.ExternalDocs != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("externalDocs")) - info.Content = append(info.Content, m.ExternalDocs.ToRawInfo()) - } - if m.Example != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("example")) - info.Content = append(info.Content, m.Example.ToRawInfo()) - } - if m.VendorExtension != nil { - for _, item := range m.VendorExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of SchemaItem suitable for JSON or YAML export. -func (m *SchemaItem) ToRawInfo() *yaml.Node { - // ONE OF WRAPPER - // SchemaItem - // {Name:schema Type:Schema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v0 := m.GetSchema() - if v0 != nil { - return v0.ToRawInfo() - } - // {Name:fileSchema Type:FileSchema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v1 := m.GetFileSchema() - if v1 != nil { - return v1.ToRawInfo() - } - return compiler.NewNullNode() -} - -// ToRawInfo returns a description of SecurityDefinitions suitable for JSON or YAML export. -func (m *SecurityDefinitions) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.AdditionalProperties != nil { - for _, item := range m.AdditionalProperties { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of SecurityDefinitionsItem suitable for JSON or YAML export. -func (m *SecurityDefinitionsItem) ToRawInfo() *yaml.Node { - // ONE OF WRAPPER - // SecurityDefinitionsItem - // {Name:basicAuthenticationSecurity Type:BasicAuthenticationSecurity StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v0 := m.GetBasicAuthenticationSecurity() - if v0 != nil { - return v0.ToRawInfo() - } - // {Name:apiKeySecurity Type:ApiKeySecurity StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v1 := m.GetApiKeySecurity() - if v1 != nil { - return v1.ToRawInfo() - } - // {Name:oauth2ImplicitSecurity Type:Oauth2ImplicitSecurity StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v2 := m.GetOauth2ImplicitSecurity() - if v2 != nil { - return v2.ToRawInfo() - } - // {Name:oauth2PasswordSecurity Type:Oauth2PasswordSecurity StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v3 := m.GetOauth2PasswordSecurity() - if v3 != nil { - return v3.ToRawInfo() - } - // {Name:oauth2ApplicationSecurity Type:Oauth2ApplicationSecurity StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v4 := m.GetOauth2ApplicationSecurity() - if v4 != nil { - return v4.ToRawInfo() - } - // {Name:oauth2AccessCodeSecurity Type:Oauth2AccessCodeSecurity StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v5 := m.GetOauth2AccessCodeSecurity() - if v5 != nil { - return v5.ToRawInfo() - } - return compiler.NewNullNode() -} - -// ToRawInfo returns a description of SecurityRequirement suitable for JSON or YAML export. -func (m *SecurityRequirement) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.AdditionalProperties != nil { - for _, item := range m.AdditionalProperties { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of StringArray suitable for JSON or YAML export. -func (m *StringArray) ToRawInfo() *yaml.Node { - return compiler.NewSequenceNodeForStringArray(m.Value) -} - -// ToRawInfo returns a description of Tag suitable for JSON or YAML export. -func (m *Tag) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.ExternalDocs != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("externalDocs")) - info.Content = append(info.Content, m.ExternalDocs.ToRawInfo()) - } - if m.VendorExtension != nil { - for _, item := range m.VendorExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of TypeItem suitable for JSON or YAML export. -func (m *TypeItem) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if len(m.Value) != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("value")) - info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Value)) - } - return info -} - -// ToRawInfo returns a description of VendorExtension suitable for JSON or YAML export. -func (m *VendorExtension) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.AdditionalProperties != nil { - for _, item := range m.AdditionalProperties { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Xml suitable for JSON or YAML export. -func (m *Xml) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - if m.Namespace != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("namespace")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Namespace)) - } - if m.Prefix != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("prefix")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Prefix)) - } - if m.Attribute != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("attribute")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Attribute)) - } - if m.Wrapped != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("wrapped")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Wrapped)) - } - if m.VendorExtension != nil { - for _, item := range m.VendorExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -var ( - pattern0 = regexp.MustCompile("^x-") - pattern1 = regexp.MustCompile("^/") - pattern2 = regexp.MustCompile("^([0-9]{3})$|^(default)$") -) diff --git a/vendor/github.com/google/gnostic/openapiv2/OpenAPIv2.pb.go b/vendor/github.com/google/gnostic/openapiv2/OpenAPIv2.pb.go deleted file mode 100644 index 06b60157c..000000000 --- a/vendor/github.com/google/gnostic/openapiv2/OpenAPIv2.pb.go +++ /dev/null @@ -1,7342 +0,0 @@ -// Copyright 2020 Google LLC. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// THIS FILE IS AUTOMATICALLY GENERATED. - -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.26.0 -// protoc v3.18.1 -// source: openapiv2/OpenAPIv2.proto - -package openapi_v2 - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - anypb "google.golang.org/protobuf/types/known/anypb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type AdditionalPropertiesItem struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Oneof: - // *AdditionalPropertiesItem_Schema - // *AdditionalPropertiesItem_Boolean - Oneof isAdditionalPropertiesItem_Oneof `protobuf_oneof:"oneof"` -} - -func (x *AdditionalPropertiesItem) Reset() { - *x = AdditionalPropertiesItem{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AdditionalPropertiesItem) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AdditionalPropertiesItem) ProtoMessage() {} - -func (x *AdditionalPropertiesItem) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AdditionalPropertiesItem.ProtoReflect.Descriptor instead. -func (*AdditionalPropertiesItem) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{0} -} - -func (m *AdditionalPropertiesItem) GetOneof() isAdditionalPropertiesItem_Oneof { - if m != nil { - return m.Oneof - } - return nil -} - -func (x *AdditionalPropertiesItem) GetSchema() *Schema { - if x, ok := x.GetOneof().(*AdditionalPropertiesItem_Schema); ok { - return x.Schema - } - return nil -} - -func (x *AdditionalPropertiesItem) GetBoolean() bool { - if x, ok := x.GetOneof().(*AdditionalPropertiesItem_Boolean); ok { - return x.Boolean - } - return false -} - -type isAdditionalPropertiesItem_Oneof interface { - isAdditionalPropertiesItem_Oneof() -} - -type AdditionalPropertiesItem_Schema struct { - Schema *Schema `protobuf:"bytes,1,opt,name=schema,proto3,oneof"` -} - -type AdditionalPropertiesItem_Boolean struct { - Boolean bool `protobuf:"varint,2,opt,name=boolean,proto3,oneof"` -} - -func (*AdditionalPropertiesItem_Schema) isAdditionalPropertiesItem_Oneof() {} - -func (*AdditionalPropertiesItem_Boolean) isAdditionalPropertiesItem_Oneof() {} - -type Any struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Value *anypb.Any `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` - Yaml string `protobuf:"bytes,2,opt,name=yaml,proto3" json:"yaml,omitempty"` -} - -func (x *Any) Reset() { - *x = Any{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Any) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Any) ProtoMessage() {} - -func (x *Any) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Any.ProtoReflect.Descriptor instead. -func (*Any) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{1} -} - -func (x *Any) GetValue() *anypb.Any { - if x != nil { - return x.Value - } - return nil -} - -func (x *Any) GetYaml() string { - if x != nil { - return x.Yaml - } - return "" -} - -type ApiKeySecurity struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - In string `protobuf:"bytes,3,opt,name=in,proto3" json:"in,omitempty"` - Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"` - VendorExtension []*NamedAny `protobuf:"bytes,5,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` -} - -func (x *ApiKeySecurity) Reset() { - *x = ApiKeySecurity{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ApiKeySecurity) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ApiKeySecurity) ProtoMessage() {} - -func (x *ApiKeySecurity) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ApiKeySecurity.ProtoReflect.Descriptor instead. -func (*ApiKeySecurity) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{2} -} - -func (x *ApiKeySecurity) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -func (x *ApiKeySecurity) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *ApiKeySecurity) GetIn() string { - if x != nil { - return x.In - } - return "" -} - -func (x *ApiKeySecurity) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *ApiKeySecurity) GetVendorExtension() []*NamedAny { - if x != nil { - return x.VendorExtension - } - return nil -} - -type BasicAuthenticationSecurity struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - VendorExtension []*NamedAny `protobuf:"bytes,3,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` -} - -func (x *BasicAuthenticationSecurity) Reset() { - *x = BasicAuthenticationSecurity{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BasicAuthenticationSecurity) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BasicAuthenticationSecurity) ProtoMessage() {} - -func (x *BasicAuthenticationSecurity) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BasicAuthenticationSecurity.ProtoReflect.Descriptor instead. -func (*BasicAuthenticationSecurity) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{3} -} - -func (x *BasicAuthenticationSecurity) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -func (x *BasicAuthenticationSecurity) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *BasicAuthenticationSecurity) GetVendorExtension() []*NamedAny { - if x != nil { - return x.VendorExtension - } - return nil -} - -type BodyParameter struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed. - Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"` - // The name of the parameter. - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - // Determines the location of the parameter. - In string `protobuf:"bytes,3,opt,name=in,proto3" json:"in,omitempty"` - // Determines whether or not this parameter is required or optional. - Required bool `protobuf:"varint,4,opt,name=required,proto3" json:"required,omitempty"` - Schema *Schema `protobuf:"bytes,5,opt,name=schema,proto3" json:"schema,omitempty"` - VendorExtension []*NamedAny `protobuf:"bytes,6,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` -} - -func (x *BodyParameter) Reset() { - *x = BodyParameter{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BodyParameter) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BodyParameter) ProtoMessage() {} - -func (x *BodyParameter) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BodyParameter.ProtoReflect.Descriptor instead. -func (*BodyParameter) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{4} -} - -func (x *BodyParameter) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *BodyParameter) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *BodyParameter) GetIn() string { - if x != nil { - return x.In - } - return "" -} - -func (x *BodyParameter) GetRequired() bool { - if x != nil { - return x.Required - } - return false -} - -func (x *BodyParameter) GetSchema() *Schema { - if x != nil { - return x.Schema - } - return nil -} - -func (x *BodyParameter) GetVendorExtension() []*NamedAny { - if x != nil { - return x.VendorExtension - } - return nil -} - -// Contact information for the owners of the API. -type Contact struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The identifying name of the contact person/organization. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // The URL pointing to the contact information. - Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` - // The email address of the contact person/organization. - Email string `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"` - VendorExtension []*NamedAny `protobuf:"bytes,4,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` -} - -func (x *Contact) Reset() { - *x = Contact{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Contact) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Contact) ProtoMessage() {} - -func (x *Contact) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Contact.ProtoReflect.Descriptor instead. -func (*Contact) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{5} -} - -func (x *Contact) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Contact) GetUrl() string { - if x != nil { - return x.Url - } - return "" -} - -func (x *Contact) GetEmail() string { - if x != nil { - return x.Email - } - return "" -} - -func (x *Contact) GetVendorExtension() []*NamedAny { - if x != nil { - return x.VendorExtension - } - return nil -} - -type Default struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedAny `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *Default) Reset() { - *x = Default{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Default) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Default) ProtoMessage() {} - -func (x *Default) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Default.ProtoReflect.Descriptor instead. -func (*Default) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{6} -} - -func (x *Default) GetAdditionalProperties() []*NamedAny { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -// One or more JSON objects describing the schemas being consumed and produced by the API. -type Definitions struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedSchema `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *Definitions) Reset() { - *x = Definitions{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Definitions) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Definitions) ProtoMessage() {} - -func (x *Definitions) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Definitions.ProtoReflect.Descriptor instead. -func (*Definitions) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{7} -} - -func (x *Definitions) GetAdditionalProperties() []*NamedSchema { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -type Document struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The Swagger version of this document. - Swagger string `protobuf:"bytes,1,opt,name=swagger,proto3" json:"swagger,omitempty"` - Info *Info `protobuf:"bytes,2,opt,name=info,proto3" json:"info,omitempty"` - // The host (name or ip) of the API. Example: 'swagger.io' - Host string `protobuf:"bytes,3,opt,name=host,proto3" json:"host,omitempty"` - // The base path to the API. Example: '/api'. - BasePath string `protobuf:"bytes,4,opt,name=base_path,json=basePath,proto3" json:"base_path,omitempty"` - // The transfer protocol of the API. - Schemes []string `protobuf:"bytes,5,rep,name=schemes,proto3" json:"schemes,omitempty"` - // A list of MIME types accepted by the API. - Consumes []string `protobuf:"bytes,6,rep,name=consumes,proto3" json:"consumes,omitempty"` - // A list of MIME types the API can produce. - Produces []string `protobuf:"bytes,7,rep,name=produces,proto3" json:"produces,omitempty"` - Paths *Paths `protobuf:"bytes,8,opt,name=paths,proto3" json:"paths,omitempty"` - Definitions *Definitions `protobuf:"bytes,9,opt,name=definitions,proto3" json:"definitions,omitempty"` - Parameters *ParameterDefinitions `protobuf:"bytes,10,opt,name=parameters,proto3" json:"parameters,omitempty"` - Responses *ResponseDefinitions `protobuf:"bytes,11,opt,name=responses,proto3" json:"responses,omitempty"` - Security []*SecurityRequirement `protobuf:"bytes,12,rep,name=security,proto3" json:"security,omitempty"` - SecurityDefinitions *SecurityDefinitions `protobuf:"bytes,13,opt,name=security_definitions,json=securityDefinitions,proto3" json:"security_definitions,omitempty"` - Tags []*Tag `protobuf:"bytes,14,rep,name=tags,proto3" json:"tags,omitempty"` - ExternalDocs *ExternalDocs `protobuf:"bytes,15,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"` - VendorExtension []*NamedAny `protobuf:"bytes,16,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` -} - -func (x *Document) Reset() { - *x = Document{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Document) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Document) ProtoMessage() {} - -func (x *Document) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Document.ProtoReflect.Descriptor instead. -func (*Document) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{8} -} - -func (x *Document) GetSwagger() string { - if x != nil { - return x.Swagger - } - return "" -} - -func (x *Document) GetInfo() *Info { - if x != nil { - return x.Info - } - return nil -} - -func (x *Document) GetHost() string { - if x != nil { - return x.Host - } - return "" -} - -func (x *Document) GetBasePath() string { - if x != nil { - return x.BasePath - } - return "" -} - -func (x *Document) GetSchemes() []string { - if x != nil { - return x.Schemes - } - return nil -} - -func (x *Document) GetConsumes() []string { - if x != nil { - return x.Consumes - } - return nil -} - -func (x *Document) GetProduces() []string { - if x != nil { - return x.Produces - } - return nil -} - -func (x *Document) GetPaths() *Paths { - if x != nil { - return x.Paths - } - return nil -} - -func (x *Document) GetDefinitions() *Definitions { - if x != nil { - return x.Definitions - } - return nil -} - -func (x *Document) GetParameters() *ParameterDefinitions { - if x != nil { - return x.Parameters - } - return nil -} - -func (x *Document) GetResponses() *ResponseDefinitions { - if x != nil { - return x.Responses - } - return nil -} - -func (x *Document) GetSecurity() []*SecurityRequirement { - if x != nil { - return x.Security - } - return nil -} - -func (x *Document) GetSecurityDefinitions() *SecurityDefinitions { - if x != nil { - return x.SecurityDefinitions - } - return nil -} - -func (x *Document) GetTags() []*Tag { - if x != nil { - return x.Tags - } - return nil -} - -func (x *Document) GetExternalDocs() *ExternalDocs { - if x != nil { - return x.ExternalDocs - } - return nil -} - -func (x *Document) GetVendorExtension() []*NamedAny { - if x != nil { - return x.VendorExtension - } - return nil -} - -type Examples struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedAny `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *Examples) Reset() { - *x = Examples{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Examples) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Examples) ProtoMessage() {} - -func (x *Examples) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Examples.ProtoReflect.Descriptor instead. -func (*Examples) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{9} -} - -func (x *Examples) GetAdditionalProperties() []*NamedAny { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -// information about external documentation -type ExternalDocs struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"` - Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` - VendorExtension []*NamedAny `protobuf:"bytes,3,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` -} - -func (x *ExternalDocs) Reset() { - *x = ExternalDocs{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ExternalDocs) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ExternalDocs) ProtoMessage() {} - -func (x *ExternalDocs) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ExternalDocs.ProtoReflect.Descriptor instead. -func (*ExternalDocs) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{10} -} - -func (x *ExternalDocs) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *ExternalDocs) GetUrl() string { - if x != nil { - return x.Url - } - return "" -} - -func (x *ExternalDocs) GetVendorExtension() []*NamedAny { - if x != nil { - return x.VendorExtension - } - return nil -} - -// A deterministic version of a JSON Schema object. -type FileSchema struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Format string `protobuf:"bytes,1,opt,name=format,proto3" json:"format,omitempty"` - Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"` - Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` - Default *Any `protobuf:"bytes,4,opt,name=default,proto3" json:"default,omitempty"` - Required []string `protobuf:"bytes,5,rep,name=required,proto3" json:"required,omitempty"` - Type string `protobuf:"bytes,6,opt,name=type,proto3" json:"type,omitempty"` - ReadOnly bool `protobuf:"varint,7,opt,name=read_only,json=readOnly,proto3" json:"read_only,omitempty"` - ExternalDocs *ExternalDocs `protobuf:"bytes,8,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"` - Example *Any `protobuf:"bytes,9,opt,name=example,proto3" json:"example,omitempty"` - VendorExtension []*NamedAny `protobuf:"bytes,10,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` -} - -func (x *FileSchema) Reset() { - *x = FileSchema{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *FileSchema) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*FileSchema) ProtoMessage() {} - -func (x *FileSchema) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use FileSchema.ProtoReflect.Descriptor instead. -func (*FileSchema) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{11} -} - -func (x *FileSchema) GetFormat() string { - if x != nil { - return x.Format - } - return "" -} - -func (x *FileSchema) GetTitle() string { - if x != nil { - return x.Title - } - return "" -} - -func (x *FileSchema) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *FileSchema) GetDefault() *Any { - if x != nil { - return x.Default - } - return nil -} - -func (x *FileSchema) GetRequired() []string { - if x != nil { - return x.Required - } - return nil -} - -func (x *FileSchema) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -func (x *FileSchema) GetReadOnly() bool { - if x != nil { - return x.ReadOnly - } - return false -} - -func (x *FileSchema) GetExternalDocs() *ExternalDocs { - if x != nil { - return x.ExternalDocs - } - return nil -} - -func (x *FileSchema) GetExample() *Any { - if x != nil { - return x.Example - } - return nil -} - -func (x *FileSchema) GetVendorExtension() []*NamedAny { - if x != nil { - return x.VendorExtension - } - return nil -} - -type FormDataParameterSubSchema struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Determines whether or not this parameter is required or optional. - Required bool `protobuf:"varint,1,opt,name=required,proto3" json:"required,omitempty"` - // Determines the location of the parameter. - In string `protobuf:"bytes,2,opt,name=in,proto3" json:"in,omitempty"` - // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed. - Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` - // The name of the parameter. - Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` - // allows sending a parameter by name only or with an empty value. - AllowEmptyValue bool `protobuf:"varint,5,opt,name=allow_empty_value,json=allowEmptyValue,proto3" json:"allow_empty_value,omitempty"` - Type string `protobuf:"bytes,6,opt,name=type,proto3" json:"type,omitempty"` - Format string `protobuf:"bytes,7,opt,name=format,proto3" json:"format,omitempty"` - Items *PrimitivesItems `protobuf:"bytes,8,opt,name=items,proto3" json:"items,omitempty"` - CollectionFormat string `protobuf:"bytes,9,opt,name=collection_format,json=collectionFormat,proto3" json:"collection_format,omitempty"` - Default *Any `protobuf:"bytes,10,opt,name=default,proto3" json:"default,omitempty"` - Maximum float64 `protobuf:"fixed64,11,opt,name=maximum,proto3" json:"maximum,omitempty"` - ExclusiveMaximum bool `protobuf:"varint,12,opt,name=exclusive_maximum,json=exclusiveMaximum,proto3" json:"exclusive_maximum,omitempty"` - Minimum float64 `protobuf:"fixed64,13,opt,name=minimum,proto3" json:"minimum,omitempty"` - ExclusiveMinimum bool `protobuf:"varint,14,opt,name=exclusive_minimum,json=exclusiveMinimum,proto3" json:"exclusive_minimum,omitempty"` - MaxLength int64 `protobuf:"varint,15,opt,name=max_length,json=maxLength,proto3" json:"max_length,omitempty"` - MinLength int64 `protobuf:"varint,16,opt,name=min_length,json=minLength,proto3" json:"min_length,omitempty"` - Pattern string `protobuf:"bytes,17,opt,name=pattern,proto3" json:"pattern,omitempty"` - MaxItems int64 `protobuf:"varint,18,opt,name=max_items,json=maxItems,proto3" json:"max_items,omitempty"` - MinItems int64 `protobuf:"varint,19,opt,name=min_items,json=minItems,proto3" json:"min_items,omitempty"` - UniqueItems bool `protobuf:"varint,20,opt,name=unique_items,json=uniqueItems,proto3" json:"unique_items,omitempty"` - Enum []*Any `protobuf:"bytes,21,rep,name=enum,proto3" json:"enum,omitempty"` - MultipleOf float64 `protobuf:"fixed64,22,opt,name=multiple_of,json=multipleOf,proto3" json:"multiple_of,omitempty"` - VendorExtension []*NamedAny `protobuf:"bytes,23,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` -} - -func (x *FormDataParameterSubSchema) Reset() { - *x = FormDataParameterSubSchema{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *FormDataParameterSubSchema) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*FormDataParameterSubSchema) ProtoMessage() {} - -func (x *FormDataParameterSubSchema) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use FormDataParameterSubSchema.ProtoReflect.Descriptor instead. -func (*FormDataParameterSubSchema) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{12} -} - -func (x *FormDataParameterSubSchema) GetRequired() bool { - if x != nil { - return x.Required - } - return false -} - -func (x *FormDataParameterSubSchema) GetIn() string { - if x != nil { - return x.In - } - return "" -} - -func (x *FormDataParameterSubSchema) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *FormDataParameterSubSchema) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *FormDataParameterSubSchema) GetAllowEmptyValue() bool { - if x != nil { - return x.AllowEmptyValue - } - return false -} - -func (x *FormDataParameterSubSchema) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -func (x *FormDataParameterSubSchema) GetFormat() string { - if x != nil { - return x.Format - } - return "" -} - -func (x *FormDataParameterSubSchema) GetItems() *PrimitivesItems { - if x != nil { - return x.Items - } - return nil -} - -func (x *FormDataParameterSubSchema) GetCollectionFormat() string { - if x != nil { - return x.CollectionFormat - } - return "" -} - -func (x *FormDataParameterSubSchema) GetDefault() *Any { - if x != nil { - return x.Default - } - return nil -} - -func (x *FormDataParameterSubSchema) GetMaximum() float64 { - if x != nil { - return x.Maximum - } - return 0 -} - -func (x *FormDataParameterSubSchema) GetExclusiveMaximum() bool { - if x != nil { - return x.ExclusiveMaximum - } - return false -} - -func (x *FormDataParameterSubSchema) GetMinimum() float64 { - if x != nil { - return x.Minimum - } - return 0 -} - -func (x *FormDataParameterSubSchema) GetExclusiveMinimum() bool { - if x != nil { - return x.ExclusiveMinimum - } - return false -} - -func (x *FormDataParameterSubSchema) GetMaxLength() int64 { - if x != nil { - return x.MaxLength - } - return 0 -} - -func (x *FormDataParameterSubSchema) GetMinLength() int64 { - if x != nil { - return x.MinLength - } - return 0 -} - -func (x *FormDataParameterSubSchema) GetPattern() string { - if x != nil { - return x.Pattern - } - return "" -} - -func (x *FormDataParameterSubSchema) GetMaxItems() int64 { - if x != nil { - return x.MaxItems - } - return 0 -} - -func (x *FormDataParameterSubSchema) GetMinItems() int64 { - if x != nil { - return x.MinItems - } - return 0 -} - -func (x *FormDataParameterSubSchema) GetUniqueItems() bool { - if x != nil { - return x.UniqueItems - } - return false -} - -func (x *FormDataParameterSubSchema) GetEnum() []*Any { - if x != nil { - return x.Enum - } - return nil -} - -func (x *FormDataParameterSubSchema) GetMultipleOf() float64 { - if x != nil { - return x.MultipleOf - } - return 0 -} - -func (x *FormDataParameterSubSchema) GetVendorExtension() []*NamedAny { - if x != nil { - return x.VendorExtension - } - return nil -} - -type Header struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` - Format string `protobuf:"bytes,2,opt,name=format,proto3" json:"format,omitempty"` - Items *PrimitivesItems `protobuf:"bytes,3,opt,name=items,proto3" json:"items,omitempty"` - CollectionFormat string `protobuf:"bytes,4,opt,name=collection_format,json=collectionFormat,proto3" json:"collection_format,omitempty"` - Default *Any `protobuf:"bytes,5,opt,name=default,proto3" json:"default,omitempty"` - Maximum float64 `protobuf:"fixed64,6,opt,name=maximum,proto3" json:"maximum,omitempty"` - ExclusiveMaximum bool `protobuf:"varint,7,opt,name=exclusive_maximum,json=exclusiveMaximum,proto3" json:"exclusive_maximum,omitempty"` - Minimum float64 `protobuf:"fixed64,8,opt,name=minimum,proto3" json:"minimum,omitempty"` - ExclusiveMinimum bool `protobuf:"varint,9,opt,name=exclusive_minimum,json=exclusiveMinimum,proto3" json:"exclusive_minimum,omitempty"` - MaxLength int64 `protobuf:"varint,10,opt,name=max_length,json=maxLength,proto3" json:"max_length,omitempty"` - MinLength int64 `protobuf:"varint,11,opt,name=min_length,json=minLength,proto3" json:"min_length,omitempty"` - Pattern string `protobuf:"bytes,12,opt,name=pattern,proto3" json:"pattern,omitempty"` - MaxItems int64 `protobuf:"varint,13,opt,name=max_items,json=maxItems,proto3" json:"max_items,omitempty"` - MinItems int64 `protobuf:"varint,14,opt,name=min_items,json=minItems,proto3" json:"min_items,omitempty"` - UniqueItems bool `protobuf:"varint,15,opt,name=unique_items,json=uniqueItems,proto3" json:"unique_items,omitempty"` - Enum []*Any `protobuf:"bytes,16,rep,name=enum,proto3" json:"enum,omitempty"` - MultipleOf float64 `protobuf:"fixed64,17,opt,name=multiple_of,json=multipleOf,proto3" json:"multiple_of,omitempty"` - Description string `protobuf:"bytes,18,opt,name=description,proto3" json:"description,omitempty"` - VendorExtension []*NamedAny `protobuf:"bytes,19,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` -} - -func (x *Header) Reset() { - *x = Header{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Header) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Header) ProtoMessage() {} - -func (x *Header) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Header.ProtoReflect.Descriptor instead. -func (*Header) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{13} -} - -func (x *Header) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -func (x *Header) GetFormat() string { - if x != nil { - return x.Format - } - return "" -} - -func (x *Header) GetItems() *PrimitivesItems { - if x != nil { - return x.Items - } - return nil -} - -func (x *Header) GetCollectionFormat() string { - if x != nil { - return x.CollectionFormat - } - return "" -} - -func (x *Header) GetDefault() *Any { - if x != nil { - return x.Default - } - return nil -} - -func (x *Header) GetMaximum() float64 { - if x != nil { - return x.Maximum - } - return 0 -} - -func (x *Header) GetExclusiveMaximum() bool { - if x != nil { - return x.ExclusiveMaximum - } - return false -} - -func (x *Header) GetMinimum() float64 { - if x != nil { - return x.Minimum - } - return 0 -} - -func (x *Header) GetExclusiveMinimum() bool { - if x != nil { - return x.ExclusiveMinimum - } - return false -} - -func (x *Header) GetMaxLength() int64 { - if x != nil { - return x.MaxLength - } - return 0 -} - -func (x *Header) GetMinLength() int64 { - if x != nil { - return x.MinLength - } - return 0 -} - -func (x *Header) GetPattern() string { - if x != nil { - return x.Pattern - } - return "" -} - -func (x *Header) GetMaxItems() int64 { - if x != nil { - return x.MaxItems - } - return 0 -} - -func (x *Header) GetMinItems() int64 { - if x != nil { - return x.MinItems - } - return 0 -} - -func (x *Header) GetUniqueItems() bool { - if x != nil { - return x.UniqueItems - } - return false -} - -func (x *Header) GetEnum() []*Any { - if x != nil { - return x.Enum - } - return nil -} - -func (x *Header) GetMultipleOf() float64 { - if x != nil { - return x.MultipleOf - } - return 0 -} - -func (x *Header) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *Header) GetVendorExtension() []*NamedAny { - if x != nil { - return x.VendorExtension - } - return nil -} - -type HeaderParameterSubSchema struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Determines whether or not this parameter is required or optional. - Required bool `protobuf:"varint,1,opt,name=required,proto3" json:"required,omitempty"` - // Determines the location of the parameter. - In string `protobuf:"bytes,2,opt,name=in,proto3" json:"in,omitempty"` - // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed. - Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` - // The name of the parameter. - Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` - Type string `protobuf:"bytes,5,opt,name=type,proto3" json:"type,omitempty"` - Format string `protobuf:"bytes,6,opt,name=format,proto3" json:"format,omitempty"` - Items *PrimitivesItems `protobuf:"bytes,7,opt,name=items,proto3" json:"items,omitempty"` - CollectionFormat string `protobuf:"bytes,8,opt,name=collection_format,json=collectionFormat,proto3" json:"collection_format,omitempty"` - Default *Any `protobuf:"bytes,9,opt,name=default,proto3" json:"default,omitempty"` - Maximum float64 `protobuf:"fixed64,10,opt,name=maximum,proto3" json:"maximum,omitempty"` - ExclusiveMaximum bool `protobuf:"varint,11,opt,name=exclusive_maximum,json=exclusiveMaximum,proto3" json:"exclusive_maximum,omitempty"` - Minimum float64 `protobuf:"fixed64,12,opt,name=minimum,proto3" json:"minimum,omitempty"` - ExclusiveMinimum bool `protobuf:"varint,13,opt,name=exclusive_minimum,json=exclusiveMinimum,proto3" json:"exclusive_minimum,omitempty"` - MaxLength int64 `protobuf:"varint,14,opt,name=max_length,json=maxLength,proto3" json:"max_length,omitempty"` - MinLength int64 `protobuf:"varint,15,opt,name=min_length,json=minLength,proto3" json:"min_length,omitempty"` - Pattern string `protobuf:"bytes,16,opt,name=pattern,proto3" json:"pattern,omitempty"` - MaxItems int64 `protobuf:"varint,17,opt,name=max_items,json=maxItems,proto3" json:"max_items,omitempty"` - MinItems int64 `protobuf:"varint,18,opt,name=min_items,json=minItems,proto3" json:"min_items,omitempty"` - UniqueItems bool `protobuf:"varint,19,opt,name=unique_items,json=uniqueItems,proto3" json:"unique_items,omitempty"` - Enum []*Any `protobuf:"bytes,20,rep,name=enum,proto3" json:"enum,omitempty"` - MultipleOf float64 `protobuf:"fixed64,21,opt,name=multiple_of,json=multipleOf,proto3" json:"multiple_of,omitempty"` - VendorExtension []*NamedAny `protobuf:"bytes,22,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` -} - -func (x *HeaderParameterSubSchema) Reset() { - *x = HeaderParameterSubSchema{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HeaderParameterSubSchema) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HeaderParameterSubSchema) ProtoMessage() {} - -func (x *HeaderParameterSubSchema) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[14] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HeaderParameterSubSchema.ProtoReflect.Descriptor instead. -func (*HeaderParameterSubSchema) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{14} -} - -func (x *HeaderParameterSubSchema) GetRequired() bool { - if x != nil { - return x.Required - } - return false -} - -func (x *HeaderParameterSubSchema) GetIn() string { - if x != nil { - return x.In - } - return "" -} - -func (x *HeaderParameterSubSchema) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *HeaderParameterSubSchema) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *HeaderParameterSubSchema) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -func (x *HeaderParameterSubSchema) GetFormat() string { - if x != nil { - return x.Format - } - return "" -} - -func (x *HeaderParameterSubSchema) GetItems() *PrimitivesItems { - if x != nil { - return x.Items - } - return nil -} - -func (x *HeaderParameterSubSchema) GetCollectionFormat() string { - if x != nil { - return x.CollectionFormat - } - return "" -} - -func (x *HeaderParameterSubSchema) GetDefault() *Any { - if x != nil { - return x.Default - } - return nil -} - -func (x *HeaderParameterSubSchema) GetMaximum() float64 { - if x != nil { - return x.Maximum - } - return 0 -} - -func (x *HeaderParameterSubSchema) GetExclusiveMaximum() bool { - if x != nil { - return x.ExclusiveMaximum - } - return false -} - -func (x *HeaderParameterSubSchema) GetMinimum() float64 { - if x != nil { - return x.Minimum - } - return 0 -} - -func (x *HeaderParameterSubSchema) GetExclusiveMinimum() bool { - if x != nil { - return x.ExclusiveMinimum - } - return false -} - -func (x *HeaderParameterSubSchema) GetMaxLength() int64 { - if x != nil { - return x.MaxLength - } - return 0 -} - -func (x *HeaderParameterSubSchema) GetMinLength() int64 { - if x != nil { - return x.MinLength - } - return 0 -} - -func (x *HeaderParameterSubSchema) GetPattern() string { - if x != nil { - return x.Pattern - } - return "" -} - -func (x *HeaderParameterSubSchema) GetMaxItems() int64 { - if x != nil { - return x.MaxItems - } - return 0 -} - -func (x *HeaderParameterSubSchema) GetMinItems() int64 { - if x != nil { - return x.MinItems - } - return 0 -} - -func (x *HeaderParameterSubSchema) GetUniqueItems() bool { - if x != nil { - return x.UniqueItems - } - return false -} - -func (x *HeaderParameterSubSchema) GetEnum() []*Any { - if x != nil { - return x.Enum - } - return nil -} - -func (x *HeaderParameterSubSchema) GetMultipleOf() float64 { - if x != nil { - return x.MultipleOf - } - return 0 -} - -func (x *HeaderParameterSubSchema) GetVendorExtension() []*NamedAny { - if x != nil { - return x.VendorExtension - } - return nil -} - -type Headers struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedHeader `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *Headers) Reset() { - *x = Headers{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Headers) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Headers) ProtoMessage() {} - -func (x *Headers) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[15] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Headers.ProtoReflect.Descriptor instead. -func (*Headers) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{15} -} - -func (x *Headers) GetAdditionalProperties() []*NamedHeader { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -// General information about the API. -type Info struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // A unique and precise title of the API. - Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` - // A semantic version number of the API. - Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` - // A longer description of the API. Should be different from the title. GitHub Flavored Markdown is allowed. - Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` - // The terms of service for the API. - TermsOfService string `protobuf:"bytes,4,opt,name=terms_of_service,json=termsOfService,proto3" json:"terms_of_service,omitempty"` - Contact *Contact `protobuf:"bytes,5,opt,name=contact,proto3" json:"contact,omitempty"` - License *License `protobuf:"bytes,6,opt,name=license,proto3" json:"license,omitempty"` - VendorExtension []*NamedAny `protobuf:"bytes,7,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` -} - -func (x *Info) Reset() { - *x = Info{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[16] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Info) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Info) ProtoMessage() {} - -func (x *Info) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[16] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Info.ProtoReflect.Descriptor instead. -func (*Info) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{16} -} - -func (x *Info) GetTitle() string { - if x != nil { - return x.Title - } - return "" -} - -func (x *Info) GetVersion() string { - if x != nil { - return x.Version - } - return "" -} - -func (x *Info) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *Info) GetTermsOfService() string { - if x != nil { - return x.TermsOfService - } - return "" -} - -func (x *Info) GetContact() *Contact { - if x != nil { - return x.Contact - } - return nil -} - -func (x *Info) GetLicense() *License { - if x != nil { - return x.License - } - return nil -} - -func (x *Info) GetVendorExtension() []*NamedAny { - if x != nil { - return x.VendorExtension - } - return nil -} - -type ItemsItem struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Schema []*Schema `protobuf:"bytes,1,rep,name=schema,proto3" json:"schema,omitempty"` -} - -func (x *ItemsItem) Reset() { - *x = ItemsItem{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[17] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ItemsItem) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ItemsItem) ProtoMessage() {} - -func (x *ItemsItem) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[17] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ItemsItem.ProtoReflect.Descriptor instead. -func (*ItemsItem) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{17} -} - -func (x *ItemsItem) GetSchema() []*Schema { - if x != nil { - return x.Schema - } - return nil -} - -type JsonReference struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - XRef string `protobuf:"bytes,1,opt,name=_ref,json=Ref,proto3" json:"_ref,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` -} - -func (x *JsonReference) Reset() { - *x = JsonReference{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[18] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *JsonReference) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*JsonReference) ProtoMessage() {} - -func (x *JsonReference) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[18] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use JsonReference.ProtoReflect.Descriptor instead. -func (*JsonReference) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{18} -} - -func (x *JsonReference) GetXRef() string { - if x != nil { - return x.XRef - } - return "" -} - -func (x *JsonReference) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -type License struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The name of the license type. It's encouraged to use an OSI compatible license. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // The URL pointing to the license. - Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` - VendorExtension []*NamedAny `protobuf:"bytes,3,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` -} - -func (x *License) Reset() { - *x = License{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[19] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *License) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*License) ProtoMessage() {} - -func (x *License) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[19] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use License.ProtoReflect.Descriptor instead. -func (*License) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{19} -} - -func (x *License) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *License) GetUrl() string { - if x != nil { - return x.Url - } - return "" -} - -func (x *License) GetVendorExtension() []*NamedAny { - if x != nil { - return x.VendorExtension - } - return nil -} - -// Automatically-generated message used to represent maps of Any as ordered (name,value) pairs. -type NamedAny struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Map key - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Mapped value - Value *Any `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *NamedAny) Reset() { - *x = NamedAny{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[20] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamedAny) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamedAny) ProtoMessage() {} - -func (x *NamedAny) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[20] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NamedAny.ProtoReflect.Descriptor instead. -func (*NamedAny) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{20} -} - -func (x *NamedAny) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *NamedAny) GetValue() *Any { - if x != nil { - return x.Value - } - return nil -} - -// Automatically-generated message used to represent maps of Header as ordered (name,value) pairs. -type NamedHeader struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Map key - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Mapped value - Value *Header `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *NamedHeader) Reset() { - *x = NamedHeader{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[21] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamedHeader) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamedHeader) ProtoMessage() {} - -func (x *NamedHeader) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[21] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NamedHeader.ProtoReflect.Descriptor instead. -func (*NamedHeader) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{21} -} - -func (x *NamedHeader) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *NamedHeader) GetValue() *Header { - if x != nil { - return x.Value - } - return nil -} - -// Automatically-generated message used to represent maps of Parameter as ordered (name,value) pairs. -type NamedParameter struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Map key - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Mapped value - Value *Parameter `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *NamedParameter) Reset() { - *x = NamedParameter{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[22] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamedParameter) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamedParameter) ProtoMessage() {} - -func (x *NamedParameter) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[22] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NamedParameter.ProtoReflect.Descriptor instead. -func (*NamedParameter) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{22} -} - -func (x *NamedParameter) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *NamedParameter) GetValue() *Parameter { - if x != nil { - return x.Value - } - return nil -} - -// Automatically-generated message used to represent maps of PathItem as ordered (name,value) pairs. -type NamedPathItem struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Map key - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Mapped value - Value *PathItem `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *NamedPathItem) Reset() { - *x = NamedPathItem{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[23] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamedPathItem) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamedPathItem) ProtoMessage() {} - -func (x *NamedPathItem) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[23] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NamedPathItem.ProtoReflect.Descriptor instead. -func (*NamedPathItem) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{23} -} - -func (x *NamedPathItem) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *NamedPathItem) GetValue() *PathItem { - if x != nil { - return x.Value - } - return nil -} - -// Automatically-generated message used to represent maps of Response as ordered (name,value) pairs. -type NamedResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Map key - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Mapped value - Value *Response `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *NamedResponse) Reset() { - *x = NamedResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[24] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamedResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamedResponse) ProtoMessage() {} - -func (x *NamedResponse) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[24] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NamedResponse.ProtoReflect.Descriptor instead. -func (*NamedResponse) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{24} -} - -func (x *NamedResponse) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *NamedResponse) GetValue() *Response { - if x != nil { - return x.Value - } - return nil -} - -// Automatically-generated message used to represent maps of ResponseValue as ordered (name,value) pairs. -type NamedResponseValue struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Map key - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Mapped value - Value *ResponseValue `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *NamedResponseValue) Reset() { - *x = NamedResponseValue{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[25] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamedResponseValue) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamedResponseValue) ProtoMessage() {} - -func (x *NamedResponseValue) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[25] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NamedResponseValue.ProtoReflect.Descriptor instead. -func (*NamedResponseValue) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{25} -} - -func (x *NamedResponseValue) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *NamedResponseValue) GetValue() *ResponseValue { - if x != nil { - return x.Value - } - return nil -} - -// Automatically-generated message used to represent maps of Schema as ordered (name,value) pairs. -type NamedSchema struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Map key - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Mapped value - Value *Schema `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *NamedSchema) Reset() { - *x = NamedSchema{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[26] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamedSchema) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamedSchema) ProtoMessage() {} - -func (x *NamedSchema) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[26] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NamedSchema.ProtoReflect.Descriptor instead. -func (*NamedSchema) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{26} -} - -func (x *NamedSchema) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *NamedSchema) GetValue() *Schema { - if x != nil { - return x.Value - } - return nil -} - -// Automatically-generated message used to represent maps of SecurityDefinitionsItem as ordered (name,value) pairs. -type NamedSecurityDefinitionsItem struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Map key - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Mapped value - Value *SecurityDefinitionsItem `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *NamedSecurityDefinitionsItem) Reset() { - *x = NamedSecurityDefinitionsItem{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[27] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamedSecurityDefinitionsItem) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamedSecurityDefinitionsItem) ProtoMessage() {} - -func (x *NamedSecurityDefinitionsItem) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[27] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NamedSecurityDefinitionsItem.ProtoReflect.Descriptor instead. -func (*NamedSecurityDefinitionsItem) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{27} -} - -func (x *NamedSecurityDefinitionsItem) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *NamedSecurityDefinitionsItem) GetValue() *SecurityDefinitionsItem { - if x != nil { - return x.Value - } - return nil -} - -// Automatically-generated message used to represent maps of string as ordered (name,value) pairs. -type NamedString struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Map key - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Mapped value - Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *NamedString) Reset() { - *x = NamedString{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[28] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamedString) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamedString) ProtoMessage() {} - -func (x *NamedString) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[28] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NamedString.ProtoReflect.Descriptor instead. -func (*NamedString) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{28} -} - -func (x *NamedString) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *NamedString) GetValue() string { - if x != nil { - return x.Value - } - return "" -} - -// Automatically-generated message used to represent maps of StringArray as ordered (name,value) pairs. -type NamedStringArray struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Map key - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Mapped value - Value *StringArray `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *NamedStringArray) Reset() { - *x = NamedStringArray{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[29] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamedStringArray) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamedStringArray) ProtoMessage() {} - -func (x *NamedStringArray) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[29] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NamedStringArray.ProtoReflect.Descriptor instead. -func (*NamedStringArray) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{29} -} - -func (x *NamedStringArray) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *NamedStringArray) GetValue() *StringArray { - if x != nil { - return x.Value - } - return nil -} - -type NonBodyParameter struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Oneof: - // *NonBodyParameter_HeaderParameterSubSchema - // *NonBodyParameter_FormDataParameterSubSchema - // *NonBodyParameter_QueryParameterSubSchema - // *NonBodyParameter_PathParameterSubSchema - Oneof isNonBodyParameter_Oneof `protobuf_oneof:"oneof"` -} - -func (x *NonBodyParameter) Reset() { - *x = NonBodyParameter{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[30] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NonBodyParameter) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NonBodyParameter) ProtoMessage() {} - -func (x *NonBodyParameter) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[30] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NonBodyParameter.ProtoReflect.Descriptor instead. -func (*NonBodyParameter) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{30} -} - -func (m *NonBodyParameter) GetOneof() isNonBodyParameter_Oneof { - if m != nil { - return m.Oneof - } - return nil -} - -func (x *NonBodyParameter) GetHeaderParameterSubSchema() *HeaderParameterSubSchema { - if x, ok := x.GetOneof().(*NonBodyParameter_HeaderParameterSubSchema); ok { - return x.HeaderParameterSubSchema - } - return nil -} - -func (x *NonBodyParameter) GetFormDataParameterSubSchema() *FormDataParameterSubSchema { - if x, ok := x.GetOneof().(*NonBodyParameter_FormDataParameterSubSchema); ok { - return x.FormDataParameterSubSchema - } - return nil -} - -func (x *NonBodyParameter) GetQueryParameterSubSchema() *QueryParameterSubSchema { - if x, ok := x.GetOneof().(*NonBodyParameter_QueryParameterSubSchema); ok { - return x.QueryParameterSubSchema - } - return nil -} - -func (x *NonBodyParameter) GetPathParameterSubSchema() *PathParameterSubSchema { - if x, ok := x.GetOneof().(*NonBodyParameter_PathParameterSubSchema); ok { - return x.PathParameterSubSchema - } - return nil -} - -type isNonBodyParameter_Oneof interface { - isNonBodyParameter_Oneof() -} - -type NonBodyParameter_HeaderParameterSubSchema struct { - HeaderParameterSubSchema *HeaderParameterSubSchema `protobuf:"bytes,1,opt,name=header_parameter_sub_schema,json=headerParameterSubSchema,proto3,oneof"` -} - -type NonBodyParameter_FormDataParameterSubSchema struct { - FormDataParameterSubSchema *FormDataParameterSubSchema `protobuf:"bytes,2,opt,name=form_data_parameter_sub_schema,json=formDataParameterSubSchema,proto3,oneof"` -} - -type NonBodyParameter_QueryParameterSubSchema struct { - QueryParameterSubSchema *QueryParameterSubSchema `protobuf:"bytes,3,opt,name=query_parameter_sub_schema,json=queryParameterSubSchema,proto3,oneof"` -} - -type NonBodyParameter_PathParameterSubSchema struct { - PathParameterSubSchema *PathParameterSubSchema `protobuf:"bytes,4,opt,name=path_parameter_sub_schema,json=pathParameterSubSchema,proto3,oneof"` -} - -func (*NonBodyParameter_HeaderParameterSubSchema) isNonBodyParameter_Oneof() {} - -func (*NonBodyParameter_FormDataParameterSubSchema) isNonBodyParameter_Oneof() {} - -func (*NonBodyParameter_QueryParameterSubSchema) isNonBodyParameter_Oneof() {} - -func (*NonBodyParameter_PathParameterSubSchema) isNonBodyParameter_Oneof() {} - -type Oauth2AccessCodeSecurity struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` - Flow string `protobuf:"bytes,2,opt,name=flow,proto3" json:"flow,omitempty"` - Scopes *Oauth2Scopes `protobuf:"bytes,3,opt,name=scopes,proto3" json:"scopes,omitempty"` - AuthorizationUrl string `protobuf:"bytes,4,opt,name=authorization_url,json=authorizationUrl,proto3" json:"authorization_url,omitempty"` - TokenUrl string `protobuf:"bytes,5,opt,name=token_url,json=tokenUrl,proto3" json:"token_url,omitempty"` - Description string `protobuf:"bytes,6,opt,name=description,proto3" json:"description,omitempty"` - VendorExtension []*NamedAny `protobuf:"bytes,7,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` -} - -func (x *Oauth2AccessCodeSecurity) Reset() { - *x = Oauth2AccessCodeSecurity{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[31] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Oauth2AccessCodeSecurity) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Oauth2AccessCodeSecurity) ProtoMessage() {} - -func (x *Oauth2AccessCodeSecurity) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[31] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Oauth2AccessCodeSecurity.ProtoReflect.Descriptor instead. -func (*Oauth2AccessCodeSecurity) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{31} -} - -func (x *Oauth2AccessCodeSecurity) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -func (x *Oauth2AccessCodeSecurity) GetFlow() string { - if x != nil { - return x.Flow - } - return "" -} - -func (x *Oauth2AccessCodeSecurity) GetScopes() *Oauth2Scopes { - if x != nil { - return x.Scopes - } - return nil -} - -func (x *Oauth2AccessCodeSecurity) GetAuthorizationUrl() string { - if x != nil { - return x.AuthorizationUrl - } - return "" -} - -func (x *Oauth2AccessCodeSecurity) GetTokenUrl() string { - if x != nil { - return x.TokenUrl - } - return "" -} - -func (x *Oauth2AccessCodeSecurity) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *Oauth2AccessCodeSecurity) GetVendorExtension() []*NamedAny { - if x != nil { - return x.VendorExtension - } - return nil -} - -type Oauth2ApplicationSecurity struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` - Flow string `protobuf:"bytes,2,opt,name=flow,proto3" json:"flow,omitempty"` - Scopes *Oauth2Scopes `protobuf:"bytes,3,opt,name=scopes,proto3" json:"scopes,omitempty"` - TokenUrl string `protobuf:"bytes,4,opt,name=token_url,json=tokenUrl,proto3" json:"token_url,omitempty"` - Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"` - VendorExtension []*NamedAny `protobuf:"bytes,6,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` -} - -func (x *Oauth2ApplicationSecurity) Reset() { - *x = Oauth2ApplicationSecurity{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[32] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Oauth2ApplicationSecurity) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Oauth2ApplicationSecurity) ProtoMessage() {} - -func (x *Oauth2ApplicationSecurity) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[32] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Oauth2ApplicationSecurity.ProtoReflect.Descriptor instead. -func (*Oauth2ApplicationSecurity) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{32} -} - -func (x *Oauth2ApplicationSecurity) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -func (x *Oauth2ApplicationSecurity) GetFlow() string { - if x != nil { - return x.Flow - } - return "" -} - -func (x *Oauth2ApplicationSecurity) GetScopes() *Oauth2Scopes { - if x != nil { - return x.Scopes - } - return nil -} - -func (x *Oauth2ApplicationSecurity) GetTokenUrl() string { - if x != nil { - return x.TokenUrl - } - return "" -} - -func (x *Oauth2ApplicationSecurity) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *Oauth2ApplicationSecurity) GetVendorExtension() []*NamedAny { - if x != nil { - return x.VendorExtension - } - return nil -} - -type Oauth2ImplicitSecurity struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` - Flow string `protobuf:"bytes,2,opt,name=flow,proto3" json:"flow,omitempty"` - Scopes *Oauth2Scopes `protobuf:"bytes,3,opt,name=scopes,proto3" json:"scopes,omitempty"` - AuthorizationUrl string `protobuf:"bytes,4,opt,name=authorization_url,json=authorizationUrl,proto3" json:"authorization_url,omitempty"` - Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"` - VendorExtension []*NamedAny `protobuf:"bytes,6,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` -} - -func (x *Oauth2ImplicitSecurity) Reset() { - *x = Oauth2ImplicitSecurity{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[33] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Oauth2ImplicitSecurity) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Oauth2ImplicitSecurity) ProtoMessage() {} - -func (x *Oauth2ImplicitSecurity) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[33] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Oauth2ImplicitSecurity.ProtoReflect.Descriptor instead. -func (*Oauth2ImplicitSecurity) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{33} -} - -func (x *Oauth2ImplicitSecurity) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -func (x *Oauth2ImplicitSecurity) GetFlow() string { - if x != nil { - return x.Flow - } - return "" -} - -func (x *Oauth2ImplicitSecurity) GetScopes() *Oauth2Scopes { - if x != nil { - return x.Scopes - } - return nil -} - -func (x *Oauth2ImplicitSecurity) GetAuthorizationUrl() string { - if x != nil { - return x.AuthorizationUrl - } - return "" -} - -func (x *Oauth2ImplicitSecurity) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *Oauth2ImplicitSecurity) GetVendorExtension() []*NamedAny { - if x != nil { - return x.VendorExtension - } - return nil -} - -type Oauth2PasswordSecurity struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` - Flow string `protobuf:"bytes,2,opt,name=flow,proto3" json:"flow,omitempty"` - Scopes *Oauth2Scopes `protobuf:"bytes,3,opt,name=scopes,proto3" json:"scopes,omitempty"` - TokenUrl string `protobuf:"bytes,4,opt,name=token_url,json=tokenUrl,proto3" json:"token_url,omitempty"` - Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"` - VendorExtension []*NamedAny `protobuf:"bytes,6,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` -} - -func (x *Oauth2PasswordSecurity) Reset() { - *x = Oauth2PasswordSecurity{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[34] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Oauth2PasswordSecurity) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Oauth2PasswordSecurity) ProtoMessage() {} - -func (x *Oauth2PasswordSecurity) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[34] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Oauth2PasswordSecurity.ProtoReflect.Descriptor instead. -func (*Oauth2PasswordSecurity) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{34} -} - -func (x *Oauth2PasswordSecurity) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -func (x *Oauth2PasswordSecurity) GetFlow() string { - if x != nil { - return x.Flow - } - return "" -} - -func (x *Oauth2PasswordSecurity) GetScopes() *Oauth2Scopes { - if x != nil { - return x.Scopes - } - return nil -} - -func (x *Oauth2PasswordSecurity) GetTokenUrl() string { - if x != nil { - return x.TokenUrl - } - return "" -} - -func (x *Oauth2PasswordSecurity) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *Oauth2PasswordSecurity) GetVendorExtension() []*NamedAny { - if x != nil { - return x.VendorExtension - } - return nil -} - -type Oauth2Scopes struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedString `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *Oauth2Scopes) Reset() { - *x = Oauth2Scopes{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[35] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Oauth2Scopes) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Oauth2Scopes) ProtoMessage() {} - -func (x *Oauth2Scopes) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[35] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Oauth2Scopes.ProtoReflect.Descriptor instead. -func (*Oauth2Scopes) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{35} -} - -func (x *Oauth2Scopes) GetAdditionalProperties() []*NamedString { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -type Operation struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Tags []string `protobuf:"bytes,1,rep,name=tags,proto3" json:"tags,omitempty"` - // A brief summary of the operation. - Summary string `protobuf:"bytes,2,opt,name=summary,proto3" json:"summary,omitempty"` - // A longer description of the operation, GitHub Flavored Markdown is allowed. - Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` - ExternalDocs *ExternalDocs `protobuf:"bytes,4,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"` - // A unique identifier of the operation. - OperationId string `protobuf:"bytes,5,opt,name=operation_id,json=operationId,proto3" json:"operation_id,omitempty"` - // A list of MIME types the API can produce. - Produces []string `protobuf:"bytes,6,rep,name=produces,proto3" json:"produces,omitempty"` - // A list of MIME types the API can consume. - Consumes []string `protobuf:"bytes,7,rep,name=consumes,proto3" json:"consumes,omitempty"` - // The parameters needed to send a valid API call. - Parameters []*ParametersItem `protobuf:"bytes,8,rep,name=parameters,proto3" json:"parameters,omitempty"` - Responses *Responses `protobuf:"bytes,9,opt,name=responses,proto3" json:"responses,omitempty"` - // The transfer protocol of the API. - Schemes []string `protobuf:"bytes,10,rep,name=schemes,proto3" json:"schemes,omitempty"` - Deprecated bool `protobuf:"varint,11,opt,name=deprecated,proto3" json:"deprecated,omitempty"` - Security []*SecurityRequirement `protobuf:"bytes,12,rep,name=security,proto3" json:"security,omitempty"` - VendorExtension []*NamedAny `protobuf:"bytes,13,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` -} - -func (x *Operation) Reset() { - *x = Operation{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[36] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Operation) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Operation) ProtoMessage() {} - -func (x *Operation) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[36] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Operation.ProtoReflect.Descriptor instead. -func (*Operation) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{36} -} - -func (x *Operation) GetTags() []string { - if x != nil { - return x.Tags - } - return nil -} - -func (x *Operation) GetSummary() string { - if x != nil { - return x.Summary - } - return "" -} - -func (x *Operation) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *Operation) GetExternalDocs() *ExternalDocs { - if x != nil { - return x.ExternalDocs - } - return nil -} - -func (x *Operation) GetOperationId() string { - if x != nil { - return x.OperationId - } - return "" -} - -func (x *Operation) GetProduces() []string { - if x != nil { - return x.Produces - } - return nil -} - -func (x *Operation) GetConsumes() []string { - if x != nil { - return x.Consumes - } - return nil -} - -func (x *Operation) GetParameters() []*ParametersItem { - if x != nil { - return x.Parameters - } - return nil -} - -func (x *Operation) GetResponses() *Responses { - if x != nil { - return x.Responses - } - return nil -} - -func (x *Operation) GetSchemes() []string { - if x != nil { - return x.Schemes - } - return nil -} - -func (x *Operation) GetDeprecated() bool { - if x != nil { - return x.Deprecated - } - return false -} - -func (x *Operation) GetSecurity() []*SecurityRequirement { - if x != nil { - return x.Security - } - return nil -} - -func (x *Operation) GetVendorExtension() []*NamedAny { - if x != nil { - return x.VendorExtension - } - return nil -} - -type Parameter struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Oneof: - // *Parameter_BodyParameter - // *Parameter_NonBodyParameter - Oneof isParameter_Oneof `protobuf_oneof:"oneof"` -} - -func (x *Parameter) Reset() { - *x = Parameter{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[37] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Parameter) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Parameter) ProtoMessage() {} - -func (x *Parameter) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[37] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Parameter.ProtoReflect.Descriptor instead. -func (*Parameter) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{37} -} - -func (m *Parameter) GetOneof() isParameter_Oneof { - if m != nil { - return m.Oneof - } - return nil -} - -func (x *Parameter) GetBodyParameter() *BodyParameter { - if x, ok := x.GetOneof().(*Parameter_BodyParameter); ok { - return x.BodyParameter - } - return nil -} - -func (x *Parameter) GetNonBodyParameter() *NonBodyParameter { - if x, ok := x.GetOneof().(*Parameter_NonBodyParameter); ok { - return x.NonBodyParameter - } - return nil -} - -type isParameter_Oneof interface { - isParameter_Oneof() -} - -type Parameter_BodyParameter struct { - BodyParameter *BodyParameter `protobuf:"bytes,1,opt,name=body_parameter,json=bodyParameter,proto3,oneof"` -} - -type Parameter_NonBodyParameter struct { - NonBodyParameter *NonBodyParameter `protobuf:"bytes,2,opt,name=non_body_parameter,json=nonBodyParameter,proto3,oneof"` -} - -func (*Parameter_BodyParameter) isParameter_Oneof() {} - -func (*Parameter_NonBodyParameter) isParameter_Oneof() {} - -// One or more JSON representations for parameters -type ParameterDefinitions struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedParameter `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *ParameterDefinitions) Reset() { - *x = ParameterDefinitions{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[38] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ParameterDefinitions) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ParameterDefinitions) ProtoMessage() {} - -func (x *ParameterDefinitions) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[38] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ParameterDefinitions.ProtoReflect.Descriptor instead. -func (*ParameterDefinitions) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{38} -} - -func (x *ParameterDefinitions) GetAdditionalProperties() []*NamedParameter { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -type ParametersItem struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Oneof: - // *ParametersItem_Parameter - // *ParametersItem_JsonReference - Oneof isParametersItem_Oneof `protobuf_oneof:"oneof"` -} - -func (x *ParametersItem) Reset() { - *x = ParametersItem{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[39] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ParametersItem) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ParametersItem) ProtoMessage() {} - -func (x *ParametersItem) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[39] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ParametersItem.ProtoReflect.Descriptor instead. -func (*ParametersItem) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{39} -} - -func (m *ParametersItem) GetOneof() isParametersItem_Oneof { - if m != nil { - return m.Oneof - } - return nil -} - -func (x *ParametersItem) GetParameter() *Parameter { - if x, ok := x.GetOneof().(*ParametersItem_Parameter); ok { - return x.Parameter - } - return nil -} - -func (x *ParametersItem) GetJsonReference() *JsonReference { - if x, ok := x.GetOneof().(*ParametersItem_JsonReference); ok { - return x.JsonReference - } - return nil -} - -type isParametersItem_Oneof interface { - isParametersItem_Oneof() -} - -type ParametersItem_Parameter struct { - Parameter *Parameter `protobuf:"bytes,1,opt,name=parameter,proto3,oneof"` -} - -type ParametersItem_JsonReference struct { - JsonReference *JsonReference `protobuf:"bytes,2,opt,name=json_reference,json=jsonReference,proto3,oneof"` -} - -func (*ParametersItem_Parameter) isParametersItem_Oneof() {} - -func (*ParametersItem_JsonReference) isParametersItem_Oneof() {} - -type PathItem struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - XRef string `protobuf:"bytes,1,opt,name=_ref,json=Ref,proto3" json:"_ref,omitempty"` - Get *Operation `protobuf:"bytes,2,opt,name=get,proto3" json:"get,omitempty"` - Put *Operation `protobuf:"bytes,3,opt,name=put,proto3" json:"put,omitempty"` - Post *Operation `protobuf:"bytes,4,opt,name=post,proto3" json:"post,omitempty"` - Delete *Operation `protobuf:"bytes,5,opt,name=delete,proto3" json:"delete,omitempty"` - Options *Operation `protobuf:"bytes,6,opt,name=options,proto3" json:"options,omitempty"` - Head *Operation `protobuf:"bytes,7,opt,name=head,proto3" json:"head,omitempty"` - Patch *Operation `protobuf:"bytes,8,opt,name=patch,proto3" json:"patch,omitempty"` - // The parameters needed to send a valid API call. - Parameters []*ParametersItem `protobuf:"bytes,9,rep,name=parameters,proto3" json:"parameters,omitempty"` - VendorExtension []*NamedAny `protobuf:"bytes,10,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` -} - -func (x *PathItem) Reset() { - *x = PathItem{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[40] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PathItem) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PathItem) ProtoMessage() {} - -func (x *PathItem) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[40] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PathItem.ProtoReflect.Descriptor instead. -func (*PathItem) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{40} -} - -func (x *PathItem) GetXRef() string { - if x != nil { - return x.XRef - } - return "" -} - -func (x *PathItem) GetGet() *Operation { - if x != nil { - return x.Get - } - return nil -} - -func (x *PathItem) GetPut() *Operation { - if x != nil { - return x.Put - } - return nil -} - -func (x *PathItem) GetPost() *Operation { - if x != nil { - return x.Post - } - return nil -} - -func (x *PathItem) GetDelete() *Operation { - if x != nil { - return x.Delete - } - return nil -} - -func (x *PathItem) GetOptions() *Operation { - if x != nil { - return x.Options - } - return nil -} - -func (x *PathItem) GetHead() *Operation { - if x != nil { - return x.Head - } - return nil -} - -func (x *PathItem) GetPatch() *Operation { - if x != nil { - return x.Patch - } - return nil -} - -func (x *PathItem) GetParameters() []*ParametersItem { - if x != nil { - return x.Parameters - } - return nil -} - -func (x *PathItem) GetVendorExtension() []*NamedAny { - if x != nil { - return x.VendorExtension - } - return nil -} - -type PathParameterSubSchema struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Determines whether or not this parameter is required or optional. - Required bool `protobuf:"varint,1,opt,name=required,proto3" json:"required,omitempty"` - // Determines the location of the parameter. - In string `protobuf:"bytes,2,opt,name=in,proto3" json:"in,omitempty"` - // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed. - Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` - // The name of the parameter. - Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` - Type string `protobuf:"bytes,5,opt,name=type,proto3" json:"type,omitempty"` - Format string `protobuf:"bytes,6,opt,name=format,proto3" json:"format,omitempty"` - Items *PrimitivesItems `protobuf:"bytes,7,opt,name=items,proto3" json:"items,omitempty"` - CollectionFormat string `protobuf:"bytes,8,opt,name=collection_format,json=collectionFormat,proto3" json:"collection_format,omitempty"` - Default *Any `protobuf:"bytes,9,opt,name=default,proto3" json:"default,omitempty"` - Maximum float64 `protobuf:"fixed64,10,opt,name=maximum,proto3" json:"maximum,omitempty"` - ExclusiveMaximum bool `protobuf:"varint,11,opt,name=exclusive_maximum,json=exclusiveMaximum,proto3" json:"exclusive_maximum,omitempty"` - Minimum float64 `protobuf:"fixed64,12,opt,name=minimum,proto3" json:"minimum,omitempty"` - ExclusiveMinimum bool `protobuf:"varint,13,opt,name=exclusive_minimum,json=exclusiveMinimum,proto3" json:"exclusive_minimum,omitempty"` - MaxLength int64 `protobuf:"varint,14,opt,name=max_length,json=maxLength,proto3" json:"max_length,omitempty"` - MinLength int64 `protobuf:"varint,15,opt,name=min_length,json=minLength,proto3" json:"min_length,omitempty"` - Pattern string `protobuf:"bytes,16,opt,name=pattern,proto3" json:"pattern,omitempty"` - MaxItems int64 `protobuf:"varint,17,opt,name=max_items,json=maxItems,proto3" json:"max_items,omitempty"` - MinItems int64 `protobuf:"varint,18,opt,name=min_items,json=minItems,proto3" json:"min_items,omitempty"` - UniqueItems bool `protobuf:"varint,19,opt,name=unique_items,json=uniqueItems,proto3" json:"unique_items,omitempty"` - Enum []*Any `protobuf:"bytes,20,rep,name=enum,proto3" json:"enum,omitempty"` - MultipleOf float64 `protobuf:"fixed64,21,opt,name=multiple_of,json=multipleOf,proto3" json:"multiple_of,omitempty"` - VendorExtension []*NamedAny `protobuf:"bytes,22,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` -} - -func (x *PathParameterSubSchema) Reset() { - *x = PathParameterSubSchema{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[41] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PathParameterSubSchema) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PathParameterSubSchema) ProtoMessage() {} - -func (x *PathParameterSubSchema) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[41] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PathParameterSubSchema.ProtoReflect.Descriptor instead. -func (*PathParameterSubSchema) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{41} -} - -func (x *PathParameterSubSchema) GetRequired() bool { - if x != nil { - return x.Required - } - return false -} - -func (x *PathParameterSubSchema) GetIn() string { - if x != nil { - return x.In - } - return "" -} - -func (x *PathParameterSubSchema) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *PathParameterSubSchema) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *PathParameterSubSchema) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -func (x *PathParameterSubSchema) GetFormat() string { - if x != nil { - return x.Format - } - return "" -} - -func (x *PathParameterSubSchema) GetItems() *PrimitivesItems { - if x != nil { - return x.Items - } - return nil -} - -func (x *PathParameterSubSchema) GetCollectionFormat() string { - if x != nil { - return x.CollectionFormat - } - return "" -} - -func (x *PathParameterSubSchema) GetDefault() *Any { - if x != nil { - return x.Default - } - return nil -} - -func (x *PathParameterSubSchema) GetMaximum() float64 { - if x != nil { - return x.Maximum - } - return 0 -} - -func (x *PathParameterSubSchema) GetExclusiveMaximum() bool { - if x != nil { - return x.ExclusiveMaximum - } - return false -} - -func (x *PathParameterSubSchema) GetMinimum() float64 { - if x != nil { - return x.Minimum - } - return 0 -} - -func (x *PathParameterSubSchema) GetExclusiveMinimum() bool { - if x != nil { - return x.ExclusiveMinimum - } - return false -} - -func (x *PathParameterSubSchema) GetMaxLength() int64 { - if x != nil { - return x.MaxLength - } - return 0 -} - -func (x *PathParameterSubSchema) GetMinLength() int64 { - if x != nil { - return x.MinLength - } - return 0 -} - -func (x *PathParameterSubSchema) GetPattern() string { - if x != nil { - return x.Pattern - } - return "" -} - -func (x *PathParameterSubSchema) GetMaxItems() int64 { - if x != nil { - return x.MaxItems - } - return 0 -} - -func (x *PathParameterSubSchema) GetMinItems() int64 { - if x != nil { - return x.MinItems - } - return 0 -} - -func (x *PathParameterSubSchema) GetUniqueItems() bool { - if x != nil { - return x.UniqueItems - } - return false -} - -func (x *PathParameterSubSchema) GetEnum() []*Any { - if x != nil { - return x.Enum - } - return nil -} - -func (x *PathParameterSubSchema) GetMultipleOf() float64 { - if x != nil { - return x.MultipleOf - } - return 0 -} - -func (x *PathParameterSubSchema) GetVendorExtension() []*NamedAny { - if x != nil { - return x.VendorExtension - } - return nil -} - -// Relative paths to the individual endpoints. They must be relative to the 'basePath'. -type Paths struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - VendorExtension []*NamedAny `protobuf:"bytes,1,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` - Path []*NamedPathItem `protobuf:"bytes,2,rep,name=path,proto3" json:"path,omitempty"` -} - -func (x *Paths) Reset() { - *x = Paths{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[42] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Paths) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Paths) ProtoMessage() {} - -func (x *Paths) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[42] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Paths.ProtoReflect.Descriptor instead. -func (*Paths) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{42} -} - -func (x *Paths) GetVendorExtension() []*NamedAny { - if x != nil { - return x.VendorExtension - } - return nil -} - -func (x *Paths) GetPath() []*NamedPathItem { - if x != nil { - return x.Path - } - return nil -} - -type PrimitivesItems struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` - Format string `protobuf:"bytes,2,opt,name=format,proto3" json:"format,omitempty"` - Items *PrimitivesItems `protobuf:"bytes,3,opt,name=items,proto3" json:"items,omitempty"` - CollectionFormat string `protobuf:"bytes,4,opt,name=collection_format,json=collectionFormat,proto3" json:"collection_format,omitempty"` - Default *Any `protobuf:"bytes,5,opt,name=default,proto3" json:"default,omitempty"` - Maximum float64 `protobuf:"fixed64,6,opt,name=maximum,proto3" json:"maximum,omitempty"` - ExclusiveMaximum bool `protobuf:"varint,7,opt,name=exclusive_maximum,json=exclusiveMaximum,proto3" json:"exclusive_maximum,omitempty"` - Minimum float64 `protobuf:"fixed64,8,opt,name=minimum,proto3" json:"minimum,omitempty"` - ExclusiveMinimum bool `protobuf:"varint,9,opt,name=exclusive_minimum,json=exclusiveMinimum,proto3" json:"exclusive_minimum,omitempty"` - MaxLength int64 `protobuf:"varint,10,opt,name=max_length,json=maxLength,proto3" json:"max_length,omitempty"` - MinLength int64 `protobuf:"varint,11,opt,name=min_length,json=minLength,proto3" json:"min_length,omitempty"` - Pattern string `protobuf:"bytes,12,opt,name=pattern,proto3" json:"pattern,omitempty"` - MaxItems int64 `protobuf:"varint,13,opt,name=max_items,json=maxItems,proto3" json:"max_items,omitempty"` - MinItems int64 `protobuf:"varint,14,opt,name=min_items,json=minItems,proto3" json:"min_items,omitempty"` - UniqueItems bool `protobuf:"varint,15,opt,name=unique_items,json=uniqueItems,proto3" json:"unique_items,omitempty"` - Enum []*Any `protobuf:"bytes,16,rep,name=enum,proto3" json:"enum,omitempty"` - MultipleOf float64 `protobuf:"fixed64,17,opt,name=multiple_of,json=multipleOf,proto3" json:"multiple_of,omitempty"` - VendorExtension []*NamedAny `protobuf:"bytes,18,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` -} - -func (x *PrimitivesItems) Reset() { - *x = PrimitivesItems{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[43] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PrimitivesItems) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PrimitivesItems) ProtoMessage() {} - -func (x *PrimitivesItems) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[43] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PrimitivesItems.ProtoReflect.Descriptor instead. -func (*PrimitivesItems) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{43} -} - -func (x *PrimitivesItems) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -func (x *PrimitivesItems) GetFormat() string { - if x != nil { - return x.Format - } - return "" -} - -func (x *PrimitivesItems) GetItems() *PrimitivesItems { - if x != nil { - return x.Items - } - return nil -} - -func (x *PrimitivesItems) GetCollectionFormat() string { - if x != nil { - return x.CollectionFormat - } - return "" -} - -func (x *PrimitivesItems) GetDefault() *Any { - if x != nil { - return x.Default - } - return nil -} - -func (x *PrimitivesItems) GetMaximum() float64 { - if x != nil { - return x.Maximum - } - return 0 -} - -func (x *PrimitivesItems) GetExclusiveMaximum() bool { - if x != nil { - return x.ExclusiveMaximum - } - return false -} - -func (x *PrimitivesItems) GetMinimum() float64 { - if x != nil { - return x.Minimum - } - return 0 -} - -func (x *PrimitivesItems) GetExclusiveMinimum() bool { - if x != nil { - return x.ExclusiveMinimum - } - return false -} - -func (x *PrimitivesItems) GetMaxLength() int64 { - if x != nil { - return x.MaxLength - } - return 0 -} - -func (x *PrimitivesItems) GetMinLength() int64 { - if x != nil { - return x.MinLength - } - return 0 -} - -func (x *PrimitivesItems) GetPattern() string { - if x != nil { - return x.Pattern - } - return "" -} - -func (x *PrimitivesItems) GetMaxItems() int64 { - if x != nil { - return x.MaxItems - } - return 0 -} - -func (x *PrimitivesItems) GetMinItems() int64 { - if x != nil { - return x.MinItems - } - return 0 -} - -func (x *PrimitivesItems) GetUniqueItems() bool { - if x != nil { - return x.UniqueItems - } - return false -} - -func (x *PrimitivesItems) GetEnum() []*Any { - if x != nil { - return x.Enum - } - return nil -} - -func (x *PrimitivesItems) GetMultipleOf() float64 { - if x != nil { - return x.MultipleOf - } - return 0 -} - -func (x *PrimitivesItems) GetVendorExtension() []*NamedAny { - if x != nil { - return x.VendorExtension - } - return nil -} - -type Properties struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedSchema `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *Properties) Reset() { - *x = Properties{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[44] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Properties) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Properties) ProtoMessage() {} - -func (x *Properties) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[44] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Properties.ProtoReflect.Descriptor instead. -func (*Properties) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{44} -} - -func (x *Properties) GetAdditionalProperties() []*NamedSchema { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -type QueryParameterSubSchema struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Determines whether or not this parameter is required or optional. - Required bool `protobuf:"varint,1,opt,name=required,proto3" json:"required,omitempty"` - // Determines the location of the parameter. - In string `protobuf:"bytes,2,opt,name=in,proto3" json:"in,omitempty"` - // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed. - Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` - // The name of the parameter. - Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` - // allows sending a parameter by name only or with an empty value. - AllowEmptyValue bool `protobuf:"varint,5,opt,name=allow_empty_value,json=allowEmptyValue,proto3" json:"allow_empty_value,omitempty"` - Type string `protobuf:"bytes,6,opt,name=type,proto3" json:"type,omitempty"` - Format string `protobuf:"bytes,7,opt,name=format,proto3" json:"format,omitempty"` - Items *PrimitivesItems `protobuf:"bytes,8,opt,name=items,proto3" json:"items,omitempty"` - CollectionFormat string `protobuf:"bytes,9,opt,name=collection_format,json=collectionFormat,proto3" json:"collection_format,omitempty"` - Default *Any `protobuf:"bytes,10,opt,name=default,proto3" json:"default,omitempty"` - Maximum float64 `protobuf:"fixed64,11,opt,name=maximum,proto3" json:"maximum,omitempty"` - ExclusiveMaximum bool `protobuf:"varint,12,opt,name=exclusive_maximum,json=exclusiveMaximum,proto3" json:"exclusive_maximum,omitempty"` - Minimum float64 `protobuf:"fixed64,13,opt,name=minimum,proto3" json:"minimum,omitempty"` - ExclusiveMinimum bool `protobuf:"varint,14,opt,name=exclusive_minimum,json=exclusiveMinimum,proto3" json:"exclusive_minimum,omitempty"` - MaxLength int64 `protobuf:"varint,15,opt,name=max_length,json=maxLength,proto3" json:"max_length,omitempty"` - MinLength int64 `protobuf:"varint,16,opt,name=min_length,json=minLength,proto3" json:"min_length,omitempty"` - Pattern string `protobuf:"bytes,17,opt,name=pattern,proto3" json:"pattern,omitempty"` - MaxItems int64 `protobuf:"varint,18,opt,name=max_items,json=maxItems,proto3" json:"max_items,omitempty"` - MinItems int64 `protobuf:"varint,19,opt,name=min_items,json=minItems,proto3" json:"min_items,omitempty"` - UniqueItems bool `protobuf:"varint,20,opt,name=unique_items,json=uniqueItems,proto3" json:"unique_items,omitempty"` - Enum []*Any `protobuf:"bytes,21,rep,name=enum,proto3" json:"enum,omitempty"` - MultipleOf float64 `protobuf:"fixed64,22,opt,name=multiple_of,json=multipleOf,proto3" json:"multiple_of,omitempty"` - VendorExtension []*NamedAny `protobuf:"bytes,23,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` -} - -func (x *QueryParameterSubSchema) Reset() { - *x = QueryParameterSubSchema{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[45] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *QueryParameterSubSchema) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*QueryParameterSubSchema) ProtoMessage() {} - -func (x *QueryParameterSubSchema) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[45] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use QueryParameterSubSchema.ProtoReflect.Descriptor instead. -func (*QueryParameterSubSchema) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{45} -} - -func (x *QueryParameterSubSchema) GetRequired() bool { - if x != nil { - return x.Required - } - return false -} - -func (x *QueryParameterSubSchema) GetIn() string { - if x != nil { - return x.In - } - return "" -} - -func (x *QueryParameterSubSchema) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *QueryParameterSubSchema) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *QueryParameterSubSchema) GetAllowEmptyValue() bool { - if x != nil { - return x.AllowEmptyValue - } - return false -} - -func (x *QueryParameterSubSchema) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -func (x *QueryParameterSubSchema) GetFormat() string { - if x != nil { - return x.Format - } - return "" -} - -func (x *QueryParameterSubSchema) GetItems() *PrimitivesItems { - if x != nil { - return x.Items - } - return nil -} - -func (x *QueryParameterSubSchema) GetCollectionFormat() string { - if x != nil { - return x.CollectionFormat - } - return "" -} - -func (x *QueryParameterSubSchema) GetDefault() *Any { - if x != nil { - return x.Default - } - return nil -} - -func (x *QueryParameterSubSchema) GetMaximum() float64 { - if x != nil { - return x.Maximum - } - return 0 -} - -func (x *QueryParameterSubSchema) GetExclusiveMaximum() bool { - if x != nil { - return x.ExclusiveMaximum - } - return false -} - -func (x *QueryParameterSubSchema) GetMinimum() float64 { - if x != nil { - return x.Minimum - } - return 0 -} - -func (x *QueryParameterSubSchema) GetExclusiveMinimum() bool { - if x != nil { - return x.ExclusiveMinimum - } - return false -} - -func (x *QueryParameterSubSchema) GetMaxLength() int64 { - if x != nil { - return x.MaxLength - } - return 0 -} - -func (x *QueryParameterSubSchema) GetMinLength() int64 { - if x != nil { - return x.MinLength - } - return 0 -} - -func (x *QueryParameterSubSchema) GetPattern() string { - if x != nil { - return x.Pattern - } - return "" -} - -func (x *QueryParameterSubSchema) GetMaxItems() int64 { - if x != nil { - return x.MaxItems - } - return 0 -} - -func (x *QueryParameterSubSchema) GetMinItems() int64 { - if x != nil { - return x.MinItems - } - return 0 -} - -func (x *QueryParameterSubSchema) GetUniqueItems() bool { - if x != nil { - return x.UniqueItems - } - return false -} - -func (x *QueryParameterSubSchema) GetEnum() []*Any { - if x != nil { - return x.Enum - } - return nil -} - -func (x *QueryParameterSubSchema) GetMultipleOf() float64 { - if x != nil { - return x.MultipleOf - } - return 0 -} - -func (x *QueryParameterSubSchema) GetVendorExtension() []*NamedAny { - if x != nil { - return x.VendorExtension - } - return nil -} - -type Response struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"` - Schema *SchemaItem `protobuf:"bytes,2,opt,name=schema,proto3" json:"schema,omitempty"` - Headers *Headers `protobuf:"bytes,3,opt,name=headers,proto3" json:"headers,omitempty"` - Examples *Examples `protobuf:"bytes,4,opt,name=examples,proto3" json:"examples,omitempty"` - VendorExtension []*NamedAny `protobuf:"bytes,5,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` -} - -func (x *Response) Reset() { - *x = Response{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[46] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Response) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Response) ProtoMessage() {} - -func (x *Response) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[46] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Response.ProtoReflect.Descriptor instead. -func (*Response) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{46} -} - -func (x *Response) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *Response) GetSchema() *SchemaItem { - if x != nil { - return x.Schema - } - return nil -} - -func (x *Response) GetHeaders() *Headers { - if x != nil { - return x.Headers - } - return nil -} - -func (x *Response) GetExamples() *Examples { - if x != nil { - return x.Examples - } - return nil -} - -func (x *Response) GetVendorExtension() []*NamedAny { - if x != nil { - return x.VendorExtension - } - return nil -} - -// One or more JSON representations for responses -type ResponseDefinitions struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedResponse `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *ResponseDefinitions) Reset() { - *x = ResponseDefinitions{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[47] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ResponseDefinitions) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ResponseDefinitions) ProtoMessage() {} - -func (x *ResponseDefinitions) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[47] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ResponseDefinitions.ProtoReflect.Descriptor instead. -func (*ResponseDefinitions) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{47} -} - -func (x *ResponseDefinitions) GetAdditionalProperties() []*NamedResponse { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -type ResponseValue struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Oneof: - // *ResponseValue_Response - // *ResponseValue_JsonReference - Oneof isResponseValue_Oneof `protobuf_oneof:"oneof"` -} - -func (x *ResponseValue) Reset() { - *x = ResponseValue{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[48] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ResponseValue) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ResponseValue) ProtoMessage() {} - -func (x *ResponseValue) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[48] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ResponseValue.ProtoReflect.Descriptor instead. -func (*ResponseValue) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{48} -} - -func (m *ResponseValue) GetOneof() isResponseValue_Oneof { - if m != nil { - return m.Oneof - } - return nil -} - -func (x *ResponseValue) GetResponse() *Response { - if x, ok := x.GetOneof().(*ResponseValue_Response); ok { - return x.Response - } - return nil -} - -func (x *ResponseValue) GetJsonReference() *JsonReference { - if x, ok := x.GetOneof().(*ResponseValue_JsonReference); ok { - return x.JsonReference - } - return nil -} - -type isResponseValue_Oneof interface { - isResponseValue_Oneof() -} - -type ResponseValue_Response struct { - Response *Response `protobuf:"bytes,1,opt,name=response,proto3,oneof"` -} - -type ResponseValue_JsonReference struct { - JsonReference *JsonReference `protobuf:"bytes,2,opt,name=json_reference,json=jsonReference,proto3,oneof"` -} - -func (*ResponseValue_Response) isResponseValue_Oneof() {} - -func (*ResponseValue_JsonReference) isResponseValue_Oneof() {} - -// Response objects names can either be any valid HTTP status code or 'default'. -type Responses struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ResponseCode []*NamedResponseValue `protobuf:"bytes,1,rep,name=response_code,json=responseCode,proto3" json:"response_code,omitempty"` - VendorExtension []*NamedAny `protobuf:"bytes,2,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` -} - -func (x *Responses) Reset() { - *x = Responses{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[49] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Responses) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Responses) ProtoMessage() {} - -func (x *Responses) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[49] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Responses.ProtoReflect.Descriptor instead. -func (*Responses) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{49} -} - -func (x *Responses) GetResponseCode() []*NamedResponseValue { - if x != nil { - return x.ResponseCode - } - return nil -} - -func (x *Responses) GetVendorExtension() []*NamedAny { - if x != nil { - return x.VendorExtension - } - return nil -} - -// A deterministic version of a JSON Schema object. -type Schema struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - XRef string `protobuf:"bytes,1,opt,name=_ref,json=Ref,proto3" json:"_ref,omitempty"` - Format string `protobuf:"bytes,2,opt,name=format,proto3" json:"format,omitempty"` - Title string `protobuf:"bytes,3,opt,name=title,proto3" json:"title,omitempty"` - Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"` - Default *Any `protobuf:"bytes,5,opt,name=default,proto3" json:"default,omitempty"` - MultipleOf float64 `protobuf:"fixed64,6,opt,name=multiple_of,json=multipleOf,proto3" json:"multiple_of,omitempty"` - Maximum float64 `protobuf:"fixed64,7,opt,name=maximum,proto3" json:"maximum,omitempty"` - ExclusiveMaximum bool `protobuf:"varint,8,opt,name=exclusive_maximum,json=exclusiveMaximum,proto3" json:"exclusive_maximum,omitempty"` - Minimum float64 `protobuf:"fixed64,9,opt,name=minimum,proto3" json:"minimum,omitempty"` - ExclusiveMinimum bool `protobuf:"varint,10,opt,name=exclusive_minimum,json=exclusiveMinimum,proto3" json:"exclusive_minimum,omitempty"` - MaxLength int64 `protobuf:"varint,11,opt,name=max_length,json=maxLength,proto3" json:"max_length,omitempty"` - MinLength int64 `protobuf:"varint,12,opt,name=min_length,json=minLength,proto3" json:"min_length,omitempty"` - Pattern string `protobuf:"bytes,13,opt,name=pattern,proto3" json:"pattern,omitempty"` - MaxItems int64 `protobuf:"varint,14,opt,name=max_items,json=maxItems,proto3" json:"max_items,omitempty"` - MinItems int64 `protobuf:"varint,15,opt,name=min_items,json=minItems,proto3" json:"min_items,omitempty"` - UniqueItems bool `protobuf:"varint,16,opt,name=unique_items,json=uniqueItems,proto3" json:"unique_items,omitempty"` - MaxProperties int64 `protobuf:"varint,17,opt,name=max_properties,json=maxProperties,proto3" json:"max_properties,omitempty"` - MinProperties int64 `protobuf:"varint,18,opt,name=min_properties,json=minProperties,proto3" json:"min_properties,omitempty"` - Required []string `protobuf:"bytes,19,rep,name=required,proto3" json:"required,omitempty"` - Enum []*Any `protobuf:"bytes,20,rep,name=enum,proto3" json:"enum,omitempty"` - AdditionalProperties *AdditionalPropertiesItem `protobuf:"bytes,21,opt,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` - Type *TypeItem `protobuf:"bytes,22,opt,name=type,proto3" json:"type,omitempty"` - Items *ItemsItem `protobuf:"bytes,23,opt,name=items,proto3" json:"items,omitempty"` - AllOf []*Schema `protobuf:"bytes,24,rep,name=all_of,json=allOf,proto3" json:"all_of,omitempty"` - Properties *Properties `protobuf:"bytes,25,opt,name=properties,proto3" json:"properties,omitempty"` - Discriminator string `protobuf:"bytes,26,opt,name=discriminator,proto3" json:"discriminator,omitempty"` - ReadOnly bool `protobuf:"varint,27,opt,name=read_only,json=readOnly,proto3" json:"read_only,omitempty"` - Xml *Xml `protobuf:"bytes,28,opt,name=xml,proto3" json:"xml,omitempty"` - ExternalDocs *ExternalDocs `protobuf:"bytes,29,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"` - Example *Any `protobuf:"bytes,30,opt,name=example,proto3" json:"example,omitempty"` - VendorExtension []*NamedAny `protobuf:"bytes,31,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` -} - -func (x *Schema) Reset() { - *x = Schema{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[50] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Schema) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Schema) ProtoMessage() {} - -func (x *Schema) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[50] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Schema.ProtoReflect.Descriptor instead. -func (*Schema) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{50} -} - -func (x *Schema) GetXRef() string { - if x != nil { - return x.XRef - } - return "" -} - -func (x *Schema) GetFormat() string { - if x != nil { - return x.Format - } - return "" -} - -func (x *Schema) GetTitle() string { - if x != nil { - return x.Title - } - return "" -} - -func (x *Schema) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *Schema) GetDefault() *Any { - if x != nil { - return x.Default - } - return nil -} - -func (x *Schema) GetMultipleOf() float64 { - if x != nil { - return x.MultipleOf - } - return 0 -} - -func (x *Schema) GetMaximum() float64 { - if x != nil { - return x.Maximum - } - return 0 -} - -func (x *Schema) GetExclusiveMaximum() bool { - if x != nil { - return x.ExclusiveMaximum - } - return false -} - -func (x *Schema) GetMinimum() float64 { - if x != nil { - return x.Minimum - } - return 0 -} - -func (x *Schema) GetExclusiveMinimum() bool { - if x != nil { - return x.ExclusiveMinimum - } - return false -} - -func (x *Schema) GetMaxLength() int64 { - if x != nil { - return x.MaxLength - } - return 0 -} - -func (x *Schema) GetMinLength() int64 { - if x != nil { - return x.MinLength - } - return 0 -} - -func (x *Schema) GetPattern() string { - if x != nil { - return x.Pattern - } - return "" -} - -func (x *Schema) GetMaxItems() int64 { - if x != nil { - return x.MaxItems - } - return 0 -} - -func (x *Schema) GetMinItems() int64 { - if x != nil { - return x.MinItems - } - return 0 -} - -func (x *Schema) GetUniqueItems() bool { - if x != nil { - return x.UniqueItems - } - return false -} - -func (x *Schema) GetMaxProperties() int64 { - if x != nil { - return x.MaxProperties - } - return 0 -} - -func (x *Schema) GetMinProperties() int64 { - if x != nil { - return x.MinProperties - } - return 0 -} - -func (x *Schema) GetRequired() []string { - if x != nil { - return x.Required - } - return nil -} - -func (x *Schema) GetEnum() []*Any { - if x != nil { - return x.Enum - } - return nil -} - -func (x *Schema) GetAdditionalProperties() *AdditionalPropertiesItem { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -func (x *Schema) GetType() *TypeItem { - if x != nil { - return x.Type - } - return nil -} - -func (x *Schema) GetItems() *ItemsItem { - if x != nil { - return x.Items - } - return nil -} - -func (x *Schema) GetAllOf() []*Schema { - if x != nil { - return x.AllOf - } - return nil -} - -func (x *Schema) GetProperties() *Properties { - if x != nil { - return x.Properties - } - return nil -} - -func (x *Schema) GetDiscriminator() string { - if x != nil { - return x.Discriminator - } - return "" -} - -func (x *Schema) GetReadOnly() bool { - if x != nil { - return x.ReadOnly - } - return false -} - -func (x *Schema) GetXml() *Xml { - if x != nil { - return x.Xml - } - return nil -} - -func (x *Schema) GetExternalDocs() *ExternalDocs { - if x != nil { - return x.ExternalDocs - } - return nil -} - -func (x *Schema) GetExample() *Any { - if x != nil { - return x.Example - } - return nil -} - -func (x *Schema) GetVendorExtension() []*NamedAny { - if x != nil { - return x.VendorExtension - } - return nil -} - -type SchemaItem struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Oneof: - // *SchemaItem_Schema - // *SchemaItem_FileSchema - Oneof isSchemaItem_Oneof `protobuf_oneof:"oneof"` -} - -func (x *SchemaItem) Reset() { - *x = SchemaItem{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[51] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SchemaItem) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SchemaItem) ProtoMessage() {} - -func (x *SchemaItem) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[51] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SchemaItem.ProtoReflect.Descriptor instead. -func (*SchemaItem) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{51} -} - -func (m *SchemaItem) GetOneof() isSchemaItem_Oneof { - if m != nil { - return m.Oneof - } - return nil -} - -func (x *SchemaItem) GetSchema() *Schema { - if x, ok := x.GetOneof().(*SchemaItem_Schema); ok { - return x.Schema - } - return nil -} - -func (x *SchemaItem) GetFileSchema() *FileSchema { - if x, ok := x.GetOneof().(*SchemaItem_FileSchema); ok { - return x.FileSchema - } - return nil -} - -type isSchemaItem_Oneof interface { - isSchemaItem_Oneof() -} - -type SchemaItem_Schema struct { - Schema *Schema `protobuf:"bytes,1,opt,name=schema,proto3,oneof"` -} - -type SchemaItem_FileSchema struct { - FileSchema *FileSchema `protobuf:"bytes,2,opt,name=file_schema,json=fileSchema,proto3,oneof"` -} - -func (*SchemaItem_Schema) isSchemaItem_Oneof() {} - -func (*SchemaItem_FileSchema) isSchemaItem_Oneof() {} - -type SecurityDefinitions struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedSecurityDefinitionsItem `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *SecurityDefinitions) Reset() { - *x = SecurityDefinitions{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[52] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SecurityDefinitions) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SecurityDefinitions) ProtoMessage() {} - -func (x *SecurityDefinitions) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[52] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SecurityDefinitions.ProtoReflect.Descriptor instead. -func (*SecurityDefinitions) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{52} -} - -func (x *SecurityDefinitions) GetAdditionalProperties() []*NamedSecurityDefinitionsItem { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -type SecurityDefinitionsItem struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Oneof: - // *SecurityDefinitionsItem_BasicAuthenticationSecurity - // *SecurityDefinitionsItem_ApiKeySecurity - // *SecurityDefinitionsItem_Oauth2ImplicitSecurity - // *SecurityDefinitionsItem_Oauth2PasswordSecurity - // *SecurityDefinitionsItem_Oauth2ApplicationSecurity - // *SecurityDefinitionsItem_Oauth2AccessCodeSecurity - Oneof isSecurityDefinitionsItem_Oneof `protobuf_oneof:"oneof"` -} - -func (x *SecurityDefinitionsItem) Reset() { - *x = SecurityDefinitionsItem{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[53] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SecurityDefinitionsItem) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SecurityDefinitionsItem) ProtoMessage() {} - -func (x *SecurityDefinitionsItem) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[53] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SecurityDefinitionsItem.ProtoReflect.Descriptor instead. -func (*SecurityDefinitionsItem) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{53} -} - -func (m *SecurityDefinitionsItem) GetOneof() isSecurityDefinitionsItem_Oneof { - if m != nil { - return m.Oneof - } - return nil -} - -func (x *SecurityDefinitionsItem) GetBasicAuthenticationSecurity() *BasicAuthenticationSecurity { - if x, ok := x.GetOneof().(*SecurityDefinitionsItem_BasicAuthenticationSecurity); ok { - return x.BasicAuthenticationSecurity - } - return nil -} - -func (x *SecurityDefinitionsItem) GetApiKeySecurity() *ApiKeySecurity { - if x, ok := x.GetOneof().(*SecurityDefinitionsItem_ApiKeySecurity); ok { - return x.ApiKeySecurity - } - return nil -} - -func (x *SecurityDefinitionsItem) GetOauth2ImplicitSecurity() *Oauth2ImplicitSecurity { - if x, ok := x.GetOneof().(*SecurityDefinitionsItem_Oauth2ImplicitSecurity); ok { - return x.Oauth2ImplicitSecurity - } - return nil -} - -func (x *SecurityDefinitionsItem) GetOauth2PasswordSecurity() *Oauth2PasswordSecurity { - if x, ok := x.GetOneof().(*SecurityDefinitionsItem_Oauth2PasswordSecurity); ok { - return x.Oauth2PasswordSecurity - } - return nil -} - -func (x *SecurityDefinitionsItem) GetOauth2ApplicationSecurity() *Oauth2ApplicationSecurity { - if x, ok := x.GetOneof().(*SecurityDefinitionsItem_Oauth2ApplicationSecurity); ok { - return x.Oauth2ApplicationSecurity - } - return nil -} - -func (x *SecurityDefinitionsItem) GetOauth2AccessCodeSecurity() *Oauth2AccessCodeSecurity { - if x, ok := x.GetOneof().(*SecurityDefinitionsItem_Oauth2AccessCodeSecurity); ok { - return x.Oauth2AccessCodeSecurity - } - return nil -} - -type isSecurityDefinitionsItem_Oneof interface { - isSecurityDefinitionsItem_Oneof() -} - -type SecurityDefinitionsItem_BasicAuthenticationSecurity struct { - BasicAuthenticationSecurity *BasicAuthenticationSecurity `protobuf:"bytes,1,opt,name=basic_authentication_security,json=basicAuthenticationSecurity,proto3,oneof"` -} - -type SecurityDefinitionsItem_ApiKeySecurity struct { - ApiKeySecurity *ApiKeySecurity `protobuf:"bytes,2,opt,name=api_key_security,json=apiKeySecurity,proto3,oneof"` -} - -type SecurityDefinitionsItem_Oauth2ImplicitSecurity struct { - Oauth2ImplicitSecurity *Oauth2ImplicitSecurity `protobuf:"bytes,3,opt,name=oauth2_implicit_security,json=oauth2ImplicitSecurity,proto3,oneof"` -} - -type SecurityDefinitionsItem_Oauth2PasswordSecurity struct { - Oauth2PasswordSecurity *Oauth2PasswordSecurity `protobuf:"bytes,4,opt,name=oauth2_password_security,json=oauth2PasswordSecurity,proto3,oneof"` -} - -type SecurityDefinitionsItem_Oauth2ApplicationSecurity struct { - Oauth2ApplicationSecurity *Oauth2ApplicationSecurity `protobuf:"bytes,5,opt,name=oauth2_application_security,json=oauth2ApplicationSecurity,proto3,oneof"` -} - -type SecurityDefinitionsItem_Oauth2AccessCodeSecurity struct { - Oauth2AccessCodeSecurity *Oauth2AccessCodeSecurity `protobuf:"bytes,6,opt,name=oauth2_access_code_security,json=oauth2AccessCodeSecurity,proto3,oneof"` -} - -func (*SecurityDefinitionsItem_BasicAuthenticationSecurity) isSecurityDefinitionsItem_Oneof() {} - -func (*SecurityDefinitionsItem_ApiKeySecurity) isSecurityDefinitionsItem_Oneof() {} - -func (*SecurityDefinitionsItem_Oauth2ImplicitSecurity) isSecurityDefinitionsItem_Oneof() {} - -func (*SecurityDefinitionsItem_Oauth2PasswordSecurity) isSecurityDefinitionsItem_Oneof() {} - -func (*SecurityDefinitionsItem_Oauth2ApplicationSecurity) isSecurityDefinitionsItem_Oneof() {} - -func (*SecurityDefinitionsItem_Oauth2AccessCodeSecurity) isSecurityDefinitionsItem_Oneof() {} - -type SecurityRequirement struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedStringArray `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *SecurityRequirement) Reset() { - *x = SecurityRequirement{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[54] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SecurityRequirement) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SecurityRequirement) ProtoMessage() {} - -func (x *SecurityRequirement) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[54] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SecurityRequirement.ProtoReflect.Descriptor instead. -func (*SecurityRequirement) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{54} -} - -func (x *SecurityRequirement) GetAdditionalProperties() []*NamedStringArray { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -type StringArray struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Value []string `protobuf:"bytes,1,rep,name=value,proto3" json:"value,omitempty"` -} - -func (x *StringArray) Reset() { - *x = StringArray{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[55] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *StringArray) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*StringArray) ProtoMessage() {} - -func (x *StringArray) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[55] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use StringArray.ProtoReflect.Descriptor instead. -func (*StringArray) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{55} -} - -func (x *StringArray) GetValue() []string { - if x != nil { - return x.Value - } - return nil -} - -type Tag struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - ExternalDocs *ExternalDocs `protobuf:"bytes,3,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"` - VendorExtension []*NamedAny `protobuf:"bytes,4,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` -} - -func (x *Tag) Reset() { - *x = Tag{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[56] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Tag) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Tag) ProtoMessage() {} - -func (x *Tag) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[56] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Tag.ProtoReflect.Descriptor instead. -func (*Tag) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{56} -} - -func (x *Tag) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Tag) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *Tag) GetExternalDocs() *ExternalDocs { - if x != nil { - return x.ExternalDocs - } - return nil -} - -func (x *Tag) GetVendorExtension() []*NamedAny { - if x != nil { - return x.VendorExtension - } - return nil -} - -type TypeItem struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Value []string `protobuf:"bytes,1,rep,name=value,proto3" json:"value,omitempty"` -} - -func (x *TypeItem) Reset() { - *x = TypeItem{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[57] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TypeItem) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TypeItem) ProtoMessage() {} - -func (x *TypeItem) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[57] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TypeItem.ProtoReflect.Descriptor instead. -func (*TypeItem) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{57} -} - -func (x *TypeItem) GetValue() []string { - if x != nil { - return x.Value - } - return nil -} - -// Any property starting with x- is valid. -type VendorExtension struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedAny `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *VendorExtension) Reset() { - *x = VendorExtension{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[58] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *VendorExtension) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*VendorExtension) ProtoMessage() {} - -func (x *VendorExtension) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[58] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use VendorExtension.ProtoReflect.Descriptor instead. -func (*VendorExtension) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{58} -} - -func (x *VendorExtension) GetAdditionalProperties() []*NamedAny { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -type Xml struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Namespace string `protobuf:"bytes,2,opt,name=namespace,proto3" json:"namespace,omitempty"` - Prefix string `protobuf:"bytes,3,opt,name=prefix,proto3" json:"prefix,omitempty"` - Attribute bool `protobuf:"varint,4,opt,name=attribute,proto3" json:"attribute,omitempty"` - Wrapped bool `protobuf:"varint,5,opt,name=wrapped,proto3" json:"wrapped,omitempty"` - VendorExtension []*NamedAny `protobuf:"bytes,6,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"` -} - -func (x *Xml) Reset() { - *x = Xml{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[59] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Xml) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Xml) ProtoMessage() {} - -func (x *Xml) ProtoReflect() protoreflect.Message { - mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[59] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Xml.ProtoReflect.Descriptor instead. -func (*Xml) Descriptor() ([]byte, []int) { - return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{59} -} - -func (x *Xml) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Xml) GetNamespace() string { - if x != nil { - return x.Namespace - } - return "" -} - -func (x *Xml) GetPrefix() string { - if x != nil { - return x.Prefix - } - return "" -} - -func (x *Xml) GetAttribute() bool { - if x != nil { - return x.Attribute - } - return false -} - -func (x *Xml) GetWrapped() bool { - if x != nil { - return x.Wrapped - } - return false -} - -func (x *Xml) GetVendorExtension() []*NamedAny { - if x != nil { - return x.VendorExtension - } - return nil -} - -var File_openapiv2_OpenAPIv2_proto protoreflect.FileDescriptor - -var file_openapiv2_OpenAPIv2_proto_rawDesc = []byte{ - 0x0a, 0x19, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2f, 0x4f, 0x70, 0x65, 0x6e, - 0x41, 0x50, 0x49, 0x76, 0x32, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x6f, 0x70, 0x65, - 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x22, 0x6d, 0x0a, 0x18, 0x41, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, - 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x2c, - 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, - 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x63, 0x68, 0x65, - 0x6d, 0x61, 0x48, 0x00, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x1a, 0x0a, 0x07, - 0x62, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, - 0x07, 0x62, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x42, 0x07, 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f, - 0x66, 0x22, 0x45, 0x0a, 0x03, 0x41, 0x6e, 0x79, 0x12, 0x2a, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x79, 0x61, 0x6d, 0x6c, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x79, 0x61, 0x6d, 0x6c, 0x22, 0xab, 0x01, 0x0a, 0x0e, 0x41, 0x70, 0x69, - 0x4b, 0x65, 0x79, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x74, - 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, - 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x02, 0x69, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, - 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, - 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, - 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x94, 0x01, 0x0a, 0x1b, 0x42, 0x61, 0x73, 0x69, 0x63, - 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, - 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, - 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3f, 0x0a, 0x10, - 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, - 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, - 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xde, 0x01, - 0x0a, 0x0d, 0x42, 0x6f, 0x64, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, - 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x02, 0x69, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, - 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, - 0x64, 0x12, 0x2a, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x12, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, - 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x3f, 0x0a, - 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, - 0x6e, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, - 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x86, - 0x01, 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, - 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, - 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, - 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, - 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, - 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x54, 0x0a, 0x07, 0x44, 0x65, 0x66, 0x61, 0x75, - 0x6c, 0x74, 0x12, 0x49, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, - 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, - 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, - 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x5b, 0x0a, - 0x0b, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x4c, 0x0a, 0x15, - 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, - 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6f, 0x70, - 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x63, - 0x68, 0x65, 0x6d, 0x61, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, - 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0xe8, 0x05, 0x0a, 0x08, 0x44, - 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x77, 0x61, 0x67, 0x67, - 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x77, 0x61, 0x67, 0x67, 0x65, - 0x72, 0x12, 0x24, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x10, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x49, 0x6e, 0x66, - 0x6f, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x62, - 0x61, 0x73, 0x65, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, - 0x62, 0x61, 0x73, 0x65, 0x50, 0x61, 0x74, 0x68, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x63, 0x68, 0x65, - 0x6d, 0x65, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x73, 0x63, 0x68, 0x65, 0x6d, - 0x65, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x73, 0x18, 0x06, - 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x73, 0x12, 0x1a, - 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, - 0x52, 0x08, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x73, 0x12, 0x27, 0x0a, 0x05, 0x70, 0x61, - 0x74, 0x68, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6f, 0x70, 0x65, 0x6e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x61, 0x74, 0x68, 0x73, 0x52, 0x05, 0x70, 0x61, - 0x74, 0x68, 0x73, 0x12, 0x39, 0x0a, 0x0b, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x52, 0x0b, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x40, - 0x0a, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x18, 0x0a, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, - 0x12, 0x3d, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x18, 0x0b, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, - 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x12, - 0x3b, 0x0a, 0x08, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x18, 0x0c, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x1f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, - 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x52, 0x08, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x12, 0x52, 0x0a, 0x14, - 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x5f, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6f, 0x70, 0x65, - 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, - 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x13, 0x73, 0x65, 0x63, - 0x75, 0x72, 0x69, 0x74, 0x79, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x12, 0x23, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x0e, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, - 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x54, 0x61, 0x67, 0x52, - 0x04, 0x74, 0x61, 0x67, 0x73, 0x12, 0x3d, 0x0a, 0x0d, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, - 0x6c, 0x5f, 0x64, 0x6f, 0x63, 0x73, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6f, - 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, - 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x52, 0x0c, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, - 0x44, 0x6f, 0x63, 0x73, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, - 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x10, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, - 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, - 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, - 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x55, 0x0a, 0x08, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, - 0x73, 0x12, 0x49, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, - 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, - 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, - 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x83, 0x01, 0x0a, - 0x0c, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x12, 0x20, 0x0a, - 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, - 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, - 0x6c, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, - 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, - 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, - 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, - 0x6f, 0x6e, 0x22, 0xff, 0x02, 0x0a, 0x0a, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x63, 0x68, 0x65, 0x6d, - 0x61, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, - 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, - 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x12, 0x29, 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, - 0x41, 0x6e, 0x79, 0x52, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x1a, 0x0a, 0x08, - 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, - 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x09, - 0x72, 0x65, 0x61, 0x64, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x08, 0x72, 0x65, 0x61, 0x64, 0x4f, 0x6e, 0x6c, 0x79, 0x12, 0x3d, 0x0a, 0x0d, 0x65, 0x78, 0x74, - 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x64, 0x6f, 0x63, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x18, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x45, 0x78, - 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x52, 0x0c, 0x65, 0x78, 0x74, 0x65, - 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x12, 0x29, 0x0a, 0x07, 0x65, 0x78, 0x61, 0x6d, - 0x70, 0x6c, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x07, 0x65, 0x78, 0x61, 0x6d, - 0x70, 0x6c, 0x65, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, - 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, - 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, - 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, - 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xab, 0x06, 0x0a, 0x1a, 0x46, 0x6f, 0x72, 0x6d, 0x44, 0x61, 0x74, - 0x61, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68, - 0x65, 0x6d, 0x61, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, - 0x0e, 0x0a, 0x02, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x6e, 0x12, - 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x11, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x65, - 0x6d, 0x70, 0x74, 0x79, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x0f, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, - 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x31, 0x0a, - 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6f, - 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, - 0x69, 0x76, 0x65, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, - 0x12, 0x2b, 0x0a, 0x11, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x66, - 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, 0x6f, 0x6c, - 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x29, 0x0a, - 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, - 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, - 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x61, 0x78, 0x69, - 0x6d, 0x75, 0x6d, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d, - 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, - 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65, - 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x12, - 0x18, 0x0a, 0x07, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x01, - 0x52, 0x07, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63, - 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0e, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d, - 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x61, 0x78, 0x5f, 0x6c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x61, 0x78, 0x4c, - 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x69, 0x6e, 0x5f, 0x6c, 0x65, 0x6e, - 0x67, 0x74, 0x68, 0x18, 0x10, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x69, 0x6e, 0x4c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x18, - 0x11, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x12, 0x1b, - 0x0a, 0x09, 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x12, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6d, - 0x69, 0x6e, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x13, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, - 0x6d, 0x69, 0x6e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x75, 0x6e, 0x69, 0x71, - 0x75, 0x65, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x14, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, - 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x23, 0x0a, 0x04, 0x65, - 0x6e, 0x75, 0x6d, 0x18, 0x15, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x04, 0x65, 0x6e, 0x75, 0x6d, - 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x6f, 0x66, 0x18, - 0x16, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0a, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x4f, - 0x66, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, - 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x17, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, - 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, - 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, - 0x6f, 0x6e, 0x22, 0xab, 0x05, 0x0a, 0x06, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x12, 0x0a, - 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, - 0x65, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x31, 0x0a, 0x05, 0x69, 0x74, 0x65, - 0x6d, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, - 0x49, 0x74, 0x65, 0x6d, 0x73, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x2b, 0x0a, 0x11, - 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, - 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x29, 0x0a, 0x07, 0x64, 0x65, 0x66, - 0x61, 0x75, 0x6c, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, - 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x07, 0x64, 0x65, 0x66, - 0x61, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x2b, - 0x0a, 0x11, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, 0x6d, 0x61, 0x78, 0x69, - 0x6d, 0x75, 0x6d, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65, 0x78, 0x63, 0x6c, 0x75, - 0x73, 0x69, 0x76, 0x65, 0x4d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x18, 0x0a, 0x07, 0x6d, - 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x08, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x6d, 0x69, - 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, - 0x76, 0x65, 0x5f, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x10, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d, 0x69, 0x6e, 0x69, 0x6d, - 0x75, 0x6d, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x61, 0x78, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, - 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x61, 0x78, 0x4c, 0x65, 0x6e, 0x67, 0x74, - 0x68, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x69, 0x6e, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, - 0x0b, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x69, 0x6e, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, - 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x18, 0x0c, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, - 0x78, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, - 0x61, 0x78, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x69, 0x6e, 0x5f, 0x69, - 0x74, 0x65, 0x6d, 0x73, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x69, 0x6e, 0x49, - 0x74, 0x65, 0x6d, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x5f, 0x69, - 0x74, 0x65, 0x6d, 0x73, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x75, 0x6e, 0x69, 0x71, - 0x75, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x23, 0x0a, 0x04, 0x65, 0x6e, 0x75, 0x6d, 0x18, - 0x10, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x04, 0x65, 0x6e, 0x75, 0x6d, 0x12, 0x1f, 0x0a, 0x0b, - 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x6f, 0x66, 0x18, 0x11, 0x20, 0x01, 0x28, - 0x01, 0x52, 0x0a, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x4f, 0x66, 0x12, 0x20, 0x0a, - 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x12, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, - 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, - 0x69, 0x6f, 0x6e, 0x18, 0x13, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, - 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, - 0x22, 0xfd, 0x05, 0x0a, 0x18, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x65, 0x74, 0x65, 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x1a, 0x0a, - 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x6e, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, - 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, - 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, - 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x06, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x31, 0x0a, 0x05, 0x69, - 0x74, 0x65, 0x6d, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6f, 0x70, 0x65, - 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, - 0x65, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x2b, - 0x0a, 0x11, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x66, 0x6f, 0x72, - 0x6d, 0x61, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, 0x6f, 0x6c, 0x6c, 0x65, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x29, 0x0a, 0x07, 0x64, - 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, - 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x07, 0x64, - 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, - 0x6d, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, - 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, 0x6d, 0x61, - 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65, 0x78, 0x63, - 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x18, 0x0a, - 0x07, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, - 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63, 0x6c, 0x75, - 0x73, 0x69, 0x76, 0x65, 0x5f, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0d, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x10, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d, 0x69, 0x6e, - 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x61, 0x78, 0x5f, 0x6c, 0x65, 0x6e, 0x67, - 0x74, 0x68, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x61, 0x78, 0x4c, 0x65, 0x6e, - 0x67, 0x74, 0x68, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x69, 0x6e, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, - 0x68, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x69, 0x6e, 0x4c, 0x65, 0x6e, 0x67, - 0x74, 0x68, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x18, 0x10, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x12, 0x1b, 0x0a, 0x09, - 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x11, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x08, 0x6d, 0x61, 0x78, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x69, 0x6e, - 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x12, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x69, - 0x6e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, - 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x13, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x75, 0x6e, - 0x69, 0x71, 0x75, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x23, 0x0a, 0x04, 0x65, 0x6e, 0x75, - 0x6d, 0x18, 0x14, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x04, 0x65, 0x6e, 0x75, 0x6d, 0x12, 0x1f, - 0x0a, 0x0b, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x6f, 0x66, 0x18, 0x15, 0x20, - 0x01, 0x28, 0x01, 0x52, 0x0a, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x4f, 0x66, 0x12, - 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, - 0x69, 0x6f, 0x6e, 0x18, 0x16, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, - 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, - 0x22, 0x57, 0x0a, 0x07, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x4c, 0x0a, 0x15, 0x61, - 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, - 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6f, 0x70, 0x65, - 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x48, 0x65, 0x61, - 0x64, 0x65, 0x72, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, - 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0xa1, 0x02, 0x0a, 0x04, 0x49, 0x6e, - 0x66, 0x6f, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x28, 0x0a, 0x10, 0x74, 0x65, 0x72, 0x6d, 0x73, 0x5f, 0x6f, 0x66, - 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, - 0x74, 0x65, 0x72, 0x6d, 0x73, 0x4f, 0x66, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x2d, - 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x13, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x43, 0x6f, 0x6e, - 0x74, 0x61, 0x63, 0x74, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x12, 0x2d, 0x0a, - 0x07, 0x6c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, - 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4c, 0x69, 0x63, 0x65, - 0x6e, 0x73, 0x65, 0x52, 0x07, 0x6c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x10, - 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, - 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, - 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x37, 0x0a, - 0x09, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x2a, 0x0a, 0x06, 0x73, 0x63, - 0x68, 0x65, 0x6d, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6f, 0x70, 0x65, - 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x06, - 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x22, 0x44, 0x0a, 0x0d, 0x4a, 0x73, 0x6f, 0x6e, 0x52, 0x65, - 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x11, 0x0a, 0x04, 0x5f, 0x72, 0x65, 0x66, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x52, 0x65, 0x66, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, - 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x70, 0x0a, 0x07, - 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, - 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x3f, 0x0a, - 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, - 0x6e, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, - 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x45, - 0x0a, 0x08, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x25, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, - 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x4b, 0x0a, 0x0b, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x48, 0x65, - 0x61, 0x64, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x28, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x22, 0x51, 0x0a, 0x0e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x65, 0x74, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2b, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x4f, 0x0a, 0x0d, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x50, 0x61, - 0x74, 0x68, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x61, 0x74, 0x68, 0x49, 0x74, 0x65, 0x6d, 0x52, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x4f, 0x0a, 0x0d, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, - 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x59, 0x0a, 0x12, 0x4e, 0x61, 0x6d, 0x65, 0x64, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x12, 0x0a, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x12, 0x2f, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x19, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x22, 0x4b, 0x0a, 0x0b, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x63, 0x68, 0x65, 0x6d, - 0x61, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x28, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x32, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, - 0x6d, 0x0a, 0x1c, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, - 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x12, - 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x12, 0x39, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, - 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x37, - 0x0a, 0x0b, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x12, 0x0a, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x55, 0x0a, 0x10, 0x4e, 0x61, 0x6d, 0x65, 0x64, - 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x41, 0x72, 0x72, 0x61, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, - 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, - 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x74, 0x72, 0x69, - 0x6e, 0x67, 0x41, 0x72, 0x72, 0x61, 0x79, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xb5, - 0x03, 0x0a, 0x10, 0x4e, 0x6f, 0x6e, 0x42, 0x6f, 0x64, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, - 0x74, 0x65, 0x72, 0x12, 0x65, 0x0a, 0x1b, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x70, 0x61, - 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x5f, 0x73, 0x75, 0x62, 0x5f, 0x73, 0x63, 0x68, 0x65, - 0x6d, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x48, 0x00, - 0x52, 0x18, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, - 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x6c, 0x0a, 0x1e, 0x66, 0x6f, - 0x72, 0x6d, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, - 0x72, 0x5f, 0x73, 0x75, 0x62, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, - 0x46, 0x6f, 0x72, 0x6d, 0x44, 0x61, 0x74, 0x61, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, - 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x48, 0x00, 0x52, 0x1a, 0x66, 0x6f, - 0x72, 0x6d, 0x44, 0x61, 0x74, 0x61, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53, - 0x75, 0x62, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x62, 0x0a, 0x1a, 0x71, 0x75, 0x65, 0x72, - 0x79, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x5f, 0x73, 0x75, 0x62, 0x5f, - 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, - 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, - 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68, 0x65, 0x6d, - 0x61, 0x48, 0x00, 0x52, 0x17, 0x71, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, - 0x74, 0x65, 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x5f, 0x0a, 0x19, - 0x70, 0x61, 0x74, 0x68, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x5f, 0x73, - 0x75, 0x62, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x22, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x61, 0x74, - 0x68, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68, - 0x65, 0x6d, 0x61, 0x48, 0x00, 0x52, 0x16, 0x70, 0x61, 0x74, 0x68, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x65, 0x74, 0x65, 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x42, 0x07, 0x0a, - 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x22, 0xa1, 0x02, 0x0a, 0x18, 0x4f, 0x61, 0x75, 0x74, 0x68, - 0x32, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x53, 0x65, 0x63, 0x75, 0x72, - 0x69, 0x74, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x6c, 0x6f, 0x77, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x66, 0x6c, 0x6f, 0x77, 0x12, 0x30, 0x0a, 0x06, 0x73, - 0x63, 0x6f, 0x70, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6f, 0x70, - 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x53, - 0x63, 0x6f, 0x70, 0x65, 0x73, 0x52, 0x06, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x12, 0x2b, 0x0a, - 0x11, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x75, - 0x72, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, - 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x55, 0x72, 0x6c, 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x6f, - 0x6b, 0x65, 0x6e, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, - 0x6f, 0x6b, 0x65, 0x6e, 0x55, 0x72, 0x6c, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, - 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, - 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, - 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, - 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xf5, 0x01, 0x0a, 0x19, 0x4f, - 0x61, 0x75, 0x74, 0x68, 0x32, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, - 0x66, 0x6c, 0x6f, 0x77, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x66, 0x6c, 0x6f, 0x77, - 0x12, 0x30, 0x0a, 0x06, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x18, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f, 0x61, - 0x75, 0x74, 0x68, 0x32, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x52, 0x06, 0x73, 0x63, 0x6f, 0x70, - 0x65, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x75, 0x72, 0x6c, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x55, 0x72, 0x6c, 0x12, - 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, - 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, - 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, - 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, - 0x6f, 0x6e, 0x22, 0x82, 0x02, 0x0a, 0x16, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x49, 0x6d, 0x70, - 0x6c, 0x69, 0x63, 0x69, 0x74, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x12, 0x12, 0x0a, - 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, - 0x65, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x6c, 0x6f, 0x77, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x66, 0x6c, 0x6f, 0x77, 0x12, 0x30, 0x0a, 0x06, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x32, 0x2e, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x52, - 0x06, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x61, 0x75, 0x74, 0x68, 0x6f, - 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x10, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x55, 0x72, 0x6c, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, - 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, - 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, - 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xf2, 0x01, 0x0a, 0x16, 0x4f, 0x61, 0x75, 0x74, - 0x68, 0x32, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, - 0x74, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x6c, 0x6f, 0x77, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x66, 0x6c, 0x6f, 0x77, 0x12, 0x30, 0x0a, 0x06, 0x73, 0x63, - 0x6f, 0x70, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6f, 0x70, 0x65, - 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x53, 0x63, - 0x6f, 0x70, 0x65, 0x73, 0x52, 0x06, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x12, 0x1b, 0x0a, 0x09, - 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x08, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x55, 0x72, 0x6c, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, - 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3f, 0x0a, 0x10, 0x76, - 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, - 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, - 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x5c, 0x0a, 0x0c, - 0x4f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x12, 0x4c, 0x0a, 0x15, - 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, - 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6f, 0x70, - 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x74, - 0x72, 0x69, 0x6e, 0x67, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, - 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x9e, 0x04, 0x0a, 0x09, 0x4f, - 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x74, 0x61, 0x67, 0x73, 0x12, 0x18, 0x0a, 0x07, - 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, - 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3d, 0x0a, 0x0d, 0x65, 0x78, 0x74, 0x65, - 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x64, 0x6f, 0x63, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x18, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x45, 0x78, 0x74, - 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x52, 0x0c, 0x65, 0x78, 0x74, 0x65, 0x72, - 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x6f, 0x70, 0x65, 0x72, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6f, - 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, - 0x6f, 0x64, 0x75, 0x63, 0x65, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x70, 0x72, - 0x6f, 0x64, 0x75, 0x63, 0x65, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, - 0x65, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, - 0x65, 0x73, 0x12, 0x3a, 0x0a, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, - 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x49, 0x74, - 0x65, 0x6d, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x12, 0x33, - 0x0a, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x52, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x73, 0x18, 0x0a, - 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x73, 0x12, 0x1e, 0x0a, - 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x0b, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x3b, 0x0a, - 0x08, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x1f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x65, 0x63, - 0x75, 0x72, 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x52, 0x08, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, - 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x0d, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, - 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xa6, 0x01, 0x0a, 0x09, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x42, 0x0a, 0x0e, 0x62, 0x6f, 0x64, - 0x79, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x19, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x42, - 0x6f, 0x64, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x48, 0x00, 0x52, 0x0d, - 0x62, 0x6f, 0x64, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x4c, 0x0a, - 0x12, 0x6e, 0x6f, 0x6e, 0x5f, 0x62, 0x6f, 0x64, 0x79, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, - 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6f, 0x70, 0x65, 0x6e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x6f, 0x6e, 0x42, 0x6f, 0x64, 0x79, 0x50, 0x61, - 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x48, 0x00, 0x52, 0x10, 0x6e, 0x6f, 0x6e, 0x42, 0x6f, - 0x64, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x42, 0x07, 0x0a, 0x05, 0x6f, - 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x67, 0x0a, 0x14, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, - 0x72, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x4f, 0x0a, 0x15, - 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, - 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6f, 0x70, - 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x50, 0x61, - 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, - 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x94, 0x01, - 0x0a, 0x0e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x49, 0x74, 0x65, 0x6d, - 0x12, 0x35, 0x0a, 0x09, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, - 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x48, 0x00, 0x52, 0x09, 0x70, 0x61, - 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x42, 0x0a, 0x0e, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, - 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x19, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4a, 0x73, 0x6f, - 0x6e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x48, 0x00, 0x52, 0x0d, 0x6a, 0x73, - 0x6f, 0x6e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x6f, - 0x6e, 0x65, 0x6f, 0x66, 0x22, 0xcf, 0x03, 0x0a, 0x08, 0x50, 0x61, 0x74, 0x68, 0x49, 0x74, 0x65, - 0x6d, 0x12, 0x11, 0x0a, 0x04, 0x5f, 0x72, 0x65, 0x66, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x03, 0x52, 0x65, 0x66, 0x12, 0x27, 0x0a, 0x03, 0x67, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f, - 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x03, 0x67, 0x65, 0x74, 0x12, 0x27, 0x0a, - 0x03, 0x70, 0x75, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, - 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x52, 0x03, 0x70, 0x75, 0x74, 0x12, 0x29, 0x0a, 0x04, 0x70, 0x6f, 0x73, 0x74, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x32, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x04, 0x70, 0x6f, 0x73, - 0x74, 0x12, 0x2d, 0x0a, 0x06, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f, - 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, - 0x12, 0x2f, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f, - 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x12, 0x29, 0x0a, 0x04, 0x68, 0x65, 0x61, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f, 0x70, 0x65, - 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x04, 0x68, 0x65, 0x61, 0x64, 0x12, 0x2b, 0x0a, 0x05, - 0x70, 0x61, 0x74, 0x63, 0x68, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, - 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x52, 0x05, 0x70, 0x61, 0x74, 0x63, 0x68, 0x12, 0x3a, 0x0a, 0x0a, 0x70, 0x61, 0x72, - 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, - 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x65, 0x74, 0x65, 0x72, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, - 0x65, 0x74, 0x65, 0x72, 0x73, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, - 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, - 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, - 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xfb, 0x05, 0x0a, 0x16, 0x50, 0x61, 0x74, 0x68, 0x50, - 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68, 0x65, 0x6d, - 0x61, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x0e, 0x0a, - 0x02, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x6e, 0x12, 0x20, 0x0a, - 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, - 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, - 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, - 0x31, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, - 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x72, 0x69, 0x6d, - 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x52, 0x05, 0x69, 0x74, 0x65, - 0x6d, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, - 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, - 0x29, 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, - 0x79, 0x52, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x61, - 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x6d, 0x61, 0x78, - 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, - 0x65, 0x5f, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x10, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d, 0x61, 0x78, 0x69, 0x6d, 0x75, - 0x6d, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0c, 0x20, 0x01, - 0x28, 0x01, 0x52, 0x07, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, - 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, - 0x18, 0x0d, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, - 0x65, 0x4d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x61, 0x78, 0x5f, - 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x61, - 0x78, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x69, 0x6e, 0x5f, 0x6c, - 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x69, 0x6e, - 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x18, 0x10, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, - 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x11, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x1b, 0x0a, - 0x09, 0x6d, 0x69, 0x6e, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x12, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x08, 0x6d, 0x69, 0x6e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x75, 0x6e, - 0x69, 0x71, 0x75, 0x65, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x13, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x0b, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x23, 0x0a, - 0x04, 0x65, 0x6e, 0x75, 0x6d, 0x18, 0x14, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, - 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x04, 0x65, 0x6e, - 0x75, 0x6d, 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x6f, - 0x66, 0x18, 0x15, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0a, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, - 0x65, 0x4f, 0x66, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, - 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x16, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, - 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, - 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, - 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x77, 0x0a, 0x05, 0x50, 0x61, 0x74, 0x68, 0x73, 0x12, 0x3f, 0x0a, - 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, - 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, - 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2d, - 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6f, - 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x50, - 0x61, 0x74, 0x68, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x22, 0x92, 0x05, - 0x0a, 0x0f, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x49, 0x74, 0x65, 0x6d, - 0x73, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x31, 0x0a, - 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6f, - 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, - 0x69, 0x76, 0x65, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, - 0x12, 0x2b, 0x0a, 0x11, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x66, - 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, 0x6f, 0x6c, - 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x29, 0x0a, - 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, - 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, - 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x61, 0x78, 0x69, - 0x6d, 0x75, 0x6d, 0x18, 0x06, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d, - 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, - 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65, - 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x12, - 0x18, 0x0a, 0x07, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x08, 0x20, 0x01, 0x28, 0x01, - 0x52, 0x07, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63, - 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x09, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d, - 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x61, 0x78, 0x5f, 0x6c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x61, 0x78, 0x4c, - 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x69, 0x6e, 0x5f, 0x6c, 0x65, 0x6e, - 0x67, 0x74, 0x68, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x69, 0x6e, 0x4c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x18, - 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x12, 0x1b, - 0x0a, 0x09, 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x0d, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6d, - 0x69, 0x6e, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, - 0x6d, 0x69, 0x6e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x75, 0x6e, 0x69, 0x71, - 0x75, 0x65, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, - 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x23, 0x0a, 0x04, 0x65, - 0x6e, 0x75, 0x6d, 0x18, 0x10, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x04, 0x65, 0x6e, 0x75, 0x6d, - 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x6f, 0x66, 0x18, - 0x11, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0a, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x4f, - 0x66, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, - 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x12, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, - 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, - 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, - 0x6f, 0x6e, 0x22, 0x5a, 0x0a, 0x0a, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, - 0x12, 0x4c, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, - 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x17, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, - 0x65, 0x64, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, - 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0xa8, - 0x06, 0x0a, 0x17, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, - 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, - 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, - 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x02, 0x69, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x11, - 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x5f, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x45, 0x6d, - 0x70, 0x74, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, - 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x6f, - 0x72, 0x6d, 0x61, 0x74, 0x12, 0x31, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x08, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, - 0x2e, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x73, - 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x63, 0x6f, 0x6c, 0x6c, 0x65, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x09, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x10, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x6f, - 0x72, 0x6d, 0x61, 0x74, 0x12, 0x29, 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, - 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, - 0x18, 0x0a, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x01, - 0x52, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63, - 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0c, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d, - 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, - 0x6d, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, - 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, 0x6d, 0x69, - 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65, 0x78, 0x63, - 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x1d, 0x0a, - 0x0a, 0x6d, 0x61, 0x78, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x0f, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x09, 0x6d, 0x61, 0x78, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x1d, 0x0a, 0x0a, - 0x6d, 0x69, 0x6e, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x10, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x09, 0x6d, 0x69, 0x6e, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x18, 0x0a, 0x07, 0x70, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x18, 0x11, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x74, 0x65, - 0x6d, 0x73, 0x18, 0x12, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x49, 0x74, 0x65, - 0x6d, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x69, 0x6e, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, - 0x13, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x69, 0x6e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, - 0x21, 0x0a, 0x0c, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, - 0x14, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x49, 0x74, 0x65, - 0x6d, 0x73, 0x12, 0x23, 0x0a, 0x04, 0x65, 0x6e, 0x75, 0x6d, 0x18, 0x15, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, - 0x79, 0x52, 0x04, 0x65, 0x6e, 0x75, 0x6d, 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x75, 0x6c, 0x74, 0x69, - 0x70, 0x6c, 0x65, 0x5f, 0x6f, 0x66, 0x18, 0x16, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0a, 0x6d, 0x75, - 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x4f, 0x66, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, - 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x17, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, - 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, - 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xfe, 0x01, 0x0a, 0x08, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2e, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, - 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x49, 0x74, 0x65, 0x6d, - 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x2d, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, - 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6f, 0x70, 0x65, 0x6e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x52, 0x07, - 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x30, 0x0a, 0x08, 0x65, 0x78, 0x61, 0x6d, 0x70, - 0x6c, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x52, - 0x08, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, - 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, - 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, - 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x65, 0x0a, 0x13, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x12, 0x4e, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, - 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x19, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, - 0x6d, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x14, 0x61, 0x64, 0x64, - 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, - 0x73, 0x22, 0x90, 0x01, 0x0a, 0x0d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x12, 0x32, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x32, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x08, 0x72, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x42, 0x0a, 0x0e, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, - 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x19, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4a, 0x73, 0x6f, - 0x6e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x48, 0x00, 0x52, 0x0d, 0x6a, 0x73, - 0x6f, 0x6e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x6f, - 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x91, 0x01, 0x0a, 0x09, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x73, 0x12, 0x43, 0x0a, 0x0d, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x63, - 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6f, 0x70, 0x65, 0x6e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0c, 0x72, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, - 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, - 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, - 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xaf, 0x09, 0x0a, 0x06, 0x53, 0x63, 0x68, - 0x65, 0x6d, 0x61, 0x12, 0x11, 0x0a, 0x04, 0x5f, 0x72, 0x65, 0x66, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x03, 0x52, 0x65, 0x66, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x14, - 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, - 0x69, 0x74, 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x29, 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, - 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, - 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x6f, 0x66, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0a, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, - 0x4f, 0x66, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x07, 0x20, - 0x01, 0x28, 0x01, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, - 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, - 0x6d, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, - 0x76, 0x65, 0x4d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x69, 0x6e, - 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x09, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x6d, 0x69, 0x6e, 0x69, - 0x6d, 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, - 0x5f, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, - 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, - 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x61, 0x78, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x0b, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x61, 0x78, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, - 0x1d, 0x0a, 0x0a, 0x6d, 0x69, 0x6e, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x0c, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x69, 0x6e, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x18, - 0x0a, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x78, 0x5f, - 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x61, 0x78, - 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x69, 0x6e, 0x5f, 0x69, 0x74, 0x65, - 0x6d, 0x73, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x69, 0x6e, 0x49, 0x74, 0x65, - 0x6d, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x5f, 0x69, 0x74, 0x65, - 0x6d, 0x73, 0x18, 0x10, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, - 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x72, 0x6f, - 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x11, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x6d, - 0x61, 0x78, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x12, 0x25, 0x0a, 0x0e, - 0x6d, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x12, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x6d, 0x69, 0x6e, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, - 0x69, 0x65, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, - 0x13, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, - 0x23, 0x0a, 0x04, 0x65, 0x6e, 0x75, 0x6d, 0x18, 0x14, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, - 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x04, - 0x65, 0x6e, 0x75, 0x6d, 0x12, 0x59, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, - 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x15, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, - 0x2e, 0x41, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, - 0x72, 0x74, 0x69, 0x65, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, - 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x12, - 0x28, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x16, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, - 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x49, - 0x74, 0x65, 0x6d, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x2b, 0x0a, 0x05, 0x69, 0x74, 0x65, - 0x6d, 0x73, 0x18, 0x17, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x52, - 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x29, 0x0a, 0x06, 0x61, 0x6c, 0x6c, 0x5f, 0x6f, 0x66, - 0x18, 0x18, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x05, 0x61, 0x6c, 0x6c, 0x4f, - 0x66, 0x12, 0x36, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, - 0x19, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x32, 0x2e, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x52, 0x0a, 0x70, - 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x0d, 0x64, 0x69, 0x73, - 0x63, 0x72, 0x69, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x1a, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0d, 0x64, 0x69, 0x73, 0x63, 0x72, 0x69, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x12, - 0x1b, 0x0a, 0x09, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x1b, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x61, 0x64, 0x4f, 0x6e, 0x6c, 0x79, 0x12, 0x21, 0x0a, 0x03, - 0x78, 0x6d, 0x6c, 0x18, 0x1c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x58, 0x6d, 0x6c, 0x52, 0x03, 0x78, 0x6d, 0x6c, 0x12, - 0x3d, 0x0a, 0x0d, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x64, 0x6f, 0x63, 0x73, - 0x18, 0x1d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x32, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, - 0x52, 0x0c, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x12, 0x29, - 0x0a, 0x07, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, - 0x52, 0x07, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, - 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x1f, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, - 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, - 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x7e, 0x0a, 0x0a, 0x53, 0x63, - 0x68, 0x65, 0x6d, 0x61, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x2c, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, - 0x6d, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x48, 0x00, 0x52, 0x06, - 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x39, 0x0a, 0x0b, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x73, - 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6f, 0x70, - 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x63, 0x68, - 0x65, 0x6d, 0x61, 0x48, 0x00, 0x52, 0x0a, 0x66, 0x69, 0x6c, 0x65, 0x53, 0x63, 0x68, 0x65, 0x6d, - 0x61, 0x42, 0x07, 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x74, 0x0a, 0x13, 0x53, 0x65, - 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x12, 0x5d, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, - 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x28, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, - 0x6d, 0x65, 0x64, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x44, 0x65, 0x66, 0x69, 0x6e, - 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, - 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, - 0x22, 0xe9, 0x04, 0x0a, 0x17, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x44, 0x65, 0x66, - 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x6d, 0x0a, 0x1d, - 0x62, 0x61, 0x73, 0x69, 0x63, 0x5f, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, - 0x2e, 0x42, 0x61, 0x73, 0x69, 0x63, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x48, 0x00, 0x52, 0x1b, - 0x62, 0x61, 0x73, 0x69, 0x63, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x12, 0x46, 0x0a, 0x10, 0x61, - 0x70, 0x69, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x32, 0x2e, 0x41, 0x70, 0x69, 0x4b, 0x65, 0x79, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, - 0x79, 0x48, 0x00, 0x52, 0x0e, 0x61, 0x70, 0x69, 0x4b, 0x65, 0x79, 0x53, 0x65, 0x63, 0x75, 0x72, - 0x69, 0x74, 0x79, 0x12, 0x5e, 0x0a, 0x18, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x5f, 0x69, 0x6d, - 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x5f, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x32, 0x2e, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x49, 0x6d, 0x70, 0x6c, 0x69, 0x63, 0x69, - 0x74, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x48, 0x00, 0x52, 0x16, 0x6f, 0x61, 0x75, - 0x74, 0x68, 0x32, 0x49, 0x6d, 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x53, 0x65, 0x63, 0x75, 0x72, - 0x69, 0x74, 0x79, 0x12, 0x5e, 0x0a, 0x18, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x5f, 0x70, 0x61, - 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x5f, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x32, 0x2e, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, - 0x64, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x48, 0x00, 0x52, 0x16, 0x6f, 0x61, 0x75, - 0x74, 0x68, 0x32, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x53, 0x65, 0x63, 0x75, 0x72, - 0x69, 0x74, 0x79, 0x12, 0x67, 0x0a, 0x1b, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x5f, 0x61, 0x70, - 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, - 0x74, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x41, 0x70, 0x70, 0x6c, - 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x48, - 0x00, 0x52, 0x19, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x12, 0x65, 0x0a, 0x1b, - 0x6f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x5f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x63, 0x6f, - 0x64, 0x65, 0x5f, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f, - 0x61, 0x75, 0x74, 0x68, 0x32, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x53, - 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x48, 0x00, 0x52, 0x18, 0x6f, 0x61, 0x75, 0x74, 0x68, - 0x32, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x53, 0x65, 0x63, 0x75, 0x72, - 0x69, 0x74, 0x79, 0x42, 0x07, 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x68, 0x0a, 0x13, - 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x12, 0x51, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, - 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, - 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x41, 0x72, 0x72, 0x61, 0x79, - 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, - 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x23, 0x0a, 0x0b, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, - 0x41, 0x72, 0x72, 0x61, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xbb, 0x01, 0x0a, 0x03, - 0x54, 0x61, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, - 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3d, 0x0a, 0x0d, 0x65, 0x78, 0x74, - 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x64, 0x6f, 0x63, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x18, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x45, 0x78, - 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x52, 0x0c, 0x65, 0x78, 0x74, 0x65, - 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, - 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, - 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, - 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x20, 0x0a, 0x08, 0x54, 0x79, 0x70, - 0x65, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x5c, 0x0a, 0x0f, 0x56, - 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x49, - 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, - 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, - 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, - 0x41, 0x6e, 0x79, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, - 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0xc8, 0x01, 0x0a, 0x03, 0x58, 0x6d, - 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, - 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, - 0x61, 0x63, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x1c, 0x0a, 0x09, 0x61, - 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, - 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x77, 0x72, 0x61, - 0x70, 0x70, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x77, 0x72, 0x61, 0x70, - 0x70, 0x65, 0x64, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, - 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, - 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, - 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, - 0x73, 0x69, 0x6f, 0x6e, 0x42, 0x3e, 0x0a, 0x0e, 0x6f, 0x72, 0x67, 0x2e, 0x6f, 0x70, 0x65, 0x6e, - 0x61, 0x70, 0x69, 0x5f, 0x76, 0x32, 0x42, 0x0c, 0x4f, 0x70, 0x65, 0x6e, 0x41, 0x50, 0x49, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x16, 0x2e, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, - 0x69, 0x76, 0x32, 0x3b, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x5f, 0x76, 0x32, 0xa2, 0x02, - 0x03, 0x4f, 0x41, 0x53, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_openapiv2_OpenAPIv2_proto_rawDescOnce sync.Once - file_openapiv2_OpenAPIv2_proto_rawDescData = file_openapiv2_OpenAPIv2_proto_rawDesc -) - -func file_openapiv2_OpenAPIv2_proto_rawDescGZIP() []byte { - file_openapiv2_OpenAPIv2_proto_rawDescOnce.Do(func() { - file_openapiv2_OpenAPIv2_proto_rawDescData = protoimpl.X.CompressGZIP(file_openapiv2_OpenAPIv2_proto_rawDescData) - }) - return file_openapiv2_OpenAPIv2_proto_rawDescData -} - -var file_openapiv2_OpenAPIv2_proto_msgTypes = make([]protoimpl.MessageInfo, 60) -var file_openapiv2_OpenAPIv2_proto_goTypes = []interface{}{ - (*AdditionalPropertiesItem)(nil), // 0: openapi.v2.AdditionalPropertiesItem - (*Any)(nil), // 1: openapi.v2.Any - (*ApiKeySecurity)(nil), // 2: openapi.v2.ApiKeySecurity - (*BasicAuthenticationSecurity)(nil), // 3: openapi.v2.BasicAuthenticationSecurity - (*BodyParameter)(nil), // 4: openapi.v2.BodyParameter - (*Contact)(nil), // 5: openapi.v2.Contact - (*Default)(nil), // 6: openapi.v2.Default - (*Definitions)(nil), // 7: openapi.v2.Definitions - (*Document)(nil), // 8: openapi.v2.Document - (*Examples)(nil), // 9: openapi.v2.Examples - (*ExternalDocs)(nil), // 10: openapi.v2.ExternalDocs - (*FileSchema)(nil), // 11: openapi.v2.FileSchema - (*FormDataParameterSubSchema)(nil), // 12: openapi.v2.FormDataParameterSubSchema - (*Header)(nil), // 13: openapi.v2.Header - (*HeaderParameterSubSchema)(nil), // 14: openapi.v2.HeaderParameterSubSchema - (*Headers)(nil), // 15: openapi.v2.Headers - (*Info)(nil), // 16: openapi.v2.Info - (*ItemsItem)(nil), // 17: openapi.v2.ItemsItem - (*JsonReference)(nil), // 18: openapi.v2.JsonReference - (*License)(nil), // 19: openapi.v2.License - (*NamedAny)(nil), // 20: openapi.v2.NamedAny - (*NamedHeader)(nil), // 21: openapi.v2.NamedHeader - (*NamedParameter)(nil), // 22: openapi.v2.NamedParameter - (*NamedPathItem)(nil), // 23: openapi.v2.NamedPathItem - (*NamedResponse)(nil), // 24: openapi.v2.NamedResponse - (*NamedResponseValue)(nil), // 25: openapi.v2.NamedResponseValue - (*NamedSchema)(nil), // 26: openapi.v2.NamedSchema - (*NamedSecurityDefinitionsItem)(nil), // 27: openapi.v2.NamedSecurityDefinitionsItem - (*NamedString)(nil), // 28: openapi.v2.NamedString - (*NamedStringArray)(nil), // 29: openapi.v2.NamedStringArray - (*NonBodyParameter)(nil), // 30: openapi.v2.NonBodyParameter - (*Oauth2AccessCodeSecurity)(nil), // 31: openapi.v2.Oauth2AccessCodeSecurity - (*Oauth2ApplicationSecurity)(nil), // 32: openapi.v2.Oauth2ApplicationSecurity - (*Oauth2ImplicitSecurity)(nil), // 33: openapi.v2.Oauth2ImplicitSecurity - (*Oauth2PasswordSecurity)(nil), // 34: openapi.v2.Oauth2PasswordSecurity - (*Oauth2Scopes)(nil), // 35: openapi.v2.Oauth2Scopes - (*Operation)(nil), // 36: openapi.v2.Operation - (*Parameter)(nil), // 37: openapi.v2.Parameter - (*ParameterDefinitions)(nil), // 38: openapi.v2.ParameterDefinitions - (*ParametersItem)(nil), // 39: openapi.v2.ParametersItem - (*PathItem)(nil), // 40: openapi.v2.PathItem - (*PathParameterSubSchema)(nil), // 41: openapi.v2.PathParameterSubSchema - (*Paths)(nil), // 42: openapi.v2.Paths - (*PrimitivesItems)(nil), // 43: openapi.v2.PrimitivesItems - (*Properties)(nil), // 44: openapi.v2.Properties - (*QueryParameterSubSchema)(nil), // 45: openapi.v2.QueryParameterSubSchema - (*Response)(nil), // 46: openapi.v2.Response - (*ResponseDefinitions)(nil), // 47: openapi.v2.ResponseDefinitions - (*ResponseValue)(nil), // 48: openapi.v2.ResponseValue - (*Responses)(nil), // 49: openapi.v2.Responses - (*Schema)(nil), // 50: openapi.v2.Schema - (*SchemaItem)(nil), // 51: openapi.v2.SchemaItem - (*SecurityDefinitions)(nil), // 52: openapi.v2.SecurityDefinitions - (*SecurityDefinitionsItem)(nil), // 53: openapi.v2.SecurityDefinitionsItem - (*SecurityRequirement)(nil), // 54: openapi.v2.SecurityRequirement - (*StringArray)(nil), // 55: openapi.v2.StringArray - (*Tag)(nil), // 56: openapi.v2.Tag - (*TypeItem)(nil), // 57: openapi.v2.TypeItem - (*VendorExtension)(nil), // 58: openapi.v2.VendorExtension - (*Xml)(nil), // 59: openapi.v2.Xml - (*anypb.Any)(nil), // 60: google.protobuf.Any -} -var file_openapiv2_OpenAPIv2_proto_depIdxs = []int32{ - 50, // 0: openapi.v2.AdditionalPropertiesItem.schema:type_name -> openapi.v2.Schema - 60, // 1: openapi.v2.Any.value:type_name -> google.protobuf.Any - 20, // 2: openapi.v2.ApiKeySecurity.vendor_extension:type_name -> openapi.v2.NamedAny - 20, // 3: openapi.v2.BasicAuthenticationSecurity.vendor_extension:type_name -> openapi.v2.NamedAny - 50, // 4: openapi.v2.BodyParameter.schema:type_name -> openapi.v2.Schema - 20, // 5: openapi.v2.BodyParameter.vendor_extension:type_name -> openapi.v2.NamedAny - 20, // 6: openapi.v2.Contact.vendor_extension:type_name -> openapi.v2.NamedAny - 20, // 7: openapi.v2.Default.additional_properties:type_name -> openapi.v2.NamedAny - 26, // 8: openapi.v2.Definitions.additional_properties:type_name -> openapi.v2.NamedSchema - 16, // 9: openapi.v2.Document.info:type_name -> openapi.v2.Info - 42, // 10: openapi.v2.Document.paths:type_name -> openapi.v2.Paths - 7, // 11: openapi.v2.Document.definitions:type_name -> openapi.v2.Definitions - 38, // 12: openapi.v2.Document.parameters:type_name -> openapi.v2.ParameterDefinitions - 47, // 13: openapi.v2.Document.responses:type_name -> openapi.v2.ResponseDefinitions - 54, // 14: openapi.v2.Document.security:type_name -> openapi.v2.SecurityRequirement - 52, // 15: openapi.v2.Document.security_definitions:type_name -> openapi.v2.SecurityDefinitions - 56, // 16: openapi.v2.Document.tags:type_name -> openapi.v2.Tag - 10, // 17: openapi.v2.Document.external_docs:type_name -> openapi.v2.ExternalDocs - 20, // 18: openapi.v2.Document.vendor_extension:type_name -> openapi.v2.NamedAny - 20, // 19: openapi.v2.Examples.additional_properties:type_name -> openapi.v2.NamedAny - 20, // 20: openapi.v2.ExternalDocs.vendor_extension:type_name -> openapi.v2.NamedAny - 1, // 21: openapi.v2.FileSchema.default:type_name -> openapi.v2.Any - 10, // 22: openapi.v2.FileSchema.external_docs:type_name -> openapi.v2.ExternalDocs - 1, // 23: openapi.v2.FileSchema.example:type_name -> openapi.v2.Any - 20, // 24: openapi.v2.FileSchema.vendor_extension:type_name -> openapi.v2.NamedAny - 43, // 25: openapi.v2.FormDataParameterSubSchema.items:type_name -> openapi.v2.PrimitivesItems - 1, // 26: openapi.v2.FormDataParameterSubSchema.default:type_name -> openapi.v2.Any - 1, // 27: openapi.v2.FormDataParameterSubSchema.enum:type_name -> openapi.v2.Any - 20, // 28: openapi.v2.FormDataParameterSubSchema.vendor_extension:type_name -> openapi.v2.NamedAny - 43, // 29: openapi.v2.Header.items:type_name -> openapi.v2.PrimitivesItems - 1, // 30: openapi.v2.Header.default:type_name -> openapi.v2.Any - 1, // 31: openapi.v2.Header.enum:type_name -> openapi.v2.Any - 20, // 32: openapi.v2.Header.vendor_extension:type_name -> openapi.v2.NamedAny - 43, // 33: openapi.v2.HeaderParameterSubSchema.items:type_name -> openapi.v2.PrimitivesItems - 1, // 34: openapi.v2.HeaderParameterSubSchema.default:type_name -> openapi.v2.Any - 1, // 35: openapi.v2.HeaderParameterSubSchema.enum:type_name -> openapi.v2.Any - 20, // 36: openapi.v2.HeaderParameterSubSchema.vendor_extension:type_name -> openapi.v2.NamedAny - 21, // 37: openapi.v2.Headers.additional_properties:type_name -> openapi.v2.NamedHeader - 5, // 38: openapi.v2.Info.contact:type_name -> openapi.v2.Contact - 19, // 39: openapi.v2.Info.license:type_name -> openapi.v2.License - 20, // 40: openapi.v2.Info.vendor_extension:type_name -> openapi.v2.NamedAny - 50, // 41: openapi.v2.ItemsItem.schema:type_name -> openapi.v2.Schema - 20, // 42: openapi.v2.License.vendor_extension:type_name -> openapi.v2.NamedAny - 1, // 43: openapi.v2.NamedAny.value:type_name -> openapi.v2.Any - 13, // 44: openapi.v2.NamedHeader.value:type_name -> openapi.v2.Header - 37, // 45: openapi.v2.NamedParameter.value:type_name -> openapi.v2.Parameter - 40, // 46: openapi.v2.NamedPathItem.value:type_name -> openapi.v2.PathItem - 46, // 47: openapi.v2.NamedResponse.value:type_name -> openapi.v2.Response - 48, // 48: openapi.v2.NamedResponseValue.value:type_name -> openapi.v2.ResponseValue - 50, // 49: openapi.v2.NamedSchema.value:type_name -> openapi.v2.Schema - 53, // 50: openapi.v2.NamedSecurityDefinitionsItem.value:type_name -> openapi.v2.SecurityDefinitionsItem - 55, // 51: openapi.v2.NamedStringArray.value:type_name -> openapi.v2.StringArray - 14, // 52: openapi.v2.NonBodyParameter.header_parameter_sub_schema:type_name -> openapi.v2.HeaderParameterSubSchema - 12, // 53: openapi.v2.NonBodyParameter.form_data_parameter_sub_schema:type_name -> openapi.v2.FormDataParameterSubSchema - 45, // 54: openapi.v2.NonBodyParameter.query_parameter_sub_schema:type_name -> openapi.v2.QueryParameterSubSchema - 41, // 55: openapi.v2.NonBodyParameter.path_parameter_sub_schema:type_name -> openapi.v2.PathParameterSubSchema - 35, // 56: openapi.v2.Oauth2AccessCodeSecurity.scopes:type_name -> openapi.v2.Oauth2Scopes - 20, // 57: openapi.v2.Oauth2AccessCodeSecurity.vendor_extension:type_name -> openapi.v2.NamedAny - 35, // 58: openapi.v2.Oauth2ApplicationSecurity.scopes:type_name -> openapi.v2.Oauth2Scopes - 20, // 59: openapi.v2.Oauth2ApplicationSecurity.vendor_extension:type_name -> openapi.v2.NamedAny - 35, // 60: openapi.v2.Oauth2ImplicitSecurity.scopes:type_name -> openapi.v2.Oauth2Scopes - 20, // 61: openapi.v2.Oauth2ImplicitSecurity.vendor_extension:type_name -> openapi.v2.NamedAny - 35, // 62: openapi.v2.Oauth2PasswordSecurity.scopes:type_name -> openapi.v2.Oauth2Scopes - 20, // 63: openapi.v2.Oauth2PasswordSecurity.vendor_extension:type_name -> openapi.v2.NamedAny - 28, // 64: openapi.v2.Oauth2Scopes.additional_properties:type_name -> openapi.v2.NamedString - 10, // 65: openapi.v2.Operation.external_docs:type_name -> openapi.v2.ExternalDocs - 39, // 66: openapi.v2.Operation.parameters:type_name -> openapi.v2.ParametersItem - 49, // 67: openapi.v2.Operation.responses:type_name -> openapi.v2.Responses - 54, // 68: openapi.v2.Operation.security:type_name -> openapi.v2.SecurityRequirement - 20, // 69: openapi.v2.Operation.vendor_extension:type_name -> openapi.v2.NamedAny - 4, // 70: openapi.v2.Parameter.body_parameter:type_name -> openapi.v2.BodyParameter - 30, // 71: openapi.v2.Parameter.non_body_parameter:type_name -> openapi.v2.NonBodyParameter - 22, // 72: openapi.v2.ParameterDefinitions.additional_properties:type_name -> openapi.v2.NamedParameter - 37, // 73: openapi.v2.ParametersItem.parameter:type_name -> openapi.v2.Parameter - 18, // 74: openapi.v2.ParametersItem.json_reference:type_name -> openapi.v2.JsonReference - 36, // 75: openapi.v2.PathItem.get:type_name -> openapi.v2.Operation - 36, // 76: openapi.v2.PathItem.put:type_name -> openapi.v2.Operation - 36, // 77: openapi.v2.PathItem.post:type_name -> openapi.v2.Operation - 36, // 78: openapi.v2.PathItem.delete:type_name -> openapi.v2.Operation - 36, // 79: openapi.v2.PathItem.options:type_name -> openapi.v2.Operation - 36, // 80: openapi.v2.PathItem.head:type_name -> openapi.v2.Operation - 36, // 81: openapi.v2.PathItem.patch:type_name -> openapi.v2.Operation - 39, // 82: openapi.v2.PathItem.parameters:type_name -> openapi.v2.ParametersItem - 20, // 83: openapi.v2.PathItem.vendor_extension:type_name -> openapi.v2.NamedAny - 43, // 84: openapi.v2.PathParameterSubSchema.items:type_name -> openapi.v2.PrimitivesItems - 1, // 85: openapi.v2.PathParameterSubSchema.default:type_name -> openapi.v2.Any - 1, // 86: openapi.v2.PathParameterSubSchema.enum:type_name -> openapi.v2.Any - 20, // 87: openapi.v2.PathParameterSubSchema.vendor_extension:type_name -> openapi.v2.NamedAny - 20, // 88: openapi.v2.Paths.vendor_extension:type_name -> openapi.v2.NamedAny - 23, // 89: openapi.v2.Paths.path:type_name -> openapi.v2.NamedPathItem - 43, // 90: openapi.v2.PrimitivesItems.items:type_name -> openapi.v2.PrimitivesItems - 1, // 91: openapi.v2.PrimitivesItems.default:type_name -> openapi.v2.Any - 1, // 92: openapi.v2.PrimitivesItems.enum:type_name -> openapi.v2.Any - 20, // 93: openapi.v2.PrimitivesItems.vendor_extension:type_name -> openapi.v2.NamedAny - 26, // 94: openapi.v2.Properties.additional_properties:type_name -> openapi.v2.NamedSchema - 43, // 95: openapi.v2.QueryParameterSubSchema.items:type_name -> openapi.v2.PrimitivesItems - 1, // 96: openapi.v2.QueryParameterSubSchema.default:type_name -> openapi.v2.Any - 1, // 97: openapi.v2.QueryParameterSubSchema.enum:type_name -> openapi.v2.Any - 20, // 98: openapi.v2.QueryParameterSubSchema.vendor_extension:type_name -> openapi.v2.NamedAny - 51, // 99: openapi.v2.Response.schema:type_name -> openapi.v2.SchemaItem - 15, // 100: openapi.v2.Response.headers:type_name -> openapi.v2.Headers - 9, // 101: openapi.v2.Response.examples:type_name -> openapi.v2.Examples - 20, // 102: openapi.v2.Response.vendor_extension:type_name -> openapi.v2.NamedAny - 24, // 103: openapi.v2.ResponseDefinitions.additional_properties:type_name -> openapi.v2.NamedResponse - 46, // 104: openapi.v2.ResponseValue.response:type_name -> openapi.v2.Response - 18, // 105: openapi.v2.ResponseValue.json_reference:type_name -> openapi.v2.JsonReference - 25, // 106: openapi.v2.Responses.response_code:type_name -> openapi.v2.NamedResponseValue - 20, // 107: openapi.v2.Responses.vendor_extension:type_name -> openapi.v2.NamedAny - 1, // 108: openapi.v2.Schema.default:type_name -> openapi.v2.Any - 1, // 109: openapi.v2.Schema.enum:type_name -> openapi.v2.Any - 0, // 110: openapi.v2.Schema.additional_properties:type_name -> openapi.v2.AdditionalPropertiesItem - 57, // 111: openapi.v2.Schema.type:type_name -> openapi.v2.TypeItem - 17, // 112: openapi.v2.Schema.items:type_name -> openapi.v2.ItemsItem - 50, // 113: openapi.v2.Schema.all_of:type_name -> openapi.v2.Schema - 44, // 114: openapi.v2.Schema.properties:type_name -> openapi.v2.Properties - 59, // 115: openapi.v2.Schema.xml:type_name -> openapi.v2.Xml - 10, // 116: openapi.v2.Schema.external_docs:type_name -> openapi.v2.ExternalDocs - 1, // 117: openapi.v2.Schema.example:type_name -> openapi.v2.Any - 20, // 118: openapi.v2.Schema.vendor_extension:type_name -> openapi.v2.NamedAny - 50, // 119: openapi.v2.SchemaItem.schema:type_name -> openapi.v2.Schema - 11, // 120: openapi.v2.SchemaItem.file_schema:type_name -> openapi.v2.FileSchema - 27, // 121: openapi.v2.SecurityDefinitions.additional_properties:type_name -> openapi.v2.NamedSecurityDefinitionsItem - 3, // 122: openapi.v2.SecurityDefinitionsItem.basic_authentication_security:type_name -> openapi.v2.BasicAuthenticationSecurity - 2, // 123: openapi.v2.SecurityDefinitionsItem.api_key_security:type_name -> openapi.v2.ApiKeySecurity - 33, // 124: openapi.v2.SecurityDefinitionsItem.oauth2_implicit_security:type_name -> openapi.v2.Oauth2ImplicitSecurity - 34, // 125: openapi.v2.SecurityDefinitionsItem.oauth2_password_security:type_name -> openapi.v2.Oauth2PasswordSecurity - 32, // 126: openapi.v2.SecurityDefinitionsItem.oauth2_application_security:type_name -> openapi.v2.Oauth2ApplicationSecurity - 31, // 127: openapi.v2.SecurityDefinitionsItem.oauth2_access_code_security:type_name -> openapi.v2.Oauth2AccessCodeSecurity - 29, // 128: openapi.v2.SecurityRequirement.additional_properties:type_name -> openapi.v2.NamedStringArray - 10, // 129: openapi.v2.Tag.external_docs:type_name -> openapi.v2.ExternalDocs - 20, // 130: openapi.v2.Tag.vendor_extension:type_name -> openapi.v2.NamedAny - 20, // 131: openapi.v2.VendorExtension.additional_properties:type_name -> openapi.v2.NamedAny - 20, // 132: openapi.v2.Xml.vendor_extension:type_name -> openapi.v2.NamedAny - 133, // [133:133] is the sub-list for method output_type - 133, // [133:133] is the sub-list for method input_type - 133, // [133:133] is the sub-list for extension type_name - 133, // [133:133] is the sub-list for extension extendee - 0, // [0:133] is the sub-list for field type_name -} - -func init() { file_openapiv2_OpenAPIv2_proto_init() } -func file_openapiv2_OpenAPIv2_proto_init() { - if File_openapiv2_OpenAPIv2_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_openapiv2_OpenAPIv2_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AdditionalPropertiesItem); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Any); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ApiKeySecurity); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BasicAuthenticationSecurity); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BodyParameter); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Contact); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Default); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Definitions); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Document); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Examples); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ExternalDocs); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FileSchema); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FormDataParameterSubSchema); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Header); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HeaderParameterSubSchema); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Headers); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Info); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ItemsItem); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*JsonReference); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*License); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamedAny); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamedHeader); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamedParameter); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamedPathItem); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamedResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamedResponseValue); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamedSchema); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamedSecurityDefinitionsItem); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamedString); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamedStringArray); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NonBodyParameter); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Oauth2AccessCodeSecurity); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Oauth2ApplicationSecurity); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[33].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Oauth2ImplicitSecurity); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[34].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Oauth2PasswordSecurity); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[35].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Oauth2Scopes); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[36].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Operation); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[37].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Parameter); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[38].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ParameterDefinitions); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[39].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ParametersItem); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[40].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PathItem); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[41].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PathParameterSubSchema); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[42].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Paths); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[43].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PrimitivesItems); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[44].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Properties); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[45].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QueryParameterSubSchema); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[46].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Response); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[47].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ResponseDefinitions); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[48].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ResponseValue); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[49].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Responses); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[50].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Schema); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[51].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SchemaItem); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[52].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SecurityDefinitions); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[53].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SecurityDefinitionsItem); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[54].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SecurityRequirement); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[55].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StringArray); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[56].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Tag); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[57].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TypeItem); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[58].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*VendorExtension); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[59].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Xml); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_openapiv2_OpenAPIv2_proto_msgTypes[0].OneofWrappers = []interface{}{ - (*AdditionalPropertiesItem_Schema)(nil), - (*AdditionalPropertiesItem_Boolean)(nil), - } - file_openapiv2_OpenAPIv2_proto_msgTypes[30].OneofWrappers = []interface{}{ - (*NonBodyParameter_HeaderParameterSubSchema)(nil), - (*NonBodyParameter_FormDataParameterSubSchema)(nil), - (*NonBodyParameter_QueryParameterSubSchema)(nil), - (*NonBodyParameter_PathParameterSubSchema)(nil), - } - file_openapiv2_OpenAPIv2_proto_msgTypes[37].OneofWrappers = []interface{}{ - (*Parameter_BodyParameter)(nil), - (*Parameter_NonBodyParameter)(nil), - } - file_openapiv2_OpenAPIv2_proto_msgTypes[39].OneofWrappers = []interface{}{ - (*ParametersItem_Parameter)(nil), - (*ParametersItem_JsonReference)(nil), - } - file_openapiv2_OpenAPIv2_proto_msgTypes[48].OneofWrappers = []interface{}{ - (*ResponseValue_Response)(nil), - (*ResponseValue_JsonReference)(nil), - } - file_openapiv2_OpenAPIv2_proto_msgTypes[51].OneofWrappers = []interface{}{ - (*SchemaItem_Schema)(nil), - (*SchemaItem_FileSchema)(nil), - } - file_openapiv2_OpenAPIv2_proto_msgTypes[53].OneofWrappers = []interface{}{ - (*SecurityDefinitionsItem_BasicAuthenticationSecurity)(nil), - (*SecurityDefinitionsItem_ApiKeySecurity)(nil), - (*SecurityDefinitionsItem_Oauth2ImplicitSecurity)(nil), - (*SecurityDefinitionsItem_Oauth2PasswordSecurity)(nil), - (*SecurityDefinitionsItem_Oauth2ApplicationSecurity)(nil), - (*SecurityDefinitionsItem_Oauth2AccessCodeSecurity)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_openapiv2_OpenAPIv2_proto_rawDesc, - NumEnums: 0, - NumMessages: 60, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_openapiv2_OpenAPIv2_proto_goTypes, - DependencyIndexes: file_openapiv2_OpenAPIv2_proto_depIdxs, - MessageInfos: file_openapiv2_OpenAPIv2_proto_msgTypes, - }.Build() - File_openapiv2_OpenAPIv2_proto = out.File - file_openapiv2_OpenAPIv2_proto_rawDesc = nil - file_openapiv2_OpenAPIv2_proto_goTypes = nil - file_openapiv2_OpenAPIv2_proto_depIdxs = nil -} diff --git a/vendor/github.com/google/gnostic/openapiv2/OpenAPIv2.proto b/vendor/github.com/google/gnostic/openapiv2/OpenAPIv2.proto deleted file mode 100644 index 1c59b2f4a..000000000 --- a/vendor/github.com/google/gnostic/openapiv2/OpenAPIv2.proto +++ /dev/null @@ -1,666 +0,0 @@ -// Copyright 2020 Google LLC. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// THIS FILE IS AUTOMATICALLY GENERATED. - -syntax = "proto3"; - -package openapi.v2; - -import "google/protobuf/any.proto"; - -// This option lets the proto compiler generate Java code inside the package -// name (see below) instead of inside an outer class. It creates a simpler -// developer experience by reducing one-level of name nesting and be -// consistent with most programming languages that don't support outer classes. -option java_multiple_files = true; - -// The Java outer classname should be the filename in UpperCamelCase. This -// class is only used to hold proto descriptor, so developers don't need to -// work with it directly. -option java_outer_classname = "OpenAPIProto"; - -// The Java package name must be proto package name with proper prefix. -option java_package = "org.openapi_v2"; - -// A reasonable prefix for the Objective-C symbols generated from the package. -// It should at a minimum be 3 characters long, all uppercase, and convention -// is to use an abbreviation of the package name. Something short, but -// hopefully unique enough to not conflict with things that may come along in -// the future. 'GPB' is reserved for the protocol buffer implementation itself. -option objc_class_prefix = "OAS"; - -// The Go package name. -option go_package = "./openapiv2;openapi_v2"; - -message AdditionalPropertiesItem { - oneof oneof { - Schema schema = 1; - bool boolean = 2; - } -} - -message Any { - google.protobuf.Any value = 1; - string yaml = 2; -} - -message ApiKeySecurity { - string type = 1; - string name = 2; - string in = 3; - string description = 4; - repeated NamedAny vendor_extension = 5; -} - -message BasicAuthenticationSecurity { - string type = 1; - string description = 2; - repeated NamedAny vendor_extension = 3; -} - -message BodyParameter { - // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed. - string description = 1; - // The name of the parameter. - string name = 2; - // Determines the location of the parameter. - string in = 3; - // Determines whether or not this parameter is required or optional. - bool required = 4; - Schema schema = 5; - repeated NamedAny vendor_extension = 6; -} - -// Contact information for the owners of the API. -message Contact { - // The identifying name of the contact person/organization. - string name = 1; - // The URL pointing to the contact information. - string url = 2; - // The email address of the contact person/organization. - string email = 3; - repeated NamedAny vendor_extension = 4; -} - -message Default { - repeated NamedAny additional_properties = 1; -} - -// One or more JSON objects describing the schemas being consumed and produced by the API. -message Definitions { - repeated NamedSchema additional_properties = 1; -} - -message Document { - // The Swagger version of this document. - string swagger = 1; - Info info = 2; - // The host (name or ip) of the API. Example: 'swagger.io' - string host = 3; - // The base path to the API. Example: '/api'. - string base_path = 4; - // The transfer protocol of the API. - repeated string schemes = 5; - // A list of MIME types accepted by the API. - repeated string consumes = 6; - // A list of MIME types the API can produce. - repeated string produces = 7; - Paths paths = 8; - Definitions definitions = 9; - ParameterDefinitions parameters = 10; - ResponseDefinitions responses = 11; - repeated SecurityRequirement security = 12; - SecurityDefinitions security_definitions = 13; - repeated Tag tags = 14; - ExternalDocs external_docs = 15; - repeated NamedAny vendor_extension = 16; -} - -message Examples { - repeated NamedAny additional_properties = 1; -} - -// information about external documentation -message ExternalDocs { - string description = 1; - string url = 2; - repeated NamedAny vendor_extension = 3; -} - -// A deterministic version of a JSON Schema object. -message FileSchema { - string format = 1; - string title = 2; - string description = 3; - Any default = 4; - repeated string required = 5; - string type = 6; - bool read_only = 7; - ExternalDocs external_docs = 8; - Any example = 9; - repeated NamedAny vendor_extension = 10; -} - -message FormDataParameterSubSchema { - // Determines whether or not this parameter is required or optional. - bool required = 1; - // Determines the location of the parameter. - string in = 2; - // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed. - string description = 3; - // The name of the parameter. - string name = 4; - // allows sending a parameter by name only or with an empty value. - bool allow_empty_value = 5; - string type = 6; - string format = 7; - PrimitivesItems items = 8; - string collection_format = 9; - Any default = 10; - double maximum = 11; - bool exclusive_maximum = 12; - double minimum = 13; - bool exclusive_minimum = 14; - int64 max_length = 15; - int64 min_length = 16; - string pattern = 17; - int64 max_items = 18; - int64 min_items = 19; - bool unique_items = 20; - repeated Any enum = 21; - double multiple_of = 22; - repeated NamedAny vendor_extension = 23; -} - -message Header { - string type = 1; - string format = 2; - PrimitivesItems items = 3; - string collection_format = 4; - Any default = 5; - double maximum = 6; - bool exclusive_maximum = 7; - double minimum = 8; - bool exclusive_minimum = 9; - int64 max_length = 10; - int64 min_length = 11; - string pattern = 12; - int64 max_items = 13; - int64 min_items = 14; - bool unique_items = 15; - repeated Any enum = 16; - double multiple_of = 17; - string description = 18; - repeated NamedAny vendor_extension = 19; -} - -message HeaderParameterSubSchema { - // Determines whether or not this parameter is required or optional. - bool required = 1; - // Determines the location of the parameter. - string in = 2; - // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed. - string description = 3; - // The name of the parameter. - string name = 4; - string type = 5; - string format = 6; - PrimitivesItems items = 7; - string collection_format = 8; - Any default = 9; - double maximum = 10; - bool exclusive_maximum = 11; - double minimum = 12; - bool exclusive_minimum = 13; - int64 max_length = 14; - int64 min_length = 15; - string pattern = 16; - int64 max_items = 17; - int64 min_items = 18; - bool unique_items = 19; - repeated Any enum = 20; - double multiple_of = 21; - repeated NamedAny vendor_extension = 22; -} - -message Headers { - repeated NamedHeader additional_properties = 1; -} - -// General information about the API. -message Info { - // A unique and precise title of the API. - string title = 1; - // A semantic version number of the API. - string version = 2; - // A longer description of the API. Should be different from the title. GitHub Flavored Markdown is allowed. - string description = 3; - // The terms of service for the API. - string terms_of_service = 4; - Contact contact = 5; - License license = 6; - repeated NamedAny vendor_extension = 7; -} - -message ItemsItem { - repeated Schema schema = 1; -} - -message JsonReference { - string _ref = 1; - string description = 2; -} - -message License { - // The name of the license type. It's encouraged to use an OSI compatible license. - string name = 1; - // The URL pointing to the license. - string url = 2; - repeated NamedAny vendor_extension = 3; -} - -// Automatically-generated message used to represent maps of Any as ordered (name,value) pairs. -message NamedAny { - // Map key - string name = 1; - // Mapped value - Any value = 2; -} - -// Automatically-generated message used to represent maps of Header as ordered (name,value) pairs. -message NamedHeader { - // Map key - string name = 1; - // Mapped value - Header value = 2; -} - -// Automatically-generated message used to represent maps of Parameter as ordered (name,value) pairs. -message NamedParameter { - // Map key - string name = 1; - // Mapped value - Parameter value = 2; -} - -// Automatically-generated message used to represent maps of PathItem as ordered (name,value) pairs. -message NamedPathItem { - // Map key - string name = 1; - // Mapped value - PathItem value = 2; -} - -// Automatically-generated message used to represent maps of Response as ordered (name,value) pairs. -message NamedResponse { - // Map key - string name = 1; - // Mapped value - Response value = 2; -} - -// Automatically-generated message used to represent maps of ResponseValue as ordered (name,value) pairs. -message NamedResponseValue { - // Map key - string name = 1; - // Mapped value - ResponseValue value = 2; -} - -// Automatically-generated message used to represent maps of Schema as ordered (name,value) pairs. -message NamedSchema { - // Map key - string name = 1; - // Mapped value - Schema value = 2; -} - -// Automatically-generated message used to represent maps of SecurityDefinitionsItem as ordered (name,value) pairs. -message NamedSecurityDefinitionsItem { - // Map key - string name = 1; - // Mapped value - SecurityDefinitionsItem value = 2; -} - -// Automatically-generated message used to represent maps of string as ordered (name,value) pairs. -message NamedString { - // Map key - string name = 1; - // Mapped value - string value = 2; -} - -// Automatically-generated message used to represent maps of StringArray as ordered (name,value) pairs. -message NamedStringArray { - // Map key - string name = 1; - // Mapped value - StringArray value = 2; -} - -message NonBodyParameter { - oneof oneof { - HeaderParameterSubSchema header_parameter_sub_schema = 1; - FormDataParameterSubSchema form_data_parameter_sub_schema = 2; - QueryParameterSubSchema query_parameter_sub_schema = 3; - PathParameterSubSchema path_parameter_sub_schema = 4; - } -} - -message Oauth2AccessCodeSecurity { - string type = 1; - string flow = 2; - Oauth2Scopes scopes = 3; - string authorization_url = 4; - string token_url = 5; - string description = 6; - repeated NamedAny vendor_extension = 7; -} - -message Oauth2ApplicationSecurity { - string type = 1; - string flow = 2; - Oauth2Scopes scopes = 3; - string token_url = 4; - string description = 5; - repeated NamedAny vendor_extension = 6; -} - -message Oauth2ImplicitSecurity { - string type = 1; - string flow = 2; - Oauth2Scopes scopes = 3; - string authorization_url = 4; - string description = 5; - repeated NamedAny vendor_extension = 6; -} - -message Oauth2PasswordSecurity { - string type = 1; - string flow = 2; - Oauth2Scopes scopes = 3; - string token_url = 4; - string description = 5; - repeated NamedAny vendor_extension = 6; -} - -message Oauth2Scopes { - repeated NamedString additional_properties = 1; -} - -message Operation { - repeated string tags = 1; - // A brief summary of the operation. - string summary = 2; - // A longer description of the operation, GitHub Flavored Markdown is allowed. - string description = 3; - ExternalDocs external_docs = 4; - // A unique identifier of the operation. - string operation_id = 5; - // A list of MIME types the API can produce. - repeated string produces = 6; - // A list of MIME types the API can consume. - repeated string consumes = 7; - // The parameters needed to send a valid API call. - repeated ParametersItem parameters = 8; - Responses responses = 9; - // The transfer protocol of the API. - repeated string schemes = 10; - bool deprecated = 11; - repeated SecurityRequirement security = 12; - repeated NamedAny vendor_extension = 13; -} - -message Parameter { - oneof oneof { - BodyParameter body_parameter = 1; - NonBodyParameter non_body_parameter = 2; - } -} - -// One or more JSON representations for parameters -message ParameterDefinitions { - repeated NamedParameter additional_properties = 1; -} - -message ParametersItem { - oneof oneof { - Parameter parameter = 1; - JsonReference json_reference = 2; - } -} - -message PathItem { - string _ref = 1; - Operation get = 2; - Operation put = 3; - Operation post = 4; - Operation delete = 5; - Operation options = 6; - Operation head = 7; - Operation patch = 8; - // The parameters needed to send a valid API call. - repeated ParametersItem parameters = 9; - repeated NamedAny vendor_extension = 10; -} - -message PathParameterSubSchema { - // Determines whether or not this parameter is required or optional. - bool required = 1; - // Determines the location of the parameter. - string in = 2; - // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed. - string description = 3; - // The name of the parameter. - string name = 4; - string type = 5; - string format = 6; - PrimitivesItems items = 7; - string collection_format = 8; - Any default = 9; - double maximum = 10; - bool exclusive_maximum = 11; - double minimum = 12; - bool exclusive_minimum = 13; - int64 max_length = 14; - int64 min_length = 15; - string pattern = 16; - int64 max_items = 17; - int64 min_items = 18; - bool unique_items = 19; - repeated Any enum = 20; - double multiple_of = 21; - repeated NamedAny vendor_extension = 22; -} - -// Relative paths to the individual endpoints. They must be relative to the 'basePath'. -message Paths { - repeated NamedAny vendor_extension = 1; - repeated NamedPathItem path = 2; -} - -message PrimitivesItems { - string type = 1; - string format = 2; - PrimitivesItems items = 3; - string collection_format = 4; - Any default = 5; - double maximum = 6; - bool exclusive_maximum = 7; - double minimum = 8; - bool exclusive_minimum = 9; - int64 max_length = 10; - int64 min_length = 11; - string pattern = 12; - int64 max_items = 13; - int64 min_items = 14; - bool unique_items = 15; - repeated Any enum = 16; - double multiple_of = 17; - repeated NamedAny vendor_extension = 18; -} - -message Properties { - repeated NamedSchema additional_properties = 1; -} - -message QueryParameterSubSchema { - // Determines whether or not this parameter is required or optional. - bool required = 1; - // Determines the location of the parameter. - string in = 2; - // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed. - string description = 3; - // The name of the parameter. - string name = 4; - // allows sending a parameter by name only or with an empty value. - bool allow_empty_value = 5; - string type = 6; - string format = 7; - PrimitivesItems items = 8; - string collection_format = 9; - Any default = 10; - double maximum = 11; - bool exclusive_maximum = 12; - double minimum = 13; - bool exclusive_minimum = 14; - int64 max_length = 15; - int64 min_length = 16; - string pattern = 17; - int64 max_items = 18; - int64 min_items = 19; - bool unique_items = 20; - repeated Any enum = 21; - double multiple_of = 22; - repeated NamedAny vendor_extension = 23; -} - -message Response { - string description = 1; - SchemaItem schema = 2; - Headers headers = 3; - Examples examples = 4; - repeated NamedAny vendor_extension = 5; -} - -// One or more JSON representations for responses -message ResponseDefinitions { - repeated NamedResponse additional_properties = 1; -} - -message ResponseValue { - oneof oneof { - Response response = 1; - JsonReference json_reference = 2; - } -} - -// Response objects names can either be any valid HTTP status code or 'default'. -message Responses { - repeated NamedResponseValue response_code = 1; - repeated NamedAny vendor_extension = 2; -} - -// A deterministic version of a JSON Schema object. -message Schema { - string _ref = 1; - string format = 2; - string title = 3; - string description = 4; - Any default = 5; - double multiple_of = 6; - double maximum = 7; - bool exclusive_maximum = 8; - double minimum = 9; - bool exclusive_minimum = 10; - int64 max_length = 11; - int64 min_length = 12; - string pattern = 13; - int64 max_items = 14; - int64 min_items = 15; - bool unique_items = 16; - int64 max_properties = 17; - int64 min_properties = 18; - repeated string required = 19; - repeated Any enum = 20; - AdditionalPropertiesItem additional_properties = 21; - TypeItem type = 22; - ItemsItem items = 23; - repeated Schema all_of = 24; - Properties properties = 25; - string discriminator = 26; - bool read_only = 27; - Xml xml = 28; - ExternalDocs external_docs = 29; - Any example = 30; - repeated NamedAny vendor_extension = 31; -} - -message SchemaItem { - oneof oneof { - Schema schema = 1; - FileSchema file_schema = 2; - } -} - -message SecurityDefinitions { - repeated NamedSecurityDefinitionsItem additional_properties = 1; -} - -message SecurityDefinitionsItem { - oneof oneof { - BasicAuthenticationSecurity basic_authentication_security = 1; - ApiKeySecurity api_key_security = 2; - Oauth2ImplicitSecurity oauth2_implicit_security = 3; - Oauth2PasswordSecurity oauth2_password_security = 4; - Oauth2ApplicationSecurity oauth2_application_security = 5; - Oauth2AccessCodeSecurity oauth2_access_code_security = 6; - } -} - -message SecurityRequirement { - repeated NamedStringArray additional_properties = 1; -} - -message StringArray { - repeated string value = 1; -} - -message Tag { - string name = 1; - string description = 2; - ExternalDocs external_docs = 3; - repeated NamedAny vendor_extension = 4; -} - -message TypeItem { - repeated string value = 1; -} - -// Any property starting with x- is valid. -message VendorExtension { - repeated NamedAny additional_properties = 1; -} - -message Xml { - string name = 1; - string namespace = 2; - string prefix = 3; - bool attribute = 4; - bool wrapped = 5; - repeated NamedAny vendor_extension = 6; -} - diff --git a/vendor/github.com/google/gnostic/openapiv2/README.md b/vendor/github.com/google/gnostic/openapiv2/README.md deleted file mode 100644 index 5276128d3..000000000 --- a/vendor/github.com/google/gnostic/openapiv2/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# OpenAPI v2 Protocol Buffer Models - -This directory contains a Protocol Buffer-language model and related code for -supporting OpenAPI v2. - -Gnostic applications and plugins can use OpenAPIv2.proto to generate Protocol -Buffer support code for their preferred languages. - -OpenAPIv2.go is used by Gnostic to read JSON and YAML OpenAPI descriptions into -the Protocol Buffer-based datastructures generated from OpenAPIv2.proto. - -OpenAPIv2.proto and OpenAPIv2.go are generated by the Gnostic compiler -generator, and OpenAPIv2.pb.go is generated by protoc, the Protocol Buffer -compiler, and protoc-gen-go, the Protocol Buffer Go code generation plugin. diff --git a/vendor/github.com/google/gnostic/openapiv2/document.go b/vendor/github.com/google/gnostic/openapiv2/document.go deleted file mode 100644 index 0021ae871..000000000 --- a/vendor/github.com/google/gnostic/openapiv2/document.go +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2020 Google LLC. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package openapi_v2 - -import ( - "gopkg.in/yaml.v3" - - "github.com/google/gnostic/compiler" -) - -// ParseDocument reads an OpenAPI v2 description from a YAML/JSON representation. -func ParseDocument(b []byte) (*Document, error) { - info, err := compiler.ReadInfoFromBytes("", b) - if err != nil { - return nil, err - } - root := info.Content[0] - return NewDocument(root, compiler.NewContextWithExtensions("$root", root, nil, nil)) -} - -// YAMLValue produces a serialized YAML representation of the document. -func (d *Document) YAMLValue(comment string) ([]byte, error) { - rawInfo := d.ToRawInfo() - rawInfo = &yaml.Node{ - Kind: yaml.DocumentNode, - Content: []*yaml.Node{rawInfo}, - HeadComment: comment, - } - return yaml.Marshal(rawInfo) -} diff --git a/vendor/github.com/google/gnostic/openapiv2/openapi-2.0.json b/vendor/github.com/google/gnostic/openapiv2/openapi-2.0.json deleted file mode 100644 index afa12b79b..000000000 --- a/vendor/github.com/google/gnostic/openapiv2/openapi-2.0.json +++ /dev/null @@ -1,1610 +0,0 @@ -{ - "title": "A JSON Schema for Swagger 2.0 API.", - "id": "http://swagger.io/v2/schema.json#", - "$schema": "http://json-schema.org/draft-04/schema#", - "type": "object", - "required": [ - "swagger", - "info", - "paths" - ], - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "swagger": { - "type": "string", - "enum": [ - "2.0" - ], - "description": "The Swagger version of this document." - }, - "info": { - "$ref": "#/definitions/info" - }, - "host": { - "type": "string", - "pattern": "^[^{}/ :\\\\]+(?::\\d+)?$", - "description": "The host (name or ip) of the API. Example: 'swagger.io'" - }, - "basePath": { - "type": "string", - "pattern": "^/", - "description": "The base path to the API. Example: '/api'." - }, - "schemes": { - "$ref": "#/definitions/schemesList" - }, - "consumes": { - "description": "A list of MIME types accepted by the API.", - "allOf": [ - { - "$ref": "#/definitions/mediaTypeList" - } - ] - }, - "produces": { - "description": "A list of MIME types the API can produce.", - "allOf": [ - { - "$ref": "#/definitions/mediaTypeList" - } - ] - }, - "paths": { - "$ref": "#/definitions/paths" - }, - "definitions": { - "$ref": "#/definitions/definitions" - }, - "parameters": { - "$ref": "#/definitions/parameterDefinitions" - }, - "responses": { - "$ref": "#/definitions/responseDefinitions" - }, - "security": { - "$ref": "#/definitions/security" - }, - "securityDefinitions": { - "$ref": "#/definitions/securityDefinitions" - }, - "tags": { - "type": "array", - "items": { - "$ref": "#/definitions/tag" - }, - "uniqueItems": true - }, - "externalDocs": { - "$ref": "#/definitions/externalDocs" - } - }, - "definitions": { - "info": { - "type": "object", - "description": "General information about the API.", - "required": [ - "version", - "title" - ], - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "title": { - "type": "string", - "description": "A unique and precise title of the API." - }, - "version": { - "type": "string", - "description": "A semantic version number of the API." - }, - "description": { - "type": "string", - "description": "A longer description of the API. Should be different from the title. GitHub Flavored Markdown is allowed." - }, - "termsOfService": { - "type": "string", - "description": "The terms of service for the API." - }, - "contact": { - "$ref": "#/definitions/contact" - }, - "license": { - "$ref": "#/definitions/license" - } - } - }, - "contact": { - "type": "object", - "description": "Contact information for the owners of the API.", - "additionalProperties": false, - "properties": { - "name": { - "type": "string", - "description": "The identifying name of the contact person/organization." - }, - "url": { - "type": "string", - "description": "The URL pointing to the contact information.", - "format": "uri" - }, - "email": { - "type": "string", - "description": "The email address of the contact person/organization.", - "format": "email" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "license": { - "type": "object", - "required": [ - "name" - ], - "additionalProperties": false, - "properties": { - "name": { - "type": "string", - "description": "The name of the license type. It's encouraged to use an OSI compatible license." - }, - "url": { - "type": "string", - "description": "The URL pointing to the license.", - "format": "uri" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "paths": { - "type": "object", - "description": "Relative paths to the individual endpoints. They must be relative to the 'basePath'.", - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - }, - "^/": { - "$ref": "#/definitions/pathItem" - } - }, - "additionalProperties": false - }, - "definitions": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/schema" - }, - "description": "One or more JSON objects describing the schemas being consumed and produced by the API." - }, - "parameterDefinitions": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/parameter" - }, - "description": "One or more JSON representations for parameters" - }, - "responseDefinitions": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/response" - }, - "description": "One or more JSON representations for responses" - }, - "externalDocs": { - "type": "object", - "additionalProperties": false, - "description": "information about external documentation", - "required": [ - "url" - ], - "properties": { - "description": { - "type": "string" - }, - "url": { - "type": "string", - "format": "uri" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "examples": { - "type": "object", - "additionalProperties": true - }, - "mimeType": { - "type": "string", - "description": "The MIME type of the HTTP message." - }, - "operation": { - "type": "object", - "required": [ - "responses" - ], - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "tags": { - "type": "array", - "items": { - "type": "string" - }, - "uniqueItems": true - }, - "summary": { - "type": "string", - "description": "A brief summary of the operation." - }, - "description": { - "type": "string", - "description": "A longer description of the operation, GitHub Flavored Markdown is allowed." - }, - "externalDocs": { - "$ref": "#/definitions/externalDocs" - }, - "operationId": { - "type": "string", - "description": "A unique identifier of the operation." - }, - "produces": { - "description": "A list of MIME types the API can produce.", - "allOf": [ - { - "$ref": "#/definitions/mediaTypeList" - } - ] - }, - "consumes": { - "description": "A list of MIME types the API can consume.", - "allOf": [ - { - "$ref": "#/definitions/mediaTypeList" - } - ] - }, - "parameters": { - "$ref": "#/definitions/parametersList" - }, - "responses": { - "$ref": "#/definitions/responses" - }, - "schemes": { - "$ref": "#/definitions/schemesList" - }, - "deprecated": { - "type": "boolean", - "default": false - }, - "security": { - "$ref": "#/definitions/security" - } - } - }, - "pathItem": { - "type": "object", - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "$ref": { - "type": "string" - }, - "get": { - "$ref": "#/definitions/operation" - }, - "put": { - "$ref": "#/definitions/operation" - }, - "post": { - "$ref": "#/definitions/operation" - }, - "delete": { - "$ref": "#/definitions/operation" - }, - "options": { - "$ref": "#/definitions/operation" - }, - "head": { - "$ref": "#/definitions/operation" - }, - "patch": { - "$ref": "#/definitions/operation" - }, - "parameters": { - "$ref": "#/definitions/parametersList" - } - } - }, - "responses": { - "type": "object", - "description": "Response objects names can either be any valid HTTP status code or 'default'.", - "minProperties": 1, - "additionalProperties": false, - "patternProperties": { - "^([0-9]{3})$|^(default)$": { - "$ref": "#/definitions/responseValue" - }, - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "not": { - "type": "object", - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - } - }, - "responseValue": { - "oneOf": [ - { - "$ref": "#/definitions/response" - }, - { - "$ref": "#/definitions/jsonReference" - } - ] - }, - "response": { - "type": "object", - "required": [ - "description" - ], - "properties": { - "description": { - "type": "string" - }, - "schema": { - "oneOf": [ - { - "$ref": "#/definitions/schema" - }, - { - "$ref": "#/definitions/fileSchema" - } - ] - }, - "headers": { - "$ref": "#/definitions/headers" - }, - "examples": { - "$ref": "#/definitions/examples" - } - }, - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "headers": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/header" - } - }, - "header": { - "type": "object", - "additionalProperties": false, - "required": [ - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "string", - "number", - "integer", - "boolean", - "array" - ] - }, - "format": { - "type": "string" - }, - "items": { - "$ref": "#/definitions/primitivesItems" - }, - "collectionFormat": { - "$ref": "#/definitions/collectionFormat" - }, - "default": { - "$ref": "#/definitions/default" - }, - "maximum": { - "$ref": "#/definitions/maximum" - }, - "exclusiveMaximum": { - "$ref": "#/definitions/exclusiveMaximum" - }, - "minimum": { - "$ref": "#/definitions/minimum" - }, - "exclusiveMinimum": { - "$ref": "#/definitions/exclusiveMinimum" - }, - "maxLength": { - "$ref": "#/definitions/maxLength" - }, - "minLength": { - "$ref": "#/definitions/minLength" - }, - "pattern": { - "$ref": "#/definitions/pattern" - }, - "maxItems": { - "$ref": "#/definitions/maxItems" - }, - "minItems": { - "$ref": "#/definitions/minItems" - }, - "uniqueItems": { - "$ref": "#/definitions/uniqueItems" - }, - "enum": { - "$ref": "#/definitions/enum" - }, - "multipleOf": { - "$ref": "#/definitions/multipleOf" - }, - "description": { - "type": "string" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "vendorExtension": { - "description": "Any property starting with x- is valid.", - "additionalProperties": true, - "additionalItems": true - }, - "bodyParameter": { - "type": "object", - "required": [ - "name", - "in", - "schema" - ], - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "description": { - "type": "string", - "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed." - }, - "name": { - "type": "string", - "description": "The name of the parameter." - }, - "in": { - "type": "string", - "description": "Determines the location of the parameter.", - "enum": [ - "body" - ] - }, - "required": { - "type": "boolean", - "description": "Determines whether or not this parameter is required or optional.", - "default": false - }, - "schema": { - "$ref": "#/definitions/schema" - } - }, - "additionalProperties": false - }, - "headerParameterSubSchema": { - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "required": { - "type": "boolean", - "description": "Determines whether or not this parameter is required or optional.", - "default": false - }, - "in": { - "type": "string", - "description": "Determines the location of the parameter.", - "enum": [ - "header" - ] - }, - "description": { - "type": "string", - "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed." - }, - "name": { - "type": "string", - "description": "The name of the parameter." - }, - "type": { - "type": "string", - "enum": [ - "string", - "number", - "boolean", - "integer", - "array" - ] - }, - "format": { - "type": "string" - }, - "items": { - "$ref": "#/definitions/primitivesItems" - }, - "collectionFormat": { - "$ref": "#/definitions/collectionFormat" - }, - "default": { - "$ref": "#/definitions/default" - }, - "maximum": { - "$ref": "#/definitions/maximum" - }, - "exclusiveMaximum": { - "$ref": "#/definitions/exclusiveMaximum" - }, - "minimum": { - "$ref": "#/definitions/minimum" - }, - "exclusiveMinimum": { - "$ref": "#/definitions/exclusiveMinimum" - }, - "maxLength": { - "$ref": "#/definitions/maxLength" - }, - "minLength": { - "$ref": "#/definitions/minLength" - }, - "pattern": { - "$ref": "#/definitions/pattern" - }, - "maxItems": { - "$ref": "#/definitions/maxItems" - }, - "minItems": { - "$ref": "#/definitions/minItems" - }, - "uniqueItems": { - "$ref": "#/definitions/uniqueItems" - }, - "enum": { - "$ref": "#/definitions/enum" - }, - "multipleOf": { - "$ref": "#/definitions/multipleOf" - } - } - }, - "queryParameterSubSchema": { - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "required": { - "type": "boolean", - "description": "Determines whether or not this parameter is required or optional.", - "default": false - }, - "in": { - "type": "string", - "description": "Determines the location of the parameter.", - "enum": [ - "query" - ] - }, - "description": { - "type": "string", - "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed." - }, - "name": { - "type": "string", - "description": "The name of the parameter." - }, - "allowEmptyValue": { - "type": "boolean", - "default": false, - "description": "allows sending a parameter by name only or with an empty value." - }, - "type": { - "type": "string", - "enum": [ - "string", - "number", - "boolean", - "integer", - "array" - ] - }, - "format": { - "type": "string" - }, - "items": { - "$ref": "#/definitions/primitivesItems" - }, - "collectionFormat": { - "$ref": "#/definitions/collectionFormatWithMulti" - }, - "default": { - "$ref": "#/definitions/default" - }, - "maximum": { - "$ref": "#/definitions/maximum" - }, - "exclusiveMaximum": { - "$ref": "#/definitions/exclusiveMaximum" - }, - "minimum": { - "$ref": "#/definitions/minimum" - }, - "exclusiveMinimum": { - "$ref": "#/definitions/exclusiveMinimum" - }, - "maxLength": { - "$ref": "#/definitions/maxLength" - }, - "minLength": { - "$ref": "#/definitions/minLength" - }, - "pattern": { - "$ref": "#/definitions/pattern" - }, - "maxItems": { - "$ref": "#/definitions/maxItems" - }, - "minItems": { - "$ref": "#/definitions/minItems" - }, - "uniqueItems": { - "$ref": "#/definitions/uniqueItems" - }, - "enum": { - "$ref": "#/definitions/enum" - }, - "multipleOf": { - "$ref": "#/definitions/multipleOf" - } - } - }, - "formDataParameterSubSchema": { - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "required": { - "type": "boolean", - "description": "Determines whether or not this parameter is required or optional.", - "default": false - }, - "in": { - "type": "string", - "description": "Determines the location of the parameter.", - "enum": [ - "formData" - ] - }, - "description": { - "type": "string", - "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed." - }, - "name": { - "type": "string", - "description": "The name of the parameter." - }, - "allowEmptyValue": { - "type": "boolean", - "default": false, - "description": "allows sending a parameter by name only or with an empty value." - }, - "type": { - "type": "string", - "enum": [ - "string", - "number", - "boolean", - "integer", - "array", - "file" - ] - }, - "format": { - "type": "string" - }, - "items": { - "$ref": "#/definitions/primitivesItems" - }, - "collectionFormat": { - "$ref": "#/definitions/collectionFormatWithMulti" - }, - "default": { - "$ref": "#/definitions/default" - }, - "maximum": { - "$ref": "#/definitions/maximum" - }, - "exclusiveMaximum": { - "$ref": "#/definitions/exclusiveMaximum" - }, - "minimum": { - "$ref": "#/definitions/minimum" - }, - "exclusiveMinimum": { - "$ref": "#/definitions/exclusiveMinimum" - }, - "maxLength": { - "$ref": "#/definitions/maxLength" - }, - "minLength": { - "$ref": "#/definitions/minLength" - }, - "pattern": { - "$ref": "#/definitions/pattern" - }, - "maxItems": { - "$ref": "#/definitions/maxItems" - }, - "minItems": { - "$ref": "#/definitions/minItems" - }, - "uniqueItems": { - "$ref": "#/definitions/uniqueItems" - }, - "enum": { - "$ref": "#/definitions/enum" - }, - "multipleOf": { - "$ref": "#/definitions/multipleOf" - } - } - }, - "pathParameterSubSchema": { - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "required": [ - "required" - ], - "properties": { - "required": { - "type": "boolean", - "enum": [ - true - ], - "description": "Determines whether or not this parameter is required or optional." - }, - "in": { - "type": "string", - "description": "Determines the location of the parameter.", - "enum": [ - "path" - ] - }, - "description": { - "type": "string", - "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed." - }, - "name": { - "type": "string", - "description": "The name of the parameter." - }, - "type": { - "type": "string", - "enum": [ - "string", - "number", - "boolean", - "integer", - "array" - ] - }, - "format": { - "type": "string" - }, - "items": { - "$ref": "#/definitions/primitivesItems" - }, - "collectionFormat": { - "$ref": "#/definitions/collectionFormat" - }, - "default": { - "$ref": "#/definitions/default" - }, - "maximum": { - "$ref": "#/definitions/maximum" - }, - "exclusiveMaximum": { - "$ref": "#/definitions/exclusiveMaximum" - }, - "minimum": { - "$ref": "#/definitions/minimum" - }, - "exclusiveMinimum": { - "$ref": "#/definitions/exclusiveMinimum" - }, - "maxLength": { - "$ref": "#/definitions/maxLength" - }, - "minLength": { - "$ref": "#/definitions/minLength" - }, - "pattern": { - "$ref": "#/definitions/pattern" - }, - "maxItems": { - "$ref": "#/definitions/maxItems" - }, - "minItems": { - "$ref": "#/definitions/minItems" - }, - "uniqueItems": { - "$ref": "#/definitions/uniqueItems" - }, - "enum": { - "$ref": "#/definitions/enum" - }, - "multipleOf": { - "$ref": "#/definitions/multipleOf" - } - } - }, - "nonBodyParameter": { - "type": "object", - "required": [ - "name", - "in", - "type" - ], - "oneOf": [ - { - "$ref": "#/definitions/headerParameterSubSchema" - }, - { - "$ref": "#/definitions/formDataParameterSubSchema" - }, - { - "$ref": "#/definitions/queryParameterSubSchema" - }, - { - "$ref": "#/definitions/pathParameterSubSchema" - } - ] - }, - "parameter": { - "oneOf": [ - { - "$ref": "#/definitions/bodyParameter" - }, - { - "$ref": "#/definitions/nonBodyParameter" - } - ] - }, - "schema": { - "type": "object", - "description": "A deterministic version of a JSON Schema object.", - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "properties": { - "$ref": { - "type": "string" - }, - "format": { - "type": "string" - }, - "title": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/title" - }, - "description": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/description" - }, - "default": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/default" - }, - "multipleOf": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/multipleOf" - }, - "maximum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/maximum" - }, - "exclusiveMaximum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum" - }, - "minimum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/minimum" - }, - "exclusiveMinimum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum" - }, - "maxLength": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" - }, - "minLength": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" - }, - "pattern": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/pattern" - }, - "maxItems": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" - }, - "minItems": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" - }, - "uniqueItems": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/uniqueItems" - }, - "maxProperties": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" - }, - "minProperties": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" - }, - "required": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/stringArray" - }, - "enum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/enum" - }, - "additionalProperties": { - "oneOf": [ - { - "$ref": "#/definitions/schema" - }, - { - "type": "boolean" - } - ], - "default": {} - }, - "type": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/type" - }, - "items": { - "anyOf": [ - { - "$ref": "#/definitions/schema" - }, - { - "type": "array", - "minItems": 1, - "items": { - "$ref": "#/definitions/schema" - } - } - ], - "default": {} - }, - "allOf": { - "type": "array", - "minItems": 1, - "items": { - "$ref": "#/definitions/schema" - } - }, - "properties": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/schema" - }, - "default": {} - }, - "discriminator": { - "type": "string" - }, - "readOnly": { - "type": "boolean", - "default": false - }, - "xml": { - "$ref": "#/definitions/xml" - }, - "externalDocs": { - "$ref": "#/definitions/externalDocs" - }, - "example": {} - }, - "additionalProperties": false - }, - "fileSchema": { - "type": "object", - "description": "A deterministic version of a JSON Schema object.", - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - }, - "required": [ - "type" - ], - "properties": { - "format": { - "type": "string" - }, - "title": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/title" - }, - "description": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/description" - }, - "default": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/default" - }, - "required": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/stringArray" - }, - "type": { - "type": "string", - "enum": [ - "file" - ] - }, - "readOnly": { - "type": "boolean", - "default": false - }, - "externalDocs": { - "$ref": "#/definitions/externalDocs" - }, - "example": {} - }, - "additionalProperties": false - }, - "primitivesItems": { - "type": "object", - "additionalProperties": false, - "properties": { - "type": { - "type": "string", - "enum": [ - "string", - "number", - "integer", - "boolean", - "array" - ] - }, - "format": { - "type": "string" - }, - "items": { - "$ref": "#/definitions/primitivesItems" - }, - "collectionFormat": { - "$ref": "#/definitions/collectionFormat" - }, - "default": { - "$ref": "#/definitions/default" - }, - "maximum": { - "$ref": "#/definitions/maximum" - }, - "exclusiveMaximum": { - "$ref": "#/definitions/exclusiveMaximum" - }, - "minimum": { - "$ref": "#/definitions/minimum" - }, - "exclusiveMinimum": { - "$ref": "#/definitions/exclusiveMinimum" - }, - "maxLength": { - "$ref": "#/definitions/maxLength" - }, - "minLength": { - "$ref": "#/definitions/minLength" - }, - "pattern": { - "$ref": "#/definitions/pattern" - }, - "maxItems": { - "$ref": "#/definitions/maxItems" - }, - "minItems": { - "$ref": "#/definitions/minItems" - }, - "uniqueItems": { - "$ref": "#/definitions/uniqueItems" - }, - "enum": { - "$ref": "#/definitions/enum" - }, - "multipleOf": { - "$ref": "#/definitions/multipleOf" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "security": { - "type": "array", - "items": { - "$ref": "#/definitions/securityRequirement" - }, - "uniqueItems": true - }, - "securityRequirement": { - "type": "object", - "additionalProperties": { - "type": "array", - "items": { - "type": "string" - }, - "uniqueItems": true - } - }, - "xml": { - "type": "object", - "additionalProperties": false, - "properties": { - "name": { - "type": "string" - }, - "namespace": { - "type": "string" - }, - "prefix": { - "type": "string" - }, - "attribute": { - "type": "boolean", - "default": false - }, - "wrapped": { - "type": "boolean", - "default": false - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "tag": { - "type": "object", - "additionalProperties": false, - "required": [ - "name" - ], - "properties": { - "name": { - "type": "string" - }, - "description": { - "type": "string" - }, - "externalDocs": { - "$ref": "#/definitions/externalDocs" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "securityDefinitions": { - "type": "object", - "additionalProperties": { - "oneOf": [ - { - "$ref": "#/definitions/basicAuthenticationSecurity" - }, - { - "$ref": "#/definitions/apiKeySecurity" - }, - { - "$ref": "#/definitions/oauth2ImplicitSecurity" - }, - { - "$ref": "#/definitions/oauth2PasswordSecurity" - }, - { - "$ref": "#/definitions/oauth2ApplicationSecurity" - }, - { - "$ref": "#/definitions/oauth2AccessCodeSecurity" - } - ] - } - }, - "basicAuthenticationSecurity": { - "type": "object", - "additionalProperties": false, - "required": [ - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "basic" - ] - }, - "description": { - "type": "string" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "apiKeySecurity": { - "type": "object", - "additionalProperties": false, - "required": [ - "type", - "name", - "in" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "apiKey" - ] - }, - "name": { - "type": "string" - }, - "in": { - "type": "string", - "enum": [ - "header", - "query" - ] - }, - "description": { - "type": "string" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "oauth2ImplicitSecurity": { - "type": "object", - "additionalProperties": false, - "required": [ - "type", - "flow", - "authorizationUrl" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "oauth2" - ] - }, - "flow": { - "type": "string", - "enum": [ - "implicit" - ] - }, - "scopes": { - "$ref": "#/definitions/oauth2Scopes" - }, - "authorizationUrl": { - "type": "string", - "format": "uri" - }, - "description": { - "type": "string" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "oauth2PasswordSecurity": { - "type": "object", - "additionalProperties": false, - "required": [ - "type", - "flow", - "tokenUrl" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "oauth2" - ] - }, - "flow": { - "type": "string", - "enum": [ - "password" - ] - }, - "scopes": { - "$ref": "#/definitions/oauth2Scopes" - }, - "tokenUrl": { - "type": "string", - "format": "uri" - }, - "description": { - "type": "string" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "oauth2ApplicationSecurity": { - "type": "object", - "additionalProperties": false, - "required": [ - "type", - "flow", - "tokenUrl" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "oauth2" - ] - }, - "flow": { - "type": "string", - "enum": [ - "application" - ] - }, - "scopes": { - "$ref": "#/definitions/oauth2Scopes" - }, - "tokenUrl": { - "type": "string", - "format": "uri" - }, - "description": { - "type": "string" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "oauth2AccessCodeSecurity": { - "type": "object", - "additionalProperties": false, - "required": [ - "type", - "flow", - "authorizationUrl", - "tokenUrl" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "oauth2" - ] - }, - "flow": { - "type": "string", - "enum": [ - "accessCode" - ] - }, - "scopes": { - "$ref": "#/definitions/oauth2Scopes" - }, - "authorizationUrl": { - "type": "string", - "format": "uri" - }, - "tokenUrl": { - "type": "string", - "format": "uri" - }, - "description": { - "type": "string" - } - }, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/vendorExtension" - } - } - }, - "oauth2Scopes": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "mediaTypeList": { - "type": "array", - "items": { - "$ref": "#/definitions/mimeType" - }, - "uniqueItems": true - }, - "parametersList": { - "type": "array", - "description": "The parameters needed to send a valid API call.", - "additionalItems": false, - "items": { - "oneOf": [ - { - "$ref": "#/definitions/parameter" - }, - { - "$ref": "#/definitions/jsonReference" - } - ] - }, - "uniqueItems": true - }, - "schemesList": { - "type": "array", - "description": "The transfer protocol of the API.", - "items": { - "type": "string", - "enum": [ - "http", - "https", - "ws", - "wss" - ] - }, - "uniqueItems": true - }, - "collectionFormat": { - "type": "string", - "enum": [ - "csv", - "ssv", - "tsv", - "pipes" - ], - "default": "csv" - }, - "collectionFormatWithMulti": { - "type": "string", - "enum": [ - "csv", - "ssv", - "tsv", - "pipes", - "multi" - ], - "default": "csv" - }, - "title": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/title" - }, - "description": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/description" - }, - "default": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/default" - }, - "multipleOf": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/multipleOf" - }, - "maximum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/maximum" - }, - "exclusiveMaximum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum" - }, - "minimum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/minimum" - }, - "exclusiveMinimum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum" - }, - "maxLength": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" - }, - "minLength": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" - }, - "pattern": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/pattern" - }, - "maxItems": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger" - }, - "minItems": { - "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0" - }, - "uniqueItems": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/uniqueItems" - }, - "enum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/enum" - }, - "jsonReference": { - "type": "object", - "required": [ - "$ref" - ], - "additionalProperties": false, - "properties": { - "$ref": { - "type": "string" - }, - "description": { - "type": "string" - } - } - } - } -} \ No newline at end of file diff --git a/vendor/github.com/google/gnostic/openapiv3/OpenAPIv3.go b/vendor/github.com/google/gnostic/openapiv3/OpenAPIv3.go deleted file mode 100644 index 5f4a7025e..000000000 --- a/vendor/github.com/google/gnostic/openapiv3/OpenAPIv3.go +++ /dev/null @@ -1,8633 +0,0 @@ -// Copyright 2020 Google LLC. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// THIS FILE IS AUTOMATICALLY GENERATED. - -package openapi_v3 - -import ( - "fmt" - "regexp" - "strings" - - "gopkg.in/yaml.v3" - - "github.com/google/gnostic/compiler" -) - -// Version returns the package name (and OpenAPI version). -func Version() string { - return "openapi_v3" -} - -// NewAdditionalPropertiesItem creates an object of type AdditionalPropertiesItem if possible, returning an error if not. -func NewAdditionalPropertiesItem(in *yaml.Node, context *compiler.Context) (*AdditionalPropertiesItem, error) { - errors := make([]error, 0) - x := &AdditionalPropertiesItem{} - matched := false - // SchemaOrReference schema_or_reference = 1; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewSchemaOrReference(m, compiler.NewContext("schemaOrReference", m, context)) - if matchingError == nil { - x.Oneof = &AdditionalPropertiesItem_SchemaOrReference{SchemaOrReference: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - // bool boolean = 2; - boolValue, ok := compiler.BoolForScalarNode(in) - if ok { - x.Oneof = &AdditionalPropertiesItem_Boolean{Boolean: boolValue} - matched = true - } - if matched { - // since the oneof matched one of its possibilities, discard any matching errors - errors = make([]error, 0) - } else { - message := fmt.Sprintf("contains an invalid AdditionalPropertiesItem") - err := compiler.NewError(context, message) - errors = []error{err} - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewAny creates an object of type Any if possible, returning an error if not. -func NewAny(in *yaml.Node, context *compiler.Context) (*Any, error) { - errors := make([]error, 0) - x := &Any{} - bytes := compiler.Marshal(in) - x.Yaml = string(bytes) - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewAnyOrExpression creates an object of type AnyOrExpression if possible, returning an error if not. -func NewAnyOrExpression(in *yaml.Node, context *compiler.Context) (*AnyOrExpression, error) { - errors := make([]error, 0) - x := &AnyOrExpression{} - matched := false - // Any any = 1; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewAny(m, compiler.NewContext("any", m, context)) - if matchingError == nil { - x.Oneof = &AnyOrExpression_Any{Any: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - // Expression expression = 2; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewExpression(m, compiler.NewContext("expression", m, context)) - if matchingError == nil { - x.Oneof = &AnyOrExpression_Expression{Expression: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - if matched { - // since the oneof matched one of its possibilities, discard any matching errors - errors = make([]error, 0) - } else { - message := fmt.Sprintf("contains an invalid AnyOrExpression") - err := compiler.NewError(context, message) - errors = []error{err} - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewCallback creates an object of type Callback if possible, returning an error if not. -func NewCallback(in *yaml.Node, context *compiler.Context) (*Callback, error) { - errors := make([]error, 0) - x := &Callback{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{} - allowedPatterns := []*regexp.Regexp{pattern0, pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // repeated NamedPathItem path = 1; - // MAP: PathItem ^ - x.Path = make([]*NamedPathItem, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if true { - pair := &NamedPathItem{} - pair.Name = k - var err error - pair.Value, err = NewPathItem(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - x.Path = append(x.Path, pair) - } - } - } - // repeated NamedAny specification_extension = 2; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewCallbackOrReference creates an object of type CallbackOrReference if possible, returning an error if not. -func NewCallbackOrReference(in *yaml.Node, context *compiler.Context) (*CallbackOrReference, error) { - errors := make([]error, 0) - x := &CallbackOrReference{} - matched := false - // Callback callback = 1; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewCallback(m, compiler.NewContext("callback", m, context)) - if matchingError == nil { - x.Oneof = &CallbackOrReference_Callback{Callback: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - // Reference reference = 2; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewReference(m, compiler.NewContext("reference", m, context)) - if matchingError == nil { - x.Oneof = &CallbackOrReference_Reference{Reference: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - if matched { - // since the oneof matched one of its possibilities, discard any matching errors - errors = make([]error, 0) - } else { - message := fmt.Sprintf("contains an invalid CallbackOrReference") - err := compiler.NewError(context, message) - errors = []error{err} - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewCallbacksOrReferences creates an object of type CallbacksOrReferences if possible, returning an error if not. -func NewCallbacksOrReferences(in *yaml.Node, context *compiler.Context) (*CallbacksOrReferences, error) { - errors := make([]error, 0) - x := &CallbacksOrReferences{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedCallbackOrReference additional_properties = 1; - // MAP: CallbackOrReference - x.AdditionalProperties = make([]*NamedCallbackOrReference, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedCallbackOrReference{} - pair.Name = k - var err error - pair.Value, err = NewCallbackOrReference(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewComponents creates an object of type Components if possible, returning an error if not. -func NewComponents(in *yaml.Node, context *compiler.Context) (*Components, error) { - errors := make([]error, 0) - x := &Components{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"callbacks", "examples", "headers", "links", "parameters", "requestBodies", "responses", "schemas", "securitySchemes"} - allowedPatterns := []*regexp.Regexp{pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // SchemasOrReferences schemas = 1; - v1 := compiler.MapValueForKey(m, "schemas") - if v1 != nil { - var err error - x.Schemas, err = NewSchemasOrReferences(v1, compiler.NewContext("schemas", v1, context)) - if err != nil { - errors = append(errors, err) - } - } - // ResponsesOrReferences responses = 2; - v2 := compiler.MapValueForKey(m, "responses") - if v2 != nil { - var err error - x.Responses, err = NewResponsesOrReferences(v2, compiler.NewContext("responses", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - // ParametersOrReferences parameters = 3; - v3 := compiler.MapValueForKey(m, "parameters") - if v3 != nil { - var err error - x.Parameters, err = NewParametersOrReferences(v3, compiler.NewContext("parameters", v3, context)) - if err != nil { - errors = append(errors, err) - } - } - // ExamplesOrReferences examples = 4; - v4 := compiler.MapValueForKey(m, "examples") - if v4 != nil { - var err error - x.Examples, err = NewExamplesOrReferences(v4, compiler.NewContext("examples", v4, context)) - if err != nil { - errors = append(errors, err) - } - } - // RequestBodiesOrReferences request_bodies = 5; - v5 := compiler.MapValueForKey(m, "requestBodies") - if v5 != nil { - var err error - x.RequestBodies, err = NewRequestBodiesOrReferences(v5, compiler.NewContext("requestBodies", v5, context)) - if err != nil { - errors = append(errors, err) - } - } - // HeadersOrReferences headers = 6; - v6 := compiler.MapValueForKey(m, "headers") - if v6 != nil { - var err error - x.Headers, err = NewHeadersOrReferences(v6, compiler.NewContext("headers", v6, context)) - if err != nil { - errors = append(errors, err) - } - } - // SecuritySchemesOrReferences security_schemes = 7; - v7 := compiler.MapValueForKey(m, "securitySchemes") - if v7 != nil { - var err error - x.SecuritySchemes, err = NewSecuritySchemesOrReferences(v7, compiler.NewContext("securitySchemes", v7, context)) - if err != nil { - errors = append(errors, err) - } - } - // LinksOrReferences links = 8; - v8 := compiler.MapValueForKey(m, "links") - if v8 != nil { - var err error - x.Links, err = NewLinksOrReferences(v8, compiler.NewContext("links", v8, context)) - if err != nil { - errors = append(errors, err) - } - } - // CallbacksOrReferences callbacks = 9; - v9 := compiler.MapValueForKey(m, "callbacks") - if v9 != nil { - var err error - x.Callbacks, err = NewCallbacksOrReferences(v9, compiler.NewContext("callbacks", v9, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated NamedAny specification_extension = 10; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewContact creates an object of type Contact if possible, returning an error if not. -func NewContact(in *yaml.Node, context *compiler.Context) (*Contact, error) { - errors := make([]error, 0) - x := &Contact{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"email", "name", "url"} - allowedPatterns := []*regexp.Regexp{pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string url = 2; - v2 := compiler.MapValueForKey(m, "url") - if v2 != nil { - x.Url, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for url: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string email = 3; - v3 := compiler.MapValueForKey(m, "email") - if v3 != nil { - x.Email, ok = compiler.StringForScalarNode(v3) - if !ok { - message := fmt.Sprintf("has unexpected value for email: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated NamedAny specification_extension = 4; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewDefaultType creates an object of type DefaultType if possible, returning an error if not. -func NewDefaultType(in *yaml.Node, context *compiler.Context) (*DefaultType, error) { - errors := make([]error, 0) - x := &DefaultType{} - matched := false - switch in.Tag { - case "!!bool": - var v bool - v, matched = compiler.BoolForScalarNode(in) - x.Oneof = &DefaultType_Boolean{Boolean: v} - case "!!str": - var v string - v, matched = compiler.StringForScalarNode(in) - x.Oneof = &DefaultType_String_{String_: v} - case "!!float": - var v float64 - v, matched = compiler.FloatForScalarNode(in) - x.Oneof = &DefaultType_Number{Number: v} - case "!!int": - var v int64 - v, matched = compiler.IntForScalarNode(in) - x.Oneof = &DefaultType_Number{Number: float64(v)} - } - if matched { - // since the oneof matched one of its possibilities, discard any matching errors - errors = make([]error, 0) - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewDiscriminator creates an object of type Discriminator if possible, returning an error if not. -func NewDiscriminator(in *yaml.Node, context *compiler.Context) (*Discriminator, error) { - errors := make([]error, 0) - x := &Discriminator{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"propertyName"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"mapping", "propertyName"} - allowedPatterns := []*regexp.Regexp{pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string property_name = 1; - v1 := compiler.MapValueForKey(m, "propertyName") - if v1 != nil { - x.PropertyName, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for propertyName: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Strings mapping = 2; - v2 := compiler.MapValueForKey(m, "mapping") - if v2 != nil { - var err error - x.Mapping, err = NewStrings(v2, compiler.NewContext("mapping", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated NamedAny specification_extension = 3; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewDocument creates an object of type Document if possible, returning an error if not. -func NewDocument(in *yaml.Node, context *compiler.Context) (*Document, error) { - errors := make([]error, 0) - x := &Document{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"info", "openapi", "paths"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"components", "externalDocs", "info", "openapi", "paths", "security", "servers", "tags"} - allowedPatterns := []*regexp.Regexp{pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string openapi = 1; - v1 := compiler.MapValueForKey(m, "openapi") - if v1 != nil { - x.Openapi, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for openapi: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Info info = 2; - v2 := compiler.MapValueForKey(m, "info") - if v2 != nil { - var err error - x.Info, err = NewInfo(v2, compiler.NewContext("info", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated Server servers = 3; - v3 := compiler.MapValueForKey(m, "servers") - if v3 != nil { - // repeated Server - x.Servers = make([]*Server, 0) - a, ok := compiler.SequenceNodeForNode(v3) - if ok { - for _, item := range a.Content { - y, err := NewServer(item, compiler.NewContext("servers", item, context)) - if err != nil { - errors = append(errors, err) - } - x.Servers = append(x.Servers, y) - } - } - } - // Paths paths = 4; - v4 := compiler.MapValueForKey(m, "paths") - if v4 != nil { - var err error - x.Paths, err = NewPaths(v4, compiler.NewContext("paths", v4, context)) - if err != nil { - errors = append(errors, err) - } - } - // Components components = 5; - v5 := compiler.MapValueForKey(m, "components") - if v5 != nil { - var err error - x.Components, err = NewComponents(v5, compiler.NewContext("components", v5, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated SecurityRequirement security = 6; - v6 := compiler.MapValueForKey(m, "security") - if v6 != nil { - // repeated SecurityRequirement - x.Security = make([]*SecurityRequirement, 0) - a, ok := compiler.SequenceNodeForNode(v6) - if ok { - for _, item := range a.Content { - y, err := NewSecurityRequirement(item, compiler.NewContext("security", item, context)) - if err != nil { - errors = append(errors, err) - } - x.Security = append(x.Security, y) - } - } - } - // repeated Tag tags = 7; - v7 := compiler.MapValueForKey(m, "tags") - if v7 != nil { - // repeated Tag - x.Tags = make([]*Tag, 0) - a, ok := compiler.SequenceNodeForNode(v7) - if ok { - for _, item := range a.Content { - y, err := NewTag(item, compiler.NewContext("tags", item, context)) - if err != nil { - errors = append(errors, err) - } - x.Tags = append(x.Tags, y) - } - } - } - // ExternalDocs external_docs = 8; - v8 := compiler.MapValueForKey(m, "externalDocs") - if v8 != nil { - var err error - x.ExternalDocs, err = NewExternalDocs(v8, compiler.NewContext("externalDocs", v8, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated NamedAny specification_extension = 9; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewEncoding creates an object of type Encoding if possible, returning an error if not. -func NewEncoding(in *yaml.Node, context *compiler.Context) (*Encoding, error) { - errors := make([]error, 0) - x := &Encoding{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"allowReserved", "contentType", "explode", "headers", "style"} - allowedPatterns := []*regexp.Regexp{pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string content_type = 1; - v1 := compiler.MapValueForKey(m, "contentType") - if v1 != nil { - x.ContentType, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for contentType: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // HeadersOrReferences headers = 2; - v2 := compiler.MapValueForKey(m, "headers") - if v2 != nil { - var err error - x.Headers, err = NewHeadersOrReferences(v2, compiler.NewContext("headers", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - // string style = 3; - v3 := compiler.MapValueForKey(m, "style") - if v3 != nil { - x.Style, ok = compiler.StringForScalarNode(v3) - if !ok { - message := fmt.Sprintf("has unexpected value for style: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool explode = 4; - v4 := compiler.MapValueForKey(m, "explode") - if v4 != nil { - x.Explode, ok = compiler.BoolForScalarNode(v4) - if !ok { - message := fmt.Sprintf("has unexpected value for explode: %s", compiler.Display(v4)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool allow_reserved = 5; - v5 := compiler.MapValueForKey(m, "allowReserved") - if v5 != nil { - x.AllowReserved, ok = compiler.BoolForScalarNode(v5) - if !ok { - message := fmt.Sprintf("has unexpected value for allowReserved: %s", compiler.Display(v5)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated NamedAny specification_extension = 6; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewEncodings creates an object of type Encodings if possible, returning an error if not. -func NewEncodings(in *yaml.Node, context *compiler.Context) (*Encodings, error) { - errors := make([]error, 0) - x := &Encodings{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedEncoding additional_properties = 1; - // MAP: Encoding - x.AdditionalProperties = make([]*NamedEncoding, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedEncoding{} - pair.Name = k - var err error - pair.Value, err = NewEncoding(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewExample creates an object of type Example if possible, returning an error if not. -func NewExample(in *yaml.Node, context *compiler.Context) (*Example, error) { - errors := make([]error, 0) - x := &Example{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"description", "externalValue", "summary", "value"} - allowedPatterns := []*regexp.Regexp{pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string summary = 1; - v1 := compiler.MapValueForKey(m, "summary") - if v1 != nil { - x.Summary, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for summary: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string description = 2; - v2 := compiler.MapValueForKey(m, "description") - if v2 != nil { - x.Description, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Any value = 3; - v3 := compiler.MapValueForKey(m, "value") - if v3 != nil { - var err error - x.Value, err = NewAny(v3, compiler.NewContext("value", v3, context)) - if err != nil { - errors = append(errors, err) - } - } - // string external_value = 4; - v4 := compiler.MapValueForKey(m, "externalValue") - if v4 != nil { - x.ExternalValue, ok = compiler.StringForScalarNode(v4) - if !ok { - message := fmt.Sprintf("has unexpected value for externalValue: %s", compiler.Display(v4)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated NamedAny specification_extension = 5; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewExampleOrReference creates an object of type ExampleOrReference if possible, returning an error if not. -func NewExampleOrReference(in *yaml.Node, context *compiler.Context) (*ExampleOrReference, error) { - errors := make([]error, 0) - x := &ExampleOrReference{} - matched := false - // Example example = 1; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewExample(m, compiler.NewContext("example", m, context)) - if matchingError == nil { - x.Oneof = &ExampleOrReference_Example{Example: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - // Reference reference = 2; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewReference(m, compiler.NewContext("reference", m, context)) - if matchingError == nil { - x.Oneof = &ExampleOrReference_Reference{Reference: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - if matched { - // since the oneof matched one of its possibilities, discard any matching errors - errors = make([]error, 0) - } else { - message := fmt.Sprintf("contains an invalid ExampleOrReference") - err := compiler.NewError(context, message) - errors = []error{err} - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewExamplesOrReferences creates an object of type ExamplesOrReferences if possible, returning an error if not. -func NewExamplesOrReferences(in *yaml.Node, context *compiler.Context) (*ExamplesOrReferences, error) { - errors := make([]error, 0) - x := &ExamplesOrReferences{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedExampleOrReference additional_properties = 1; - // MAP: ExampleOrReference - x.AdditionalProperties = make([]*NamedExampleOrReference, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedExampleOrReference{} - pair.Name = k - var err error - pair.Value, err = NewExampleOrReference(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewExpression creates an object of type Expression if possible, returning an error if not. -func NewExpression(in *yaml.Node, context *compiler.Context) (*Expression, error) { - errors := make([]error, 0) - x := &Expression{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedAny additional_properties = 1; - // MAP: Any - x.AdditionalProperties = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewExternalDocs creates an object of type ExternalDocs if possible, returning an error if not. -func NewExternalDocs(in *yaml.Node, context *compiler.Context) (*ExternalDocs, error) { - errors := make([]error, 0) - x := &ExternalDocs{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"url"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"description", "url"} - allowedPatterns := []*regexp.Regexp{pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string description = 1; - v1 := compiler.MapValueForKey(m, "description") - if v1 != nil { - x.Description, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string url = 2; - v2 := compiler.MapValueForKey(m, "url") - if v2 != nil { - x.Url, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for url: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated NamedAny specification_extension = 3; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewHeader creates an object of type Header if possible, returning an error if not. -func NewHeader(in *yaml.Node, context *compiler.Context) (*Header, error) { - errors := make([]error, 0) - x := &Header{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"allowEmptyValue", "allowReserved", "content", "deprecated", "description", "example", "examples", "explode", "required", "schema", "style"} - allowedPatterns := []*regexp.Regexp{pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string description = 1; - v1 := compiler.MapValueForKey(m, "description") - if v1 != nil { - x.Description, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool required = 2; - v2 := compiler.MapValueForKey(m, "required") - if v2 != nil { - x.Required, ok = compiler.BoolForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for required: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool deprecated = 3; - v3 := compiler.MapValueForKey(m, "deprecated") - if v3 != nil { - x.Deprecated, ok = compiler.BoolForScalarNode(v3) - if !ok { - message := fmt.Sprintf("has unexpected value for deprecated: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool allow_empty_value = 4; - v4 := compiler.MapValueForKey(m, "allowEmptyValue") - if v4 != nil { - x.AllowEmptyValue, ok = compiler.BoolForScalarNode(v4) - if !ok { - message := fmt.Sprintf("has unexpected value for allowEmptyValue: %s", compiler.Display(v4)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string style = 5; - v5 := compiler.MapValueForKey(m, "style") - if v5 != nil { - x.Style, ok = compiler.StringForScalarNode(v5) - if !ok { - message := fmt.Sprintf("has unexpected value for style: %s", compiler.Display(v5)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool explode = 6; - v6 := compiler.MapValueForKey(m, "explode") - if v6 != nil { - x.Explode, ok = compiler.BoolForScalarNode(v6) - if !ok { - message := fmt.Sprintf("has unexpected value for explode: %s", compiler.Display(v6)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool allow_reserved = 7; - v7 := compiler.MapValueForKey(m, "allowReserved") - if v7 != nil { - x.AllowReserved, ok = compiler.BoolForScalarNode(v7) - if !ok { - message := fmt.Sprintf("has unexpected value for allowReserved: %s", compiler.Display(v7)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // SchemaOrReference schema = 8; - v8 := compiler.MapValueForKey(m, "schema") - if v8 != nil { - var err error - x.Schema, err = NewSchemaOrReference(v8, compiler.NewContext("schema", v8, context)) - if err != nil { - errors = append(errors, err) - } - } - // Any example = 9; - v9 := compiler.MapValueForKey(m, "example") - if v9 != nil { - var err error - x.Example, err = NewAny(v9, compiler.NewContext("example", v9, context)) - if err != nil { - errors = append(errors, err) - } - } - // ExamplesOrReferences examples = 10; - v10 := compiler.MapValueForKey(m, "examples") - if v10 != nil { - var err error - x.Examples, err = NewExamplesOrReferences(v10, compiler.NewContext("examples", v10, context)) - if err != nil { - errors = append(errors, err) - } - } - // MediaTypes content = 11; - v11 := compiler.MapValueForKey(m, "content") - if v11 != nil { - var err error - x.Content, err = NewMediaTypes(v11, compiler.NewContext("content", v11, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated NamedAny specification_extension = 12; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewHeaderOrReference creates an object of type HeaderOrReference if possible, returning an error if not. -func NewHeaderOrReference(in *yaml.Node, context *compiler.Context) (*HeaderOrReference, error) { - errors := make([]error, 0) - x := &HeaderOrReference{} - matched := false - // Header header = 1; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewHeader(m, compiler.NewContext("header", m, context)) - if matchingError == nil { - x.Oneof = &HeaderOrReference_Header{Header: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - // Reference reference = 2; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewReference(m, compiler.NewContext("reference", m, context)) - if matchingError == nil { - x.Oneof = &HeaderOrReference_Reference{Reference: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - if matched { - // since the oneof matched one of its possibilities, discard any matching errors - errors = make([]error, 0) - } else { - message := fmt.Sprintf("contains an invalid HeaderOrReference") - err := compiler.NewError(context, message) - errors = []error{err} - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewHeadersOrReferences creates an object of type HeadersOrReferences if possible, returning an error if not. -func NewHeadersOrReferences(in *yaml.Node, context *compiler.Context) (*HeadersOrReferences, error) { - errors := make([]error, 0) - x := &HeadersOrReferences{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedHeaderOrReference additional_properties = 1; - // MAP: HeaderOrReference - x.AdditionalProperties = make([]*NamedHeaderOrReference, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedHeaderOrReference{} - pair.Name = k - var err error - pair.Value, err = NewHeaderOrReference(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewInfo creates an object of type Info if possible, returning an error if not. -func NewInfo(in *yaml.Node, context *compiler.Context) (*Info, error) { - errors := make([]error, 0) - x := &Info{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"title", "version"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"contact", "description", "license", "summary", "termsOfService", "title", "version"} - allowedPatterns := []*regexp.Regexp{pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string title = 1; - v1 := compiler.MapValueForKey(m, "title") - if v1 != nil { - x.Title, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for title: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string description = 2; - v2 := compiler.MapValueForKey(m, "description") - if v2 != nil { - x.Description, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string terms_of_service = 3; - v3 := compiler.MapValueForKey(m, "termsOfService") - if v3 != nil { - x.TermsOfService, ok = compiler.StringForScalarNode(v3) - if !ok { - message := fmt.Sprintf("has unexpected value for termsOfService: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Contact contact = 4; - v4 := compiler.MapValueForKey(m, "contact") - if v4 != nil { - var err error - x.Contact, err = NewContact(v4, compiler.NewContext("contact", v4, context)) - if err != nil { - errors = append(errors, err) - } - } - // License license = 5; - v5 := compiler.MapValueForKey(m, "license") - if v5 != nil { - var err error - x.License, err = NewLicense(v5, compiler.NewContext("license", v5, context)) - if err != nil { - errors = append(errors, err) - } - } - // string version = 6; - v6 := compiler.MapValueForKey(m, "version") - if v6 != nil { - x.Version, ok = compiler.StringForScalarNode(v6) - if !ok { - message := fmt.Sprintf("has unexpected value for version: %s", compiler.Display(v6)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string summary = 7; - v7 := compiler.MapValueForKey(m, "summary") - if v7 != nil { - x.Summary, ok = compiler.StringForScalarNode(v7) - if !ok { - message := fmt.Sprintf("has unexpected value for summary: %s", compiler.Display(v7)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated NamedAny specification_extension = 8; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewItemsItem creates an object of type ItemsItem if possible, returning an error if not. -func NewItemsItem(in *yaml.Node, context *compiler.Context) (*ItemsItem, error) { - errors := make([]error, 0) - x := &ItemsItem{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value for item array: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - x.SchemaOrReference = make([]*SchemaOrReference, 0) - y, err := NewSchemaOrReference(m, compiler.NewContext("", m, context)) - if err != nil { - return nil, err - } - x.SchemaOrReference = append(x.SchemaOrReference, y) - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewLicense creates an object of type License if possible, returning an error if not. -func NewLicense(in *yaml.Node, context *compiler.Context) (*License, error) { - errors := make([]error, 0) - x := &License{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"name"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"name", "url"} - allowedPatterns := []*regexp.Regexp{pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string url = 2; - v2 := compiler.MapValueForKey(m, "url") - if v2 != nil { - x.Url, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for url: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated NamedAny specification_extension = 3; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewLink creates an object of type Link if possible, returning an error if not. -func NewLink(in *yaml.Node, context *compiler.Context) (*Link, error) { - errors := make([]error, 0) - x := &Link{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"description", "operationId", "operationRef", "parameters", "requestBody", "server"} - allowedPatterns := []*regexp.Regexp{pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string operation_ref = 1; - v1 := compiler.MapValueForKey(m, "operationRef") - if v1 != nil { - x.OperationRef, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for operationRef: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string operation_id = 2; - v2 := compiler.MapValueForKey(m, "operationId") - if v2 != nil { - x.OperationId, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for operationId: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // AnyOrExpression parameters = 3; - v3 := compiler.MapValueForKey(m, "parameters") - if v3 != nil { - var err error - x.Parameters, err = NewAnyOrExpression(v3, compiler.NewContext("parameters", v3, context)) - if err != nil { - errors = append(errors, err) - } - } - // AnyOrExpression request_body = 4; - v4 := compiler.MapValueForKey(m, "requestBody") - if v4 != nil { - var err error - x.RequestBody, err = NewAnyOrExpression(v4, compiler.NewContext("requestBody", v4, context)) - if err != nil { - errors = append(errors, err) - } - } - // string description = 5; - v5 := compiler.MapValueForKey(m, "description") - if v5 != nil { - x.Description, ok = compiler.StringForScalarNode(v5) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v5)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Server server = 6; - v6 := compiler.MapValueForKey(m, "server") - if v6 != nil { - var err error - x.Server, err = NewServer(v6, compiler.NewContext("server", v6, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated NamedAny specification_extension = 7; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewLinkOrReference creates an object of type LinkOrReference if possible, returning an error if not. -func NewLinkOrReference(in *yaml.Node, context *compiler.Context) (*LinkOrReference, error) { - errors := make([]error, 0) - x := &LinkOrReference{} - matched := false - // Link link = 1; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewLink(m, compiler.NewContext("link", m, context)) - if matchingError == nil { - x.Oneof = &LinkOrReference_Link{Link: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - // Reference reference = 2; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewReference(m, compiler.NewContext("reference", m, context)) - if matchingError == nil { - x.Oneof = &LinkOrReference_Reference{Reference: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - if matched { - // since the oneof matched one of its possibilities, discard any matching errors - errors = make([]error, 0) - } else { - message := fmt.Sprintf("contains an invalid LinkOrReference") - err := compiler.NewError(context, message) - errors = []error{err} - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewLinksOrReferences creates an object of type LinksOrReferences if possible, returning an error if not. -func NewLinksOrReferences(in *yaml.Node, context *compiler.Context) (*LinksOrReferences, error) { - errors := make([]error, 0) - x := &LinksOrReferences{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedLinkOrReference additional_properties = 1; - // MAP: LinkOrReference - x.AdditionalProperties = make([]*NamedLinkOrReference, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedLinkOrReference{} - pair.Name = k - var err error - pair.Value, err = NewLinkOrReference(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewMediaType creates an object of type MediaType if possible, returning an error if not. -func NewMediaType(in *yaml.Node, context *compiler.Context) (*MediaType, error) { - errors := make([]error, 0) - x := &MediaType{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"encoding", "example", "examples", "schema"} - allowedPatterns := []*regexp.Regexp{pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // SchemaOrReference schema = 1; - v1 := compiler.MapValueForKey(m, "schema") - if v1 != nil { - var err error - x.Schema, err = NewSchemaOrReference(v1, compiler.NewContext("schema", v1, context)) - if err != nil { - errors = append(errors, err) - } - } - // Any example = 2; - v2 := compiler.MapValueForKey(m, "example") - if v2 != nil { - var err error - x.Example, err = NewAny(v2, compiler.NewContext("example", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - // ExamplesOrReferences examples = 3; - v3 := compiler.MapValueForKey(m, "examples") - if v3 != nil { - var err error - x.Examples, err = NewExamplesOrReferences(v3, compiler.NewContext("examples", v3, context)) - if err != nil { - errors = append(errors, err) - } - } - // Encodings encoding = 4; - v4 := compiler.MapValueForKey(m, "encoding") - if v4 != nil { - var err error - x.Encoding, err = NewEncodings(v4, compiler.NewContext("encoding", v4, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated NamedAny specification_extension = 5; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewMediaTypes creates an object of type MediaTypes if possible, returning an error if not. -func NewMediaTypes(in *yaml.Node, context *compiler.Context) (*MediaTypes, error) { - errors := make([]error, 0) - x := &MediaTypes{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedMediaType additional_properties = 1; - // MAP: MediaType - x.AdditionalProperties = make([]*NamedMediaType, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedMediaType{} - pair.Name = k - var err error - pair.Value, err = NewMediaType(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewNamedAny creates an object of type NamedAny if possible, returning an error if not. -func NewNamedAny(in *yaml.Node, context *compiler.Context) (*NamedAny, error) { - errors := make([]error, 0) - x := &NamedAny{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"name", "value"} - var allowedPatterns []*regexp.Regexp - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Any value = 2; - v2 := compiler.MapValueForKey(m, "value") - if v2 != nil { - var err error - x.Value, err = NewAny(v2, compiler.NewContext("value", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewNamedCallbackOrReference creates an object of type NamedCallbackOrReference if possible, returning an error if not. -func NewNamedCallbackOrReference(in *yaml.Node, context *compiler.Context) (*NamedCallbackOrReference, error) { - errors := make([]error, 0) - x := &NamedCallbackOrReference{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"name", "value"} - var allowedPatterns []*regexp.Regexp - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // CallbackOrReference value = 2; - v2 := compiler.MapValueForKey(m, "value") - if v2 != nil { - var err error - x.Value, err = NewCallbackOrReference(v2, compiler.NewContext("value", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewNamedEncoding creates an object of type NamedEncoding if possible, returning an error if not. -func NewNamedEncoding(in *yaml.Node, context *compiler.Context) (*NamedEncoding, error) { - errors := make([]error, 0) - x := &NamedEncoding{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"name", "value"} - var allowedPatterns []*regexp.Regexp - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Encoding value = 2; - v2 := compiler.MapValueForKey(m, "value") - if v2 != nil { - var err error - x.Value, err = NewEncoding(v2, compiler.NewContext("value", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewNamedExampleOrReference creates an object of type NamedExampleOrReference if possible, returning an error if not. -func NewNamedExampleOrReference(in *yaml.Node, context *compiler.Context) (*NamedExampleOrReference, error) { - errors := make([]error, 0) - x := &NamedExampleOrReference{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"name", "value"} - var allowedPatterns []*regexp.Regexp - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // ExampleOrReference value = 2; - v2 := compiler.MapValueForKey(m, "value") - if v2 != nil { - var err error - x.Value, err = NewExampleOrReference(v2, compiler.NewContext("value", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewNamedHeaderOrReference creates an object of type NamedHeaderOrReference if possible, returning an error if not. -func NewNamedHeaderOrReference(in *yaml.Node, context *compiler.Context) (*NamedHeaderOrReference, error) { - errors := make([]error, 0) - x := &NamedHeaderOrReference{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"name", "value"} - var allowedPatterns []*regexp.Regexp - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // HeaderOrReference value = 2; - v2 := compiler.MapValueForKey(m, "value") - if v2 != nil { - var err error - x.Value, err = NewHeaderOrReference(v2, compiler.NewContext("value", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewNamedLinkOrReference creates an object of type NamedLinkOrReference if possible, returning an error if not. -func NewNamedLinkOrReference(in *yaml.Node, context *compiler.Context) (*NamedLinkOrReference, error) { - errors := make([]error, 0) - x := &NamedLinkOrReference{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"name", "value"} - var allowedPatterns []*regexp.Regexp - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // LinkOrReference value = 2; - v2 := compiler.MapValueForKey(m, "value") - if v2 != nil { - var err error - x.Value, err = NewLinkOrReference(v2, compiler.NewContext("value", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewNamedMediaType creates an object of type NamedMediaType if possible, returning an error if not. -func NewNamedMediaType(in *yaml.Node, context *compiler.Context) (*NamedMediaType, error) { - errors := make([]error, 0) - x := &NamedMediaType{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"name", "value"} - var allowedPatterns []*regexp.Regexp - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // MediaType value = 2; - v2 := compiler.MapValueForKey(m, "value") - if v2 != nil { - var err error - x.Value, err = NewMediaType(v2, compiler.NewContext("value", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewNamedParameterOrReference creates an object of type NamedParameterOrReference if possible, returning an error if not. -func NewNamedParameterOrReference(in *yaml.Node, context *compiler.Context) (*NamedParameterOrReference, error) { - errors := make([]error, 0) - x := &NamedParameterOrReference{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"name", "value"} - var allowedPatterns []*regexp.Regexp - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // ParameterOrReference value = 2; - v2 := compiler.MapValueForKey(m, "value") - if v2 != nil { - var err error - x.Value, err = NewParameterOrReference(v2, compiler.NewContext("value", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewNamedPathItem creates an object of type NamedPathItem if possible, returning an error if not. -func NewNamedPathItem(in *yaml.Node, context *compiler.Context) (*NamedPathItem, error) { - errors := make([]error, 0) - x := &NamedPathItem{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"name", "value"} - var allowedPatterns []*regexp.Regexp - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // PathItem value = 2; - v2 := compiler.MapValueForKey(m, "value") - if v2 != nil { - var err error - x.Value, err = NewPathItem(v2, compiler.NewContext("value", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewNamedRequestBodyOrReference creates an object of type NamedRequestBodyOrReference if possible, returning an error if not. -func NewNamedRequestBodyOrReference(in *yaml.Node, context *compiler.Context) (*NamedRequestBodyOrReference, error) { - errors := make([]error, 0) - x := &NamedRequestBodyOrReference{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"name", "value"} - var allowedPatterns []*regexp.Regexp - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // RequestBodyOrReference value = 2; - v2 := compiler.MapValueForKey(m, "value") - if v2 != nil { - var err error - x.Value, err = NewRequestBodyOrReference(v2, compiler.NewContext("value", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewNamedResponseOrReference creates an object of type NamedResponseOrReference if possible, returning an error if not. -func NewNamedResponseOrReference(in *yaml.Node, context *compiler.Context) (*NamedResponseOrReference, error) { - errors := make([]error, 0) - x := &NamedResponseOrReference{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"name", "value"} - var allowedPatterns []*regexp.Regexp - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // ResponseOrReference value = 2; - v2 := compiler.MapValueForKey(m, "value") - if v2 != nil { - var err error - x.Value, err = NewResponseOrReference(v2, compiler.NewContext("value", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewNamedSchemaOrReference creates an object of type NamedSchemaOrReference if possible, returning an error if not. -func NewNamedSchemaOrReference(in *yaml.Node, context *compiler.Context) (*NamedSchemaOrReference, error) { - errors := make([]error, 0) - x := &NamedSchemaOrReference{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"name", "value"} - var allowedPatterns []*regexp.Regexp - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // SchemaOrReference value = 2; - v2 := compiler.MapValueForKey(m, "value") - if v2 != nil { - var err error - x.Value, err = NewSchemaOrReference(v2, compiler.NewContext("value", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewNamedSecuritySchemeOrReference creates an object of type NamedSecuritySchemeOrReference if possible, returning an error if not. -func NewNamedSecuritySchemeOrReference(in *yaml.Node, context *compiler.Context) (*NamedSecuritySchemeOrReference, error) { - errors := make([]error, 0) - x := &NamedSecuritySchemeOrReference{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"name", "value"} - var allowedPatterns []*regexp.Regexp - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // SecuritySchemeOrReference value = 2; - v2 := compiler.MapValueForKey(m, "value") - if v2 != nil { - var err error - x.Value, err = NewSecuritySchemeOrReference(v2, compiler.NewContext("value", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewNamedServerVariable creates an object of type NamedServerVariable if possible, returning an error if not. -func NewNamedServerVariable(in *yaml.Node, context *compiler.Context) (*NamedServerVariable, error) { - errors := make([]error, 0) - x := &NamedServerVariable{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"name", "value"} - var allowedPatterns []*regexp.Regexp - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // ServerVariable value = 2; - v2 := compiler.MapValueForKey(m, "value") - if v2 != nil { - var err error - x.Value, err = NewServerVariable(v2, compiler.NewContext("value", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewNamedString creates an object of type NamedString if possible, returning an error if not. -func NewNamedString(in *yaml.Node, context *compiler.Context) (*NamedString, error) { - errors := make([]error, 0) - x := &NamedString{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"name", "value"} - var allowedPatterns []*regexp.Regexp - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string value = 2; - v2 := compiler.MapValueForKey(m, "value") - if v2 != nil { - x.Value, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for value: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewNamedStringArray creates an object of type NamedStringArray if possible, returning an error if not. -func NewNamedStringArray(in *yaml.Node, context *compiler.Context) (*NamedStringArray, error) { - errors := make([]error, 0) - x := &NamedStringArray{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"name", "value"} - var allowedPatterns []*regexp.Regexp - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // StringArray value = 2; - v2 := compiler.MapValueForKey(m, "value") - if v2 != nil { - var err error - x.Value, err = NewStringArray(v2, compiler.NewContext("value", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewOauthFlow creates an object of type OauthFlow if possible, returning an error if not. -func NewOauthFlow(in *yaml.Node, context *compiler.Context) (*OauthFlow, error) { - errors := make([]error, 0) - x := &OauthFlow{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"authorizationUrl", "refreshUrl", "scopes", "tokenUrl"} - allowedPatterns := []*regexp.Regexp{pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string authorization_url = 1; - v1 := compiler.MapValueForKey(m, "authorizationUrl") - if v1 != nil { - x.AuthorizationUrl, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for authorizationUrl: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string token_url = 2; - v2 := compiler.MapValueForKey(m, "tokenUrl") - if v2 != nil { - x.TokenUrl, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for tokenUrl: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string refresh_url = 3; - v3 := compiler.MapValueForKey(m, "refreshUrl") - if v3 != nil { - x.RefreshUrl, ok = compiler.StringForScalarNode(v3) - if !ok { - message := fmt.Sprintf("has unexpected value for refreshUrl: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Strings scopes = 4; - v4 := compiler.MapValueForKey(m, "scopes") - if v4 != nil { - var err error - x.Scopes, err = NewStrings(v4, compiler.NewContext("scopes", v4, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated NamedAny specification_extension = 5; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewOauthFlows creates an object of type OauthFlows if possible, returning an error if not. -func NewOauthFlows(in *yaml.Node, context *compiler.Context) (*OauthFlows, error) { - errors := make([]error, 0) - x := &OauthFlows{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"authorizationCode", "clientCredentials", "implicit", "password"} - allowedPatterns := []*regexp.Regexp{pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // OauthFlow implicit = 1; - v1 := compiler.MapValueForKey(m, "implicit") - if v1 != nil { - var err error - x.Implicit, err = NewOauthFlow(v1, compiler.NewContext("implicit", v1, context)) - if err != nil { - errors = append(errors, err) - } - } - // OauthFlow password = 2; - v2 := compiler.MapValueForKey(m, "password") - if v2 != nil { - var err error - x.Password, err = NewOauthFlow(v2, compiler.NewContext("password", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - // OauthFlow client_credentials = 3; - v3 := compiler.MapValueForKey(m, "clientCredentials") - if v3 != nil { - var err error - x.ClientCredentials, err = NewOauthFlow(v3, compiler.NewContext("clientCredentials", v3, context)) - if err != nil { - errors = append(errors, err) - } - } - // OauthFlow authorization_code = 4; - v4 := compiler.MapValueForKey(m, "authorizationCode") - if v4 != nil { - var err error - x.AuthorizationCode, err = NewOauthFlow(v4, compiler.NewContext("authorizationCode", v4, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated NamedAny specification_extension = 5; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewObject creates an object of type Object if possible, returning an error if not. -func NewObject(in *yaml.Node, context *compiler.Context) (*Object, error) { - errors := make([]error, 0) - x := &Object{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedAny additional_properties = 1; - // MAP: Any - x.AdditionalProperties = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewOperation creates an object of type Operation if possible, returning an error if not. -func NewOperation(in *yaml.Node, context *compiler.Context) (*Operation, error) { - errors := make([]error, 0) - x := &Operation{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"responses"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"callbacks", "deprecated", "description", "externalDocs", "operationId", "parameters", "requestBody", "responses", "security", "servers", "summary", "tags"} - allowedPatterns := []*regexp.Regexp{pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // repeated string tags = 1; - v1 := compiler.MapValueForKey(m, "tags") - if v1 != nil { - v, ok := compiler.SequenceNodeForNode(v1) - if ok { - x.Tags = compiler.StringArrayForSequenceNode(v) - } else { - message := fmt.Sprintf("has unexpected value for tags: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string summary = 2; - v2 := compiler.MapValueForKey(m, "summary") - if v2 != nil { - x.Summary, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for summary: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string description = 3; - v3 := compiler.MapValueForKey(m, "description") - if v3 != nil { - x.Description, ok = compiler.StringForScalarNode(v3) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // ExternalDocs external_docs = 4; - v4 := compiler.MapValueForKey(m, "externalDocs") - if v4 != nil { - var err error - x.ExternalDocs, err = NewExternalDocs(v4, compiler.NewContext("externalDocs", v4, context)) - if err != nil { - errors = append(errors, err) - } - } - // string operation_id = 5; - v5 := compiler.MapValueForKey(m, "operationId") - if v5 != nil { - x.OperationId, ok = compiler.StringForScalarNode(v5) - if !ok { - message := fmt.Sprintf("has unexpected value for operationId: %s", compiler.Display(v5)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated ParameterOrReference parameters = 6; - v6 := compiler.MapValueForKey(m, "parameters") - if v6 != nil { - // repeated ParameterOrReference - x.Parameters = make([]*ParameterOrReference, 0) - a, ok := compiler.SequenceNodeForNode(v6) - if ok { - for _, item := range a.Content { - y, err := NewParameterOrReference(item, compiler.NewContext("parameters", item, context)) - if err != nil { - errors = append(errors, err) - } - x.Parameters = append(x.Parameters, y) - } - } - } - // RequestBodyOrReference request_body = 7; - v7 := compiler.MapValueForKey(m, "requestBody") - if v7 != nil { - var err error - x.RequestBody, err = NewRequestBodyOrReference(v7, compiler.NewContext("requestBody", v7, context)) - if err != nil { - errors = append(errors, err) - } - } - // Responses responses = 8; - v8 := compiler.MapValueForKey(m, "responses") - if v8 != nil { - var err error - x.Responses, err = NewResponses(v8, compiler.NewContext("responses", v8, context)) - if err != nil { - errors = append(errors, err) - } - } - // CallbacksOrReferences callbacks = 9; - v9 := compiler.MapValueForKey(m, "callbacks") - if v9 != nil { - var err error - x.Callbacks, err = NewCallbacksOrReferences(v9, compiler.NewContext("callbacks", v9, context)) - if err != nil { - errors = append(errors, err) - } - } - // bool deprecated = 10; - v10 := compiler.MapValueForKey(m, "deprecated") - if v10 != nil { - x.Deprecated, ok = compiler.BoolForScalarNode(v10) - if !ok { - message := fmt.Sprintf("has unexpected value for deprecated: %s", compiler.Display(v10)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated SecurityRequirement security = 11; - v11 := compiler.MapValueForKey(m, "security") - if v11 != nil { - // repeated SecurityRequirement - x.Security = make([]*SecurityRequirement, 0) - a, ok := compiler.SequenceNodeForNode(v11) - if ok { - for _, item := range a.Content { - y, err := NewSecurityRequirement(item, compiler.NewContext("security", item, context)) - if err != nil { - errors = append(errors, err) - } - x.Security = append(x.Security, y) - } - } - } - // repeated Server servers = 12; - v12 := compiler.MapValueForKey(m, "servers") - if v12 != nil { - // repeated Server - x.Servers = make([]*Server, 0) - a, ok := compiler.SequenceNodeForNode(v12) - if ok { - for _, item := range a.Content { - y, err := NewServer(item, compiler.NewContext("servers", item, context)) - if err != nil { - errors = append(errors, err) - } - x.Servers = append(x.Servers, y) - } - } - } - // repeated NamedAny specification_extension = 13; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewParameter creates an object of type Parameter if possible, returning an error if not. -func NewParameter(in *yaml.Node, context *compiler.Context) (*Parameter, error) { - errors := make([]error, 0) - x := &Parameter{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"in", "name"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"allowEmptyValue", "allowReserved", "content", "deprecated", "description", "example", "examples", "explode", "in", "name", "required", "schema", "style"} - allowedPatterns := []*regexp.Regexp{pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string in = 2; - v2 := compiler.MapValueForKey(m, "in") - if v2 != nil { - x.In, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string description = 3; - v3 := compiler.MapValueForKey(m, "description") - if v3 != nil { - x.Description, ok = compiler.StringForScalarNode(v3) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool required = 4; - v4 := compiler.MapValueForKey(m, "required") - if v4 != nil { - x.Required, ok = compiler.BoolForScalarNode(v4) - if !ok { - message := fmt.Sprintf("has unexpected value for required: %s", compiler.Display(v4)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool deprecated = 5; - v5 := compiler.MapValueForKey(m, "deprecated") - if v5 != nil { - x.Deprecated, ok = compiler.BoolForScalarNode(v5) - if !ok { - message := fmt.Sprintf("has unexpected value for deprecated: %s", compiler.Display(v5)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool allow_empty_value = 6; - v6 := compiler.MapValueForKey(m, "allowEmptyValue") - if v6 != nil { - x.AllowEmptyValue, ok = compiler.BoolForScalarNode(v6) - if !ok { - message := fmt.Sprintf("has unexpected value for allowEmptyValue: %s", compiler.Display(v6)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string style = 7; - v7 := compiler.MapValueForKey(m, "style") - if v7 != nil { - x.Style, ok = compiler.StringForScalarNode(v7) - if !ok { - message := fmt.Sprintf("has unexpected value for style: %s", compiler.Display(v7)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool explode = 8; - v8 := compiler.MapValueForKey(m, "explode") - if v8 != nil { - x.Explode, ok = compiler.BoolForScalarNode(v8) - if !ok { - message := fmt.Sprintf("has unexpected value for explode: %s", compiler.Display(v8)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool allow_reserved = 9; - v9 := compiler.MapValueForKey(m, "allowReserved") - if v9 != nil { - x.AllowReserved, ok = compiler.BoolForScalarNode(v9) - if !ok { - message := fmt.Sprintf("has unexpected value for allowReserved: %s", compiler.Display(v9)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // SchemaOrReference schema = 10; - v10 := compiler.MapValueForKey(m, "schema") - if v10 != nil { - var err error - x.Schema, err = NewSchemaOrReference(v10, compiler.NewContext("schema", v10, context)) - if err != nil { - errors = append(errors, err) - } - } - // Any example = 11; - v11 := compiler.MapValueForKey(m, "example") - if v11 != nil { - var err error - x.Example, err = NewAny(v11, compiler.NewContext("example", v11, context)) - if err != nil { - errors = append(errors, err) - } - } - // ExamplesOrReferences examples = 12; - v12 := compiler.MapValueForKey(m, "examples") - if v12 != nil { - var err error - x.Examples, err = NewExamplesOrReferences(v12, compiler.NewContext("examples", v12, context)) - if err != nil { - errors = append(errors, err) - } - } - // MediaTypes content = 13; - v13 := compiler.MapValueForKey(m, "content") - if v13 != nil { - var err error - x.Content, err = NewMediaTypes(v13, compiler.NewContext("content", v13, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated NamedAny specification_extension = 14; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewParameterOrReference creates an object of type ParameterOrReference if possible, returning an error if not. -func NewParameterOrReference(in *yaml.Node, context *compiler.Context) (*ParameterOrReference, error) { - errors := make([]error, 0) - x := &ParameterOrReference{} - matched := false - // Parameter parameter = 1; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewParameter(m, compiler.NewContext("parameter", m, context)) - if matchingError == nil { - x.Oneof = &ParameterOrReference_Parameter{Parameter: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - // Reference reference = 2; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewReference(m, compiler.NewContext("reference", m, context)) - if matchingError == nil { - x.Oneof = &ParameterOrReference_Reference{Reference: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - if matched { - // since the oneof matched one of its possibilities, discard any matching errors - errors = make([]error, 0) - } else { - message := fmt.Sprintf("contains an invalid ParameterOrReference") - err := compiler.NewError(context, message) - errors = []error{err} - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewParametersOrReferences creates an object of type ParametersOrReferences if possible, returning an error if not. -func NewParametersOrReferences(in *yaml.Node, context *compiler.Context) (*ParametersOrReferences, error) { - errors := make([]error, 0) - x := &ParametersOrReferences{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedParameterOrReference additional_properties = 1; - // MAP: ParameterOrReference - x.AdditionalProperties = make([]*NamedParameterOrReference, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedParameterOrReference{} - pair.Name = k - var err error - pair.Value, err = NewParameterOrReference(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewPathItem creates an object of type PathItem if possible, returning an error if not. -func NewPathItem(in *yaml.Node, context *compiler.Context) (*PathItem, error) { - errors := make([]error, 0) - x := &PathItem{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"$ref", "delete", "description", "get", "head", "options", "parameters", "patch", "post", "put", "servers", "summary", "trace"} - allowedPatterns := []*regexp.Regexp{pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string _ref = 1; - v1 := compiler.MapValueForKey(m, "$ref") - if v1 != nil { - x.XRef, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for $ref: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string summary = 2; - v2 := compiler.MapValueForKey(m, "summary") - if v2 != nil { - x.Summary, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for summary: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string description = 3; - v3 := compiler.MapValueForKey(m, "description") - if v3 != nil { - x.Description, ok = compiler.StringForScalarNode(v3) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Operation get = 4; - v4 := compiler.MapValueForKey(m, "get") - if v4 != nil { - var err error - x.Get, err = NewOperation(v4, compiler.NewContext("get", v4, context)) - if err != nil { - errors = append(errors, err) - } - } - // Operation put = 5; - v5 := compiler.MapValueForKey(m, "put") - if v5 != nil { - var err error - x.Put, err = NewOperation(v5, compiler.NewContext("put", v5, context)) - if err != nil { - errors = append(errors, err) - } - } - // Operation post = 6; - v6 := compiler.MapValueForKey(m, "post") - if v6 != nil { - var err error - x.Post, err = NewOperation(v6, compiler.NewContext("post", v6, context)) - if err != nil { - errors = append(errors, err) - } - } - // Operation delete = 7; - v7 := compiler.MapValueForKey(m, "delete") - if v7 != nil { - var err error - x.Delete, err = NewOperation(v7, compiler.NewContext("delete", v7, context)) - if err != nil { - errors = append(errors, err) - } - } - // Operation options = 8; - v8 := compiler.MapValueForKey(m, "options") - if v8 != nil { - var err error - x.Options, err = NewOperation(v8, compiler.NewContext("options", v8, context)) - if err != nil { - errors = append(errors, err) - } - } - // Operation head = 9; - v9 := compiler.MapValueForKey(m, "head") - if v9 != nil { - var err error - x.Head, err = NewOperation(v9, compiler.NewContext("head", v9, context)) - if err != nil { - errors = append(errors, err) - } - } - // Operation patch = 10; - v10 := compiler.MapValueForKey(m, "patch") - if v10 != nil { - var err error - x.Patch, err = NewOperation(v10, compiler.NewContext("patch", v10, context)) - if err != nil { - errors = append(errors, err) - } - } - // Operation trace = 11; - v11 := compiler.MapValueForKey(m, "trace") - if v11 != nil { - var err error - x.Trace, err = NewOperation(v11, compiler.NewContext("trace", v11, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated Server servers = 12; - v12 := compiler.MapValueForKey(m, "servers") - if v12 != nil { - // repeated Server - x.Servers = make([]*Server, 0) - a, ok := compiler.SequenceNodeForNode(v12) - if ok { - for _, item := range a.Content { - y, err := NewServer(item, compiler.NewContext("servers", item, context)) - if err != nil { - errors = append(errors, err) - } - x.Servers = append(x.Servers, y) - } - } - } - // repeated ParameterOrReference parameters = 13; - v13 := compiler.MapValueForKey(m, "parameters") - if v13 != nil { - // repeated ParameterOrReference - x.Parameters = make([]*ParameterOrReference, 0) - a, ok := compiler.SequenceNodeForNode(v13) - if ok { - for _, item := range a.Content { - y, err := NewParameterOrReference(item, compiler.NewContext("parameters", item, context)) - if err != nil { - errors = append(errors, err) - } - x.Parameters = append(x.Parameters, y) - } - } - } - // repeated NamedAny specification_extension = 14; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewPaths creates an object of type Paths if possible, returning an error if not. -func NewPaths(in *yaml.Node, context *compiler.Context) (*Paths, error) { - errors := make([]error, 0) - x := &Paths{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{} - allowedPatterns := []*regexp.Regexp{pattern2, pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // repeated NamedPathItem path = 1; - // MAP: PathItem ^/ - x.Path = make([]*NamedPathItem, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "/") { - pair := &NamedPathItem{} - pair.Name = k - var err error - pair.Value, err = NewPathItem(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - x.Path = append(x.Path, pair) - } - } - } - // repeated NamedAny specification_extension = 2; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewProperties creates an object of type Properties if possible, returning an error if not. -func NewProperties(in *yaml.Node, context *compiler.Context) (*Properties, error) { - errors := make([]error, 0) - x := &Properties{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedSchemaOrReference additional_properties = 1; - // MAP: SchemaOrReference - x.AdditionalProperties = make([]*NamedSchemaOrReference, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedSchemaOrReference{} - pair.Name = k - var err error - pair.Value, err = NewSchemaOrReference(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewReference creates an object of type Reference if possible, returning an error if not. -func NewReference(in *yaml.Node, context *compiler.Context) (*Reference, error) { - errors := make([]error, 0) - x := &Reference{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"$ref"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string _ref = 1; - v1 := compiler.MapValueForKey(m, "$ref") - if v1 != nil { - x.XRef, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for $ref: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string summary = 2; - v2 := compiler.MapValueForKey(m, "summary") - if v2 != nil { - x.Summary, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for summary: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string description = 3; - v3 := compiler.MapValueForKey(m, "description") - if v3 != nil { - x.Description, ok = compiler.StringForScalarNode(v3) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewRequestBodiesOrReferences creates an object of type RequestBodiesOrReferences if possible, returning an error if not. -func NewRequestBodiesOrReferences(in *yaml.Node, context *compiler.Context) (*RequestBodiesOrReferences, error) { - errors := make([]error, 0) - x := &RequestBodiesOrReferences{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedRequestBodyOrReference additional_properties = 1; - // MAP: RequestBodyOrReference - x.AdditionalProperties = make([]*NamedRequestBodyOrReference, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedRequestBodyOrReference{} - pair.Name = k - var err error - pair.Value, err = NewRequestBodyOrReference(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewRequestBody creates an object of type RequestBody if possible, returning an error if not. -func NewRequestBody(in *yaml.Node, context *compiler.Context) (*RequestBody, error) { - errors := make([]error, 0) - x := &RequestBody{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"content"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"content", "description", "required"} - allowedPatterns := []*regexp.Regexp{pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string description = 1; - v1 := compiler.MapValueForKey(m, "description") - if v1 != nil { - x.Description, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // MediaTypes content = 2; - v2 := compiler.MapValueForKey(m, "content") - if v2 != nil { - var err error - x.Content, err = NewMediaTypes(v2, compiler.NewContext("content", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - // bool required = 3; - v3 := compiler.MapValueForKey(m, "required") - if v3 != nil { - x.Required, ok = compiler.BoolForScalarNode(v3) - if !ok { - message := fmt.Sprintf("has unexpected value for required: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated NamedAny specification_extension = 4; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewRequestBodyOrReference creates an object of type RequestBodyOrReference if possible, returning an error if not. -func NewRequestBodyOrReference(in *yaml.Node, context *compiler.Context) (*RequestBodyOrReference, error) { - errors := make([]error, 0) - x := &RequestBodyOrReference{} - matched := false - // RequestBody request_body = 1; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewRequestBody(m, compiler.NewContext("requestBody", m, context)) - if matchingError == nil { - x.Oneof = &RequestBodyOrReference_RequestBody{RequestBody: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - // Reference reference = 2; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewReference(m, compiler.NewContext("reference", m, context)) - if matchingError == nil { - x.Oneof = &RequestBodyOrReference_Reference{Reference: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - if matched { - // since the oneof matched one of its possibilities, discard any matching errors - errors = make([]error, 0) - } else { - message := fmt.Sprintf("contains an invalid RequestBodyOrReference") - err := compiler.NewError(context, message) - errors = []error{err} - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewResponse creates an object of type Response if possible, returning an error if not. -func NewResponse(in *yaml.Node, context *compiler.Context) (*Response, error) { - errors := make([]error, 0) - x := &Response{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"description"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"content", "description", "headers", "links"} - allowedPatterns := []*regexp.Regexp{pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string description = 1; - v1 := compiler.MapValueForKey(m, "description") - if v1 != nil { - x.Description, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // HeadersOrReferences headers = 2; - v2 := compiler.MapValueForKey(m, "headers") - if v2 != nil { - var err error - x.Headers, err = NewHeadersOrReferences(v2, compiler.NewContext("headers", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - // MediaTypes content = 3; - v3 := compiler.MapValueForKey(m, "content") - if v3 != nil { - var err error - x.Content, err = NewMediaTypes(v3, compiler.NewContext("content", v3, context)) - if err != nil { - errors = append(errors, err) - } - } - // LinksOrReferences links = 4; - v4 := compiler.MapValueForKey(m, "links") - if v4 != nil { - var err error - x.Links, err = NewLinksOrReferences(v4, compiler.NewContext("links", v4, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated NamedAny specification_extension = 5; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewResponseOrReference creates an object of type ResponseOrReference if possible, returning an error if not. -func NewResponseOrReference(in *yaml.Node, context *compiler.Context) (*ResponseOrReference, error) { - errors := make([]error, 0) - x := &ResponseOrReference{} - matched := false - // Response response = 1; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewResponse(m, compiler.NewContext("response", m, context)) - if matchingError == nil { - x.Oneof = &ResponseOrReference_Response{Response: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - // Reference reference = 2; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewReference(m, compiler.NewContext("reference", m, context)) - if matchingError == nil { - x.Oneof = &ResponseOrReference_Reference{Reference: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - if matched { - // since the oneof matched one of its possibilities, discard any matching errors - errors = make([]error, 0) - } else { - message := fmt.Sprintf("contains an invalid ResponseOrReference") - err := compiler.NewError(context, message) - errors = []error{err} - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewResponses creates an object of type Responses if possible, returning an error if not. -func NewResponses(in *yaml.Node, context *compiler.Context) (*Responses, error) { - errors := make([]error, 0) - x := &Responses{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"default"} - allowedPatterns := []*regexp.Regexp{pattern3, pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // ResponseOrReference default = 1; - v1 := compiler.MapValueForKey(m, "default") - if v1 != nil { - var err error - x.Default, err = NewResponseOrReference(v1, compiler.NewContext("default", v1, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated NamedResponseOrReference response_or_reference = 2; - // MAP: ResponseOrReference ^([0-9X]{3})$ - x.ResponseOrReference = make([]*NamedResponseOrReference, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if pattern3.MatchString(k) { - pair := &NamedResponseOrReference{} - pair.Name = k - var err error - pair.Value, err = NewResponseOrReference(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - x.ResponseOrReference = append(x.ResponseOrReference, pair) - } - } - } - // repeated NamedAny specification_extension = 3; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewResponsesOrReferences creates an object of type ResponsesOrReferences if possible, returning an error if not. -func NewResponsesOrReferences(in *yaml.Node, context *compiler.Context) (*ResponsesOrReferences, error) { - errors := make([]error, 0) - x := &ResponsesOrReferences{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedResponseOrReference additional_properties = 1; - // MAP: ResponseOrReference - x.AdditionalProperties = make([]*NamedResponseOrReference, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedResponseOrReference{} - pair.Name = k - var err error - pair.Value, err = NewResponseOrReference(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewSchema creates an object of type Schema if possible, returning an error if not. -func NewSchema(in *yaml.Node, context *compiler.Context) (*Schema, error) { - errors := make([]error, 0) - x := &Schema{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"additionalProperties", "allOf", "anyOf", "default", "deprecated", "description", "discriminator", "enum", "example", "exclusiveMaximum", "exclusiveMinimum", "externalDocs", "format", "items", "maxItems", "maxLength", "maxProperties", "maximum", "minItems", "minLength", "minProperties", "minimum", "multipleOf", "not", "nullable", "oneOf", "pattern", "properties", "readOnly", "required", "title", "type", "uniqueItems", "writeOnly", "xml"} - allowedPatterns := []*regexp.Regexp{pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // bool nullable = 1; - v1 := compiler.MapValueForKey(m, "nullable") - if v1 != nil { - x.Nullable, ok = compiler.BoolForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for nullable: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Discriminator discriminator = 2; - v2 := compiler.MapValueForKey(m, "discriminator") - if v2 != nil { - var err error - x.Discriminator, err = NewDiscriminator(v2, compiler.NewContext("discriminator", v2, context)) - if err != nil { - errors = append(errors, err) - } - } - // bool read_only = 3; - v3 := compiler.MapValueForKey(m, "readOnly") - if v3 != nil { - x.ReadOnly, ok = compiler.BoolForScalarNode(v3) - if !ok { - message := fmt.Sprintf("has unexpected value for readOnly: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool write_only = 4; - v4 := compiler.MapValueForKey(m, "writeOnly") - if v4 != nil { - x.WriteOnly, ok = compiler.BoolForScalarNode(v4) - if !ok { - message := fmt.Sprintf("has unexpected value for writeOnly: %s", compiler.Display(v4)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // Xml xml = 5; - v5 := compiler.MapValueForKey(m, "xml") - if v5 != nil { - var err error - x.Xml, err = NewXml(v5, compiler.NewContext("xml", v5, context)) - if err != nil { - errors = append(errors, err) - } - } - // ExternalDocs external_docs = 6; - v6 := compiler.MapValueForKey(m, "externalDocs") - if v6 != nil { - var err error - x.ExternalDocs, err = NewExternalDocs(v6, compiler.NewContext("externalDocs", v6, context)) - if err != nil { - errors = append(errors, err) - } - } - // Any example = 7; - v7 := compiler.MapValueForKey(m, "example") - if v7 != nil { - var err error - x.Example, err = NewAny(v7, compiler.NewContext("example", v7, context)) - if err != nil { - errors = append(errors, err) - } - } - // bool deprecated = 8; - v8 := compiler.MapValueForKey(m, "deprecated") - if v8 != nil { - x.Deprecated, ok = compiler.BoolForScalarNode(v8) - if !ok { - message := fmt.Sprintf("has unexpected value for deprecated: %s", compiler.Display(v8)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string title = 9; - v9 := compiler.MapValueForKey(m, "title") - if v9 != nil { - x.Title, ok = compiler.StringForScalarNode(v9) - if !ok { - message := fmt.Sprintf("has unexpected value for title: %s", compiler.Display(v9)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // float multiple_of = 10; - v10 := compiler.MapValueForKey(m, "multipleOf") - if v10 != nil { - v, ok := compiler.FloatForScalarNode(v10) - if ok { - x.MultipleOf = v - } else { - message := fmt.Sprintf("has unexpected value for multipleOf: %s", compiler.Display(v10)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // float maximum = 11; - v11 := compiler.MapValueForKey(m, "maximum") - if v11 != nil { - v, ok := compiler.FloatForScalarNode(v11) - if ok { - x.Maximum = v - } else { - message := fmt.Sprintf("has unexpected value for maximum: %s", compiler.Display(v11)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool exclusive_maximum = 12; - v12 := compiler.MapValueForKey(m, "exclusiveMaximum") - if v12 != nil { - x.ExclusiveMaximum, ok = compiler.BoolForScalarNode(v12) - if !ok { - message := fmt.Sprintf("has unexpected value for exclusiveMaximum: %s", compiler.Display(v12)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // float minimum = 13; - v13 := compiler.MapValueForKey(m, "minimum") - if v13 != nil { - v, ok := compiler.FloatForScalarNode(v13) - if ok { - x.Minimum = v - } else { - message := fmt.Sprintf("has unexpected value for minimum: %s", compiler.Display(v13)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool exclusive_minimum = 14; - v14 := compiler.MapValueForKey(m, "exclusiveMinimum") - if v14 != nil { - x.ExclusiveMinimum, ok = compiler.BoolForScalarNode(v14) - if !ok { - message := fmt.Sprintf("has unexpected value for exclusiveMinimum: %s", compiler.Display(v14)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 max_length = 15; - v15 := compiler.MapValueForKey(m, "maxLength") - if v15 != nil { - t, ok := compiler.IntForScalarNode(v15) - if ok { - x.MaxLength = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for maxLength: %s", compiler.Display(v15)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 min_length = 16; - v16 := compiler.MapValueForKey(m, "minLength") - if v16 != nil { - t, ok := compiler.IntForScalarNode(v16) - if ok { - x.MinLength = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for minLength: %s", compiler.Display(v16)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string pattern = 17; - v17 := compiler.MapValueForKey(m, "pattern") - if v17 != nil { - x.Pattern, ok = compiler.StringForScalarNode(v17) - if !ok { - message := fmt.Sprintf("has unexpected value for pattern: %s", compiler.Display(v17)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 max_items = 18; - v18 := compiler.MapValueForKey(m, "maxItems") - if v18 != nil { - t, ok := compiler.IntForScalarNode(v18) - if ok { - x.MaxItems = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for maxItems: %s", compiler.Display(v18)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 min_items = 19; - v19 := compiler.MapValueForKey(m, "minItems") - if v19 != nil { - t, ok := compiler.IntForScalarNode(v19) - if ok { - x.MinItems = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for minItems: %s", compiler.Display(v19)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool unique_items = 20; - v20 := compiler.MapValueForKey(m, "uniqueItems") - if v20 != nil { - x.UniqueItems, ok = compiler.BoolForScalarNode(v20) - if !ok { - message := fmt.Sprintf("has unexpected value for uniqueItems: %s", compiler.Display(v20)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 max_properties = 21; - v21 := compiler.MapValueForKey(m, "maxProperties") - if v21 != nil { - t, ok := compiler.IntForScalarNode(v21) - if ok { - x.MaxProperties = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for maxProperties: %s", compiler.Display(v21)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // int64 min_properties = 22; - v22 := compiler.MapValueForKey(m, "minProperties") - if v22 != nil { - t, ok := compiler.IntForScalarNode(v22) - if ok { - x.MinProperties = int64(t) - } else { - message := fmt.Sprintf("has unexpected value for minProperties: %s", compiler.Display(v22)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated string required = 23; - v23 := compiler.MapValueForKey(m, "required") - if v23 != nil { - v, ok := compiler.SequenceNodeForNode(v23) - if ok { - x.Required = compiler.StringArrayForSequenceNode(v) - } else { - message := fmt.Sprintf("has unexpected value for required: %s", compiler.Display(v23)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated Any enum = 24; - v24 := compiler.MapValueForKey(m, "enum") - if v24 != nil { - // repeated Any - x.Enum = make([]*Any, 0) - a, ok := compiler.SequenceNodeForNode(v24) - if ok { - for _, item := range a.Content { - y, err := NewAny(item, compiler.NewContext("enum", item, context)) - if err != nil { - errors = append(errors, err) - } - x.Enum = append(x.Enum, y) - } - } - } - // string type = 25; - v25 := compiler.MapValueForKey(m, "type") - if v25 != nil { - x.Type, ok = compiler.StringForScalarNode(v25) - if !ok { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v25)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated SchemaOrReference all_of = 26; - v26 := compiler.MapValueForKey(m, "allOf") - if v26 != nil { - // repeated SchemaOrReference - x.AllOf = make([]*SchemaOrReference, 0) - a, ok := compiler.SequenceNodeForNode(v26) - if ok { - for _, item := range a.Content { - y, err := NewSchemaOrReference(item, compiler.NewContext("allOf", item, context)) - if err != nil { - errors = append(errors, err) - } - x.AllOf = append(x.AllOf, y) - } - } - } - // repeated SchemaOrReference one_of = 27; - v27 := compiler.MapValueForKey(m, "oneOf") - if v27 != nil { - // repeated SchemaOrReference - x.OneOf = make([]*SchemaOrReference, 0) - a, ok := compiler.SequenceNodeForNode(v27) - if ok { - for _, item := range a.Content { - y, err := NewSchemaOrReference(item, compiler.NewContext("oneOf", item, context)) - if err != nil { - errors = append(errors, err) - } - x.OneOf = append(x.OneOf, y) - } - } - } - // repeated SchemaOrReference any_of = 28; - v28 := compiler.MapValueForKey(m, "anyOf") - if v28 != nil { - // repeated SchemaOrReference - x.AnyOf = make([]*SchemaOrReference, 0) - a, ok := compiler.SequenceNodeForNode(v28) - if ok { - for _, item := range a.Content { - y, err := NewSchemaOrReference(item, compiler.NewContext("anyOf", item, context)) - if err != nil { - errors = append(errors, err) - } - x.AnyOf = append(x.AnyOf, y) - } - } - } - // Schema not = 29; - v29 := compiler.MapValueForKey(m, "not") - if v29 != nil { - var err error - x.Not, err = NewSchema(v29, compiler.NewContext("not", v29, context)) - if err != nil { - errors = append(errors, err) - } - } - // ItemsItem items = 30; - v30 := compiler.MapValueForKey(m, "items") - if v30 != nil { - var err error - x.Items, err = NewItemsItem(v30, compiler.NewContext("items", v30, context)) - if err != nil { - errors = append(errors, err) - } - } - // Properties properties = 31; - v31 := compiler.MapValueForKey(m, "properties") - if v31 != nil { - var err error - x.Properties, err = NewProperties(v31, compiler.NewContext("properties", v31, context)) - if err != nil { - errors = append(errors, err) - } - } - // AdditionalPropertiesItem additional_properties = 32; - v32 := compiler.MapValueForKey(m, "additionalProperties") - if v32 != nil { - var err error - x.AdditionalProperties, err = NewAdditionalPropertiesItem(v32, compiler.NewContext("additionalProperties", v32, context)) - if err != nil { - errors = append(errors, err) - } - } - // DefaultType default = 33; - v33 := compiler.MapValueForKey(m, "default") - if v33 != nil { - var err error - x.Default, err = NewDefaultType(v33, compiler.NewContext("default", v33, context)) - if err != nil { - errors = append(errors, err) - } - } - // string description = 34; - v34 := compiler.MapValueForKey(m, "description") - if v34 != nil { - x.Description, ok = compiler.StringForScalarNode(v34) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v34)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string format = 35; - v35 := compiler.MapValueForKey(m, "format") - if v35 != nil { - x.Format, ok = compiler.StringForScalarNode(v35) - if !ok { - message := fmt.Sprintf("has unexpected value for format: %s", compiler.Display(v35)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated NamedAny specification_extension = 36; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewSchemaOrReference creates an object of type SchemaOrReference if possible, returning an error if not. -func NewSchemaOrReference(in *yaml.Node, context *compiler.Context) (*SchemaOrReference, error) { - errors := make([]error, 0) - x := &SchemaOrReference{} - matched := false - // Schema schema = 1; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewSchema(m, compiler.NewContext("schema", m, context)) - if matchingError == nil { - x.Oneof = &SchemaOrReference_Schema{Schema: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - // Reference reference = 2; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewReference(m, compiler.NewContext("reference", m, context)) - if matchingError == nil { - x.Oneof = &SchemaOrReference_Reference{Reference: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - if matched { - // since the oneof matched one of its possibilities, discard any matching errors - errors = make([]error, 0) - } else { - message := fmt.Sprintf("contains an invalid SchemaOrReference") - err := compiler.NewError(context, message) - errors = []error{err} - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewSchemasOrReferences creates an object of type SchemasOrReferences if possible, returning an error if not. -func NewSchemasOrReferences(in *yaml.Node, context *compiler.Context) (*SchemasOrReferences, error) { - errors := make([]error, 0) - x := &SchemasOrReferences{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedSchemaOrReference additional_properties = 1; - // MAP: SchemaOrReference - x.AdditionalProperties = make([]*NamedSchemaOrReference, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedSchemaOrReference{} - pair.Name = k - var err error - pair.Value, err = NewSchemaOrReference(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewSecurityRequirement creates an object of type SecurityRequirement if possible, returning an error if not. -func NewSecurityRequirement(in *yaml.Node, context *compiler.Context) (*SecurityRequirement, error) { - errors := make([]error, 0) - x := &SecurityRequirement{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedStringArray additional_properties = 1; - // MAP: StringArray - x.AdditionalProperties = make([]*NamedStringArray, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedStringArray{} - pair.Name = k - var err error - pair.Value, err = NewStringArray(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewSecurityScheme creates an object of type SecurityScheme if possible, returning an error if not. -func NewSecurityScheme(in *yaml.Node, context *compiler.Context) (*SecurityScheme, error) { - errors := make([]error, 0) - x := &SecurityScheme{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"type"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"bearerFormat", "description", "flows", "in", "name", "openIdConnectUrl", "scheme", "type"} - allowedPatterns := []*regexp.Regexp{pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string type = 1; - v1 := compiler.MapValueForKey(m, "type") - if v1 != nil { - x.Type, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string description = 2; - v2 := compiler.MapValueForKey(m, "description") - if v2 != nil { - x.Description, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string name = 3; - v3 := compiler.MapValueForKey(m, "name") - if v3 != nil { - x.Name, ok = compiler.StringForScalarNode(v3) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string in = 4; - v4 := compiler.MapValueForKey(m, "in") - if v4 != nil { - x.In, ok = compiler.StringForScalarNode(v4) - if !ok { - message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v4)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string scheme = 5; - v5 := compiler.MapValueForKey(m, "scheme") - if v5 != nil { - x.Scheme, ok = compiler.StringForScalarNode(v5) - if !ok { - message := fmt.Sprintf("has unexpected value for scheme: %s", compiler.Display(v5)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string bearer_format = 6; - v6 := compiler.MapValueForKey(m, "bearerFormat") - if v6 != nil { - x.BearerFormat, ok = compiler.StringForScalarNode(v6) - if !ok { - message := fmt.Sprintf("has unexpected value for bearerFormat: %s", compiler.Display(v6)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // OauthFlows flows = 7; - v7 := compiler.MapValueForKey(m, "flows") - if v7 != nil { - var err error - x.Flows, err = NewOauthFlows(v7, compiler.NewContext("flows", v7, context)) - if err != nil { - errors = append(errors, err) - } - } - // string open_id_connect_url = 8; - v8 := compiler.MapValueForKey(m, "openIdConnectUrl") - if v8 != nil { - x.OpenIdConnectUrl, ok = compiler.StringForScalarNode(v8) - if !ok { - message := fmt.Sprintf("has unexpected value for openIdConnectUrl: %s", compiler.Display(v8)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated NamedAny specification_extension = 9; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewSecuritySchemeOrReference creates an object of type SecuritySchemeOrReference if possible, returning an error if not. -func NewSecuritySchemeOrReference(in *yaml.Node, context *compiler.Context) (*SecuritySchemeOrReference, error) { - errors := make([]error, 0) - x := &SecuritySchemeOrReference{} - matched := false - // SecurityScheme security_scheme = 1; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewSecurityScheme(m, compiler.NewContext("securityScheme", m, context)) - if matchingError == nil { - x.Oneof = &SecuritySchemeOrReference_SecurityScheme{SecurityScheme: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - // Reference reference = 2; - { - m, ok := compiler.UnpackMap(in) - if ok { - // errors might be ok here, they mean we just don't have the right subtype - t, matchingError := NewReference(m, compiler.NewContext("reference", m, context)) - if matchingError == nil { - x.Oneof = &SecuritySchemeOrReference_Reference{Reference: t} - matched = true - } else { - errors = append(errors, matchingError) - } - } - } - if matched { - // since the oneof matched one of its possibilities, discard any matching errors - errors = make([]error, 0) - } else { - message := fmt.Sprintf("contains an invalid SecuritySchemeOrReference") - err := compiler.NewError(context, message) - errors = []error{err} - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewSecuritySchemesOrReferences creates an object of type SecuritySchemesOrReferences if possible, returning an error if not. -func NewSecuritySchemesOrReferences(in *yaml.Node, context *compiler.Context) (*SecuritySchemesOrReferences, error) { - errors := make([]error, 0) - x := &SecuritySchemesOrReferences{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedSecuritySchemeOrReference additional_properties = 1; - // MAP: SecuritySchemeOrReference - x.AdditionalProperties = make([]*NamedSecuritySchemeOrReference, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedSecuritySchemeOrReference{} - pair.Name = k - var err error - pair.Value, err = NewSecuritySchemeOrReference(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewServer creates an object of type Server if possible, returning an error if not. -func NewServer(in *yaml.Node, context *compiler.Context) (*Server, error) { - errors := make([]error, 0) - x := &Server{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"url"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"description", "url", "variables"} - allowedPatterns := []*regexp.Regexp{pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string url = 1; - v1 := compiler.MapValueForKey(m, "url") - if v1 != nil { - x.Url, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for url: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string description = 2; - v2 := compiler.MapValueForKey(m, "description") - if v2 != nil { - x.Description, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // ServerVariables variables = 3; - v3 := compiler.MapValueForKey(m, "variables") - if v3 != nil { - var err error - x.Variables, err = NewServerVariables(v3, compiler.NewContext("variables", v3, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated NamedAny specification_extension = 4; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewServerVariable creates an object of type ServerVariable if possible, returning an error if not. -func NewServerVariable(in *yaml.Node, context *compiler.Context) (*ServerVariable, error) { - errors := make([]error, 0) - x := &ServerVariable{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"default"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"default", "description", "enum"} - allowedPatterns := []*regexp.Regexp{pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // repeated string enum = 1; - v1 := compiler.MapValueForKey(m, "enum") - if v1 != nil { - v, ok := compiler.SequenceNodeForNode(v1) - if ok { - x.Enum = compiler.StringArrayForSequenceNode(v) - } else { - message := fmt.Sprintf("has unexpected value for enum: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string default = 2; - v2 := compiler.MapValueForKey(m, "default") - if v2 != nil { - x.Default, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for default: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string description = 3; - v3 := compiler.MapValueForKey(m, "description") - if v3 != nil { - x.Description, ok = compiler.StringForScalarNode(v3) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated NamedAny specification_extension = 4; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewServerVariables creates an object of type ServerVariables if possible, returning an error if not. -func NewServerVariables(in *yaml.Node, context *compiler.Context) (*ServerVariables, error) { - errors := make([]error, 0) - x := &ServerVariables{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedServerVariable additional_properties = 1; - // MAP: ServerVariable - x.AdditionalProperties = make([]*NamedServerVariable, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedServerVariable{} - pair.Name = k - var err error - pair.Value, err = NewServerVariable(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewSpecificationExtension creates an object of type SpecificationExtension if possible, returning an error if not. -func NewSpecificationExtension(in *yaml.Node, context *compiler.Context) (*SpecificationExtension, error) { - errors := make([]error, 0) - x := &SpecificationExtension{} - matched := false - switch in.Tag { - case "!!bool": - var v bool - v, matched = compiler.BoolForScalarNode(in) - x.Oneof = &SpecificationExtension_Boolean{Boolean: v} - case "!!str": - var v string - v, matched = compiler.StringForScalarNode(in) - x.Oneof = &SpecificationExtension_String_{String_: v} - case "!!float": - var v float64 - v, matched = compiler.FloatForScalarNode(in) - x.Oneof = &SpecificationExtension_Number{Number: v} - case "!!int": - var v int64 - v, matched = compiler.IntForScalarNode(in) - x.Oneof = &SpecificationExtension_Number{Number: float64(v)} - } - if matched { - // since the oneof matched one of its possibilities, discard any matching errors - errors = make([]error, 0) - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewStringArray creates an object of type StringArray if possible, returning an error if not. -func NewStringArray(in *yaml.Node, context *compiler.Context) (*StringArray, error) { - errors := make([]error, 0) - x := &StringArray{} - x.Value = make([]string, 0) - for _, node := range in.Content { - s, _ := compiler.StringForScalarNode(node) - x.Value = append(x.Value, s) - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewStrings creates an object of type Strings if possible, returning an error if not. -func NewStrings(in *yaml.Node, context *compiler.Context) (*Strings, error) { - errors := make([]error, 0) - x := &Strings{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - // repeated NamedString additional_properties = 1; - // MAP: string - x.AdditionalProperties = make([]*NamedString, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - pair := &NamedString{} - pair.Name = k - pair.Value, _ = compiler.StringForScalarNode(v) - x.AdditionalProperties = append(x.AdditionalProperties, pair) - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewTag creates an object of type Tag if possible, returning an error if not. -func NewTag(in *yaml.Node, context *compiler.Context) (*Tag, error) { - errors := make([]error, 0) - x := &Tag{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - requiredKeys := []string{"name"} - missingKeys := compiler.MissingKeysInMap(m, requiredKeys) - if len(missingKeys) > 0 { - message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - allowedKeys := []string{"description", "externalDocs", "name"} - allowedPatterns := []*regexp.Regexp{pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string description = 2; - v2 := compiler.MapValueForKey(m, "description") - if v2 != nil { - x.Description, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // ExternalDocs external_docs = 3; - v3 := compiler.MapValueForKey(m, "externalDocs") - if v3 != nil { - var err error - x.ExternalDocs, err = NewExternalDocs(v3, compiler.NewContext("externalDocs", v3, context)) - if err != nil { - errors = append(errors, err) - } - } - // repeated NamedAny specification_extension = 4; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// NewXml creates an object of type Xml if possible, returning an error if not. -func NewXml(in *yaml.Node, context *compiler.Context) (*Xml, error) { - errors := make([]error, 0) - x := &Xml{} - m, ok := compiler.UnpackMap(in) - if !ok { - message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) - errors = append(errors, compiler.NewError(context, message)) - } else { - allowedKeys := []string{"attribute", "name", "namespace", "prefix", "wrapped"} - allowedPatterns := []*regexp.Regexp{pattern1} - invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns) - if len(invalidKeys) > 0 { - message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", ")) - errors = append(errors, compiler.NewError(context, message)) - } - // string name = 1; - v1 := compiler.MapValueForKey(m, "name") - if v1 != nil { - x.Name, ok = compiler.StringForScalarNode(v1) - if !ok { - message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string namespace = 2; - v2 := compiler.MapValueForKey(m, "namespace") - if v2 != nil { - x.Namespace, ok = compiler.StringForScalarNode(v2) - if !ok { - message := fmt.Sprintf("has unexpected value for namespace: %s", compiler.Display(v2)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // string prefix = 3; - v3 := compiler.MapValueForKey(m, "prefix") - if v3 != nil { - x.Prefix, ok = compiler.StringForScalarNode(v3) - if !ok { - message := fmt.Sprintf("has unexpected value for prefix: %s", compiler.Display(v3)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool attribute = 4; - v4 := compiler.MapValueForKey(m, "attribute") - if v4 != nil { - x.Attribute, ok = compiler.BoolForScalarNode(v4) - if !ok { - message := fmt.Sprintf("has unexpected value for attribute: %s", compiler.Display(v4)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // bool wrapped = 5; - v5 := compiler.MapValueForKey(m, "wrapped") - if v5 != nil { - x.Wrapped, ok = compiler.BoolForScalarNode(v5) - if !ok { - message := fmt.Sprintf("has unexpected value for wrapped: %s", compiler.Display(v5)) - errors = append(errors, compiler.NewError(context, message)) - } - } - // repeated NamedAny specification_extension = 6; - // MAP: Any ^x- - x.SpecificationExtension = make([]*NamedAny, 0) - for i := 0; i < len(m.Content); i += 2 { - k, ok := compiler.StringForScalarNode(m.Content[i]) - if ok { - v := m.Content[i+1] - if strings.HasPrefix(k, "x-") { - pair := &NamedAny{} - pair.Name = k - result := &Any{} - handled, resultFromExt, err := compiler.CallExtension(context, v, k) - if handled { - if err != nil { - errors = append(errors, err) - } else { - bytes := compiler.Marshal(v) - result.Yaml = string(bytes) - result.Value = resultFromExt - pair.Value = result - } - } else { - pair.Value, err = NewAny(v, compiler.NewContext(k, v, context)) - if err != nil { - errors = append(errors, err) - } - } - x.SpecificationExtension = append(x.SpecificationExtension, pair) - } - } - } - } - return x, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside AdditionalPropertiesItem objects. -func (m *AdditionalPropertiesItem) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - { - p, ok := m.Oneof.(*AdditionalPropertiesItem_SchemaOrReference) - if ok { - _, err := p.SchemaOrReference.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Any objects. -func (m *Any) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside AnyOrExpression objects. -func (m *AnyOrExpression) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - { - p, ok := m.Oneof.(*AnyOrExpression_Any) - if ok { - _, err := p.Any.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - { - p, ok := m.Oneof.(*AnyOrExpression_Expression) - if ok { - _, err := p.Expression.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Callback objects. -func (m *Callback) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.Path { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside CallbackOrReference objects. -func (m *CallbackOrReference) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - { - p, ok := m.Oneof.(*CallbackOrReference_Callback) - if ok { - _, err := p.Callback.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - { - p, ok := m.Oneof.(*CallbackOrReference_Reference) - if ok { - _, err := p.Reference.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside CallbacksOrReferences objects. -func (m *CallbacksOrReferences) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Components objects. -func (m *Components) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Schemas != nil { - _, err := m.Schemas.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Responses != nil { - _, err := m.Responses.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Parameters != nil { - _, err := m.Parameters.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Examples != nil { - _, err := m.Examples.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.RequestBodies != nil { - _, err := m.RequestBodies.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Headers != nil { - _, err := m.Headers.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.SecuritySchemes != nil { - _, err := m.SecuritySchemes.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Links != nil { - _, err := m.Links.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Callbacks != nil { - _, err := m.Callbacks.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Contact objects. -func (m *Contact) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside DefaultType objects. -func (m *DefaultType) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Discriminator objects. -func (m *Discriminator) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Mapping != nil { - _, err := m.Mapping.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Document objects. -func (m *Document) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Info != nil { - _, err := m.Info.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.Servers { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - if m.Paths != nil { - _, err := m.Paths.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Components != nil { - _, err := m.Components.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.Security { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - for _, item := range m.Tags { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - if m.ExternalDocs != nil { - _, err := m.ExternalDocs.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Encoding objects. -func (m *Encoding) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Headers != nil { - _, err := m.Headers.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Encodings objects. -func (m *Encodings) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Example objects. -func (m *Example) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Value != nil { - _, err := m.Value.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside ExampleOrReference objects. -func (m *ExampleOrReference) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - { - p, ok := m.Oneof.(*ExampleOrReference_Example) - if ok { - _, err := p.Example.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - { - p, ok := m.Oneof.(*ExampleOrReference_Reference) - if ok { - _, err := p.Reference.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside ExamplesOrReferences objects. -func (m *ExamplesOrReferences) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Expression objects. -func (m *Expression) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside ExternalDocs objects. -func (m *ExternalDocs) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Header objects. -func (m *Header) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Schema != nil { - _, err := m.Schema.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Example != nil { - _, err := m.Example.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Examples != nil { - _, err := m.Examples.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Content != nil { - _, err := m.Content.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside HeaderOrReference objects. -func (m *HeaderOrReference) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - { - p, ok := m.Oneof.(*HeaderOrReference_Header) - if ok { - _, err := p.Header.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - { - p, ok := m.Oneof.(*HeaderOrReference_Reference) - if ok { - _, err := p.Reference.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside HeadersOrReferences objects. -func (m *HeadersOrReferences) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Info objects. -func (m *Info) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Contact != nil { - _, err := m.Contact.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.License != nil { - _, err := m.License.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside ItemsItem objects. -func (m *ItemsItem) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.SchemaOrReference { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside License objects. -func (m *License) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Link objects. -func (m *Link) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Parameters != nil { - _, err := m.Parameters.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.RequestBody != nil { - _, err := m.RequestBody.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Server != nil { - _, err := m.Server.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside LinkOrReference objects. -func (m *LinkOrReference) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - { - p, ok := m.Oneof.(*LinkOrReference_Link) - if ok { - _, err := p.Link.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - { - p, ok := m.Oneof.(*LinkOrReference_Reference) - if ok { - _, err := p.Reference.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside LinksOrReferences objects. -func (m *LinksOrReferences) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside MediaType objects. -func (m *MediaType) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Schema != nil { - _, err := m.Schema.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Example != nil { - _, err := m.Example.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Examples != nil { - _, err := m.Examples.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Encoding != nil { - _, err := m.Encoding.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside MediaTypes objects. -func (m *MediaTypes) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside NamedAny objects. -func (m *NamedAny) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Value != nil { - _, err := m.Value.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside NamedCallbackOrReference objects. -func (m *NamedCallbackOrReference) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Value != nil { - _, err := m.Value.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside NamedEncoding objects. -func (m *NamedEncoding) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Value != nil { - _, err := m.Value.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside NamedExampleOrReference objects. -func (m *NamedExampleOrReference) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Value != nil { - _, err := m.Value.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside NamedHeaderOrReference objects. -func (m *NamedHeaderOrReference) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Value != nil { - _, err := m.Value.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside NamedLinkOrReference objects. -func (m *NamedLinkOrReference) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Value != nil { - _, err := m.Value.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside NamedMediaType objects. -func (m *NamedMediaType) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Value != nil { - _, err := m.Value.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside NamedParameterOrReference objects. -func (m *NamedParameterOrReference) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Value != nil { - _, err := m.Value.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside NamedPathItem objects. -func (m *NamedPathItem) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Value != nil { - _, err := m.Value.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside NamedRequestBodyOrReference objects. -func (m *NamedRequestBodyOrReference) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Value != nil { - _, err := m.Value.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside NamedResponseOrReference objects. -func (m *NamedResponseOrReference) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Value != nil { - _, err := m.Value.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside NamedSchemaOrReference objects. -func (m *NamedSchemaOrReference) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Value != nil { - _, err := m.Value.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside NamedSecuritySchemeOrReference objects. -func (m *NamedSecuritySchemeOrReference) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Value != nil { - _, err := m.Value.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside NamedServerVariable objects. -func (m *NamedServerVariable) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Value != nil { - _, err := m.Value.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside NamedString objects. -func (m *NamedString) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside NamedStringArray objects. -func (m *NamedStringArray) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Value != nil { - _, err := m.Value.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside OauthFlow objects. -func (m *OauthFlow) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Scopes != nil { - _, err := m.Scopes.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside OauthFlows objects. -func (m *OauthFlows) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Implicit != nil { - _, err := m.Implicit.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Password != nil { - _, err := m.Password.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.ClientCredentials != nil { - _, err := m.ClientCredentials.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.AuthorizationCode != nil { - _, err := m.AuthorizationCode.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Object objects. -func (m *Object) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Operation objects. -func (m *Operation) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.ExternalDocs != nil { - _, err := m.ExternalDocs.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.Parameters { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - if m.RequestBody != nil { - _, err := m.RequestBody.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Responses != nil { - _, err := m.Responses.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Callbacks != nil { - _, err := m.Callbacks.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.Security { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - for _, item := range m.Servers { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Parameter objects. -func (m *Parameter) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Schema != nil { - _, err := m.Schema.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Example != nil { - _, err := m.Example.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Examples != nil { - _, err := m.Examples.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Content != nil { - _, err := m.Content.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside ParameterOrReference objects. -func (m *ParameterOrReference) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - { - p, ok := m.Oneof.(*ParameterOrReference_Parameter) - if ok { - _, err := p.Parameter.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - { - p, ok := m.Oneof.(*ParameterOrReference_Reference) - if ok { - _, err := p.Reference.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside ParametersOrReferences objects. -func (m *ParametersOrReferences) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside PathItem objects. -func (m *PathItem) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.XRef != "" { - info, err := compiler.ReadInfoForRef(root, m.XRef) - if err != nil { - return nil, err - } - if info != nil { - replacement, err := NewPathItem(info, nil) - if err == nil { - *m = *replacement - return m.ResolveReferences(root) - } - } - return info, nil - } - if m.Get != nil { - _, err := m.Get.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Put != nil { - _, err := m.Put.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Post != nil { - _, err := m.Post.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Delete != nil { - _, err := m.Delete.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Options != nil { - _, err := m.Options.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Head != nil { - _, err := m.Head.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Patch != nil { - _, err := m.Patch.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Trace != nil { - _, err := m.Trace.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.Servers { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - for _, item := range m.Parameters { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Paths objects. -func (m *Paths) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.Path { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Properties objects. -func (m *Properties) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Reference objects. -func (m *Reference) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.XRef != "" { - info, err := compiler.ReadInfoForRef(root, m.XRef) - if err != nil { - return nil, err - } - if info != nil { - replacement, err := NewReference(info, nil) - if err == nil { - *m = *replacement - return m.ResolveReferences(root) - } - } - return info, nil - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside RequestBodiesOrReferences objects. -func (m *RequestBodiesOrReferences) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside RequestBody objects. -func (m *RequestBody) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Content != nil { - _, err := m.Content.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside RequestBodyOrReference objects. -func (m *RequestBodyOrReference) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - { - p, ok := m.Oneof.(*RequestBodyOrReference_RequestBody) - if ok { - _, err := p.RequestBody.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - { - p, ok := m.Oneof.(*RequestBodyOrReference_Reference) - if ok { - _, err := p.Reference.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Response objects. -func (m *Response) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Headers != nil { - _, err := m.Headers.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Content != nil { - _, err := m.Content.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Links != nil { - _, err := m.Links.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside ResponseOrReference objects. -func (m *ResponseOrReference) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - { - p, ok := m.Oneof.(*ResponseOrReference_Response) - if ok { - _, err := p.Response.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - { - p, ok := m.Oneof.(*ResponseOrReference_Reference) - if ok { - _, err := p.Reference.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Responses objects. -func (m *Responses) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Default != nil { - _, err := m.Default.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.ResponseOrReference { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside ResponsesOrReferences objects. -func (m *ResponsesOrReferences) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Schema objects. -func (m *Schema) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Discriminator != nil { - _, err := m.Discriminator.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Xml != nil { - _, err := m.Xml.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.ExternalDocs != nil { - _, err := m.ExternalDocs.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Example != nil { - _, err := m.Example.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.Enum { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - for _, item := range m.AllOf { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - for _, item := range m.OneOf { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - for _, item := range m.AnyOf { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - if m.Not != nil { - _, err := m.Not.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Items != nil { - _, err := m.Items.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Properties != nil { - _, err := m.Properties.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.AdditionalProperties != nil { - _, err := m.AdditionalProperties.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - if m.Default != nil { - _, err := m.Default.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside SchemaOrReference objects. -func (m *SchemaOrReference) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - { - p, ok := m.Oneof.(*SchemaOrReference_Schema) - if ok { - _, err := p.Schema.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - { - p, ok := m.Oneof.(*SchemaOrReference_Reference) - if ok { - _, err := p.Reference.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside SchemasOrReferences objects. -func (m *SchemasOrReferences) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside SecurityRequirement objects. -func (m *SecurityRequirement) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside SecurityScheme objects. -func (m *SecurityScheme) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Flows != nil { - _, err := m.Flows.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside SecuritySchemeOrReference objects. -func (m *SecuritySchemeOrReference) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - { - p, ok := m.Oneof.(*SecuritySchemeOrReference_SecurityScheme) - if ok { - _, err := p.SecurityScheme.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - { - p, ok := m.Oneof.(*SecuritySchemeOrReference_Reference) - if ok { - _, err := p.Reference.ResolveReferences(root) - if err != nil { - return nil, err - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside SecuritySchemesOrReferences objects. -func (m *SecuritySchemesOrReferences) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Server objects. -func (m *Server) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.Variables != nil { - _, err := m.Variables.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside ServerVariable objects. -func (m *ServerVariable) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside ServerVariables objects. -func (m *ServerVariables) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside SpecificationExtension objects. -func (m *SpecificationExtension) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside StringArray objects. -func (m *StringArray) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Strings objects. -func (m *Strings) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.AdditionalProperties { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Tag objects. -func (m *Tag) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - if m.ExternalDocs != nil { - _, err := m.ExternalDocs.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ResolveReferences resolves references found inside Xml objects. -func (m *Xml) ResolveReferences(root string) (*yaml.Node, error) { - errors := make([]error, 0) - for _, item := range m.SpecificationExtension { - if item != nil { - _, err := item.ResolveReferences(root) - if err != nil { - errors = append(errors, err) - } - } - } - return nil, compiler.NewErrorGroupOrNil(errors) -} - -// ToRawInfo returns a description of AdditionalPropertiesItem suitable for JSON or YAML export. -func (m *AdditionalPropertiesItem) ToRawInfo() *yaml.Node { - // ONE OF WRAPPER - // AdditionalPropertiesItem - // {Name:schemaOrReference Type:SchemaOrReference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v0 := m.GetSchemaOrReference() - if v0 != nil { - return v0.ToRawInfo() - } - // {Name:boolean Type:bool StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - if v1, ok := m.GetOneof().(*AdditionalPropertiesItem_Boolean); ok { - return compiler.NewScalarNodeForBool(v1.Boolean) - } - return compiler.NewNullNode() -} - -// ToRawInfo returns a description of Any suitable for JSON or YAML export. -func (m *Any) ToRawInfo() *yaml.Node { - var err error - var node yaml.Node - err = yaml.Unmarshal([]byte(m.Yaml), &node) - if err == nil { - if node.Kind == yaml.DocumentNode { - return node.Content[0] - } - return &node - } - return compiler.NewNullNode() -} - -// ToRawInfo returns a description of AnyOrExpression suitable for JSON or YAML export. -func (m *AnyOrExpression) ToRawInfo() *yaml.Node { - // ONE OF WRAPPER - // AnyOrExpression - // {Name:any Type:Any StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v0 := m.GetAny() - if v0 != nil { - return v0.ToRawInfo() - } - // {Name:expression Type:Expression StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v1 := m.GetExpression() - if v1 != nil { - return v1.ToRawInfo() - } - return compiler.NewNullNode() -} - -// ToRawInfo returns a description of Callback suitable for JSON or YAML export. -func (m *Callback) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Path != nil { - for _, item := range m.Path { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of CallbackOrReference suitable for JSON or YAML export. -func (m *CallbackOrReference) ToRawInfo() *yaml.Node { - // ONE OF WRAPPER - // CallbackOrReference - // {Name:callback Type:Callback StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v0 := m.GetCallback() - if v0 != nil { - return v0.ToRawInfo() - } - // {Name:reference Type:Reference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v1 := m.GetReference() - if v1 != nil { - return v1.ToRawInfo() - } - return compiler.NewNullNode() -} - -// ToRawInfo returns a description of CallbacksOrReferences suitable for JSON or YAML export. -func (m *CallbacksOrReferences) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.AdditionalProperties != nil { - for _, item := range m.AdditionalProperties { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Components suitable for JSON or YAML export. -func (m *Components) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Schemas != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("schemas")) - info.Content = append(info.Content, m.Schemas.ToRawInfo()) - } - if m.Responses != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("responses")) - info.Content = append(info.Content, m.Responses.ToRawInfo()) - } - if m.Parameters != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("parameters")) - info.Content = append(info.Content, m.Parameters.ToRawInfo()) - } - if m.Examples != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("examples")) - info.Content = append(info.Content, m.Examples.ToRawInfo()) - } - if m.RequestBodies != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("requestBodies")) - info.Content = append(info.Content, m.RequestBodies.ToRawInfo()) - } - if m.Headers != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("headers")) - info.Content = append(info.Content, m.Headers.ToRawInfo()) - } - if m.SecuritySchemes != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("securitySchemes")) - info.Content = append(info.Content, m.SecuritySchemes.ToRawInfo()) - } - if m.Links != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("links")) - info.Content = append(info.Content, m.Links.ToRawInfo()) - } - if m.Callbacks != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("callbacks")) - info.Content = append(info.Content, m.Callbacks.ToRawInfo()) - } - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Contact suitable for JSON or YAML export. -func (m *Contact) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - if m.Url != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("url")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Url)) - } - if m.Email != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("email")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Email)) - } - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of DefaultType suitable for JSON or YAML export. -func (m *DefaultType) ToRawInfo() *yaml.Node { - // ONE OF WRAPPER - // DefaultType - // {Name:number Type:float StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - if v0, ok := m.GetOneof().(*DefaultType_Number); ok { - return compiler.NewScalarNodeForFloat(v0.Number) - } - // {Name:boolean Type:bool StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - if v1, ok := m.GetOneof().(*DefaultType_Boolean); ok { - return compiler.NewScalarNodeForBool(v1.Boolean) - } - // {Name:string Type:string StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - if v2, ok := m.GetOneof().(*DefaultType_String_); ok { - return compiler.NewScalarNodeForString(v2.String_) - } - return compiler.NewNullNode() -} - -// ToRawInfo returns a description of Discriminator suitable for JSON or YAML export. -func (m *Discriminator) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("propertyName")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.PropertyName)) - if m.Mapping != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("mapping")) - info.Content = append(info.Content, m.Mapping.ToRawInfo()) - } - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Document suitable for JSON or YAML export. -func (m *Document) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("openapi")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Openapi)) - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("info")) - info.Content = append(info.Content, m.Info.ToRawInfo()) - if len(m.Servers) != 0 { - items := compiler.NewSequenceNode() - for _, item := range m.Servers { - items.Content = append(items.Content, item.ToRawInfo()) - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("servers")) - info.Content = append(info.Content, items) - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("paths")) - info.Content = append(info.Content, m.Paths.ToRawInfo()) - if m.Components != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("components")) - info.Content = append(info.Content, m.Components.ToRawInfo()) - } - if len(m.Security) != 0 { - items := compiler.NewSequenceNode() - for _, item := range m.Security { - items.Content = append(items.Content, item.ToRawInfo()) - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("security")) - info.Content = append(info.Content, items) - } - if len(m.Tags) != 0 { - items := compiler.NewSequenceNode() - for _, item := range m.Tags { - items.Content = append(items.Content, item.ToRawInfo()) - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("tags")) - info.Content = append(info.Content, items) - } - if m.ExternalDocs != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("externalDocs")) - info.Content = append(info.Content, m.ExternalDocs.ToRawInfo()) - } - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Encoding suitable for JSON or YAML export. -func (m *Encoding) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.ContentType != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("contentType")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.ContentType)) - } - if m.Headers != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("headers")) - info.Content = append(info.Content, m.Headers.ToRawInfo()) - } - if m.Style != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("style")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Style)) - } - if m.Explode != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("explode")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Explode)) - } - if m.AllowReserved != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("allowReserved")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.AllowReserved)) - } - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Encodings suitable for JSON or YAML export. -func (m *Encodings) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.AdditionalProperties != nil { - for _, item := range m.AdditionalProperties { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Example suitable for JSON or YAML export. -func (m *Example) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Summary != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("summary")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Summary)) - } - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.Value != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("value")) - info.Content = append(info.Content, m.Value.ToRawInfo()) - } - if m.ExternalValue != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("externalValue")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.ExternalValue)) - } - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of ExampleOrReference suitable for JSON or YAML export. -func (m *ExampleOrReference) ToRawInfo() *yaml.Node { - // ONE OF WRAPPER - // ExampleOrReference - // {Name:example Type:Example StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v0 := m.GetExample() - if v0 != nil { - return v0.ToRawInfo() - } - // {Name:reference Type:Reference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v1 := m.GetReference() - if v1 != nil { - return v1.ToRawInfo() - } - return compiler.NewNullNode() -} - -// ToRawInfo returns a description of ExamplesOrReferences suitable for JSON or YAML export. -func (m *ExamplesOrReferences) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.AdditionalProperties != nil { - for _, item := range m.AdditionalProperties { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Expression suitable for JSON or YAML export. -func (m *Expression) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.AdditionalProperties != nil { - for _, item := range m.AdditionalProperties { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of ExternalDocs suitable for JSON or YAML export. -func (m *ExternalDocs) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("url")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Url)) - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Header suitable for JSON or YAML export. -func (m *Header) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.Required != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("required")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Required)) - } - if m.Deprecated != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("deprecated")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Deprecated)) - } - if m.AllowEmptyValue != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("allowEmptyValue")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.AllowEmptyValue)) - } - if m.Style != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("style")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Style)) - } - if m.Explode != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("explode")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Explode)) - } - if m.AllowReserved != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("allowReserved")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.AllowReserved)) - } - if m.Schema != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("schema")) - info.Content = append(info.Content, m.Schema.ToRawInfo()) - } - if m.Example != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("example")) - info.Content = append(info.Content, m.Example.ToRawInfo()) - } - if m.Examples != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("examples")) - info.Content = append(info.Content, m.Examples.ToRawInfo()) - } - if m.Content != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("content")) - info.Content = append(info.Content, m.Content.ToRawInfo()) - } - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of HeaderOrReference suitable for JSON or YAML export. -func (m *HeaderOrReference) ToRawInfo() *yaml.Node { - // ONE OF WRAPPER - // HeaderOrReference - // {Name:header Type:Header StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v0 := m.GetHeader() - if v0 != nil { - return v0.ToRawInfo() - } - // {Name:reference Type:Reference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v1 := m.GetReference() - if v1 != nil { - return v1.ToRawInfo() - } - return compiler.NewNullNode() -} - -// ToRawInfo returns a description of HeadersOrReferences suitable for JSON or YAML export. -func (m *HeadersOrReferences) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.AdditionalProperties != nil { - for _, item := range m.AdditionalProperties { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Info suitable for JSON or YAML export. -func (m *Info) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("title")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Title)) - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.TermsOfService != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("termsOfService")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.TermsOfService)) - } - if m.Contact != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("contact")) - info.Content = append(info.Content, m.Contact.ToRawInfo()) - } - if m.License != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("license")) - info.Content = append(info.Content, m.License.ToRawInfo()) - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("version")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Version)) - if m.Summary != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("summary")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Summary)) - } - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of ItemsItem suitable for JSON or YAML export. -func (m *ItemsItem) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if len(m.SchemaOrReference) != 0 { - items := compiler.NewSequenceNode() - for _, item := range m.SchemaOrReference { - items.Content = append(items.Content, item.ToRawInfo()) - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("schemaOrReference")) - info.Content = append(info.Content, items) - } - return info -} - -// ToRawInfo returns a description of License suitable for JSON or YAML export. -func (m *License) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - if m.Url != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("url")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Url)) - } - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Link suitable for JSON or YAML export. -func (m *Link) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.OperationRef != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("operationRef")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.OperationRef)) - } - if m.OperationId != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("operationId")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.OperationId)) - } - if m.Parameters != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("parameters")) - info.Content = append(info.Content, m.Parameters.ToRawInfo()) - } - if m.RequestBody != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("requestBody")) - info.Content = append(info.Content, m.RequestBody.ToRawInfo()) - } - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.Server != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("server")) - info.Content = append(info.Content, m.Server.ToRawInfo()) - } - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of LinkOrReference suitable for JSON or YAML export. -func (m *LinkOrReference) ToRawInfo() *yaml.Node { - // ONE OF WRAPPER - // LinkOrReference - // {Name:link Type:Link StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v0 := m.GetLink() - if v0 != nil { - return v0.ToRawInfo() - } - // {Name:reference Type:Reference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v1 := m.GetReference() - if v1 != nil { - return v1.ToRawInfo() - } - return compiler.NewNullNode() -} - -// ToRawInfo returns a description of LinksOrReferences suitable for JSON or YAML export. -func (m *LinksOrReferences) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.AdditionalProperties != nil { - for _, item := range m.AdditionalProperties { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of MediaType suitable for JSON or YAML export. -func (m *MediaType) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Schema != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("schema")) - info.Content = append(info.Content, m.Schema.ToRawInfo()) - } - if m.Example != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("example")) - info.Content = append(info.Content, m.Example.ToRawInfo()) - } - if m.Examples != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("examples")) - info.Content = append(info.Content, m.Examples.ToRawInfo()) - } - if m.Encoding != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("encoding")) - info.Content = append(info.Content, m.Encoding.ToRawInfo()) - } - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of MediaTypes suitable for JSON or YAML export. -func (m *MediaTypes) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.AdditionalProperties != nil { - for _, item := range m.AdditionalProperties { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of NamedAny suitable for JSON or YAML export. -func (m *NamedAny) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - if m.Value != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("value")) - info.Content = append(info.Content, m.Value.ToRawInfo()) - } - return info -} - -// ToRawInfo returns a description of NamedCallbackOrReference suitable for JSON or YAML export. -func (m *NamedCallbackOrReference) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - // &{Name:value Type:CallbackOrReference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value} - return info -} - -// ToRawInfo returns a description of NamedEncoding suitable for JSON or YAML export. -func (m *NamedEncoding) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - // &{Name:value Type:Encoding StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value} - return info -} - -// ToRawInfo returns a description of NamedExampleOrReference suitable for JSON or YAML export. -func (m *NamedExampleOrReference) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - // &{Name:value Type:ExampleOrReference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value} - return info -} - -// ToRawInfo returns a description of NamedHeaderOrReference suitable for JSON or YAML export. -func (m *NamedHeaderOrReference) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - // &{Name:value Type:HeaderOrReference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value} - return info -} - -// ToRawInfo returns a description of NamedLinkOrReference suitable for JSON or YAML export. -func (m *NamedLinkOrReference) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - // &{Name:value Type:LinkOrReference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value} - return info -} - -// ToRawInfo returns a description of NamedMediaType suitable for JSON or YAML export. -func (m *NamedMediaType) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - // &{Name:value Type:MediaType StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value} - return info -} - -// ToRawInfo returns a description of NamedParameterOrReference suitable for JSON or YAML export. -func (m *NamedParameterOrReference) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - // &{Name:value Type:ParameterOrReference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value} - return info -} - -// ToRawInfo returns a description of NamedPathItem suitable for JSON or YAML export. -func (m *NamedPathItem) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - // &{Name:value Type:PathItem StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value} - return info -} - -// ToRawInfo returns a description of NamedRequestBodyOrReference suitable for JSON or YAML export. -func (m *NamedRequestBodyOrReference) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - // &{Name:value Type:RequestBodyOrReference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value} - return info -} - -// ToRawInfo returns a description of NamedResponseOrReference suitable for JSON or YAML export. -func (m *NamedResponseOrReference) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - // &{Name:value Type:ResponseOrReference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value} - return info -} - -// ToRawInfo returns a description of NamedSchemaOrReference suitable for JSON or YAML export. -func (m *NamedSchemaOrReference) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - // &{Name:value Type:SchemaOrReference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value} - return info -} - -// ToRawInfo returns a description of NamedSecuritySchemeOrReference suitable for JSON or YAML export. -func (m *NamedSecuritySchemeOrReference) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - // &{Name:value Type:SecuritySchemeOrReference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value} - return info -} - -// ToRawInfo returns a description of NamedServerVariable suitable for JSON or YAML export. -func (m *NamedServerVariable) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - // &{Name:value Type:ServerVariable StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value} - return info -} - -// ToRawInfo returns a description of NamedString suitable for JSON or YAML export. -func (m *NamedString) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - if m.Value != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("value")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Value)) - } - return info -} - -// ToRawInfo returns a description of NamedStringArray suitable for JSON or YAML export. -func (m *NamedStringArray) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - // &{Name:value Type:StringArray StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value} - return info -} - -// ToRawInfo returns a description of OauthFlow suitable for JSON or YAML export. -func (m *OauthFlow) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.AuthorizationUrl != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("authorizationUrl")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.AuthorizationUrl)) - } - if m.TokenUrl != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("tokenUrl")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.TokenUrl)) - } - if m.RefreshUrl != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("refreshUrl")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.RefreshUrl)) - } - if m.Scopes != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("scopes")) - info.Content = append(info.Content, m.Scopes.ToRawInfo()) - } - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of OauthFlows suitable for JSON or YAML export. -func (m *OauthFlows) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Implicit != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("implicit")) - info.Content = append(info.Content, m.Implicit.ToRawInfo()) - } - if m.Password != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("password")) - info.Content = append(info.Content, m.Password.ToRawInfo()) - } - if m.ClientCredentials != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("clientCredentials")) - info.Content = append(info.Content, m.ClientCredentials.ToRawInfo()) - } - if m.AuthorizationCode != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("authorizationCode")) - info.Content = append(info.Content, m.AuthorizationCode.ToRawInfo()) - } - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Object suitable for JSON or YAML export. -func (m *Object) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.AdditionalProperties != nil { - for _, item := range m.AdditionalProperties { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Operation suitable for JSON or YAML export. -func (m *Operation) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if len(m.Tags) != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("tags")) - info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Tags)) - } - if m.Summary != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("summary")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Summary)) - } - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.ExternalDocs != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("externalDocs")) - info.Content = append(info.Content, m.ExternalDocs.ToRawInfo()) - } - if m.OperationId != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("operationId")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.OperationId)) - } - if len(m.Parameters) != 0 { - items := compiler.NewSequenceNode() - for _, item := range m.Parameters { - items.Content = append(items.Content, item.ToRawInfo()) - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("parameters")) - info.Content = append(info.Content, items) - } - if m.RequestBody != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("requestBody")) - info.Content = append(info.Content, m.RequestBody.ToRawInfo()) - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("responses")) - info.Content = append(info.Content, m.Responses.ToRawInfo()) - if m.Callbacks != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("callbacks")) - info.Content = append(info.Content, m.Callbacks.ToRawInfo()) - } - if m.Deprecated != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("deprecated")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Deprecated)) - } - if len(m.Security) != 0 { - items := compiler.NewSequenceNode() - for _, item := range m.Security { - items.Content = append(items.Content, item.ToRawInfo()) - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("security")) - info.Content = append(info.Content, items) - } - if len(m.Servers) != 0 { - items := compiler.NewSequenceNode() - for _, item := range m.Servers { - items.Content = append(items.Content, item.ToRawInfo()) - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("servers")) - info.Content = append(info.Content, items) - } - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Parameter suitable for JSON or YAML export. -func (m *Parameter) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("in")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.In)) - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.Required != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("required")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Required)) - } - if m.Deprecated != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("deprecated")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Deprecated)) - } - if m.AllowEmptyValue != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("allowEmptyValue")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.AllowEmptyValue)) - } - if m.Style != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("style")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Style)) - } - if m.Explode != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("explode")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Explode)) - } - if m.AllowReserved != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("allowReserved")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.AllowReserved)) - } - if m.Schema != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("schema")) - info.Content = append(info.Content, m.Schema.ToRawInfo()) - } - if m.Example != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("example")) - info.Content = append(info.Content, m.Example.ToRawInfo()) - } - if m.Examples != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("examples")) - info.Content = append(info.Content, m.Examples.ToRawInfo()) - } - if m.Content != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("content")) - info.Content = append(info.Content, m.Content.ToRawInfo()) - } - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of ParameterOrReference suitable for JSON or YAML export. -func (m *ParameterOrReference) ToRawInfo() *yaml.Node { - // ONE OF WRAPPER - // ParameterOrReference - // {Name:parameter Type:Parameter StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v0 := m.GetParameter() - if v0 != nil { - return v0.ToRawInfo() - } - // {Name:reference Type:Reference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v1 := m.GetReference() - if v1 != nil { - return v1.ToRawInfo() - } - return compiler.NewNullNode() -} - -// ToRawInfo returns a description of ParametersOrReferences suitable for JSON or YAML export. -func (m *ParametersOrReferences) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.AdditionalProperties != nil { - for _, item := range m.AdditionalProperties { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of PathItem suitable for JSON or YAML export. -func (m *PathItem) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.XRef != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("$ref")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.XRef)) - } - if m.Summary != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("summary")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Summary)) - } - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.Get != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("get")) - info.Content = append(info.Content, m.Get.ToRawInfo()) - } - if m.Put != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("put")) - info.Content = append(info.Content, m.Put.ToRawInfo()) - } - if m.Post != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("post")) - info.Content = append(info.Content, m.Post.ToRawInfo()) - } - if m.Delete != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("delete")) - info.Content = append(info.Content, m.Delete.ToRawInfo()) - } - if m.Options != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("options")) - info.Content = append(info.Content, m.Options.ToRawInfo()) - } - if m.Head != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("head")) - info.Content = append(info.Content, m.Head.ToRawInfo()) - } - if m.Patch != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("patch")) - info.Content = append(info.Content, m.Patch.ToRawInfo()) - } - if m.Trace != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("trace")) - info.Content = append(info.Content, m.Trace.ToRawInfo()) - } - if len(m.Servers) != 0 { - items := compiler.NewSequenceNode() - for _, item := range m.Servers { - items.Content = append(items.Content, item.ToRawInfo()) - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("servers")) - info.Content = append(info.Content, items) - } - if len(m.Parameters) != 0 { - items := compiler.NewSequenceNode() - for _, item := range m.Parameters { - items.Content = append(items.Content, item.ToRawInfo()) - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("parameters")) - info.Content = append(info.Content, items) - } - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Paths suitable for JSON or YAML export. -func (m *Paths) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Path != nil { - for _, item := range m.Path { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Properties suitable for JSON or YAML export. -func (m *Properties) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.AdditionalProperties != nil { - for _, item := range m.AdditionalProperties { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Reference suitable for JSON or YAML export. -func (m *Reference) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("$ref")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.XRef)) - if m.Summary != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("summary")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Summary)) - } - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - return info -} - -// ToRawInfo returns a description of RequestBodiesOrReferences suitable for JSON or YAML export. -func (m *RequestBodiesOrReferences) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.AdditionalProperties != nil { - for _, item := range m.AdditionalProperties { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of RequestBody suitable for JSON or YAML export. -func (m *RequestBody) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("content")) - info.Content = append(info.Content, m.Content.ToRawInfo()) - if m.Required != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("required")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Required)) - } - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of RequestBodyOrReference suitable for JSON or YAML export. -func (m *RequestBodyOrReference) ToRawInfo() *yaml.Node { - // ONE OF WRAPPER - // RequestBodyOrReference - // {Name:requestBody Type:RequestBody StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v0 := m.GetRequestBody() - if v0 != nil { - return v0.ToRawInfo() - } - // {Name:reference Type:Reference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v1 := m.GetReference() - if v1 != nil { - return v1.ToRawInfo() - } - return compiler.NewNullNode() -} - -// ToRawInfo returns a description of Response suitable for JSON or YAML export. -func (m *Response) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - if m.Headers != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("headers")) - info.Content = append(info.Content, m.Headers.ToRawInfo()) - } - if m.Content != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("content")) - info.Content = append(info.Content, m.Content.ToRawInfo()) - } - if m.Links != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("links")) - info.Content = append(info.Content, m.Links.ToRawInfo()) - } - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of ResponseOrReference suitable for JSON or YAML export. -func (m *ResponseOrReference) ToRawInfo() *yaml.Node { - // ONE OF WRAPPER - // ResponseOrReference - // {Name:response Type:Response StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v0 := m.GetResponse() - if v0 != nil { - return v0.ToRawInfo() - } - // {Name:reference Type:Reference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v1 := m.GetReference() - if v1 != nil { - return v1.ToRawInfo() - } - return compiler.NewNullNode() -} - -// ToRawInfo returns a description of Responses suitable for JSON or YAML export. -func (m *Responses) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Default != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("default")) - info.Content = append(info.Content, m.Default.ToRawInfo()) - } - if m.ResponseOrReference != nil { - for _, item := range m.ResponseOrReference { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of ResponsesOrReferences suitable for JSON or YAML export. -func (m *ResponsesOrReferences) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.AdditionalProperties != nil { - for _, item := range m.AdditionalProperties { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Schema suitable for JSON or YAML export. -func (m *Schema) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Nullable != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("nullable")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Nullable)) - } - if m.Discriminator != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("discriminator")) - info.Content = append(info.Content, m.Discriminator.ToRawInfo()) - } - if m.ReadOnly != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("readOnly")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ReadOnly)) - } - if m.WriteOnly != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("writeOnly")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.WriteOnly)) - } - if m.Xml != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("xml")) - info.Content = append(info.Content, m.Xml.ToRawInfo()) - } - if m.ExternalDocs != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("externalDocs")) - info.Content = append(info.Content, m.ExternalDocs.ToRawInfo()) - } - if m.Example != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("example")) - info.Content = append(info.Content, m.Example.ToRawInfo()) - } - if m.Deprecated != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("deprecated")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Deprecated)) - } - if m.Title != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("title")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Title)) - } - if m.MultipleOf != 0.0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("multipleOf")) - info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.MultipleOf)) - } - if m.Maximum != 0.0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("maximum")) - info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Maximum)) - } - if m.ExclusiveMaximum != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMaximum")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMaximum)) - } - if m.Minimum != 0.0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("minimum")) - info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Minimum)) - } - if m.ExclusiveMinimum != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMinimum")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMinimum)) - } - if m.MaxLength != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("maxLength")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxLength)) - } - if m.MinLength != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("minLength")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinLength)) - } - if m.Pattern != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("pattern")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Pattern)) - } - if m.MaxItems != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("maxItems")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxItems)) - } - if m.MinItems != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("minItems")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinItems)) - } - if m.UniqueItems != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("uniqueItems")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.UniqueItems)) - } - if m.MaxProperties != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("maxProperties")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxProperties)) - } - if m.MinProperties != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("minProperties")) - info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinProperties)) - } - if len(m.Required) != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("required")) - info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Required)) - } - if len(m.Enum) != 0 { - items := compiler.NewSequenceNode() - for _, item := range m.Enum { - items.Content = append(items.Content, item.ToRawInfo()) - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("enum")) - info.Content = append(info.Content, items) - } - if m.Type != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("type")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type)) - } - if len(m.AllOf) != 0 { - items := compiler.NewSequenceNode() - for _, item := range m.AllOf { - items.Content = append(items.Content, item.ToRawInfo()) - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("allOf")) - info.Content = append(info.Content, items) - } - if len(m.OneOf) != 0 { - items := compiler.NewSequenceNode() - for _, item := range m.OneOf { - items.Content = append(items.Content, item.ToRawInfo()) - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("oneOf")) - info.Content = append(info.Content, items) - } - if len(m.AnyOf) != 0 { - items := compiler.NewSequenceNode() - for _, item := range m.AnyOf { - items.Content = append(items.Content, item.ToRawInfo()) - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("anyOf")) - info.Content = append(info.Content, items) - } - if m.Not != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("not")) - info.Content = append(info.Content, m.Not.ToRawInfo()) - } - if m.Items != nil { - items := compiler.NewSequenceNode() - for _, item := range m.Items.SchemaOrReference { - items.Content = append(items.Content, item.ToRawInfo()) - } - if len(items.Content) == 1 { - items = items.Content[0] - } - info.Content = append(info.Content, compiler.NewScalarNodeForString("items")) - info.Content = append(info.Content, items) - } - if m.Properties != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("properties")) - info.Content = append(info.Content, m.Properties.ToRawInfo()) - } - if m.AdditionalProperties != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("additionalProperties")) - info.Content = append(info.Content, m.AdditionalProperties.ToRawInfo()) - } - if m.Default != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("default")) - info.Content = append(info.Content, m.Default.ToRawInfo()) - } - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.Format != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("format")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Format)) - } - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of SchemaOrReference suitable for JSON or YAML export. -func (m *SchemaOrReference) ToRawInfo() *yaml.Node { - // ONE OF WRAPPER - // SchemaOrReference - // {Name:schema Type:Schema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v0 := m.GetSchema() - if v0 != nil { - return v0.ToRawInfo() - } - // {Name:reference Type:Reference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v1 := m.GetReference() - if v1 != nil { - return v1.ToRawInfo() - } - return compiler.NewNullNode() -} - -// ToRawInfo returns a description of SchemasOrReferences suitable for JSON or YAML export. -func (m *SchemasOrReferences) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.AdditionalProperties != nil { - for _, item := range m.AdditionalProperties { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of SecurityRequirement suitable for JSON or YAML export. -func (m *SecurityRequirement) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.AdditionalProperties != nil { - for _, item := range m.AdditionalProperties { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of SecurityScheme suitable for JSON or YAML export. -func (m *SecurityScheme) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("type")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type)) - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - if m.In != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("in")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.In)) - } - if m.Scheme != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("scheme")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Scheme)) - } - if m.BearerFormat != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("bearerFormat")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.BearerFormat)) - } - if m.Flows != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("flows")) - info.Content = append(info.Content, m.Flows.ToRawInfo()) - } - if m.OpenIdConnectUrl != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("openIdConnectUrl")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.OpenIdConnectUrl)) - } - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of SecuritySchemeOrReference suitable for JSON or YAML export. -func (m *SecuritySchemeOrReference) ToRawInfo() *yaml.Node { - // ONE OF WRAPPER - // SecuritySchemeOrReference - // {Name:securityScheme Type:SecurityScheme StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v0 := m.GetSecurityScheme() - if v0 != nil { - return v0.ToRawInfo() - } - // {Name:reference Type:Reference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - v1 := m.GetReference() - if v1 != nil { - return v1.ToRawInfo() - } - return compiler.NewNullNode() -} - -// ToRawInfo returns a description of SecuritySchemesOrReferences suitable for JSON or YAML export. -func (m *SecuritySchemesOrReferences) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.AdditionalProperties != nil { - for _, item := range m.AdditionalProperties { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Server suitable for JSON or YAML export. -func (m *Server) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("url")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Url)) - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.Variables != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("variables")) - info.Content = append(info.Content, m.Variables.ToRawInfo()) - } - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of ServerVariable suitable for JSON or YAML export. -func (m *ServerVariable) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if len(m.Enum) != 0 { - info.Content = append(info.Content, compiler.NewScalarNodeForString("enum")) - info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Enum)) - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("default")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Default)) - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of ServerVariables suitable for JSON or YAML export. -func (m *ServerVariables) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.AdditionalProperties != nil { - for _, item := range m.AdditionalProperties { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of SpecificationExtension suitable for JSON or YAML export. -func (m *SpecificationExtension) ToRawInfo() *yaml.Node { - // ONE OF WRAPPER - // SpecificationExtension - // {Name:number Type:float StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - if v0, ok := m.GetOneof().(*SpecificationExtension_Number); ok { - return compiler.NewScalarNodeForFloat(v0.Number) - } - // {Name:boolean Type:bool StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - if v1, ok := m.GetOneof().(*SpecificationExtension_Boolean); ok { - return compiler.NewScalarNodeForBool(v1.Boolean) - } - // {Name:string Type:string StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} - if v2, ok := m.GetOneof().(*SpecificationExtension_String_); ok { - return compiler.NewScalarNodeForString(v2.String_) - } - return compiler.NewNullNode() -} - -// ToRawInfo returns a description of StringArray suitable for JSON or YAML export. -func (m *StringArray) ToRawInfo() *yaml.Node { - return compiler.NewSequenceNodeForStringArray(m.Value) -} - -// ToRawInfo returns a description of Strings suitable for JSON or YAML export. -func (m *Strings) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - // &{Name:additionalProperties Type:NamedString StringEnumValues:[] MapType:string Repeated:true Pattern: Implicit:true Description:} - return info -} - -// ToRawInfo returns a description of Tag suitable for JSON or YAML export. -func (m *Tag) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - // always include this required field. - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - if m.Description != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("description")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description)) - } - if m.ExternalDocs != nil { - info.Content = append(info.Content, compiler.NewScalarNodeForString("externalDocs")) - info.Content = append(info.Content, m.ExternalDocs.ToRawInfo()) - } - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -// ToRawInfo returns a description of Xml suitable for JSON or YAML export. -func (m *Xml) ToRawInfo() *yaml.Node { - info := compiler.NewMappingNode() - if m == nil { - return info - } - if m.Name != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("name")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name)) - } - if m.Namespace != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("namespace")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Namespace)) - } - if m.Prefix != "" { - info.Content = append(info.Content, compiler.NewScalarNodeForString("prefix")) - info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Prefix)) - } - if m.Attribute != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("attribute")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Attribute)) - } - if m.Wrapped != false { - info.Content = append(info.Content, compiler.NewScalarNodeForString("wrapped")) - info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Wrapped)) - } - if m.SpecificationExtension != nil { - for _, item := range m.SpecificationExtension { - info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name)) - info.Content = append(info.Content, item.Value.ToRawInfo()) - } - } - return info -} - -var ( - pattern0 = regexp.MustCompile("^") - pattern1 = regexp.MustCompile("^x-") - pattern2 = regexp.MustCompile("^/") - pattern3 = regexp.MustCompile("^([0-9X]{3})$") -) diff --git a/vendor/github.com/google/gnostic/openapiv3/OpenAPIv3.pb.go b/vendor/github.com/google/gnostic/openapiv3/OpenAPIv3.pb.go deleted file mode 100644 index 499e7f932..000000000 --- a/vendor/github.com/google/gnostic/openapiv3/OpenAPIv3.pb.go +++ /dev/null @@ -1,8053 +0,0 @@ -// Copyright 2020 Google LLC. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// THIS FILE IS AUTOMATICALLY GENERATED. - -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.26.0 -// protoc v3.18.1 -// source: openapiv3/OpenAPIv3.proto - -package openapi_v3 - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - anypb "google.golang.org/protobuf/types/known/anypb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type AdditionalPropertiesItem struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Oneof: - // *AdditionalPropertiesItem_SchemaOrReference - // *AdditionalPropertiesItem_Boolean - Oneof isAdditionalPropertiesItem_Oneof `protobuf_oneof:"oneof"` -} - -func (x *AdditionalPropertiesItem) Reset() { - *x = AdditionalPropertiesItem{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AdditionalPropertiesItem) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AdditionalPropertiesItem) ProtoMessage() {} - -func (x *AdditionalPropertiesItem) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AdditionalPropertiesItem.ProtoReflect.Descriptor instead. -func (*AdditionalPropertiesItem) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{0} -} - -func (m *AdditionalPropertiesItem) GetOneof() isAdditionalPropertiesItem_Oneof { - if m != nil { - return m.Oneof - } - return nil -} - -func (x *AdditionalPropertiesItem) GetSchemaOrReference() *SchemaOrReference { - if x, ok := x.GetOneof().(*AdditionalPropertiesItem_SchemaOrReference); ok { - return x.SchemaOrReference - } - return nil -} - -func (x *AdditionalPropertiesItem) GetBoolean() bool { - if x, ok := x.GetOneof().(*AdditionalPropertiesItem_Boolean); ok { - return x.Boolean - } - return false -} - -type isAdditionalPropertiesItem_Oneof interface { - isAdditionalPropertiesItem_Oneof() -} - -type AdditionalPropertiesItem_SchemaOrReference struct { - SchemaOrReference *SchemaOrReference `protobuf:"bytes,1,opt,name=schema_or_reference,json=schemaOrReference,proto3,oneof"` -} - -type AdditionalPropertiesItem_Boolean struct { - Boolean bool `protobuf:"varint,2,opt,name=boolean,proto3,oneof"` -} - -func (*AdditionalPropertiesItem_SchemaOrReference) isAdditionalPropertiesItem_Oneof() {} - -func (*AdditionalPropertiesItem_Boolean) isAdditionalPropertiesItem_Oneof() {} - -type Any struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Value *anypb.Any `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` - Yaml string `protobuf:"bytes,2,opt,name=yaml,proto3" json:"yaml,omitempty"` -} - -func (x *Any) Reset() { - *x = Any{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Any) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Any) ProtoMessage() {} - -func (x *Any) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Any.ProtoReflect.Descriptor instead. -func (*Any) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{1} -} - -func (x *Any) GetValue() *anypb.Any { - if x != nil { - return x.Value - } - return nil -} - -func (x *Any) GetYaml() string { - if x != nil { - return x.Yaml - } - return "" -} - -type AnyOrExpression struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Oneof: - // *AnyOrExpression_Any - // *AnyOrExpression_Expression - Oneof isAnyOrExpression_Oneof `protobuf_oneof:"oneof"` -} - -func (x *AnyOrExpression) Reset() { - *x = AnyOrExpression{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AnyOrExpression) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AnyOrExpression) ProtoMessage() {} - -func (x *AnyOrExpression) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AnyOrExpression.ProtoReflect.Descriptor instead. -func (*AnyOrExpression) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{2} -} - -func (m *AnyOrExpression) GetOneof() isAnyOrExpression_Oneof { - if m != nil { - return m.Oneof - } - return nil -} - -func (x *AnyOrExpression) GetAny() *Any { - if x, ok := x.GetOneof().(*AnyOrExpression_Any); ok { - return x.Any - } - return nil -} - -func (x *AnyOrExpression) GetExpression() *Expression { - if x, ok := x.GetOneof().(*AnyOrExpression_Expression); ok { - return x.Expression - } - return nil -} - -type isAnyOrExpression_Oneof interface { - isAnyOrExpression_Oneof() -} - -type AnyOrExpression_Any struct { - Any *Any `protobuf:"bytes,1,opt,name=any,proto3,oneof"` -} - -type AnyOrExpression_Expression struct { - Expression *Expression `protobuf:"bytes,2,opt,name=expression,proto3,oneof"` -} - -func (*AnyOrExpression_Any) isAnyOrExpression_Oneof() {} - -func (*AnyOrExpression_Expression) isAnyOrExpression_Oneof() {} - -// A map of possible out-of band callbacks related to the parent operation. Each value in the map is a Path Item Object that describes a set of requests that may be initiated by the API provider and the expected responses. The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation. -type Callback struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Path []*NamedPathItem `protobuf:"bytes,1,rep,name=path,proto3" json:"path,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,2,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` -} - -func (x *Callback) Reset() { - *x = Callback{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Callback) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Callback) ProtoMessage() {} - -func (x *Callback) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Callback.ProtoReflect.Descriptor instead. -func (*Callback) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{3} -} - -func (x *Callback) GetPath() []*NamedPathItem { - if x != nil { - return x.Path - } - return nil -} - -func (x *Callback) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -type CallbackOrReference struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Oneof: - // *CallbackOrReference_Callback - // *CallbackOrReference_Reference - Oneof isCallbackOrReference_Oneof `protobuf_oneof:"oneof"` -} - -func (x *CallbackOrReference) Reset() { - *x = CallbackOrReference{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CallbackOrReference) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CallbackOrReference) ProtoMessage() {} - -func (x *CallbackOrReference) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CallbackOrReference.ProtoReflect.Descriptor instead. -func (*CallbackOrReference) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{4} -} - -func (m *CallbackOrReference) GetOneof() isCallbackOrReference_Oneof { - if m != nil { - return m.Oneof - } - return nil -} - -func (x *CallbackOrReference) GetCallback() *Callback { - if x, ok := x.GetOneof().(*CallbackOrReference_Callback); ok { - return x.Callback - } - return nil -} - -func (x *CallbackOrReference) GetReference() *Reference { - if x, ok := x.GetOneof().(*CallbackOrReference_Reference); ok { - return x.Reference - } - return nil -} - -type isCallbackOrReference_Oneof interface { - isCallbackOrReference_Oneof() -} - -type CallbackOrReference_Callback struct { - Callback *Callback `protobuf:"bytes,1,opt,name=callback,proto3,oneof"` -} - -type CallbackOrReference_Reference struct { - Reference *Reference `protobuf:"bytes,2,opt,name=reference,proto3,oneof"` -} - -func (*CallbackOrReference_Callback) isCallbackOrReference_Oneof() {} - -func (*CallbackOrReference_Reference) isCallbackOrReference_Oneof() {} - -type CallbacksOrReferences struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedCallbackOrReference `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *CallbacksOrReferences) Reset() { - *x = CallbacksOrReferences{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CallbacksOrReferences) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CallbacksOrReferences) ProtoMessage() {} - -func (x *CallbacksOrReferences) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CallbacksOrReferences.ProtoReflect.Descriptor instead. -func (*CallbacksOrReferences) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{5} -} - -func (x *CallbacksOrReferences) GetAdditionalProperties() []*NamedCallbackOrReference { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -// Holds a set of reusable objects for different aspects of the OAS. All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object. -type Components struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Schemas *SchemasOrReferences `protobuf:"bytes,1,opt,name=schemas,proto3" json:"schemas,omitempty"` - Responses *ResponsesOrReferences `protobuf:"bytes,2,opt,name=responses,proto3" json:"responses,omitempty"` - Parameters *ParametersOrReferences `protobuf:"bytes,3,opt,name=parameters,proto3" json:"parameters,omitempty"` - Examples *ExamplesOrReferences `protobuf:"bytes,4,opt,name=examples,proto3" json:"examples,omitempty"` - RequestBodies *RequestBodiesOrReferences `protobuf:"bytes,5,opt,name=request_bodies,json=requestBodies,proto3" json:"request_bodies,omitempty"` - Headers *HeadersOrReferences `protobuf:"bytes,6,opt,name=headers,proto3" json:"headers,omitempty"` - SecuritySchemes *SecuritySchemesOrReferences `protobuf:"bytes,7,opt,name=security_schemes,json=securitySchemes,proto3" json:"security_schemes,omitempty"` - Links *LinksOrReferences `protobuf:"bytes,8,opt,name=links,proto3" json:"links,omitempty"` - Callbacks *CallbacksOrReferences `protobuf:"bytes,9,opt,name=callbacks,proto3" json:"callbacks,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,10,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` -} - -func (x *Components) Reset() { - *x = Components{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Components) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Components) ProtoMessage() {} - -func (x *Components) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Components.ProtoReflect.Descriptor instead. -func (*Components) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{6} -} - -func (x *Components) GetSchemas() *SchemasOrReferences { - if x != nil { - return x.Schemas - } - return nil -} - -func (x *Components) GetResponses() *ResponsesOrReferences { - if x != nil { - return x.Responses - } - return nil -} - -func (x *Components) GetParameters() *ParametersOrReferences { - if x != nil { - return x.Parameters - } - return nil -} - -func (x *Components) GetExamples() *ExamplesOrReferences { - if x != nil { - return x.Examples - } - return nil -} - -func (x *Components) GetRequestBodies() *RequestBodiesOrReferences { - if x != nil { - return x.RequestBodies - } - return nil -} - -func (x *Components) GetHeaders() *HeadersOrReferences { - if x != nil { - return x.Headers - } - return nil -} - -func (x *Components) GetSecuritySchemes() *SecuritySchemesOrReferences { - if x != nil { - return x.SecuritySchemes - } - return nil -} - -func (x *Components) GetLinks() *LinksOrReferences { - if x != nil { - return x.Links - } - return nil -} - -func (x *Components) GetCallbacks() *CallbacksOrReferences { - if x != nil { - return x.Callbacks - } - return nil -} - -func (x *Components) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -// Contact information for the exposed API. -type Contact struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` - Email string `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,4,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` -} - -func (x *Contact) Reset() { - *x = Contact{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Contact) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Contact) ProtoMessage() {} - -func (x *Contact) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Contact.ProtoReflect.Descriptor instead. -func (*Contact) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{7} -} - -func (x *Contact) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Contact) GetUrl() string { - if x != nil { - return x.Url - } - return "" -} - -func (x *Contact) GetEmail() string { - if x != nil { - return x.Email - } - return "" -} - -func (x *Contact) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -type DefaultType struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Oneof: - // *DefaultType_Number - // *DefaultType_Boolean - // *DefaultType_String_ - Oneof isDefaultType_Oneof `protobuf_oneof:"oneof"` -} - -func (x *DefaultType) Reset() { - *x = DefaultType{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DefaultType) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DefaultType) ProtoMessage() {} - -func (x *DefaultType) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DefaultType.ProtoReflect.Descriptor instead. -func (*DefaultType) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{8} -} - -func (m *DefaultType) GetOneof() isDefaultType_Oneof { - if m != nil { - return m.Oneof - } - return nil -} - -func (x *DefaultType) GetNumber() float64 { - if x, ok := x.GetOneof().(*DefaultType_Number); ok { - return x.Number - } - return 0 -} - -func (x *DefaultType) GetBoolean() bool { - if x, ok := x.GetOneof().(*DefaultType_Boolean); ok { - return x.Boolean - } - return false -} - -func (x *DefaultType) GetString_() string { - if x, ok := x.GetOneof().(*DefaultType_String_); ok { - return x.String_ - } - return "" -} - -type isDefaultType_Oneof interface { - isDefaultType_Oneof() -} - -type DefaultType_Number struct { - Number float64 `protobuf:"fixed64,1,opt,name=number,proto3,oneof"` -} - -type DefaultType_Boolean struct { - Boolean bool `protobuf:"varint,2,opt,name=boolean,proto3,oneof"` -} - -type DefaultType_String_ struct { - String_ string `protobuf:"bytes,3,opt,name=string,proto3,oneof"` -} - -func (*DefaultType_Number) isDefaultType_Oneof() {} - -func (*DefaultType_Boolean) isDefaultType_Oneof() {} - -func (*DefaultType_String_) isDefaultType_Oneof() {} - -// When request bodies or response payloads may be one of a number of different schemas, a `discriminator` object can be used to aid in serialization, deserialization, and validation. The discriminator is a specific object in a schema which is used to inform the consumer of the specification of an alternative schema based on the value associated with it. When using the discriminator, _inline_ schemas will not be considered. -type Discriminator struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - PropertyName string `protobuf:"bytes,1,opt,name=property_name,json=propertyName,proto3" json:"property_name,omitempty"` - Mapping *Strings `protobuf:"bytes,2,opt,name=mapping,proto3" json:"mapping,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,3,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` -} - -func (x *Discriminator) Reset() { - *x = Discriminator{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Discriminator) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Discriminator) ProtoMessage() {} - -func (x *Discriminator) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Discriminator.ProtoReflect.Descriptor instead. -func (*Discriminator) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{9} -} - -func (x *Discriminator) GetPropertyName() string { - if x != nil { - return x.PropertyName - } - return "" -} - -func (x *Discriminator) GetMapping() *Strings { - if x != nil { - return x.Mapping - } - return nil -} - -func (x *Discriminator) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -type Document struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Openapi string `protobuf:"bytes,1,opt,name=openapi,proto3" json:"openapi,omitempty"` - Info *Info `protobuf:"bytes,2,opt,name=info,proto3" json:"info,omitempty"` - Servers []*Server `protobuf:"bytes,3,rep,name=servers,proto3" json:"servers,omitempty"` - Paths *Paths `protobuf:"bytes,4,opt,name=paths,proto3" json:"paths,omitempty"` - Components *Components `protobuf:"bytes,5,opt,name=components,proto3" json:"components,omitempty"` - Security []*SecurityRequirement `protobuf:"bytes,6,rep,name=security,proto3" json:"security,omitempty"` - Tags []*Tag `protobuf:"bytes,7,rep,name=tags,proto3" json:"tags,omitempty"` - ExternalDocs *ExternalDocs `protobuf:"bytes,8,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,9,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` -} - -func (x *Document) Reset() { - *x = Document{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Document) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Document) ProtoMessage() {} - -func (x *Document) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Document.ProtoReflect.Descriptor instead. -func (*Document) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{10} -} - -func (x *Document) GetOpenapi() string { - if x != nil { - return x.Openapi - } - return "" -} - -func (x *Document) GetInfo() *Info { - if x != nil { - return x.Info - } - return nil -} - -func (x *Document) GetServers() []*Server { - if x != nil { - return x.Servers - } - return nil -} - -func (x *Document) GetPaths() *Paths { - if x != nil { - return x.Paths - } - return nil -} - -func (x *Document) GetComponents() *Components { - if x != nil { - return x.Components - } - return nil -} - -func (x *Document) GetSecurity() []*SecurityRequirement { - if x != nil { - return x.Security - } - return nil -} - -func (x *Document) GetTags() []*Tag { - if x != nil { - return x.Tags - } - return nil -} - -func (x *Document) GetExternalDocs() *ExternalDocs { - if x != nil { - return x.ExternalDocs - } - return nil -} - -func (x *Document) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -// A single encoding definition applied to a single schema property. -type Encoding struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ContentType string `protobuf:"bytes,1,opt,name=content_type,json=contentType,proto3" json:"content_type,omitempty"` - Headers *HeadersOrReferences `protobuf:"bytes,2,opt,name=headers,proto3" json:"headers,omitempty"` - Style string `protobuf:"bytes,3,opt,name=style,proto3" json:"style,omitempty"` - Explode bool `protobuf:"varint,4,opt,name=explode,proto3" json:"explode,omitempty"` - AllowReserved bool `protobuf:"varint,5,opt,name=allow_reserved,json=allowReserved,proto3" json:"allow_reserved,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,6,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` -} - -func (x *Encoding) Reset() { - *x = Encoding{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Encoding) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Encoding) ProtoMessage() {} - -func (x *Encoding) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Encoding.ProtoReflect.Descriptor instead. -func (*Encoding) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{11} -} - -func (x *Encoding) GetContentType() string { - if x != nil { - return x.ContentType - } - return "" -} - -func (x *Encoding) GetHeaders() *HeadersOrReferences { - if x != nil { - return x.Headers - } - return nil -} - -func (x *Encoding) GetStyle() string { - if x != nil { - return x.Style - } - return "" -} - -func (x *Encoding) GetExplode() bool { - if x != nil { - return x.Explode - } - return false -} - -func (x *Encoding) GetAllowReserved() bool { - if x != nil { - return x.AllowReserved - } - return false -} - -func (x *Encoding) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -type Encodings struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedEncoding `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *Encodings) Reset() { - *x = Encodings{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Encodings) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Encodings) ProtoMessage() {} - -func (x *Encodings) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Encodings.ProtoReflect.Descriptor instead. -func (*Encodings) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{12} -} - -func (x *Encodings) GetAdditionalProperties() []*NamedEncoding { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -type Example struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Summary string `protobuf:"bytes,1,opt,name=summary,proto3" json:"summary,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - Value *Any `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` - ExternalValue string `protobuf:"bytes,4,opt,name=external_value,json=externalValue,proto3" json:"external_value,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,5,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` -} - -func (x *Example) Reset() { - *x = Example{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Example) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Example) ProtoMessage() {} - -func (x *Example) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Example.ProtoReflect.Descriptor instead. -func (*Example) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{13} -} - -func (x *Example) GetSummary() string { - if x != nil { - return x.Summary - } - return "" -} - -func (x *Example) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *Example) GetValue() *Any { - if x != nil { - return x.Value - } - return nil -} - -func (x *Example) GetExternalValue() string { - if x != nil { - return x.ExternalValue - } - return "" -} - -func (x *Example) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -type ExampleOrReference struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Oneof: - // *ExampleOrReference_Example - // *ExampleOrReference_Reference - Oneof isExampleOrReference_Oneof `protobuf_oneof:"oneof"` -} - -func (x *ExampleOrReference) Reset() { - *x = ExampleOrReference{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ExampleOrReference) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ExampleOrReference) ProtoMessage() {} - -func (x *ExampleOrReference) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[14] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ExampleOrReference.ProtoReflect.Descriptor instead. -func (*ExampleOrReference) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{14} -} - -func (m *ExampleOrReference) GetOneof() isExampleOrReference_Oneof { - if m != nil { - return m.Oneof - } - return nil -} - -func (x *ExampleOrReference) GetExample() *Example { - if x, ok := x.GetOneof().(*ExampleOrReference_Example); ok { - return x.Example - } - return nil -} - -func (x *ExampleOrReference) GetReference() *Reference { - if x, ok := x.GetOneof().(*ExampleOrReference_Reference); ok { - return x.Reference - } - return nil -} - -type isExampleOrReference_Oneof interface { - isExampleOrReference_Oneof() -} - -type ExampleOrReference_Example struct { - Example *Example `protobuf:"bytes,1,opt,name=example,proto3,oneof"` -} - -type ExampleOrReference_Reference struct { - Reference *Reference `protobuf:"bytes,2,opt,name=reference,proto3,oneof"` -} - -func (*ExampleOrReference_Example) isExampleOrReference_Oneof() {} - -func (*ExampleOrReference_Reference) isExampleOrReference_Oneof() {} - -type ExamplesOrReferences struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedExampleOrReference `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *ExamplesOrReferences) Reset() { - *x = ExamplesOrReferences{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ExamplesOrReferences) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ExamplesOrReferences) ProtoMessage() {} - -func (x *ExamplesOrReferences) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[15] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ExamplesOrReferences.ProtoReflect.Descriptor instead. -func (*ExamplesOrReferences) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{15} -} - -func (x *ExamplesOrReferences) GetAdditionalProperties() []*NamedExampleOrReference { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -type Expression struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedAny `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *Expression) Reset() { - *x = Expression{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[16] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Expression) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Expression) ProtoMessage() {} - -func (x *Expression) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[16] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Expression.ProtoReflect.Descriptor instead. -func (*Expression) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{16} -} - -func (x *Expression) GetAdditionalProperties() []*NamedAny { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -// Allows referencing an external resource for extended documentation. -type ExternalDocs struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"` - Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,3,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` -} - -func (x *ExternalDocs) Reset() { - *x = ExternalDocs{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[17] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ExternalDocs) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ExternalDocs) ProtoMessage() {} - -func (x *ExternalDocs) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[17] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ExternalDocs.ProtoReflect.Descriptor instead. -func (*ExternalDocs) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{17} -} - -func (x *ExternalDocs) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *ExternalDocs) GetUrl() string { - if x != nil { - return x.Url - } - return "" -} - -func (x *ExternalDocs) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -// The Header Object follows the structure of the Parameter Object with the following changes: 1. `name` MUST NOT be specified, it is given in the corresponding `headers` map. 1. `in` MUST NOT be specified, it is implicitly in `header`. 1. All traits that are affected by the location MUST be applicable to a location of `header` (for example, `style`). -type Header struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"` - Required bool `protobuf:"varint,2,opt,name=required,proto3" json:"required,omitempty"` - Deprecated bool `protobuf:"varint,3,opt,name=deprecated,proto3" json:"deprecated,omitempty"` - AllowEmptyValue bool `protobuf:"varint,4,opt,name=allow_empty_value,json=allowEmptyValue,proto3" json:"allow_empty_value,omitempty"` - Style string `protobuf:"bytes,5,opt,name=style,proto3" json:"style,omitempty"` - Explode bool `protobuf:"varint,6,opt,name=explode,proto3" json:"explode,omitempty"` - AllowReserved bool `protobuf:"varint,7,opt,name=allow_reserved,json=allowReserved,proto3" json:"allow_reserved,omitempty"` - Schema *SchemaOrReference `protobuf:"bytes,8,opt,name=schema,proto3" json:"schema,omitempty"` - Example *Any `protobuf:"bytes,9,opt,name=example,proto3" json:"example,omitempty"` - Examples *ExamplesOrReferences `protobuf:"bytes,10,opt,name=examples,proto3" json:"examples,omitempty"` - Content *MediaTypes `protobuf:"bytes,11,opt,name=content,proto3" json:"content,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,12,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` -} - -func (x *Header) Reset() { - *x = Header{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[18] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Header) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Header) ProtoMessage() {} - -func (x *Header) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[18] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Header.ProtoReflect.Descriptor instead. -func (*Header) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{18} -} - -func (x *Header) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *Header) GetRequired() bool { - if x != nil { - return x.Required - } - return false -} - -func (x *Header) GetDeprecated() bool { - if x != nil { - return x.Deprecated - } - return false -} - -func (x *Header) GetAllowEmptyValue() bool { - if x != nil { - return x.AllowEmptyValue - } - return false -} - -func (x *Header) GetStyle() string { - if x != nil { - return x.Style - } - return "" -} - -func (x *Header) GetExplode() bool { - if x != nil { - return x.Explode - } - return false -} - -func (x *Header) GetAllowReserved() bool { - if x != nil { - return x.AllowReserved - } - return false -} - -func (x *Header) GetSchema() *SchemaOrReference { - if x != nil { - return x.Schema - } - return nil -} - -func (x *Header) GetExample() *Any { - if x != nil { - return x.Example - } - return nil -} - -func (x *Header) GetExamples() *ExamplesOrReferences { - if x != nil { - return x.Examples - } - return nil -} - -func (x *Header) GetContent() *MediaTypes { - if x != nil { - return x.Content - } - return nil -} - -func (x *Header) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -type HeaderOrReference struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Oneof: - // *HeaderOrReference_Header - // *HeaderOrReference_Reference - Oneof isHeaderOrReference_Oneof `protobuf_oneof:"oneof"` -} - -func (x *HeaderOrReference) Reset() { - *x = HeaderOrReference{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[19] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HeaderOrReference) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HeaderOrReference) ProtoMessage() {} - -func (x *HeaderOrReference) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[19] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HeaderOrReference.ProtoReflect.Descriptor instead. -func (*HeaderOrReference) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{19} -} - -func (m *HeaderOrReference) GetOneof() isHeaderOrReference_Oneof { - if m != nil { - return m.Oneof - } - return nil -} - -func (x *HeaderOrReference) GetHeader() *Header { - if x, ok := x.GetOneof().(*HeaderOrReference_Header); ok { - return x.Header - } - return nil -} - -func (x *HeaderOrReference) GetReference() *Reference { - if x, ok := x.GetOneof().(*HeaderOrReference_Reference); ok { - return x.Reference - } - return nil -} - -type isHeaderOrReference_Oneof interface { - isHeaderOrReference_Oneof() -} - -type HeaderOrReference_Header struct { - Header *Header `protobuf:"bytes,1,opt,name=header,proto3,oneof"` -} - -type HeaderOrReference_Reference struct { - Reference *Reference `protobuf:"bytes,2,opt,name=reference,proto3,oneof"` -} - -func (*HeaderOrReference_Header) isHeaderOrReference_Oneof() {} - -func (*HeaderOrReference_Reference) isHeaderOrReference_Oneof() {} - -type HeadersOrReferences struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedHeaderOrReference `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *HeadersOrReferences) Reset() { - *x = HeadersOrReferences{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[20] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HeadersOrReferences) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HeadersOrReferences) ProtoMessage() {} - -func (x *HeadersOrReferences) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[20] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HeadersOrReferences.ProtoReflect.Descriptor instead. -func (*HeadersOrReferences) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{20} -} - -func (x *HeadersOrReferences) GetAdditionalProperties() []*NamedHeaderOrReference { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -// The object provides metadata about the API. The metadata MAY be used by the clients if needed, and MAY be presented in editing or documentation generation tools for convenience. -type Info struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - TermsOfService string `protobuf:"bytes,3,opt,name=terms_of_service,json=termsOfService,proto3" json:"terms_of_service,omitempty"` - Contact *Contact `protobuf:"bytes,4,opt,name=contact,proto3" json:"contact,omitempty"` - License *License `protobuf:"bytes,5,opt,name=license,proto3" json:"license,omitempty"` - Version string `protobuf:"bytes,6,opt,name=version,proto3" json:"version,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,7,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` - Summary string `protobuf:"bytes,8,opt,name=summary,proto3" json:"summary,omitempty"` -} - -func (x *Info) Reset() { - *x = Info{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[21] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Info) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Info) ProtoMessage() {} - -func (x *Info) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[21] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Info.ProtoReflect.Descriptor instead. -func (*Info) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{21} -} - -func (x *Info) GetTitle() string { - if x != nil { - return x.Title - } - return "" -} - -func (x *Info) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *Info) GetTermsOfService() string { - if x != nil { - return x.TermsOfService - } - return "" -} - -func (x *Info) GetContact() *Contact { - if x != nil { - return x.Contact - } - return nil -} - -func (x *Info) GetLicense() *License { - if x != nil { - return x.License - } - return nil -} - -func (x *Info) GetVersion() string { - if x != nil { - return x.Version - } - return "" -} - -func (x *Info) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -func (x *Info) GetSummary() string { - if x != nil { - return x.Summary - } - return "" -} - -type ItemsItem struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - SchemaOrReference []*SchemaOrReference `protobuf:"bytes,1,rep,name=schema_or_reference,json=schemaOrReference,proto3" json:"schema_or_reference,omitempty"` -} - -func (x *ItemsItem) Reset() { - *x = ItemsItem{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[22] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ItemsItem) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ItemsItem) ProtoMessage() {} - -func (x *ItemsItem) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[22] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ItemsItem.ProtoReflect.Descriptor instead. -func (*ItemsItem) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{22} -} - -func (x *ItemsItem) GetSchemaOrReference() []*SchemaOrReference { - if x != nil { - return x.SchemaOrReference - } - return nil -} - -// License information for the exposed API. -type License struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,3,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` -} - -func (x *License) Reset() { - *x = License{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[23] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *License) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*License) ProtoMessage() {} - -func (x *License) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[23] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use License.ProtoReflect.Descriptor instead. -func (*License) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{23} -} - -func (x *License) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *License) GetUrl() string { - if x != nil { - return x.Url - } - return "" -} - -func (x *License) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -// The `Link object` represents a possible design-time link for a response. The presence of a link does not guarantee the caller's ability to successfully invoke it, rather it provides a known relationship and traversal mechanism between responses and other operations. Unlike _dynamic_ links (i.e. links provided **in** the response payload), the OAS linking mechanism does not require link information in the runtime response. For computing links, and providing instructions to execute them, a runtime expression is used for accessing values in an operation and using them as parameters while invoking the linked operation. -type Link struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - OperationRef string `protobuf:"bytes,1,opt,name=operation_ref,json=operationRef,proto3" json:"operation_ref,omitempty"` - OperationId string `protobuf:"bytes,2,opt,name=operation_id,json=operationId,proto3" json:"operation_id,omitempty"` - Parameters *AnyOrExpression `protobuf:"bytes,3,opt,name=parameters,proto3" json:"parameters,omitempty"` - RequestBody *AnyOrExpression `protobuf:"bytes,4,opt,name=request_body,json=requestBody,proto3" json:"request_body,omitempty"` - Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"` - Server *Server `protobuf:"bytes,6,opt,name=server,proto3" json:"server,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,7,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` -} - -func (x *Link) Reset() { - *x = Link{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[24] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Link) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Link) ProtoMessage() {} - -func (x *Link) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[24] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Link.ProtoReflect.Descriptor instead. -func (*Link) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{24} -} - -func (x *Link) GetOperationRef() string { - if x != nil { - return x.OperationRef - } - return "" -} - -func (x *Link) GetOperationId() string { - if x != nil { - return x.OperationId - } - return "" -} - -func (x *Link) GetParameters() *AnyOrExpression { - if x != nil { - return x.Parameters - } - return nil -} - -func (x *Link) GetRequestBody() *AnyOrExpression { - if x != nil { - return x.RequestBody - } - return nil -} - -func (x *Link) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *Link) GetServer() *Server { - if x != nil { - return x.Server - } - return nil -} - -func (x *Link) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -type LinkOrReference struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Oneof: - // *LinkOrReference_Link - // *LinkOrReference_Reference - Oneof isLinkOrReference_Oneof `protobuf_oneof:"oneof"` -} - -func (x *LinkOrReference) Reset() { - *x = LinkOrReference{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[25] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *LinkOrReference) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*LinkOrReference) ProtoMessage() {} - -func (x *LinkOrReference) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[25] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use LinkOrReference.ProtoReflect.Descriptor instead. -func (*LinkOrReference) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{25} -} - -func (m *LinkOrReference) GetOneof() isLinkOrReference_Oneof { - if m != nil { - return m.Oneof - } - return nil -} - -func (x *LinkOrReference) GetLink() *Link { - if x, ok := x.GetOneof().(*LinkOrReference_Link); ok { - return x.Link - } - return nil -} - -func (x *LinkOrReference) GetReference() *Reference { - if x, ok := x.GetOneof().(*LinkOrReference_Reference); ok { - return x.Reference - } - return nil -} - -type isLinkOrReference_Oneof interface { - isLinkOrReference_Oneof() -} - -type LinkOrReference_Link struct { - Link *Link `protobuf:"bytes,1,opt,name=link,proto3,oneof"` -} - -type LinkOrReference_Reference struct { - Reference *Reference `protobuf:"bytes,2,opt,name=reference,proto3,oneof"` -} - -func (*LinkOrReference_Link) isLinkOrReference_Oneof() {} - -func (*LinkOrReference_Reference) isLinkOrReference_Oneof() {} - -type LinksOrReferences struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedLinkOrReference `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *LinksOrReferences) Reset() { - *x = LinksOrReferences{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[26] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *LinksOrReferences) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*LinksOrReferences) ProtoMessage() {} - -func (x *LinksOrReferences) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[26] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use LinksOrReferences.ProtoReflect.Descriptor instead. -func (*LinksOrReferences) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{26} -} - -func (x *LinksOrReferences) GetAdditionalProperties() []*NamedLinkOrReference { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -// Each Media Type Object provides schema and examples for the media type identified by its key. -type MediaType struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Schema *SchemaOrReference `protobuf:"bytes,1,opt,name=schema,proto3" json:"schema,omitempty"` - Example *Any `protobuf:"bytes,2,opt,name=example,proto3" json:"example,omitempty"` - Examples *ExamplesOrReferences `protobuf:"bytes,3,opt,name=examples,proto3" json:"examples,omitempty"` - Encoding *Encodings `protobuf:"bytes,4,opt,name=encoding,proto3" json:"encoding,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,5,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` -} - -func (x *MediaType) Reset() { - *x = MediaType{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[27] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MediaType) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MediaType) ProtoMessage() {} - -func (x *MediaType) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[27] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MediaType.ProtoReflect.Descriptor instead. -func (*MediaType) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{27} -} - -func (x *MediaType) GetSchema() *SchemaOrReference { - if x != nil { - return x.Schema - } - return nil -} - -func (x *MediaType) GetExample() *Any { - if x != nil { - return x.Example - } - return nil -} - -func (x *MediaType) GetExamples() *ExamplesOrReferences { - if x != nil { - return x.Examples - } - return nil -} - -func (x *MediaType) GetEncoding() *Encodings { - if x != nil { - return x.Encoding - } - return nil -} - -func (x *MediaType) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -type MediaTypes struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedMediaType `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *MediaTypes) Reset() { - *x = MediaTypes{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[28] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MediaTypes) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MediaTypes) ProtoMessage() {} - -func (x *MediaTypes) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[28] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MediaTypes.ProtoReflect.Descriptor instead. -func (*MediaTypes) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{28} -} - -func (x *MediaTypes) GetAdditionalProperties() []*NamedMediaType { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -// Automatically-generated message used to represent maps of Any as ordered (name,value) pairs. -type NamedAny struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Map key - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Mapped value - Value *Any `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *NamedAny) Reset() { - *x = NamedAny{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[29] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamedAny) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamedAny) ProtoMessage() {} - -func (x *NamedAny) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[29] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NamedAny.ProtoReflect.Descriptor instead. -func (*NamedAny) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{29} -} - -func (x *NamedAny) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *NamedAny) GetValue() *Any { - if x != nil { - return x.Value - } - return nil -} - -// Automatically-generated message used to represent maps of CallbackOrReference as ordered (name,value) pairs. -type NamedCallbackOrReference struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Map key - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Mapped value - Value *CallbackOrReference `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *NamedCallbackOrReference) Reset() { - *x = NamedCallbackOrReference{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[30] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamedCallbackOrReference) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamedCallbackOrReference) ProtoMessage() {} - -func (x *NamedCallbackOrReference) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[30] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NamedCallbackOrReference.ProtoReflect.Descriptor instead. -func (*NamedCallbackOrReference) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{30} -} - -func (x *NamedCallbackOrReference) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *NamedCallbackOrReference) GetValue() *CallbackOrReference { - if x != nil { - return x.Value - } - return nil -} - -// Automatically-generated message used to represent maps of Encoding as ordered (name,value) pairs. -type NamedEncoding struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Map key - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Mapped value - Value *Encoding `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *NamedEncoding) Reset() { - *x = NamedEncoding{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[31] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamedEncoding) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamedEncoding) ProtoMessage() {} - -func (x *NamedEncoding) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[31] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NamedEncoding.ProtoReflect.Descriptor instead. -func (*NamedEncoding) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{31} -} - -func (x *NamedEncoding) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *NamedEncoding) GetValue() *Encoding { - if x != nil { - return x.Value - } - return nil -} - -// Automatically-generated message used to represent maps of ExampleOrReference as ordered (name,value) pairs. -type NamedExampleOrReference struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Map key - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Mapped value - Value *ExampleOrReference `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *NamedExampleOrReference) Reset() { - *x = NamedExampleOrReference{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[32] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamedExampleOrReference) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamedExampleOrReference) ProtoMessage() {} - -func (x *NamedExampleOrReference) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[32] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NamedExampleOrReference.ProtoReflect.Descriptor instead. -func (*NamedExampleOrReference) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{32} -} - -func (x *NamedExampleOrReference) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *NamedExampleOrReference) GetValue() *ExampleOrReference { - if x != nil { - return x.Value - } - return nil -} - -// Automatically-generated message used to represent maps of HeaderOrReference as ordered (name,value) pairs. -type NamedHeaderOrReference struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Map key - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Mapped value - Value *HeaderOrReference `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *NamedHeaderOrReference) Reset() { - *x = NamedHeaderOrReference{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[33] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamedHeaderOrReference) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamedHeaderOrReference) ProtoMessage() {} - -func (x *NamedHeaderOrReference) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[33] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NamedHeaderOrReference.ProtoReflect.Descriptor instead. -func (*NamedHeaderOrReference) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{33} -} - -func (x *NamedHeaderOrReference) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *NamedHeaderOrReference) GetValue() *HeaderOrReference { - if x != nil { - return x.Value - } - return nil -} - -// Automatically-generated message used to represent maps of LinkOrReference as ordered (name,value) pairs. -type NamedLinkOrReference struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Map key - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Mapped value - Value *LinkOrReference `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *NamedLinkOrReference) Reset() { - *x = NamedLinkOrReference{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[34] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamedLinkOrReference) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamedLinkOrReference) ProtoMessage() {} - -func (x *NamedLinkOrReference) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[34] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NamedLinkOrReference.ProtoReflect.Descriptor instead. -func (*NamedLinkOrReference) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{34} -} - -func (x *NamedLinkOrReference) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *NamedLinkOrReference) GetValue() *LinkOrReference { - if x != nil { - return x.Value - } - return nil -} - -// Automatically-generated message used to represent maps of MediaType as ordered (name,value) pairs. -type NamedMediaType struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Map key - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Mapped value - Value *MediaType `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *NamedMediaType) Reset() { - *x = NamedMediaType{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[35] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamedMediaType) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamedMediaType) ProtoMessage() {} - -func (x *NamedMediaType) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[35] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NamedMediaType.ProtoReflect.Descriptor instead. -func (*NamedMediaType) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{35} -} - -func (x *NamedMediaType) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *NamedMediaType) GetValue() *MediaType { - if x != nil { - return x.Value - } - return nil -} - -// Automatically-generated message used to represent maps of ParameterOrReference as ordered (name,value) pairs. -type NamedParameterOrReference struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Map key - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Mapped value - Value *ParameterOrReference `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *NamedParameterOrReference) Reset() { - *x = NamedParameterOrReference{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[36] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamedParameterOrReference) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamedParameterOrReference) ProtoMessage() {} - -func (x *NamedParameterOrReference) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[36] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NamedParameterOrReference.ProtoReflect.Descriptor instead. -func (*NamedParameterOrReference) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{36} -} - -func (x *NamedParameterOrReference) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *NamedParameterOrReference) GetValue() *ParameterOrReference { - if x != nil { - return x.Value - } - return nil -} - -// Automatically-generated message used to represent maps of PathItem as ordered (name,value) pairs. -type NamedPathItem struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Map key - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Mapped value - Value *PathItem `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *NamedPathItem) Reset() { - *x = NamedPathItem{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[37] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamedPathItem) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamedPathItem) ProtoMessage() {} - -func (x *NamedPathItem) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[37] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NamedPathItem.ProtoReflect.Descriptor instead. -func (*NamedPathItem) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{37} -} - -func (x *NamedPathItem) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *NamedPathItem) GetValue() *PathItem { - if x != nil { - return x.Value - } - return nil -} - -// Automatically-generated message used to represent maps of RequestBodyOrReference as ordered (name,value) pairs. -type NamedRequestBodyOrReference struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Map key - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Mapped value - Value *RequestBodyOrReference `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *NamedRequestBodyOrReference) Reset() { - *x = NamedRequestBodyOrReference{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[38] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamedRequestBodyOrReference) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamedRequestBodyOrReference) ProtoMessage() {} - -func (x *NamedRequestBodyOrReference) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[38] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NamedRequestBodyOrReference.ProtoReflect.Descriptor instead. -func (*NamedRequestBodyOrReference) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{38} -} - -func (x *NamedRequestBodyOrReference) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *NamedRequestBodyOrReference) GetValue() *RequestBodyOrReference { - if x != nil { - return x.Value - } - return nil -} - -// Automatically-generated message used to represent maps of ResponseOrReference as ordered (name,value) pairs. -type NamedResponseOrReference struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Map key - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Mapped value - Value *ResponseOrReference `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *NamedResponseOrReference) Reset() { - *x = NamedResponseOrReference{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[39] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamedResponseOrReference) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamedResponseOrReference) ProtoMessage() {} - -func (x *NamedResponseOrReference) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[39] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NamedResponseOrReference.ProtoReflect.Descriptor instead. -func (*NamedResponseOrReference) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{39} -} - -func (x *NamedResponseOrReference) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *NamedResponseOrReference) GetValue() *ResponseOrReference { - if x != nil { - return x.Value - } - return nil -} - -// Automatically-generated message used to represent maps of SchemaOrReference as ordered (name,value) pairs. -type NamedSchemaOrReference struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Map key - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Mapped value - Value *SchemaOrReference `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *NamedSchemaOrReference) Reset() { - *x = NamedSchemaOrReference{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[40] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamedSchemaOrReference) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamedSchemaOrReference) ProtoMessage() {} - -func (x *NamedSchemaOrReference) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[40] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NamedSchemaOrReference.ProtoReflect.Descriptor instead. -func (*NamedSchemaOrReference) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{40} -} - -func (x *NamedSchemaOrReference) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *NamedSchemaOrReference) GetValue() *SchemaOrReference { - if x != nil { - return x.Value - } - return nil -} - -// Automatically-generated message used to represent maps of SecuritySchemeOrReference as ordered (name,value) pairs. -type NamedSecuritySchemeOrReference struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Map key - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Mapped value - Value *SecuritySchemeOrReference `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *NamedSecuritySchemeOrReference) Reset() { - *x = NamedSecuritySchemeOrReference{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[41] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamedSecuritySchemeOrReference) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamedSecuritySchemeOrReference) ProtoMessage() {} - -func (x *NamedSecuritySchemeOrReference) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[41] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NamedSecuritySchemeOrReference.ProtoReflect.Descriptor instead. -func (*NamedSecuritySchemeOrReference) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{41} -} - -func (x *NamedSecuritySchemeOrReference) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *NamedSecuritySchemeOrReference) GetValue() *SecuritySchemeOrReference { - if x != nil { - return x.Value - } - return nil -} - -// Automatically-generated message used to represent maps of ServerVariable as ordered (name,value) pairs. -type NamedServerVariable struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Map key - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Mapped value - Value *ServerVariable `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *NamedServerVariable) Reset() { - *x = NamedServerVariable{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[42] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamedServerVariable) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamedServerVariable) ProtoMessage() {} - -func (x *NamedServerVariable) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[42] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NamedServerVariable.ProtoReflect.Descriptor instead. -func (*NamedServerVariable) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{42} -} - -func (x *NamedServerVariable) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *NamedServerVariable) GetValue() *ServerVariable { - if x != nil { - return x.Value - } - return nil -} - -// Automatically-generated message used to represent maps of string as ordered (name,value) pairs. -type NamedString struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Map key - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Mapped value - Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *NamedString) Reset() { - *x = NamedString{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[43] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamedString) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamedString) ProtoMessage() {} - -func (x *NamedString) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[43] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NamedString.ProtoReflect.Descriptor instead. -func (*NamedString) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{43} -} - -func (x *NamedString) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *NamedString) GetValue() string { - if x != nil { - return x.Value - } - return "" -} - -// Automatically-generated message used to represent maps of StringArray as ordered (name,value) pairs. -type NamedStringArray struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Map key - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Mapped value - Value *StringArray `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *NamedStringArray) Reset() { - *x = NamedStringArray{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[44] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamedStringArray) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamedStringArray) ProtoMessage() {} - -func (x *NamedStringArray) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[44] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NamedStringArray.ProtoReflect.Descriptor instead. -func (*NamedStringArray) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{44} -} - -func (x *NamedStringArray) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *NamedStringArray) GetValue() *StringArray { - if x != nil { - return x.Value - } - return nil -} - -// Configuration details for a supported OAuth Flow -type OauthFlow struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AuthorizationUrl string `protobuf:"bytes,1,opt,name=authorization_url,json=authorizationUrl,proto3" json:"authorization_url,omitempty"` - TokenUrl string `protobuf:"bytes,2,opt,name=token_url,json=tokenUrl,proto3" json:"token_url,omitempty"` - RefreshUrl string `protobuf:"bytes,3,opt,name=refresh_url,json=refreshUrl,proto3" json:"refresh_url,omitempty"` - Scopes *Strings `protobuf:"bytes,4,opt,name=scopes,proto3" json:"scopes,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,5,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` -} - -func (x *OauthFlow) Reset() { - *x = OauthFlow{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[45] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *OauthFlow) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*OauthFlow) ProtoMessage() {} - -func (x *OauthFlow) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[45] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use OauthFlow.ProtoReflect.Descriptor instead. -func (*OauthFlow) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{45} -} - -func (x *OauthFlow) GetAuthorizationUrl() string { - if x != nil { - return x.AuthorizationUrl - } - return "" -} - -func (x *OauthFlow) GetTokenUrl() string { - if x != nil { - return x.TokenUrl - } - return "" -} - -func (x *OauthFlow) GetRefreshUrl() string { - if x != nil { - return x.RefreshUrl - } - return "" -} - -func (x *OauthFlow) GetScopes() *Strings { - if x != nil { - return x.Scopes - } - return nil -} - -func (x *OauthFlow) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -// Allows configuration of the supported OAuth Flows. -type OauthFlows struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Implicit *OauthFlow `protobuf:"bytes,1,opt,name=implicit,proto3" json:"implicit,omitempty"` - Password *OauthFlow `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` - ClientCredentials *OauthFlow `protobuf:"bytes,3,opt,name=client_credentials,json=clientCredentials,proto3" json:"client_credentials,omitempty"` - AuthorizationCode *OauthFlow `protobuf:"bytes,4,opt,name=authorization_code,json=authorizationCode,proto3" json:"authorization_code,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,5,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` -} - -func (x *OauthFlows) Reset() { - *x = OauthFlows{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[46] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *OauthFlows) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*OauthFlows) ProtoMessage() {} - -func (x *OauthFlows) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[46] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use OauthFlows.ProtoReflect.Descriptor instead. -func (*OauthFlows) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{46} -} - -func (x *OauthFlows) GetImplicit() *OauthFlow { - if x != nil { - return x.Implicit - } - return nil -} - -func (x *OauthFlows) GetPassword() *OauthFlow { - if x != nil { - return x.Password - } - return nil -} - -func (x *OauthFlows) GetClientCredentials() *OauthFlow { - if x != nil { - return x.ClientCredentials - } - return nil -} - -func (x *OauthFlows) GetAuthorizationCode() *OauthFlow { - if x != nil { - return x.AuthorizationCode - } - return nil -} - -func (x *OauthFlows) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -type Object struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedAny `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *Object) Reset() { - *x = Object{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[47] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Object) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Object) ProtoMessage() {} - -func (x *Object) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[47] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Object.ProtoReflect.Descriptor instead. -func (*Object) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{47} -} - -func (x *Object) GetAdditionalProperties() []*NamedAny { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -// Describes a single API operation on a path. -type Operation struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Tags []string `protobuf:"bytes,1,rep,name=tags,proto3" json:"tags,omitempty"` - Summary string `protobuf:"bytes,2,opt,name=summary,proto3" json:"summary,omitempty"` - Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` - ExternalDocs *ExternalDocs `protobuf:"bytes,4,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"` - OperationId string `protobuf:"bytes,5,opt,name=operation_id,json=operationId,proto3" json:"operation_id,omitempty"` - Parameters []*ParameterOrReference `protobuf:"bytes,6,rep,name=parameters,proto3" json:"parameters,omitempty"` - RequestBody *RequestBodyOrReference `protobuf:"bytes,7,opt,name=request_body,json=requestBody,proto3" json:"request_body,omitempty"` - Responses *Responses `protobuf:"bytes,8,opt,name=responses,proto3" json:"responses,omitempty"` - Callbacks *CallbacksOrReferences `protobuf:"bytes,9,opt,name=callbacks,proto3" json:"callbacks,omitempty"` - Deprecated bool `protobuf:"varint,10,opt,name=deprecated,proto3" json:"deprecated,omitempty"` - Security []*SecurityRequirement `protobuf:"bytes,11,rep,name=security,proto3" json:"security,omitempty"` - Servers []*Server `protobuf:"bytes,12,rep,name=servers,proto3" json:"servers,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,13,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` -} - -func (x *Operation) Reset() { - *x = Operation{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[48] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Operation) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Operation) ProtoMessage() {} - -func (x *Operation) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[48] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Operation.ProtoReflect.Descriptor instead. -func (*Operation) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{48} -} - -func (x *Operation) GetTags() []string { - if x != nil { - return x.Tags - } - return nil -} - -func (x *Operation) GetSummary() string { - if x != nil { - return x.Summary - } - return "" -} - -func (x *Operation) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *Operation) GetExternalDocs() *ExternalDocs { - if x != nil { - return x.ExternalDocs - } - return nil -} - -func (x *Operation) GetOperationId() string { - if x != nil { - return x.OperationId - } - return "" -} - -func (x *Operation) GetParameters() []*ParameterOrReference { - if x != nil { - return x.Parameters - } - return nil -} - -func (x *Operation) GetRequestBody() *RequestBodyOrReference { - if x != nil { - return x.RequestBody - } - return nil -} - -func (x *Operation) GetResponses() *Responses { - if x != nil { - return x.Responses - } - return nil -} - -func (x *Operation) GetCallbacks() *CallbacksOrReferences { - if x != nil { - return x.Callbacks - } - return nil -} - -func (x *Operation) GetDeprecated() bool { - if x != nil { - return x.Deprecated - } - return false -} - -func (x *Operation) GetSecurity() []*SecurityRequirement { - if x != nil { - return x.Security - } - return nil -} - -func (x *Operation) GetServers() []*Server { - if x != nil { - return x.Servers - } - return nil -} - -func (x *Operation) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -// Describes a single operation parameter. A unique parameter is defined by a combination of a name and location. -type Parameter struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - In string `protobuf:"bytes,2,opt,name=in,proto3" json:"in,omitempty"` - Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` - Required bool `protobuf:"varint,4,opt,name=required,proto3" json:"required,omitempty"` - Deprecated bool `protobuf:"varint,5,opt,name=deprecated,proto3" json:"deprecated,omitempty"` - AllowEmptyValue bool `protobuf:"varint,6,opt,name=allow_empty_value,json=allowEmptyValue,proto3" json:"allow_empty_value,omitempty"` - Style string `protobuf:"bytes,7,opt,name=style,proto3" json:"style,omitempty"` - Explode bool `protobuf:"varint,8,opt,name=explode,proto3" json:"explode,omitempty"` - AllowReserved bool `protobuf:"varint,9,opt,name=allow_reserved,json=allowReserved,proto3" json:"allow_reserved,omitempty"` - Schema *SchemaOrReference `protobuf:"bytes,10,opt,name=schema,proto3" json:"schema,omitempty"` - Example *Any `protobuf:"bytes,11,opt,name=example,proto3" json:"example,omitempty"` - Examples *ExamplesOrReferences `protobuf:"bytes,12,opt,name=examples,proto3" json:"examples,omitempty"` - Content *MediaTypes `protobuf:"bytes,13,opt,name=content,proto3" json:"content,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,14,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` -} - -func (x *Parameter) Reset() { - *x = Parameter{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[49] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Parameter) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Parameter) ProtoMessage() {} - -func (x *Parameter) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[49] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Parameter.ProtoReflect.Descriptor instead. -func (*Parameter) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{49} -} - -func (x *Parameter) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Parameter) GetIn() string { - if x != nil { - return x.In - } - return "" -} - -func (x *Parameter) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *Parameter) GetRequired() bool { - if x != nil { - return x.Required - } - return false -} - -func (x *Parameter) GetDeprecated() bool { - if x != nil { - return x.Deprecated - } - return false -} - -func (x *Parameter) GetAllowEmptyValue() bool { - if x != nil { - return x.AllowEmptyValue - } - return false -} - -func (x *Parameter) GetStyle() string { - if x != nil { - return x.Style - } - return "" -} - -func (x *Parameter) GetExplode() bool { - if x != nil { - return x.Explode - } - return false -} - -func (x *Parameter) GetAllowReserved() bool { - if x != nil { - return x.AllowReserved - } - return false -} - -func (x *Parameter) GetSchema() *SchemaOrReference { - if x != nil { - return x.Schema - } - return nil -} - -func (x *Parameter) GetExample() *Any { - if x != nil { - return x.Example - } - return nil -} - -func (x *Parameter) GetExamples() *ExamplesOrReferences { - if x != nil { - return x.Examples - } - return nil -} - -func (x *Parameter) GetContent() *MediaTypes { - if x != nil { - return x.Content - } - return nil -} - -func (x *Parameter) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -type ParameterOrReference struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Oneof: - // *ParameterOrReference_Parameter - // *ParameterOrReference_Reference - Oneof isParameterOrReference_Oneof `protobuf_oneof:"oneof"` -} - -func (x *ParameterOrReference) Reset() { - *x = ParameterOrReference{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[50] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ParameterOrReference) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ParameterOrReference) ProtoMessage() {} - -func (x *ParameterOrReference) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[50] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ParameterOrReference.ProtoReflect.Descriptor instead. -func (*ParameterOrReference) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{50} -} - -func (m *ParameterOrReference) GetOneof() isParameterOrReference_Oneof { - if m != nil { - return m.Oneof - } - return nil -} - -func (x *ParameterOrReference) GetParameter() *Parameter { - if x, ok := x.GetOneof().(*ParameterOrReference_Parameter); ok { - return x.Parameter - } - return nil -} - -func (x *ParameterOrReference) GetReference() *Reference { - if x, ok := x.GetOneof().(*ParameterOrReference_Reference); ok { - return x.Reference - } - return nil -} - -type isParameterOrReference_Oneof interface { - isParameterOrReference_Oneof() -} - -type ParameterOrReference_Parameter struct { - Parameter *Parameter `protobuf:"bytes,1,opt,name=parameter,proto3,oneof"` -} - -type ParameterOrReference_Reference struct { - Reference *Reference `protobuf:"bytes,2,opt,name=reference,proto3,oneof"` -} - -func (*ParameterOrReference_Parameter) isParameterOrReference_Oneof() {} - -func (*ParameterOrReference_Reference) isParameterOrReference_Oneof() {} - -type ParametersOrReferences struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedParameterOrReference `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *ParametersOrReferences) Reset() { - *x = ParametersOrReferences{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[51] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ParametersOrReferences) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ParametersOrReferences) ProtoMessage() {} - -func (x *ParametersOrReferences) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[51] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ParametersOrReferences.ProtoReflect.Descriptor instead. -func (*ParametersOrReferences) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{51} -} - -func (x *ParametersOrReferences) GetAdditionalProperties() []*NamedParameterOrReference { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -// Describes the operations available on a single path. A Path Item MAY be empty, due to ACL constraints. The path itself is still exposed to the documentation viewer but they will not know which operations and parameters are available. -type PathItem struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - XRef string `protobuf:"bytes,1,opt,name=_ref,json=Ref,proto3" json:"_ref,omitempty"` - Summary string `protobuf:"bytes,2,opt,name=summary,proto3" json:"summary,omitempty"` - Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` - Get *Operation `protobuf:"bytes,4,opt,name=get,proto3" json:"get,omitempty"` - Put *Operation `protobuf:"bytes,5,opt,name=put,proto3" json:"put,omitempty"` - Post *Operation `protobuf:"bytes,6,opt,name=post,proto3" json:"post,omitempty"` - Delete *Operation `protobuf:"bytes,7,opt,name=delete,proto3" json:"delete,omitempty"` - Options *Operation `protobuf:"bytes,8,opt,name=options,proto3" json:"options,omitempty"` - Head *Operation `protobuf:"bytes,9,opt,name=head,proto3" json:"head,omitempty"` - Patch *Operation `protobuf:"bytes,10,opt,name=patch,proto3" json:"patch,omitempty"` - Trace *Operation `protobuf:"bytes,11,opt,name=trace,proto3" json:"trace,omitempty"` - Servers []*Server `protobuf:"bytes,12,rep,name=servers,proto3" json:"servers,omitempty"` - Parameters []*ParameterOrReference `protobuf:"bytes,13,rep,name=parameters,proto3" json:"parameters,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,14,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` -} - -func (x *PathItem) Reset() { - *x = PathItem{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[52] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PathItem) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PathItem) ProtoMessage() {} - -func (x *PathItem) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[52] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PathItem.ProtoReflect.Descriptor instead. -func (*PathItem) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{52} -} - -func (x *PathItem) GetXRef() string { - if x != nil { - return x.XRef - } - return "" -} - -func (x *PathItem) GetSummary() string { - if x != nil { - return x.Summary - } - return "" -} - -func (x *PathItem) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *PathItem) GetGet() *Operation { - if x != nil { - return x.Get - } - return nil -} - -func (x *PathItem) GetPut() *Operation { - if x != nil { - return x.Put - } - return nil -} - -func (x *PathItem) GetPost() *Operation { - if x != nil { - return x.Post - } - return nil -} - -func (x *PathItem) GetDelete() *Operation { - if x != nil { - return x.Delete - } - return nil -} - -func (x *PathItem) GetOptions() *Operation { - if x != nil { - return x.Options - } - return nil -} - -func (x *PathItem) GetHead() *Operation { - if x != nil { - return x.Head - } - return nil -} - -func (x *PathItem) GetPatch() *Operation { - if x != nil { - return x.Patch - } - return nil -} - -func (x *PathItem) GetTrace() *Operation { - if x != nil { - return x.Trace - } - return nil -} - -func (x *PathItem) GetServers() []*Server { - if x != nil { - return x.Servers - } - return nil -} - -func (x *PathItem) GetParameters() []*ParameterOrReference { - if x != nil { - return x.Parameters - } - return nil -} - -func (x *PathItem) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -// Holds the relative paths to the individual endpoints and their operations. The path is appended to the URL from the `Server Object` in order to construct the full URL. The Paths MAY be empty, due to ACL constraints. -type Paths struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Path []*NamedPathItem `protobuf:"bytes,1,rep,name=path,proto3" json:"path,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,2,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` -} - -func (x *Paths) Reset() { - *x = Paths{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[53] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Paths) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Paths) ProtoMessage() {} - -func (x *Paths) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[53] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Paths.ProtoReflect.Descriptor instead. -func (*Paths) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{53} -} - -func (x *Paths) GetPath() []*NamedPathItem { - if x != nil { - return x.Path - } - return nil -} - -func (x *Paths) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -type Properties struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedSchemaOrReference `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *Properties) Reset() { - *x = Properties{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[54] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Properties) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Properties) ProtoMessage() {} - -func (x *Properties) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[54] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Properties.ProtoReflect.Descriptor instead. -func (*Properties) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{54} -} - -func (x *Properties) GetAdditionalProperties() []*NamedSchemaOrReference { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -// A simple object to allow referencing other components in the specification, internally and externally. The Reference Object is defined by JSON Reference and follows the same structure, behavior and rules. For this specification, reference resolution is accomplished as defined by the JSON Reference specification and not by the JSON Schema specification. -type Reference struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - XRef string `protobuf:"bytes,1,opt,name=_ref,json=Ref,proto3" json:"_ref,omitempty"` - Summary string `protobuf:"bytes,2,opt,name=summary,proto3" json:"summary,omitempty"` - Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` -} - -func (x *Reference) Reset() { - *x = Reference{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[55] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Reference) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Reference) ProtoMessage() {} - -func (x *Reference) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[55] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Reference.ProtoReflect.Descriptor instead. -func (*Reference) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{55} -} - -func (x *Reference) GetXRef() string { - if x != nil { - return x.XRef - } - return "" -} - -func (x *Reference) GetSummary() string { - if x != nil { - return x.Summary - } - return "" -} - -func (x *Reference) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -type RequestBodiesOrReferences struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedRequestBodyOrReference `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *RequestBodiesOrReferences) Reset() { - *x = RequestBodiesOrReferences{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[56] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RequestBodiesOrReferences) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RequestBodiesOrReferences) ProtoMessage() {} - -func (x *RequestBodiesOrReferences) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[56] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RequestBodiesOrReferences.ProtoReflect.Descriptor instead. -func (*RequestBodiesOrReferences) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{56} -} - -func (x *RequestBodiesOrReferences) GetAdditionalProperties() []*NamedRequestBodyOrReference { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -// Describes a single request body. -type RequestBody struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"` - Content *MediaTypes `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"` - Required bool `protobuf:"varint,3,opt,name=required,proto3" json:"required,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,4,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` -} - -func (x *RequestBody) Reset() { - *x = RequestBody{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[57] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RequestBody) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RequestBody) ProtoMessage() {} - -func (x *RequestBody) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[57] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RequestBody.ProtoReflect.Descriptor instead. -func (*RequestBody) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{57} -} - -func (x *RequestBody) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *RequestBody) GetContent() *MediaTypes { - if x != nil { - return x.Content - } - return nil -} - -func (x *RequestBody) GetRequired() bool { - if x != nil { - return x.Required - } - return false -} - -func (x *RequestBody) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -type RequestBodyOrReference struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Oneof: - // *RequestBodyOrReference_RequestBody - // *RequestBodyOrReference_Reference - Oneof isRequestBodyOrReference_Oneof `protobuf_oneof:"oneof"` -} - -func (x *RequestBodyOrReference) Reset() { - *x = RequestBodyOrReference{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[58] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RequestBodyOrReference) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RequestBodyOrReference) ProtoMessage() {} - -func (x *RequestBodyOrReference) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[58] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RequestBodyOrReference.ProtoReflect.Descriptor instead. -func (*RequestBodyOrReference) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{58} -} - -func (m *RequestBodyOrReference) GetOneof() isRequestBodyOrReference_Oneof { - if m != nil { - return m.Oneof - } - return nil -} - -func (x *RequestBodyOrReference) GetRequestBody() *RequestBody { - if x, ok := x.GetOneof().(*RequestBodyOrReference_RequestBody); ok { - return x.RequestBody - } - return nil -} - -func (x *RequestBodyOrReference) GetReference() *Reference { - if x, ok := x.GetOneof().(*RequestBodyOrReference_Reference); ok { - return x.Reference - } - return nil -} - -type isRequestBodyOrReference_Oneof interface { - isRequestBodyOrReference_Oneof() -} - -type RequestBodyOrReference_RequestBody struct { - RequestBody *RequestBody `protobuf:"bytes,1,opt,name=request_body,json=requestBody,proto3,oneof"` -} - -type RequestBodyOrReference_Reference struct { - Reference *Reference `protobuf:"bytes,2,opt,name=reference,proto3,oneof"` -} - -func (*RequestBodyOrReference_RequestBody) isRequestBodyOrReference_Oneof() {} - -func (*RequestBodyOrReference_Reference) isRequestBodyOrReference_Oneof() {} - -// Describes a single response from an API Operation, including design-time, static `links` to operations based on the response. -type Response struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"` - Headers *HeadersOrReferences `protobuf:"bytes,2,opt,name=headers,proto3" json:"headers,omitempty"` - Content *MediaTypes `protobuf:"bytes,3,opt,name=content,proto3" json:"content,omitempty"` - Links *LinksOrReferences `protobuf:"bytes,4,opt,name=links,proto3" json:"links,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,5,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` -} - -func (x *Response) Reset() { - *x = Response{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[59] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Response) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Response) ProtoMessage() {} - -func (x *Response) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[59] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Response.ProtoReflect.Descriptor instead. -func (*Response) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{59} -} - -func (x *Response) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *Response) GetHeaders() *HeadersOrReferences { - if x != nil { - return x.Headers - } - return nil -} - -func (x *Response) GetContent() *MediaTypes { - if x != nil { - return x.Content - } - return nil -} - -func (x *Response) GetLinks() *LinksOrReferences { - if x != nil { - return x.Links - } - return nil -} - -func (x *Response) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -type ResponseOrReference struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Oneof: - // *ResponseOrReference_Response - // *ResponseOrReference_Reference - Oneof isResponseOrReference_Oneof `protobuf_oneof:"oneof"` -} - -func (x *ResponseOrReference) Reset() { - *x = ResponseOrReference{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[60] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ResponseOrReference) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ResponseOrReference) ProtoMessage() {} - -func (x *ResponseOrReference) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[60] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ResponseOrReference.ProtoReflect.Descriptor instead. -func (*ResponseOrReference) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{60} -} - -func (m *ResponseOrReference) GetOneof() isResponseOrReference_Oneof { - if m != nil { - return m.Oneof - } - return nil -} - -func (x *ResponseOrReference) GetResponse() *Response { - if x, ok := x.GetOneof().(*ResponseOrReference_Response); ok { - return x.Response - } - return nil -} - -func (x *ResponseOrReference) GetReference() *Reference { - if x, ok := x.GetOneof().(*ResponseOrReference_Reference); ok { - return x.Reference - } - return nil -} - -type isResponseOrReference_Oneof interface { - isResponseOrReference_Oneof() -} - -type ResponseOrReference_Response struct { - Response *Response `protobuf:"bytes,1,opt,name=response,proto3,oneof"` -} - -type ResponseOrReference_Reference struct { - Reference *Reference `protobuf:"bytes,2,opt,name=reference,proto3,oneof"` -} - -func (*ResponseOrReference_Response) isResponseOrReference_Oneof() {} - -func (*ResponseOrReference_Reference) isResponseOrReference_Oneof() {} - -// A container for the expected responses of an operation. The container maps a HTTP response code to the expected response. The documentation is not necessarily expected to cover all possible HTTP response codes because they may not be known in advance. However, documentation is expected to cover a successful operation response and any known errors. The `default` MAY be used as a default response object for all HTTP codes that are not covered individually by the specification. The `Responses Object` MUST contain at least one response code, and it SHOULD be the response for a successful operation call. -type Responses struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Default *ResponseOrReference `protobuf:"bytes,1,opt,name=default,proto3" json:"default,omitempty"` - ResponseOrReference []*NamedResponseOrReference `protobuf:"bytes,2,rep,name=response_or_reference,json=responseOrReference,proto3" json:"response_or_reference,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,3,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` -} - -func (x *Responses) Reset() { - *x = Responses{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[61] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Responses) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Responses) ProtoMessage() {} - -func (x *Responses) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[61] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Responses.ProtoReflect.Descriptor instead. -func (*Responses) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{61} -} - -func (x *Responses) GetDefault() *ResponseOrReference { - if x != nil { - return x.Default - } - return nil -} - -func (x *Responses) GetResponseOrReference() []*NamedResponseOrReference { - if x != nil { - return x.ResponseOrReference - } - return nil -} - -func (x *Responses) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -type ResponsesOrReferences struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedResponseOrReference `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *ResponsesOrReferences) Reset() { - *x = ResponsesOrReferences{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[62] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ResponsesOrReferences) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ResponsesOrReferences) ProtoMessage() {} - -func (x *ResponsesOrReferences) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[62] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ResponsesOrReferences.ProtoReflect.Descriptor instead. -func (*ResponsesOrReferences) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{62} -} - -func (x *ResponsesOrReferences) GetAdditionalProperties() []*NamedResponseOrReference { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -// The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is an extended subset of the JSON Schema Specification Wright Draft 00. For more information about the properties, see JSON Schema Core and JSON Schema Validation. Unless stated otherwise, the property definitions follow the JSON Schema. -type Schema struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Nullable bool `protobuf:"varint,1,opt,name=nullable,proto3" json:"nullable,omitempty"` - Discriminator *Discriminator `protobuf:"bytes,2,opt,name=discriminator,proto3" json:"discriminator,omitempty"` - ReadOnly bool `protobuf:"varint,3,opt,name=read_only,json=readOnly,proto3" json:"read_only,omitempty"` - WriteOnly bool `protobuf:"varint,4,opt,name=write_only,json=writeOnly,proto3" json:"write_only,omitempty"` - Xml *Xml `protobuf:"bytes,5,opt,name=xml,proto3" json:"xml,omitempty"` - ExternalDocs *ExternalDocs `protobuf:"bytes,6,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"` - Example *Any `protobuf:"bytes,7,opt,name=example,proto3" json:"example,omitempty"` - Deprecated bool `protobuf:"varint,8,opt,name=deprecated,proto3" json:"deprecated,omitempty"` - Title string `protobuf:"bytes,9,opt,name=title,proto3" json:"title,omitempty"` - MultipleOf float64 `protobuf:"fixed64,10,opt,name=multiple_of,json=multipleOf,proto3" json:"multiple_of,omitempty"` - Maximum float64 `protobuf:"fixed64,11,opt,name=maximum,proto3" json:"maximum,omitempty"` - ExclusiveMaximum bool `protobuf:"varint,12,opt,name=exclusive_maximum,json=exclusiveMaximum,proto3" json:"exclusive_maximum,omitempty"` - Minimum float64 `protobuf:"fixed64,13,opt,name=minimum,proto3" json:"minimum,omitempty"` - ExclusiveMinimum bool `protobuf:"varint,14,opt,name=exclusive_minimum,json=exclusiveMinimum,proto3" json:"exclusive_minimum,omitempty"` - MaxLength int64 `protobuf:"varint,15,opt,name=max_length,json=maxLength,proto3" json:"max_length,omitempty"` - MinLength int64 `protobuf:"varint,16,opt,name=min_length,json=minLength,proto3" json:"min_length,omitempty"` - Pattern string `protobuf:"bytes,17,opt,name=pattern,proto3" json:"pattern,omitempty"` - MaxItems int64 `protobuf:"varint,18,opt,name=max_items,json=maxItems,proto3" json:"max_items,omitempty"` - MinItems int64 `protobuf:"varint,19,opt,name=min_items,json=minItems,proto3" json:"min_items,omitempty"` - UniqueItems bool `protobuf:"varint,20,opt,name=unique_items,json=uniqueItems,proto3" json:"unique_items,omitempty"` - MaxProperties int64 `protobuf:"varint,21,opt,name=max_properties,json=maxProperties,proto3" json:"max_properties,omitempty"` - MinProperties int64 `protobuf:"varint,22,opt,name=min_properties,json=minProperties,proto3" json:"min_properties,omitempty"` - Required []string `protobuf:"bytes,23,rep,name=required,proto3" json:"required,omitempty"` - Enum []*Any `protobuf:"bytes,24,rep,name=enum,proto3" json:"enum,omitempty"` - Type string `protobuf:"bytes,25,opt,name=type,proto3" json:"type,omitempty"` - AllOf []*SchemaOrReference `protobuf:"bytes,26,rep,name=all_of,json=allOf,proto3" json:"all_of,omitempty"` - OneOf []*SchemaOrReference `protobuf:"bytes,27,rep,name=one_of,json=oneOf,proto3" json:"one_of,omitempty"` - AnyOf []*SchemaOrReference `protobuf:"bytes,28,rep,name=any_of,json=anyOf,proto3" json:"any_of,omitempty"` - Not *Schema `protobuf:"bytes,29,opt,name=not,proto3" json:"not,omitempty"` - Items *ItemsItem `protobuf:"bytes,30,opt,name=items,proto3" json:"items,omitempty"` - Properties *Properties `protobuf:"bytes,31,opt,name=properties,proto3" json:"properties,omitempty"` - AdditionalProperties *AdditionalPropertiesItem `protobuf:"bytes,32,opt,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` - Default *DefaultType `protobuf:"bytes,33,opt,name=default,proto3" json:"default,omitempty"` - Description string `protobuf:"bytes,34,opt,name=description,proto3" json:"description,omitempty"` - Format string `protobuf:"bytes,35,opt,name=format,proto3" json:"format,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,36,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` -} - -func (x *Schema) Reset() { - *x = Schema{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[63] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Schema) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Schema) ProtoMessage() {} - -func (x *Schema) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[63] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Schema.ProtoReflect.Descriptor instead. -func (*Schema) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{63} -} - -func (x *Schema) GetNullable() bool { - if x != nil { - return x.Nullable - } - return false -} - -func (x *Schema) GetDiscriminator() *Discriminator { - if x != nil { - return x.Discriminator - } - return nil -} - -func (x *Schema) GetReadOnly() bool { - if x != nil { - return x.ReadOnly - } - return false -} - -func (x *Schema) GetWriteOnly() bool { - if x != nil { - return x.WriteOnly - } - return false -} - -func (x *Schema) GetXml() *Xml { - if x != nil { - return x.Xml - } - return nil -} - -func (x *Schema) GetExternalDocs() *ExternalDocs { - if x != nil { - return x.ExternalDocs - } - return nil -} - -func (x *Schema) GetExample() *Any { - if x != nil { - return x.Example - } - return nil -} - -func (x *Schema) GetDeprecated() bool { - if x != nil { - return x.Deprecated - } - return false -} - -func (x *Schema) GetTitle() string { - if x != nil { - return x.Title - } - return "" -} - -func (x *Schema) GetMultipleOf() float64 { - if x != nil { - return x.MultipleOf - } - return 0 -} - -func (x *Schema) GetMaximum() float64 { - if x != nil { - return x.Maximum - } - return 0 -} - -func (x *Schema) GetExclusiveMaximum() bool { - if x != nil { - return x.ExclusiveMaximum - } - return false -} - -func (x *Schema) GetMinimum() float64 { - if x != nil { - return x.Minimum - } - return 0 -} - -func (x *Schema) GetExclusiveMinimum() bool { - if x != nil { - return x.ExclusiveMinimum - } - return false -} - -func (x *Schema) GetMaxLength() int64 { - if x != nil { - return x.MaxLength - } - return 0 -} - -func (x *Schema) GetMinLength() int64 { - if x != nil { - return x.MinLength - } - return 0 -} - -func (x *Schema) GetPattern() string { - if x != nil { - return x.Pattern - } - return "" -} - -func (x *Schema) GetMaxItems() int64 { - if x != nil { - return x.MaxItems - } - return 0 -} - -func (x *Schema) GetMinItems() int64 { - if x != nil { - return x.MinItems - } - return 0 -} - -func (x *Schema) GetUniqueItems() bool { - if x != nil { - return x.UniqueItems - } - return false -} - -func (x *Schema) GetMaxProperties() int64 { - if x != nil { - return x.MaxProperties - } - return 0 -} - -func (x *Schema) GetMinProperties() int64 { - if x != nil { - return x.MinProperties - } - return 0 -} - -func (x *Schema) GetRequired() []string { - if x != nil { - return x.Required - } - return nil -} - -func (x *Schema) GetEnum() []*Any { - if x != nil { - return x.Enum - } - return nil -} - -func (x *Schema) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -func (x *Schema) GetAllOf() []*SchemaOrReference { - if x != nil { - return x.AllOf - } - return nil -} - -func (x *Schema) GetOneOf() []*SchemaOrReference { - if x != nil { - return x.OneOf - } - return nil -} - -func (x *Schema) GetAnyOf() []*SchemaOrReference { - if x != nil { - return x.AnyOf - } - return nil -} - -func (x *Schema) GetNot() *Schema { - if x != nil { - return x.Not - } - return nil -} - -func (x *Schema) GetItems() *ItemsItem { - if x != nil { - return x.Items - } - return nil -} - -func (x *Schema) GetProperties() *Properties { - if x != nil { - return x.Properties - } - return nil -} - -func (x *Schema) GetAdditionalProperties() *AdditionalPropertiesItem { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -func (x *Schema) GetDefault() *DefaultType { - if x != nil { - return x.Default - } - return nil -} - -func (x *Schema) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *Schema) GetFormat() string { - if x != nil { - return x.Format - } - return "" -} - -func (x *Schema) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -type SchemaOrReference struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Oneof: - // *SchemaOrReference_Schema - // *SchemaOrReference_Reference - Oneof isSchemaOrReference_Oneof `protobuf_oneof:"oneof"` -} - -func (x *SchemaOrReference) Reset() { - *x = SchemaOrReference{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[64] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SchemaOrReference) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SchemaOrReference) ProtoMessage() {} - -func (x *SchemaOrReference) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[64] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SchemaOrReference.ProtoReflect.Descriptor instead. -func (*SchemaOrReference) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{64} -} - -func (m *SchemaOrReference) GetOneof() isSchemaOrReference_Oneof { - if m != nil { - return m.Oneof - } - return nil -} - -func (x *SchemaOrReference) GetSchema() *Schema { - if x, ok := x.GetOneof().(*SchemaOrReference_Schema); ok { - return x.Schema - } - return nil -} - -func (x *SchemaOrReference) GetReference() *Reference { - if x, ok := x.GetOneof().(*SchemaOrReference_Reference); ok { - return x.Reference - } - return nil -} - -type isSchemaOrReference_Oneof interface { - isSchemaOrReference_Oneof() -} - -type SchemaOrReference_Schema struct { - Schema *Schema `protobuf:"bytes,1,opt,name=schema,proto3,oneof"` -} - -type SchemaOrReference_Reference struct { - Reference *Reference `protobuf:"bytes,2,opt,name=reference,proto3,oneof"` -} - -func (*SchemaOrReference_Schema) isSchemaOrReference_Oneof() {} - -func (*SchemaOrReference_Reference) isSchemaOrReference_Oneof() {} - -type SchemasOrReferences struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedSchemaOrReference `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *SchemasOrReferences) Reset() { - *x = SchemasOrReferences{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[65] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SchemasOrReferences) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SchemasOrReferences) ProtoMessage() {} - -func (x *SchemasOrReferences) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[65] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SchemasOrReferences.ProtoReflect.Descriptor instead. -func (*SchemasOrReferences) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{65} -} - -func (x *SchemasOrReferences) GetAdditionalProperties() []*NamedSchemaOrReference { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -// Lists the required security schemes to execute this operation. The name used for each property MUST correspond to a security scheme declared in the Security Schemes under the Components Object. Security Requirement Objects that contain multiple schemes require that all schemes MUST be satisfied for a request to be authorized. This enables support for scenarios where multiple query parameters or HTTP headers are required to convey security information. When a list of Security Requirement Objects is defined on the OpenAPI Object or Operation Object, only one of the Security Requirement Objects in the list needs to be satisfied to authorize the request. -type SecurityRequirement struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedStringArray `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *SecurityRequirement) Reset() { - *x = SecurityRequirement{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[66] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SecurityRequirement) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SecurityRequirement) ProtoMessage() {} - -func (x *SecurityRequirement) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[66] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SecurityRequirement.ProtoReflect.Descriptor instead. -func (*SecurityRequirement) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{66} -} - -func (x *SecurityRequirement) GetAdditionalProperties() []*NamedStringArray { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -// Defines a security scheme that can be used by the operations. Supported schemes are HTTP authentication, an API key (either as a header, a cookie parameter or as a query parameter), mutual TLS (use of a client certificate), OAuth2's common flows (implicit, password, application and access code) as defined in RFC6749, and OpenID Connect. Please note that currently (2019) the implicit flow is about to be deprecated OAuth 2.0 Security Best Current Practice. Recommended for most use case is Authorization Code Grant flow with PKCE. -type SecurityScheme struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` - In string `protobuf:"bytes,4,opt,name=in,proto3" json:"in,omitempty"` - Scheme string `protobuf:"bytes,5,opt,name=scheme,proto3" json:"scheme,omitempty"` - BearerFormat string `protobuf:"bytes,6,opt,name=bearer_format,json=bearerFormat,proto3" json:"bearer_format,omitempty"` - Flows *OauthFlows `protobuf:"bytes,7,opt,name=flows,proto3" json:"flows,omitempty"` - OpenIdConnectUrl string `protobuf:"bytes,8,opt,name=open_id_connect_url,json=openIdConnectUrl,proto3" json:"open_id_connect_url,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,9,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` -} - -func (x *SecurityScheme) Reset() { - *x = SecurityScheme{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[67] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SecurityScheme) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SecurityScheme) ProtoMessage() {} - -func (x *SecurityScheme) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[67] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SecurityScheme.ProtoReflect.Descriptor instead. -func (*SecurityScheme) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{67} -} - -func (x *SecurityScheme) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -func (x *SecurityScheme) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *SecurityScheme) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *SecurityScheme) GetIn() string { - if x != nil { - return x.In - } - return "" -} - -func (x *SecurityScheme) GetScheme() string { - if x != nil { - return x.Scheme - } - return "" -} - -func (x *SecurityScheme) GetBearerFormat() string { - if x != nil { - return x.BearerFormat - } - return "" -} - -func (x *SecurityScheme) GetFlows() *OauthFlows { - if x != nil { - return x.Flows - } - return nil -} - -func (x *SecurityScheme) GetOpenIdConnectUrl() string { - if x != nil { - return x.OpenIdConnectUrl - } - return "" -} - -func (x *SecurityScheme) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -type SecuritySchemeOrReference struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Oneof: - // *SecuritySchemeOrReference_SecurityScheme - // *SecuritySchemeOrReference_Reference - Oneof isSecuritySchemeOrReference_Oneof `protobuf_oneof:"oneof"` -} - -func (x *SecuritySchemeOrReference) Reset() { - *x = SecuritySchemeOrReference{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[68] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SecuritySchemeOrReference) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SecuritySchemeOrReference) ProtoMessage() {} - -func (x *SecuritySchemeOrReference) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[68] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SecuritySchemeOrReference.ProtoReflect.Descriptor instead. -func (*SecuritySchemeOrReference) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{68} -} - -func (m *SecuritySchemeOrReference) GetOneof() isSecuritySchemeOrReference_Oneof { - if m != nil { - return m.Oneof - } - return nil -} - -func (x *SecuritySchemeOrReference) GetSecurityScheme() *SecurityScheme { - if x, ok := x.GetOneof().(*SecuritySchemeOrReference_SecurityScheme); ok { - return x.SecurityScheme - } - return nil -} - -func (x *SecuritySchemeOrReference) GetReference() *Reference { - if x, ok := x.GetOneof().(*SecuritySchemeOrReference_Reference); ok { - return x.Reference - } - return nil -} - -type isSecuritySchemeOrReference_Oneof interface { - isSecuritySchemeOrReference_Oneof() -} - -type SecuritySchemeOrReference_SecurityScheme struct { - SecurityScheme *SecurityScheme `protobuf:"bytes,1,opt,name=security_scheme,json=securityScheme,proto3,oneof"` -} - -type SecuritySchemeOrReference_Reference struct { - Reference *Reference `protobuf:"bytes,2,opt,name=reference,proto3,oneof"` -} - -func (*SecuritySchemeOrReference_SecurityScheme) isSecuritySchemeOrReference_Oneof() {} - -func (*SecuritySchemeOrReference_Reference) isSecuritySchemeOrReference_Oneof() {} - -type SecuritySchemesOrReferences struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedSecuritySchemeOrReference `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *SecuritySchemesOrReferences) Reset() { - *x = SecuritySchemesOrReferences{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[69] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SecuritySchemesOrReferences) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SecuritySchemesOrReferences) ProtoMessage() {} - -func (x *SecuritySchemesOrReferences) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[69] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SecuritySchemesOrReferences.ProtoReflect.Descriptor instead. -func (*SecuritySchemesOrReferences) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{69} -} - -func (x *SecuritySchemesOrReferences) GetAdditionalProperties() []*NamedSecuritySchemeOrReference { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -// An object representing a Server. -type Server struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - Variables *ServerVariables `protobuf:"bytes,3,opt,name=variables,proto3" json:"variables,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,4,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` -} - -func (x *Server) Reset() { - *x = Server{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[70] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Server) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Server) ProtoMessage() {} - -func (x *Server) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[70] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Server.ProtoReflect.Descriptor instead. -func (*Server) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{70} -} - -func (x *Server) GetUrl() string { - if x != nil { - return x.Url - } - return "" -} - -func (x *Server) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *Server) GetVariables() *ServerVariables { - if x != nil { - return x.Variables - } - return nil -} - -func (x *Server) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -// An object representing a Server Variable for server URL template substitution. -type ServerVariable struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Enum []string `protobuf:"bytes,1,rep,name=enum,proto3" json:"enum,omitempty"` - Default string `protobuf:"bytes,2,opt,name=default,proto3" json:"default,omitempty"` - Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,4,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` -} - -func (x *ServerVariable) Reset() { - *x = ServerVariable{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[71] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ServerVariable) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ServerVariable) ProtoMessage() {} - -func (x *ServerVariable) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[71] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ServerVariable.ProtoReflect.Descriptor instead. -func (*ServerVariable) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{71} -} - -func (x *ServerVariable) GetEnum() []string { - if x != nil { - return x.Enum - } - return nil -} - -func (x *ServerVariable) GetDefault() string { - if x != nil { - return x.Default - } - return "" -} - -func (x *ServerVariable) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *ServerVariable) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -type ServerVariables struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedServerVariable `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *ServerVariables) Reset() { - *x = ServerVariables{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[72] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ServerVariables) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ServerVariables) ProtoMessage() {} - -func (x *ServerVariables) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[72] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ServerVariables.ProtoReflect.Descriptor instead. -func (*ServerVariables) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{72} -} - -func (x *ServerVariables) GetAdditionalProperties() []*NamedServerVariable { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -// Any property starting with x- is valid. -type SpecificationExtension struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Oneof: - // *SpecificationExtension_Number - // *SpecificationExtension_Boolean - // *SpecificationExtension_String_ - Oneof isSpecificationExtension_Oneof `protobuf_oneof:"oneof"` -} - -func (x *SpecificationExtension) Reset() { - *x = SpecificationExtension{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[73] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SpecificationExtension) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SpecificationExtension) ProtoMessage() {} - -func (x *SpecificationExtension) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[73] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SpecificationExtension.ProtoReflect.Descriptor instead. -func (*SpecificationExtension) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{73} -} - -func (m *SpecificationExtension) GetOneof() isSpecificationExtension_Oneof { - if m != nil { - return m.Oneof - } - return nil -} - -func (x *SpecificationExtension) GetNumber() float64 { - if x, ok := x.GetOneof().(*SpecificationExtension_Number); ok { - return x.Number - } - return 0 -} - -func (x *SpecificationExtension) GetBoolean() bool { - if x, ok := x.GetOneof().(*SpecificationExtension_Boolean); ok { - return x.Boolean - } - return false -} - -func (x *SpecificationExtension) GetString_() string { - if x, ok := x.GetOneof().(*SpecificationExtension_String_); ok { - return x.String_ - } - return "" -} - -type isSpecificationExtension_Oneof interface { - isSpecificationExtension_Oneof() -} - -type SpecificationExtension_Number struct { - Number float64 `protobuf:"fixed64,1,opt,name=number,proto3,oneof"` -} - -type SpecificationExtension_Boolean struct { - Boolean bool `protobuf:"varint,2,opt,name=boolean,proto3,oneof"` -} - -type SpecificationExtension_String_ struct { - String_ string `protobuf:"bytes,3,opt,name=string,proto3,oneof"` -} - -func (*SpecificationExtension_Number) isSpecificationExtension_Oneof() {} - -func (*SpecificationExtension_Boolean) isSpecificationExtension_Oneof() {} - -func (*SpecificationExtension_String_) isSpecificationExtension_Oneof() {} - -type StringArray struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Value []string `protobuf:"bytes,1,rep,name=value,proto3" json:"value,omitempty"` -} - -func (x *StringArray) Reset() { - *x = StringArray{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[74] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *StringArray) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*StringArray) ProtoMessage() {} - -func (x *StringArray) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[74] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use StringArray.ProtoReflect.Descriptor instead. -func (*StringArray) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{74} -} - -func (x *StringArray) GetValue() []string { - if x != nil { - return x.Value - } - return nil -} - -type Strings struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AdditionalProperties []*NamedString `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"` -} - -func (x *Strings) Reset() { - *x = Strings{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[75] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Strings) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Strings) ProtoMessage() {} - -func (x *Strings) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[75] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Strings.ProtoReflect.Descriptor instead. -func (*Strings) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{75} -} - -func (x *Strings) GetAdditionalProperties() []*NamedString { - if x != nil { - return x.AdditionalProperties - } - return nil -} - -// Adds metadata to a single tag that is used by the Operation Object. It is not mandatory to have a Tag Object per tag defined in the Operation Object instances. -type Tag struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - ExternalDocs *ExternalDocs `protobuf:"bytes,3,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,4,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` -} - -func (x *Tag) Reset() { - *x = Tag{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[76] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Tag) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Tag) ProtoMessage() {} - -func (x *Tag) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[76] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Tag.ProtoReflect.Descriptor instead. -func (*Tag) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{76} -} - -func (x *Tag) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Tag) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *Tag) GetExternalDocs() *ExternalDocs { - if x != nil { - return x.ExternalDocs - } - return nil -} - -func (x *Tag) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -// A metadata object that allows for more fine-tuned XML model definitions. When using arrays, XML element names are *not* inferred (for singular/plural forms) and the `name` property SHOULD be used to add that information. See examples for expected behavior. -type Xml struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Namespace string `protobuf:"bytes,2,opt,name=namespace,proto3" json:"namespace,omitempty"` - Prefix string `protobuf:"bytes,3,opt,name=prefix,proto3" json:"prefix,omitempty"` - Attribute bool `protobuf:"varint,4,opt,name=attribute,proto3" json:"attribute,omitempty"` - Wrapped bool `protobuf:"varint,5,opt,name=wrapped,proto3" json:"wrapped,omitempty"` - SpecificationExtension []*NamedAny `protobuf:"bytes,6,rep,name=specification_extension,json=specificationExtension,proto3" json:"specification_extension,omitempty"` -} - -func (x *Xml) Reset() { - *x = Xml{} - if protoimpl.UnsafeEnabled { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[77] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Xml) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Xml) ProtoMessage() {} - -func (x *Xml) ProtoReflect() protoreflect.Message { - mi := &file_openapiv3_OpenAPIv3_proto_msgTypes[77] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Xml.ProtoReflect.Descriptor instead. -func (*Xml) Descriptor() ([]byte, []int) { - return file_openapiv3_OpenAPIv3_proto_rawDescGZIP(), []int{77} -} - -func (x *Xml) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Xml) GetNamespace() string { - if x != nil { - return x.Namespace - } - return "" -} - -func (x *Xml) GetPrefix() string { - if x != nil { - return x.Prefix - } - return "" -} - -func (x *Xml) GetAttribute() bool { - if x != nil { - return x.Attribute - } - return false -} - -func (x *Xml) GetWrapped() bool { - if x != nil { - return x.Wrapped - } - return false -} - -func (x *Xml) GetSpecificationExtension() []*NamedAny { - if x != nil { - return x.SpecificationExtension - } - return nil -} - -var File_openapiv3_OpenAPIv3_proto protoreflect.FileDescriptor - -var file_openapiv3_OpenAPIv3_proto_rawDesc = []byte{ - 0x0a, 0x19, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x33, 0x2f, 0x4f, 0x70, 0x65, 0x6e, - 0x41, 0x50, 0x49, 0x76, 0x33, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x6f, 0x70, 0x65, - 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x22, 0x90, 0x01, 0x0a, 0x18, 0x41, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, - 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x12, - 0x4f, 0x0a, 0x13, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x5f, 0x6f, 0x72, 0x5f, 0x72, 0x65, 0x66, - 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6f, - 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, - 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x48, 0x00, 0x52, 0x11, 0x73, - 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, - 0x12, 0x1a, 0x0a, 0x07, 0x62, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x08, 0x48, 0x00, 0x52, 0x07, 0x62, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x42, 0x07, 0x0a, 0x05, - 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x45, 0x0a, 0x03, 0x41, 0x6e, 0x79, 0x12, 0x2a, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, - 0x79, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x79, 0x61, 0x6d, 0x6c, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x79, 0x61, 0x6d, 0x6c, 0x22, 0x79, 0x0a, 0x0f, - 0x41, 0x6e, 0x79, 0x4f, 0x72, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, - 0x23, 0x0a, 0x03, 0x61, 0x6e, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, - 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x41, 0x6e, 0x79, 0x48, 0x00, 0x52, - 0x03, 0x61, 0x6e, 0x79, 0x12, 0x38, 0x0a, 0x0a, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, - 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, - 0x48, 0x00, 0x52, 0x0a, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x42, 0x07, - 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x88, 0x01, 0x0a, 0x08, 0x43, 0x61, 0x6c, 0x6c, - 0x62, 0x61, 0x63, 0x6b, 0x12, 0x2d, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, - 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x50, 0x61, 0x74, 0x68, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x04, 0x70, - 0x61, 0x74, 0x68, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70, 0x65, 0x63, - 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, - 0x6f, 0x6e, 0x22, 0x89, 0x01, 0x0a, 0x13, 0x43, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x4f, - 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x32, 0x0a, 0x08, 0x63, 0x61, - 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, - 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x62, 0x61, - 0x63, 0x6b, 0x48, 0x00, 0x52, 0x08, 0x63, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x12, 0x35, - 0x0a, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x52, - 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x48, 0x00, 0x52, 0x09, 0x72, 0x65, 0x66, 0x65, - 0x72, 0x65, 0x6e, 0x63, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x72, - 0x0a, 0x15, 0x43, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, - 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x59, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, - 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x43, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, - 0x6b, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x14, 0x61, 0x64, - 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, - 0x65, 0x73, 0x22, 0xac, 0x05, 0x0a, 0x0a, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, - 0x73, 0x12, 0x39, 0x0a, 0x07, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, - 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, - 0x63, 0x65, 0x73, 0x52, 0x07, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x12, 0x3f, 0x0a, 0x09, - 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x21, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, - 0x65, 0x73, 0x52, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x12, 0x42, 0x0a, - 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x50, - 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, - 0x65, 0x6e, 0x63, 0x65, 0x73, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, - 0x73, 0x12, 0x3c, 0x0a, 0x08, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, - 0x2e, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, - 0x65, 0x6e, 0x63, 0x65, 0x73, 0x52, 0x08, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x12, - 0x4c, 0x0a, 0x0e, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x62, 0x6f, 0x64, 0x69, 0x65, - 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x42, 0x6f, 0x64, 0x69, - 0x65, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x52, 0x0d, - 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x42, 0x6f, 0x64, 0x69, 0x65, 0x73, 0x12, 0x39, 0x0a, - 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, - 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x48, 0x65, 0x61, 0x64, - 0x65, 0x72, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x52, - 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x52, 0x0a, 0x10, 0x73, 0x65, 0x63, 0x75, - 0x72, 0x69, 0x74, 0x79, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x73, 0x18, 0x07, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, - 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x73, 0x4f, - 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x52, 0x0f, 0x73, 0x65, 0x63, - 0x75, 0x72, 0x69, 0x74, 0x79, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x73, 0x12, 0x33, 0x0a, 0x05, - 0x6c, 0x69, 0x6e, 0x6b, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6f, 0x70, - 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4c, 0x69, 0x6e, 0x6b, 0x73, 0x4f, 0x72, - 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x52, 0x05, 0x6c, 0x69, 0x6e, 0x6b, - 0x73, 0x12, 0x3f, 0x0a, 0x09, 0x63, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x73, 0x18, 0x09, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x33, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, - 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x52, 0x09, 0x63, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, - 0x6b, 0x73, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x0a, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, - 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70, 0x65, 0x63, 0x69, - 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, - 0x6e, 0x22, 0x94, 0x01, 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x12, 0x12, 0x0a, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, - 0x75, 0x72, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, - 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, - 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, - 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, - 0x52, 0x16, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, - 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x66, 0x0a, 0x0b, 0x44, 0x65, 0x66, 0x61, - 0x75, 0x6c, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, - 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, 0x48, 0x00, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, - 0x72, 0x12, 0x1a, 0x0a, 0x07, 0x62, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x08, 0x48, 0x00, 0x52, 0x07, 0x62, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x12, 0x18, 0x0a, - 0x06, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, - 0x06, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x42, 0x07, 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, - 0x22, 0xb2, 0x01, 0x0a, 0x0d, 0x44, 0x69, 0x73, 0x63, 0x72, 0x69, 0x6d, 0x69, 0x6e, 0x61, 0x74, - 0x6f, 0x72, 0x12, 0x23, 0x0a, 0x0d, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x5f, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x70, 0x72, 0x6f, 0x70, 0x65, - 0x72, 0x74, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x2d, 0x0a, 0x07, 0x6d, 0x61, 0x70, 0x70, 0x69, - 0x6e, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x07, 0x6d, - 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, - 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, - 0x6e, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, - 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, - 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xc9, 0x03, 0x0a, 0x08, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, - 0x6e, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x12, 0x24, 0x0a, 0x04, - 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6f, 0x70, 0x65, - 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x69, 0x6e, - 0x66, 0x6f, 0x12, 0x2c, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, - 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, - 0x12, 0x27, 0x0a, 0x05, 0x70, 0x61, 0x74, 0x68, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x11, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x50, 0x61, 0x74, - 0x68, 0x73, 0x52, 0x05, 0x70, 0x61, 0x74, 0x68, 0x73, 0x12, 0x36, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, - 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, - 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6f, - 0x6e, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x0a, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, - 0x73, 0x12, 0x3b, 0x0a, 0x08, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x18, 0x06, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, - 0x2e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x08, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x12, 0x23, - 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, - 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x54, 0x61, 0x67, 0x52, 0x04, 0x74, - 0x61, 0x67, 0x73, 0x12, 0x3d, 0x0a, 0x0d, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, - 0x64, 0x6f, 0x63, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6f, 0x70, 0x65, - 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, - 0x44, 0x6f, 0x63, 0x73, 0x52, 0x0c, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, - 0x63, 0x73, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x09, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, - 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70, 0x65, 0x63, 0x69, - 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, - 0x6e, 0x22, 0x8e, 0x02, 0x0a, 0x08, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x21, - 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, - 0x65, 0x12, 0x39, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, - 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, - 0x63, 0x65, 0x73, 0x52, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x14, 0x0a, 0x05, - 0x73, 0x74, 0x79, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x74, 0x79, - 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x78, 0x70, 0x6c, 0x6f, 0x64, 0x65, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x07, 0x65, 0x78, 0x70, 0x6c, 0x6f, 0x64, 0x65, 0x12, 0x25, 0x0a, 0x0e, - 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x52, 0x65, 0x73, 0x65, 0x72, - 0x76, 0x65, 0x64, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70, 0x65, 0x63, - 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, - 0x6f, 0x6e, 0x22, 0x5b, 0x0a, 0x09, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x12, - 0x4e, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, - 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, - 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, - 0x64, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, - 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, - 0xe2, 0x01, 0x0a, 0x07, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, - 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, - 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, - 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x25, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x33, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x25, - 0x0a, 0x0e, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, - 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, - 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70, - 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, - 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x85, 0x01, 0x0a, 0x12, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, - 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x2f, 0x0a, 0x07, 0x65, - 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6f, - 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, - 0x65, 0x48, 0x00, 0x52, 0x07, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x12, 0x35, 0x0a, 0x09, - 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x66, - 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x48, 0x00, 0x52, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, - 0x6e, 0x63, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x70, 0x0a, 0x14, - 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, - 0x6e, 0x63, 0x65, 0x73, 0x12, 0x58, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, - 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, - 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x4f, 0x72, 0x52, - 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, - 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x57, - 0x0a, 0x0a, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x49, 0x0a, 0x15, - 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, - 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, - 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, - 0x79, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, - 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x91, 0x01, 0x0a, 0x0c, 0x45, 0x78, 0x74, 0x65, - 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, - 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, - 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, - 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x4d, 0x0a, 0x17, - 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, - 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, - 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, - 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x8a, 0x04, 0x0a, 0x06, - 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, - 0x69, 0x72, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, - 0x69, 0x72, 0x65, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, - 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, - 0x61, 0x74, 0x65, 0x64, 0x12, 0x2a, 0x0a, 0x11, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x65, 0x6d, - 0x70, 0x74, 0x79, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x0f, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, - 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x79, 0x6c, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x05, 0x73, 0x74, 0x79, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x78, 0x70, 0x6c, 0x6f, 0x64, - 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x65, 0x78, 0x70, 0x6c, 0x6f, 0x64, 0x65, - 0x12, 0x25, 0x0a, 0x0e, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, - 0x65, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x52, - 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x12, 0x35, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, - 0x61, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4f, 0x72, 0x52, 0x65, 0x66, - 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x29, - 0x0a, 0x07, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x41, 0x6e, 0x79, - 0x52, 0x07, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x12, 0x3c, 0x0a, 0x08, 0x65, 0x78, 0x61, - 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x70, - 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, - 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x52, 0x08, 0x65, - 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x12, 0x30, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, - 0x6e, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x73, - 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, - 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, - 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, - 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, - 0x52, 0x16, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, - 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x81, 0x01, 0x0a, 0x11, 0x48, 0x65, 0x61, - 0x64, 0x65, 0x72, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x2c, - 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, - 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x48, 0x65, 0x61, 0x64, - 0x65, 0x72, 0x48, 0x00, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x35, 0x0a, 0x09, - 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x66, - 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x48, 0x00, 0x52, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, - 0x6e, 0x63, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x6e, 0x0a, 0x13, - 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, - 0x63, 0x65, 0x73, 0x12, 0x57, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, - 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, - 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x72, 0x52, 0x65, 0x66, - 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, - 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0xc9, 0x02, 0x0a, - 0x04, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, - 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x28, 0x0a, - 0x10, 0x74, 0x65, 0x72, 0x6d, 0x73, 0x5f, 0x6f, 0x66, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x74, 0x65, 0x72, 0x6d, 0x73, 0x4f, 0x66, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x2d, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x61, - 0x63, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x52, 0x07, 0x63, - 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x12, 0x2d, 0x0a, 0x07, 0x6c, 0x69, 0x63, 0x65, 0x6e, 0x73, - 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x52, 0x07, 0x6c, 0x69, - 0x63, 0x65, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, - 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, - 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x18, - 0x0a, 0x07, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x07, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x22, 0x5a, 0x0a, 0x09, 0x49, 0x74, 0x65, 0x6d, - 0x73, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x4d, 0x0a, 0x13, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x5f, - 0x6f, 0x72, 0x5f, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, - 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, - 0x65, 0x52, 0x11, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, - 0x65, 0x6e, 0x63, 0x65, 0x22, 0x7e, 0x0a, 0x07, 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x12, - 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, - 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70, - 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, - 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xe8, 0x02, 0x0a, 0x04, 0x4c, 0x69, 0x6e, 0x6b, 0x12, 0x23, 0x0a, - 0x0d, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x65, 0x66, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, - 0x65, 0x66, 0x12, 0x21, 0x0a, 0x0c, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, - 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x3b, 0x0a, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, - 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6f, 0x70, 0x65, 0x6e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x41, 0x6e, 0x79, 0x4f, 0x72, 0x45, 0x78, 0x70, 0x72, - 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, - 0x72, 0x73, 0x12, 0x3e, 0x0a, 0x0c, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x62, 0x6f, - 0x64, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x41, 0x6e, 0x79, 0x4f, 0x72, 0x45, 0x78, 0x70, 0x72, 0x65, - 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x0b, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x42, 0x6f, - 0x64, 0x79, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2a, 0x0a, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x18, 0x06, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x33, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, - 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, - 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, - 0x79, 0x0a, 0x0f, 0x4c, 0x69, 0x6e, 0x6b, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, - 0x63, 0x65, 0x12, 0x26, 0x0a, 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x10, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4c, 0x69, - 0x6e, 0x6b, 0x48, 0x00, 0x52, 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x12, 0x35, 0x0a, 0x09, 0x72, 0x65, - 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, - 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x66, 0x65, 0x72, - 0x65, 0x6e, 0x63, 0x65, 0x48, 0x00, 0x52, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, - 0x65, 0x42, 0x07, 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x6a, 0x0a, 0x11, 0x4c, 0x69, - 0x6e, 0x6b, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x12, - 0x55, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, - 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, - 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, - 0x64, 0x4c, 0x69, 0x6e, 0x6b, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, - 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, - 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0xad, 0x02, 0x0a, 0x09, 0x4d, 0x65, 0x64, 0x69, 0x61, - 0x54, 0x79, 0x70, 0x65, 0x12, 0x35, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x33, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, - 0x6e, 0x63, 0x65, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x29, 0x0a, 0x07, 0x65, - 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, - 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x07, 0x65, - 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x12, 0x3c, 0x0a, 0x08, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, - 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x4f, 0x72, - 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x52, 0x08, 0x65, 0x78, 0x61, 0x6d, - 0x70, 0x6c, 0x65, 0x73, 0x12, 0x31, 0x0a, 0x08, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x33, 0x2e, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x08, 0x65, - 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, - 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, - 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, - 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, - 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x5d, 0x0a, 0x0a, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, - 0x79, 0x70, 0x65, 0x73, 0x12, 0x4f, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, - 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, - 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x52, - 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, - 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x45, 0x0a, 0x08, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, - 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x25, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x33, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x65, 0x0a, 0x18, - 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x43, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x4f, 0x72, 0x52, - 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x35, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6f, 0x70, - 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, - 0x6b, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x22, 0x4f, 0x0a, 0x0d, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x45, 0x6e, 0x63, 0x6f, - 0x64, 0x69, 0x6e, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x52, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x22, 0x63, 0x0a, 0x17, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x45, 0x78, 0x61, - 0x6d, 0x70, 0x6c, 0x65, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, - 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x12, 0x34, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, - 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, - 0x63, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x61, 0x0a, 0x16, 0x4e, 0x61, 0x6d, - 0x65, 0x64, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, - 0x6e, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x33, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x33, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, - 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x5d, 0x0a, 0x14, - 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x4c, 0x69, 0x6e, 0x6b, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, - 0x65, 0x6e, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x31, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4c, 0x69, 0x6e, 0x6b, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, - 0x65, 0x6e, 0x63, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x51, 0x0a, 0x0e, 0x4e, - 0x61, 0x6d, 0x65, 0x64, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x12, 0x2b, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4d, 0x65, - 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x67, - 0x0a, 0x19, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, - 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, - 0x36, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, - 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x65, 0x74, 0x65, 0x72, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, - 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x4f, 0x0a, 0x0d, 0x4e, 0x61, 0x6d, 0x65, 0x64, - 0x50, 0x61, 0x74, 0x68, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, - 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x50, 0x61, 0x74, 0x68, 0x49, 0x74, 0x65, - 0x6d, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x6b, 0x0a, 0x1b, 0x4e, 0x61, 0x6d, 0x65, - 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x42, 0x6f, 0x64, 0x79, 0x4f, 0x72, 0x52, 0x65, - 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x38, 0x0a, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x70, 0x65, - 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x42, - 0x6f, 0x64, 0x79, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x65, 0x0a, 0x18, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, - 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x35, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x33, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, - 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x61, 0x0a, 0x16, - 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4f, 0x72, 0x52, 0x65, 0x66, - 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x33, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6f, 0x70, 0x65, 0x6e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4f, 0x72, 0x52, - 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, - 0x71, 0x0a, 0x1e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, - 0x53, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, - 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x3b, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x33, 0x2e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x65, - 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x22, 0x5b, 0x0a, 0x13, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x65, - 0x72, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x30, 0x0a, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6f, - 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, - 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, - 0x37, 0x0a, 0x0b, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x12, - 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x55, 0x0a, 0x10, 0x4e, 0x61, 0x6d, 0x65, - 0x64, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x41, 0x72, 0x72, 0x61, 0x79, 0x12, 0x12, 0x0a, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x12, 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x17, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x74, 0x72, - 0x69, 0x6e, 0x67, 0x41, 0x72, 0x72, 0x61, 0x79, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, - 0xf2, 0x01, 0x0a, 0x09, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x46, 0x6c, 0x6f, 0x77, 0x12, 0x2b, 0x0a, - 0x11, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x75, - 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, - 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x55, 0x72, 0x6c, 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x6f, - 0x6b, 0x65, 0x6e, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, - 0x6f, 0x6b, 0x65, 0x6e, 0x55, 0x72, 0x6c, 0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x65, 0x66, 0x72, 0x65, - 0x73, 0x68, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, - 0x66, 0x72, 0x65, 0x73, 0x68, 0x55, 0x72, 0x6c, 0x12, 0x2b, 0x0a, 0x06, 0x73, 0x63, 0x6f, 0x70, - 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x06, 0x73, - 0x63, 0x6f, 0x70, 0x65, 0x73, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, - 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70, - 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, - 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xcd, 0x02, 0x0a, 0x0a, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x46, 0x6c, - 0x6f, 0x77, 0x73, 0x12, 0x31, 0x0a, 0x08, 0x69, 0x6d, 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x33, 0x2e, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x08, 0x69, 0x6d, - 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x12, 0x31, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, - 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x46, 0x6c, 0x6f, 0x77, 0x52, - 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x44, 0x0a, 0x12, 0x63, 0x6c, 0x69, - 0x65, 0x6e, 0x74, 0x5f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x33, 0x2e, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x11, 0x63, 0x6c, - 0x69, 0x65, 0x6e, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x12, - 0x44, 0x0a, 0x12, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, - 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x46, 0x6c, - 0x6f, 0x77, 0x52, 0x11, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, - 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70, - 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, - 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x53, 0x0a, 0x06, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x49, - 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, - 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, - 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, - 0x41, 0x6e, 0x79, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, - 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x96, 0x05, 0x0a, 0x09, 0x4f, 0x70, - 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, - 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x74, 0x61, 0x67, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x73, - 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, - 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, - 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3d, 0x0a, 0x0d, 0x65, 0x78, 0x74, 0x65, 0x72, - 0x6e, 0x61, 0x6c, 0x5f, 0x64, 0x6f, 0x63, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, - 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x45, 0x78, 0x74, 0x65, - 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x52, 0x0c, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, - 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6f, 0x70, - 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x40, 0x0a, 0x0a, 0x70, 0x61, 0x72, - 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, - 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x65, 0x74, 0x65, 0x72, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, - 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x12, 0x45, 0x0a, 0x0c, 0x72, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x42, 0x6f, 0x64, 0x79, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, - 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x0b, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x42, 0x6f, - 0x64, 0x79, 0x12, 0x33, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x18, - 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x33, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x52, 0x09, 0x72, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x12, 0x3f, 0x0a, 0x09, 0x63, 0x61, 0x6c, 0x6c, 0x62, - 0x61, 0x63, 0x6b, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6f, 0x70, 0x65, - 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, - 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x52, 0x09, 0x63, - 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, - 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x64, 0x65, - 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x3b, 0x0a, 0x08, 0x73, 0x65, 0x63, 0x75, - 0x72, 0x69, 0x74, 0x79, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6f, 0x70, 0x65, - 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, - 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x08, 0x73, 0x65, 0x63, - 0x75, 0x72, 0x69, 0x74, 0x79, 0x12, 0x2c, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, - 0x18, 0x0c, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, - 0x65, 0x72, 0x73, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x0d, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70, 0x65, 0x63, - 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, - 0x6f, 0x6e, 0x22, 0xb1, 0x04, 0x0a, 0x09, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, - 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x02, 0x69, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, - 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, - 0x65, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, - 0x65, 0x64, 0x12, 0x2a, 0x0a, 0x11, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x65, 0x6d, 0x70, 0x74, - 0x79, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x61, - 0x6c, 0x6c, 0x6f, 0x77, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x14, - 0x0a, 0x05, 0x73, 0x74, 0x79, 0x6c, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, - 0x74, 0x79, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x78, 0x70, 0x6c, 0x6f, 0x64, 0x65, 0x18, - 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x65, 0x78, 0x70, 0x6c, 0x6f, 0x64, 0x65, 0x12, 0x25, - 0x0a, 0x0e, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, - 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x52, 0x65, 0x73, - 0x65, 0x72, 0x76, 0x65, 0x64, 0x12, 0x35, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, - 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x33, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, - 0x65, 0x6e, 0x63, 0x65, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x29, 0x0a, 0x07, - 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, - 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x07, - 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x12, 0x3c, 0x0a, 0x08, 0x65, 0x78, 0x61, 0x6d, 0x70, - 0x6c, 0x65, 0x73, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x70, 0x65, 0x6e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x4f, - 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x52, 0x08, 0x65, 0x78, 0x61, - 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x12, 0x30, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, - 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x33, 0x2e, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x73, 0x52, 0x07, - 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, - 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, - 0x6f, 0x6e, 0x18, 0x0e, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, - 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, - 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x8d, 0x01, 0x0a, 0x14, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x65, 0x74, 0x65, 0x72, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, - 0x35, 0x0a, 0x09, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x48, 0x00, 0x52, 0x09, 0x70, 0x61, 0x72, - 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x35, 0x0a, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, - 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, - 0x48, 0x00, 0x52, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x42, 0x07, 0x0a, - 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x74, 0x0a, 0x16, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, - 0x74, 0x65, 0x72, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, - 0x12, 0x5a, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, - 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x25, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, - 0x65, 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x4f, 0x72, 0x52, 0x65, 0x66, - 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, - 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0xfa, 0x04, 0x0a, - 0x08, 0x50, 0x61, 0x74, 0x68, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x11, 0x0a, 0x04, 0x5f, 0x72, 0x65, - 0x66, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x52, 0x65, 0x66, 0x12, 0x18, 0x0a, 0x07, - 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, - 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x27, 0x0a, 0x03, 0x67, 0x65, 0x74, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x33, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x03, 0x67, 0x65, - 0x74, 0x12, 0x27, 0x0a, 0x03, 0x70, 0x75, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, - 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4f, 0x70, 0x65, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x03, 0x70, 0x75, 0x74, 0x12, 0x29, 0x0a, 0x04, 0x70, 0x6f, - 0x73, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, - 0x04, 0x70, 0x6f, 0x73, 0x74, 0x12, 0x2d, 0x0a, 0x06, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x18, - 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x33, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x64, 0x65, - 0x6c, 0x65, 0x74, 0x65, 0x12, 0x2f, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, - 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x33, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x6f, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x29, 0x0a, 0x04, 0x68, 0x65, 0x61, 0x64, 0x18, 0x09, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, - 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x04, 0x68, 0x65, 0x61, 0x64, - 0x12, 0x2b, 0x0a, 0x05, 0x70, 0x61, 0x74, 0x63, 0x68, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4f, 0x70, 0x65, - 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x05, 0x70, 0x61, 0x74, 0x63, 0x68, 0x12, 0x2b, 0x0a, - 0x05, 0x74, 0x72, 0x61, 0x63, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, - 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x52, 0x05, 0x74, 0x72, 0x61, 0x63, 0x65, 0x12, 0x2c, 0x0a, 0x07, 0x73, 0x65, - 0x72, 0x76, 0x65, 0x72, 0x73, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6f, 0x70, - 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, - 0x07, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x12, 0x40, 0x0a, 0x0a, 0x70, 0x61, 0x72, 0x61, - 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, - 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, - 0x74, 0x65, 0x72, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x0a, - 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, - 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, - 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x0e, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, - 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, - 0x79, 0x52, 0x16, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x85, 0x01, 0x0a, 0x05, 0x50, 0x61, - 0x74, 0x68, 0x73, 0x12, 0x2d, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x19, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, - 0x61, 0x6d, 0x65, 0x64, 0x50, 0x61, 0x74, 0x68, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x04, 0x70, 0x61, - 0x74, 0x68, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, - 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70, 0x65, 0x63, 0x69, - 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, - 0x6e, 0x22, 0x65, 0x0a, 0x0a, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x12, - 0x57, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, - 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, - 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, - 0x64, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, - 0x63, 0x65, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, - 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x5a, 0x0a, 0x09, 0x52, 0x65, 0x66, 0x65, - 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x11, 0x0a, 0x04, 0x5f, 0x72, 0x65, 0x66, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x03, 0x52, 0x65, 0x66, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x6d, 0x6d, - 0x61, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x6d, 0x6d, 0x61, - 0x72, 0x79, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x79, 0x0a, 0x19, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x42, - 0x6f, 0x64, 0x69, 0x65, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, - 0x73, 0x12, 0x5c, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, - 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x27, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, - 0x6d, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x42, 0x6f, 0x64, 0x79, 0x4f, 0x72, - 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, - 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, - 0xcc, 0x01, 0x0a, 0x0b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x42, 0x6f, 0x64, 0x79, 0x12, - 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x12, 0x30, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, - 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x73, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, - 0x65, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, - 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, - 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x96, - 0x01, 0x0a, 0x16, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x42, 0x6f, 0x64, 0x79, 0x4f, 0x72, - 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x3c, 0x0a, 0x0c, 0x72, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x5f, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x17, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x42, 0x6f, 0x64, 0x79, 0x48, 0x00, 0x52, 0x0b, 0x72, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x35, 0x0a, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, - 0x65, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, - 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, - 0x65, 0x48, 0x00, 0x52, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x42, 0x07, - 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x9d, 0x02, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x39, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, - 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x4f, 0x72, 0x52, 0x65, - 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x52, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, - 0x73, 0x12, 0x30, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, - 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x73, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, - 0x65, 0x6e, 0x74, 0x12, 0x33, 0x0a, 0x05, 0x6c, 0x69, 0x6e, 0x6b, 0x73, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, - 0x4c, 0x69, 0x6e, 0x6b, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, - 0x73, 0x52, 0x05, 0x6c, 0x69, 0x6e, 0x6b, 0x73, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, - 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, - 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, - 0x16, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, - 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x89, 0x01, 0x0a, 0x13, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, - 0x32, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x35, 0x0a, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x48, 0x00, 0x52, - 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x6f, 0x6e, - 0x65, 0x6f, 0x66, 0x22, 0xef, 0x01, 0x0a, 0x09, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x73, 0x12, 0x39, 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, - 0x6e, 0x63, 0x65, 0x52, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x58, 0x0a, 0x15, - 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x6f, 0x72, 0x5f, 0x72, 0x65, 0x66, 0x65, - 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x70, - 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, - 0x65, 0x52, 0x13, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4f, 0x72, 0x52, 0x65, 0x66, - 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, - 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, - 0x6e, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, - 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, - 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x72, 0x0a, 0x15, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x59, - 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, - 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, - 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, - 0x6e, 0x63, 0x65, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, - 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0xaf, 0x0b, 0x0a, 0x06, 0x53, 0x63, - 0x68, 0x65, 0x6d, 0x61, 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x75, 0x6c, 0x6c, 0x61, 0x62, 0x6c, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x6e, 0x75, 0x6c, 0x6c, 0x61, 0x62, 0x6c, 0x65, - 0x12, 0x3f, 0x0a, 0x0d, 0x64, 0x69, 0x73, 0x63, 0x72, 0x69, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x6f, - 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x44, 0x69, 0x73, 0x63, 0x72, 0x69, 0x6d, 0x69, 0x6e, 0x61, 0x74, - 0x6f, 0x72, 0x52, 0x0d, 0x64, 0x69, 0x73, 0x63, 0x72, 0x69, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x6f, - 0x72, 0x12, 0x1b, 0x0a, 0x09, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x61, 0x64, 0x4f, 0x6e, 0x6c, 0x79, 0x12, 0x1d, - 0x0a, 0x0a, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x09, 0x77, 0x72, 0x69, 0x74, 0x65, 0x4f, 0x6e, 0x6c, 0x79, 0x12, 0x21, 0x0a, - 0x03, 0x78, 0x6d, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, - 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x58, 0x6d, 0x6c, 0x52, 0x03, 0x78, 0x6d, 0x6c, - 0x12, 0x3d, 0x0a, 0x0d, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x64, 0x6f, 0x63, - 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, - 0x73, 0x52, 0x0c, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x12, - 0x29, 0x0a, 0x07, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x41, 0x6e, - 0x79, 0x52, 0x07, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65, - 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, - 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, - 0x74, 0x6c, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, - 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x6f, 0x66, 0x18, - 0x0a, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0a, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x4f, - 0x66, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0b, 0x20, 0x01, - 0x28, 0x01, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, - 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, - 0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, - 0x65, 0x4d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x69, 0x6e, 0x69, - 0x6d, 0x75, 0x6d, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x6d, 0x69, 0x6e, 0x69, 0x6d, - 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, - 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65, - 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x12, - 0x1d, 0x0a, 0x0a, 0x6d, 0x61, 0x78, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x0f, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x61, 0x78, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x1d, - 0x0a, 0x0a, 0x6d, 0x69, 0x6e, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x10, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x09, 0x6d, 0x69, 0x6e, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x18, 0x0a, - 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x18, 0x11, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, - 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x78, 0x5f, 0x69, - 0x74, 0x65, 0x6d, 0x73, 0x18, 0x12, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x49, - 0x74, 0x65, 0x6d, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x69, 0x6e, 0x5f, 0x69, 0x74, 0x65, 0x6d, - 0x73, 0x18, 0x13, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x69, 0x6e, 0x49, 0x74, 0x65, 0x6d, - 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x5f, 0x69, 0x74, 0x65, 0x6d, - 0x73, 0x18, 0x14, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x49, - 0x74, 0x65, 0x6d, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x72, 0x6f, 0x70, - 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x15, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x6d, 0x61, - 0x78, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x6d, - 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x16, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x0d, 0x6d, 0x69, 0x6e, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, - 0x65, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x17, - 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x23, - 0x0a, 0x04, 0x65, 0x6e, 0x75, 0x6d, 0x18, 0x18, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, - 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x04, 0x65, - 0x6e, 0x75, 0x6d, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x19, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x34, 0x0a, 0x06, 0x61, 0x6c, 0x6c, 0x5f, 0x6f, - 0x66, 0x18, 0x1a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4f, 0x72, 0x52, 0x65, 0x66, - 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x05, 0x61, 0x6c, 0x6c, 0x4f, 0x66, 0x12, 0x34, 0x0a, - 0x06, 0x6f, 0x6e, 0x65, 0x5f, 0x6f, 0x66, 0x18, 0x1b, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, - 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, - 0x61, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x05, 0x6f, 0x6e, - 0x65, 0x4f, 0x66, 0x12, 0x34, 0x0a, 0x06, 0x61, 0x6e, 0x79, 0x5f, 0x6f, 0x66, 0x18, 0x1c, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, - 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, - 0x63, 0x65, 0x52, 0x05, 0x61, 0x6e, 0x79, 0x4f, 0x66, 0x12, 0x24, 0x0a, 0x03, 0x6e, 0x6f, 0x74, - 0x18, 0x1d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x03, 0x6e, 0x6f, 0x74, 0x12, - 0x2b, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, - 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x49, 0x74, 0x65, 0x6d, - 0x73, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x36, 0x0a, 0x0a, - 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x1f, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x16, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x50, 0x72, - 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, - 0x74, 0x69, 0x65, 0x73, 0x12, 0x59, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, - 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x20, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, - 0x2e, 0x41, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, - 0x72, 0x74, 0x69, 0x65, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, - 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x12, - 0x31, 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x21, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x17, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x44, 0x65, - 0x66, 0x61, 0x75, 0x6c, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, - 0x6c, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x18, 0x22, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x23, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x4d, 0x0a, 0x17, - 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, - 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x24, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, - 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, - 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x81, 0x01, 0x0a, 0x11, - 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, - 0x65, 0x12, 0x2c, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x12, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x53, - 0x63, 0x68, 0x65, 0x6d, 0x61, 0x48, 0x00, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, - 0x35, 0x0a, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, - 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x48, 0x00, 0x52, 0x09, 0x72, 0x65, 0x66, - 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x22, - 0x6e, 0x0a, 0x13, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, - 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x57, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, - 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, - 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4f, 0x72, - 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, - 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, - 0x68, 0x0a, 0x13, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x69, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x51, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, - 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, - 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x41, 0x72, - 0x72, 0x61, 0x79, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, - 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0xd3, 0x02, 0x0a, 0x0e, 0x53, 0x65, - 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, - 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, - 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x6e, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x02, 0x69, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x12, 0x23, - 0x0a, 0x0d, 0x62, 0x65, 0x61, 0x72, 0x65, 0x72, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x62, 0x65, 0x61, 0x72, 0x65, 0x72, 0x46, 0x6f, 0x72, - 0x6d, 0x61, 0x74, 0x12, 0x2c, 0x0a, 0x05, 0x66, 0x6c, 0x6f, 0x77, 0x73, 0x18, 0x07, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, - 0x4f, 0x61, 0x75, 0x74, 0x68, 0x46, 0x6c, 0x6f, 0x77, 0x73, 0x52, 0x05, 0x66, 0x6c, 0x6f, 0x77, - 0x73, 0x12, 0x2d, 0x0a, 0x13, 0x6f, 0x70, 0x65, 0x6e, 0x5f, 0x69, 0x64, 0x5f, 0x63, 0x6f, 0x6e, - 0x6e, 0x65, 0x63, 0x74, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, - 0x6f, 0x70, 0x65, 0x6e, 0x49, 0x64, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x55, 0x72, 0x6c, - 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x09, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, - 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, - 0xa2, 0x01, 0x0a, 0x19, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x53, 0x63, 0x68, 0x65, - 0x6d, 0x65, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x45, 0x0a, - 0x0f, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x53, 0x63, 0x68, 0x65, - 0x6d, 0x65, 0x48, 0x00, 0x52, 0x0e, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x53, 0x63, - 0x68, 0x65, 0x6d, 0x65, 0x12, 0x35, 0x0a, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x48, 0x00, - 0x52, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x6f, - 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x7e, 0x0a, 0x1b, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, - 0x53, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x73, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, - 0x63, 0x65, 0x73, 0x12, 0x5f, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, - 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, - 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x53, 0x63, 0x68, - 0x65, 0x6d, 0x65, 0x4f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x14, - 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, - 0x74, 0x69, 0x65, 0x73, 0x22, 0xc6, 0x01, 0x0a, 0x06, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, - 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, - 0x6c, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x12, 0x39, 0x0a, 0x09, 0x76, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x73, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x33, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, - 0x6c, 0x65, 0x73, 0x52, 0x09, 0x76, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x12, 0x4d, - 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, - 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, - 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xaf, 0x01, - 0x0a, 0x0e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, - 0x12, 0x12, 0x0a, 0x04, 0x65, 0x6e, 0x75, 0x6d, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, - 0x65, 0x6e, 0x75, 0x6d, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x20, - 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, - 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, - 0x67, 0x0a, 0x0f, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, - 0x65, 0x73, 0x12, 0x54, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, - 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x1f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, - 0x61, 0x6d, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, - 0x6c, 0x65, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, - 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x71, 0x0a, 0x16, 0x53, 0x70, 0x65, 0x63, - 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, - 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x01, 0x48, 0x00, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x07, - 0x62, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, - 0x07, 0x62, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x12, 0x18, 0x0a, 0x06, 0x73, 0x74, 0x72, 0x69, - 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x06, 0x73, 0x74, 0x72, 0x69, - 0x6e, 0x67, 0x42, 0x07, 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x23, 0x0a, 0x0b, 0x53, - 0x74, 0x72, 0x69, 0x6e, 0x67, 0x41, 0x72, 0x72, 0x61, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x22, 0x57, 0x0a, 0x07, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x4c, 0x0a, 0x15, 0x61, - 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, - 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6f, 0x70, 0x65, - 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x74, 0x72, - 0x69, 0x6e, 0x67, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, - 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0xc9, 0x01, 0x0a, 0x03, 0x54, 0x61, - 0x67, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, - 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3d, 0x0a, 0x0d, 0x65, 0x78, 0x74, 0x65, 0x72, - 0x6e, 0x61, 0x6c, 0x5f, 0x64, 0x6f, 0x63, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, - 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x45, 0x78, 0x74, 0x65, - 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x52, 0x0c, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, - 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x12, 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, - 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, - 0x6e, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, - 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, - 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xd6, 0x01, 0x0a, 0x03, 0x58, 0x6d, 0x6c, 0x12, 0x12, 0x0a, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, - 0x16, 0x0a, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x74, 0x74, 0x72, 0x69, - 0x62, 0x75, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x61, 0x74, 0x74, 0x72, - 0x69, 0x62, 0x75, 0x74, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x64, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x64, 0x12, - 0x4d, 0x0a, 0x17, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x33, 0x2e, 0x4e, 0x61, - 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x16, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x42, 0x3e, - 0x0a, 0x0e, 0x6f, 0x72, 0x67, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x5f, 0x76, 0x33, - 0x42, 0x0c, 0x4f, 0x70, 0x65, 0x6e, 0x41, 0x50, 0x49, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, - 0x5a, 0x16, 0x2e, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x33, 0x3b, 0x6f, 0x70, - 0x65, 0x6e, 0x61, 0x70, 0x69, 0x5f, 0x76, 0x33, 0xa2, 0x02, 0x03, 0x4f, 0x41, 0x53, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_openapiv3_OpenAPIv3_proto_rawDescOnce sync.Once - file_openapiv3_OpenAPIv3_proto_rawDescData = file_openapiv3_OpenAPIv3_proto_rawDesc -) - -func file_openapiv3_OpenAPIv3_proto_rawDescGZIP() []byte { - file_openapiv3_OpenAPIv3_proto_rawDescOnce.Do(func() { - file_openapiv3_OpenAPIv3_proto_rawDescData = protoimpl.X.CompressGZIP(file_openapiv3_OpenAPIv3_proto_rawDescData) - }) - return file_openapiv3_OpenAPIv3_proto_rawDescData -} - -var file_openapiv3_OpenAPIv3_proto_msgTypes = make([]protoimpl.MessageInfo, 78) -var file_openapiv3_OpenAPIv3_proto_goTypes = []interface{}{ - (*AdditionalPropertiesItem)(nil), // 0: openapi.v3.AdditionalPropertiesItem - (*Any)(nil), // 1: openapi.v3.Any - (*AnyOrExpression)(nil), // 2: openapi.v3.AnyOrExpression - (*Callback)(nil), // 3: openapi.v3.Callback - (*CallbackOrReference)(nil), // 4: openapi.v3.CallbackOrReference - (*CallbacksOrReferences)(nil), // 5: openapi.v3.CallbacksOrReferences - (*Components)(nil), // 6: openapi.v3.Components - (*Contact)(nil), // 7: openapi.v3.Contact - (*DefaultType)(nil), // 8: openapi.v3.DefaultType - (*Discriminator)(nil), // 9: openapi.v3.Discriminator - (*Document)(nil), // 10: openapi.v3.Document - (*Encoding)(nil), // 11: openapi.v3.Encoding - (*Encodings)(nil), // 12: openapi.v3.Encodings - (*Example)(nil), // 13: openapi.v3.Example - (*ExampleOrReference)(nil), // 14: openapi.v3.ExampleOrReference - (*ExamplesOrReferences)(nil), // 15: openapi.v3.ExamplesOrReferences - (*Expression)(nil), // 16: openapi.v3.Expression - (*ExternalDocs)(nil), // 17: openapi.v3.ExternalDocs - (*Header)(nil), // 18: openapi.v3.Header - (*HeaderOrReference)(nil), // 19: openapi.v3.HeaderOrReference - (*HeadersOrReferences)(nil), // 20: openapi.v3.HeadersOrReferences - (*Info)(nil), // 21: openapi.v3.Info - (*ItemsItem)(nil), // 22: openapi.v3.ItemsItem - (*License)(nil), // 23: openapi.v3.License - (*Link)(nil), // 24: openapi.v3.Link - (*LinkOrReference)(nil), // 25: openapi.v3.LinkOrReference - (*LinksOrReferences)(nil), // 26: openapi.v3.LinksOrReferences - (*MediaType)(nil), // 27: openapi.v3.MediaType - (*MediaTypes)(nil), // 28: openapi.v3.MediaTypes - (*NamedAny)(nil), // 29: openapi.v3.NamedAny - (*NamedCallbackOrReference)(nil), // 30: openapi.v3.NamedCallbackOrReference - (*NamedEncoding)(nil), // 31: openapi.v3.NamedEncoding - (*NamedExampleOrReference)(nil), // 32: openapi.v3.NamedExampleOrReference - (*NamedHeaderOrReference)(nil), // 33: openapi.v3.NamedHeaderOrReference - (*NamedLinkOrReference)(nil), // 34: openapi.v3.NamedLinkOrReference - (*NamedMediaType)(nil), // 35: openapi.v3.NamedMediaType - (*NamedParameterOrReference)(nil), // 36: openapi.v3.NamedParameterOrReference - (*NamedPathItem)(nil), // 37: openapi.v3.NamedPathItem - (*NamedRequestBodyOrReference)(nil), // 38: openapi.v3.NamedRequestBodyOrReference - (*NamedResponseOrReference)(nil), // 39: openapi.v3.NamedResponseOrReference - (*NamedSchemaOrReference)(nil), // 40: openapi.v3.NamedSchemaOrReference - (*NamedSecuritySchemeOrReference)(nil), // 41: openapi.v3.NamedSecuritySchemeOrReference - (*NamedServerVariable)(nil), // 42: openapi.v3.NamedServerVariable - (*NamedString)(nil), // 43: openapi.v3.NamedString - (*NamedStringArray)(nil), // 44: openapi.v3.NamedStringArray - (*OauthFlow)(nil), // 45: openapi.v3.OauthFlow - (*OauthFlows)(nil), // 46: openapi.v3.OauthFlows - (*Object)(nil), // 47: openapi.v3.Object - (*Operation)(nil), // 48: openapi.v3.Operation - (*Parameter)(nil), // 49: openapi.v3.Parameter - (*ParameterOrReference)(nil), // 50: openapi.v3.ParameterOrReference - (*ParametersOrReferences)(nil), // 51: openapi.v3.ParametersOrReferences - (*PathItem)(nil), // 52: openapi.v3.PathItem - (*Paths)(nil), // 53: openapi.v3.Paths - (*Properties)(nil), // 54: openapi.v3.Properties - (*Reference)(nil), // 55: openapi.v3.Reference - (*RequestBodiesOrReferences)(nil), // 56: openapi.v3.RequestBodiesOrReferences - (*RequestBody)(nil), // 57: openapi.v3.RequestBody - (*RequestBodyOrReference)(nil), // 58: openapi.v3.RequestBodyOrReference - (*Response)(nil), // 59: openapi.v3.Response - (*ResponseOrReference)(nil), // 60: openapi.v3.ResponseOrReference - (*Responses)(nil), // 61: openapi.v3.Responses - (*ResponsesOrReferences)(nil), // 62: openapi.v3.ResponsesOrReferences - (*Schema)(nil), // 63: openapi.v3.Schema - (*SchemaOrReference)(nil), // 64: openapi.v3.SchemaOrReference - (*SchemasOrReferences)(nil), // 65: openapi.v3.SchemasOrReferences - (*SecurityRequirement)(nil), // 66: openapi.v3.SecurityRequirement - (*SecurityScheme)(nil), // 67: openapi.v3.SecurityScheme - (*SecuritySchemeOrReference)(nil), // 68: openapi.v3.SecuritySchemeOrReference - (*SecuritySchemesOrReferences)(nil), // 69: openapi.v3.SecuritySchemesOrReferences - (*Server)(nil), // 70: openapi.v3.Server - (*ServerVariable)(nil), // 71: openapi.v3.ServerVariable - (*ServerVariables)(nil), // 72: openapi.v3.ServerVariables - (*SpecificationExtension)(nil), // 73: openapi.v3.SpecificationExtension - (*StringArray)(nil), // 74: openapi.v3.StringArray - (*Strings)(nil), // 75: openapi.v3.Strings - (*Tag)(nil), // 76: openapi.v3.Tag - (*Xml)(nil), // 77: openapi.v3.Xml - (*anypb.Any)(nil), // 78: google.protobuf.Any -} -var file_openapiv3_OpenAPIv3_proto_depIdxs = []int32{ - 64, // 0: openapi.v3.AdditionalPropertiesItem.schema_or_reference:type_name -> openapi.v3.SchemaOrReference - 78, // 1: openapi.v3.Any.value:type_name -> google.protobuf.Any - 1, // 2: openapi.v3.AnyOrExpression.any:type_name -> openapi.v3.Any - 16, // 3: openapi.v3.AnyOrExpression.expression:type_name -> openapi.v3.Expression - 37, // 4: openapi.v3.Callback.path:type_name -> openapi.v3.NamedPathItem - 29, // 5: openapi.v3.Callback.specification_extension:type_name -> openapi.v3.NamedAny - 3, // 6: openapi.v3.CallbackOrReference.callback:type_name -> openapi.v3.Callback - 55, // 7: openapi.v3.CallbackOrReference.reference:type_name -> openapi.v3.Reference - 30, // 8: openapi.v3.CallbacksOrReferences.additional_properties:type_name -> openapi.v3.NamedCallbackOrReference - 65, // 9: openapi.v3.Components.schemas:type_name -> openapi.v3.SchemasOrReferences - 62, // 10: openapi.v3.Components.responses:type_name -> openapi.v3.ResponsesOrReferences - 51, // 11: openapi.v3.Components.parameters:type_name -> openapi.v3.ParametersOrReferences - 15, // 12: openapi.v3.Components.examples:type_name -> openapi.v3.ExamplesOrReferences - 56, // 13: openapi.v3.Components.request_bodies:type_name -> openapi.v3.RequestBodiesOrReferences - 20, // 14: openapi.v3.Components.headers:type_name -> openapi.v3.HeadersOrReferences - 69, // 15: openapi.v3.Components.security_schemes:type_name -> openapi.v3.SecuritySchemesOrReferences - 26, // 16: openapi.v3.Components.links:type_name -> openapi.v3.LinksOrReferences - 5, // 17: openapi.v3.Components.callbacks:type_name -> openapi.v3.CallbacksOrReferences - 29, // 18: openapi.v3.Components.specification_extension:type_name -> openapi.v3.NamedAny - 29, // 19: openapi.v3.Contact.specification_extension:type_name -> openapi.v3.NamedAny - 75, // 20: openapi.v3.Discriminator.mapping:type_name -> openapi.v3.Strings - 29, // 21: openapi.v3.Discriminator.specification_extension:type_name -> openapi.v3.NamedAny - 21, // 22: openapi.v3.Document.info:type_name -> openapi.v3.Info - 70, // 23: openapi.v3.Document.servers:type_name -> openapi.v3.Server - 53, // 24: openapi.v3.Document.paths:type_name -> openapi.v3.Paths - 6, // 25: openapi.v3.Document.components:type_name -> openapi.v3.Components - 66, // 26: openapi.v3.Document.security:type_name -> openapi.v3.SecurityRequirement - 76, // 27: openapi.v3.Document.tags:type_name -> openapi.v3.Tag - 17, // 28: openapi.v3.Document.external_docs:type_name -> openapi.v3.ExternalDocs - 29, // 29: openapi.v3.Document.specification_extension:type_name -> openapi.v3.NamedAny - 20, // 30: openapi.v3.Encoding.headers:type_name -> openapi.v3.HeadersOrReferences - 29, // 31: openapi.v3.Encoding.specification_extension:type_name -> openapi.v3.NamedAny - 31, // 32: openapi.v3.Encodings.additional_properties:type_name -> openapi.v3.NamedEncoding - 1, // 33: openapi.v3.Example.value:type_name -> openapi.v3.Any - 29, // 34: openapi.v3.Example.specification_extension:type_name -> openapi.v3.NamedAny - 13, // 35: openapi.v3.ExampleOrReference.example:type_name -> openapi.v3.Example - 55, // 36: openapi.v3.ExampleOrReference.reference:type_name -> openapi.v3.Reference - 32, // 37: openapi.v3.ExamplesOrReferences.additional_properties:type_name -> openapi.v3.NamedExampleOrReference - 29, // 38: openapi.v3.Expression.additional_properties:type_name -> openapi.v3.NamedAny - 29, // 39: openapi.v3.ExternalDocs.specification_extension:type_name -> openapi.v3.NamedAny - 64, // 40: openapi.v3.Header.schema:type_name -> openapi.v3.SchemaOrReference - 1, // 41: openapi.v3.Header.example:type_name -> openapi.v3.Any - 15, // 42: openapi.v3.Header.examples:type_name -> openapi.v3.ExamplesOrReferences - 28, // 43: openapi.v3.Header.content:type_name -> openapi.v3.MediaTypes - 29, // 44: openapi.v3.Header.specification_extension:type_name -> openapi.v3.NamedAny - 18, // 45: openapi.v3.HeaderOrReference.header:type_name -> openapi.v3.Header - 55, // 46: openapi.v3.HeaderOrReference.reference:type_name -> openapi.v3.Reference - 33, // 47: openapi.v3.HeadersOrReferences.additional_properties:type_name -> openapi.v3.NamedHeaderOrReference - 7, // 48: openapi.v3.Info.contact:type_name -> openapi.v3.Contact - 23, // 49: openapi.v3.Info.license:type_name -> openapi.v3.License - 29, // 50: openapi.v3.Info.specification_extension:type_name -> openapi.v3.NamedAny - 64, // 51: openapi.v3.ItemsItem.schema_or_reference:type_name -> openapi.v3.SchemaOrReference - 29, // 52: openapi.v3.License.specification_extension:type_name -> openapi.v3.NamedAny - 2, // 53: openapi.v3.Link.parameters:type_name -> openapi.v3.AnyOrExpression - 2, // 54: openapi.v3.Link.request_body:type_name -> openapi.v3.AnyOrExpression - 70, // 55: openapi.v3.Link.server:type_name -> openapi.v3.Server - 29, // 56: openapi.v3.Link.specification_extension:type_name -> openapi.v3.NamedAny - 24, // 57: openapi.v3.LinkOrReference.link:type_name -> openapi.v3.Link - 55, // 58: openapi.v3.LinkOrReference.reference:type_name -> openapi.v3.Reference - 34, // 59: openapi.v3.LinksOrReferences.additional_properties:type_name -> openapi.v3.NamedLinkOrReference - 64, // 60: openapi.v3.MediaType.schema:type_name -> openapi.v3.SchemaOrReference - 1, // 61: openapi.v3.MediaType.example:type_name -> openapi.v3.Any - 15, // 62: openapi.v3.MediaType.examples:type_name -> openapi.v3.ExamplesOrReferences - 12, // 63: openapi.v3.MediaType.encoding:type_name -> openapi.v3.Encodings - 29, // 64: openapi.v3.MediaType.specification_extension:type_name -> openapi.v3.NamedAny - 35, // 65: openapi.v3.MediaTypes.additional_properties:type_name -> openapi.v3.NamedMediaType - 1, // 66: openapi.v3.NamedAny.value:type_name -> openapi.v3.Any - 4, // 67: openapi.v3.NamedCallbackOrReference.value:type_name -> openapi.v3.CallbackOrReference - 11, // 68: openapi.v3.NamedEncoding.value:type_name -> openapi.v3.Encoding - 14, // 69: openapi.v3.NamedExampleOrReference.value:type_name -> openapi.v3.ExampleOrReference - 19, // 70: openapi.v3.NamedHeaderOrReference.value:type_name -> openapi.v3.HeaderOrReference - 25, // 71: openapi.v3.NamedLinkOrReference.value:type_name -> openapi.v3.LinkOrReference - 27, // 72: openapi.v3.NamedMediaType.value:type_name -> openapi.v3.MediaType - 50, // 73: openapi.v3.NamedParameterOrReference.value:type_name -> openapi.v3.ParameterOrReference - 52, // 74: openapi.v3.NamedPathItem.value:type_name -> openapi.v3.PathItem - 58, // 75: openapi.v3.NamedRequestBodyOrReference.value:type_name -> openapi.v3.RequestBodyOrReference - 60, // 76: openapi.v3.NamedResponseOrReference.value:type_name -> openapi.v3.ResponseOrReference - 64, // 77: openapi.v3.NamedSchemaOrReference.value:type_name -> openapi.v3.SchemaOrReference - 68, // 78: openapi.v3.NamedSecuritySchemeOrReference.value:type_name -> openapi.v3.SecuritySchemeOrReference - 71, // 79: openapi.v3.NamedServerVariable.value:type_name -> openapi.v3.ServerVariable - 74, // 80: openapi.v3.NamedStringArray.value:type_name -> openapi.v3.StringArray - 75, // 81: openapi.v3.OauthFlow.scopes:type_name -> openapi.v3.Strings - 29, // 82: openapi.v3.OauthFlow.specification_extension:type_name -> openapi.v3.NamedAny - 45, // 83: openapi.v3.OauthFlows.implicit:type_name -> openapi.v3.OauthFlow - 45, // 84: openapi.v3.OauthFlows.password:type_name -> openapi.v3.OauthFlow - 45, // 85: openapi.v3.OauthFlows.client_credentials:type_name -> openapi.v3.OauthFlow - 45, // 86: openapi.v3.OauthFlows.authorization_code:type_name -> openapi.v3.OauthFlow - 29, // 87: openapi.v3.OauthFlows.specification_extension:type_name -> openapi.v3.NamedAny - 29, // 88: openapi.v3.Object.additional_properties:type_name -> openapi.v3.NamedAny - 17, // 89: openapi.v3.Operation.external_docs:type_name -> openapi.v3.ExternalDocs - 50, // 90: openapi.v3.Operation.parameters:type_name -> openapi.v3.ParameterOrReference - 58, // 91: openapi.v3.Operation.request_body:type_name -> openapi.v3.RequestBodyOrReference - 61, // 92: openapi.v3.Operation.responses:type_name -> openapi.v3.Responses - 5, // 93: openapi.v3.Operation.callbacks:type_name -> openapi.v3.CallbacksOrReferences - 66, // 94: openapi.v3.Operation.security:type_name -> openapi.v3.SecurityRequirement - 70, // 95: openapi.v3.Operation.servers:type_name -> openapi.v3.Server - 29, // 96: openapi.v3.Operation.specification_extension:type_name -> openapi.v3.NamedAny - 64, // 97: openapi.v3.Parameter.schema:type_name -> openapi.v3.SchemaOrReference - 1, // 98: openapi.v3.Parameter.example:type_name -> openapi.v3.Any - 15, // 99: openapi.v3.Parameter.examples:type_name -> openapi.v3.ExamplesOrReferences - 28, // 100: openapi.v3.Parameter.content:type_name -> openapi.v3.MediaTypes - 29, // 101: openapi.v3.Parameter.specification_extension:type_name -> openapi.v3.NamedAny - 49, // 102: openapi.v3.ParameterOrReference.parameter:type_name -> openapi.v3.Parameter - 55, // 103: openapi.v3.ParameterOrReference.reference:type_name -> openapi.v3.Reference - 36, // 104: openapi.v3.ParametersOrReferences.additional_properties:type_name -> openapi.v3.NamedParameterOrReference - 48, // 105: openapi.v3.PathItem.get:type_name -> openapi.v3.Operation - 48, // 106: openapi.v3.PathItem.put:type_name -> openapi.v3.Operation - 48, // 107: openapi.v3.PathItem.post:type_name -> openapi.v3.Operation - 48, // 108: openapi.v3.PathItem.delete:type_name -> openapi.v3.Operation - 48, // 109: openapi.v3.PathItem.options:type_name -> openapi.v3.Operation - 48, // 110: openapi.v3.PathItem.head:type_name -> openapi.v3.Operation - 48, // 111: openapi.v3.PathItem.patch:type_name -> openapi.v3.Operation - 48, // 112: openapi.v3.PathItem.trace:type_name -> openapi.v3.Operation - 70, // 113: openapi.v3.PathItem.servers:type_name -> openapi.v3.Server - 50, // 114: openapi.v3.PathItem.parameters:type_name -> openapi.v3.ParameterOrReference - 29, // 115: openapi.v3.PathItem.specification_extension:type_name -> openapi.v3.NamedAny - 37, // 116: openapi.v3.Paths.path:type_name -> openapi.v3.NamedPathItem - 29, // 117: openapi.v3.Paths.specification_extension:type_name -> openapi.v3.NamedAny - 40, // 118: openapi.v3.Properties.additional_properties:type_name -> openapi.v3.NamedSchemaOrReference - 38, // 119: openapi.v3.RequestBodiesOrReferences.additional_properties:type_name -> openapi.v3.NamedRequestBodyOrReference - 28, // 120: openapi.v3.RequestBody.content:type_name -> openapi.v3.MediaTypes - 29, // 121: openapi.v3.RequestBody.specification_extension:type_name -> openapi.v3.NamedAny - 57, // 122: openapi.v3.RequestBodyOrReference.request_body:type_name -> openapi.v3.RequestBody - 55, // 123: openapi.v3.RequestBodyOrReference.reference:type_name -> openapi.v3.Reference - 20, // 124: openapi.v3.Response.headers:type_name -> openapi.v3.HeadersOrReferences - 28, // 125: openapi.v3.Response.content:type_name -> openapi.v3.MediaTypes - 26, // 126: openapi.v3.Response.links:type_name -> openapi.v3.LinksOrReferences - 29, // 127: openapi.v3.Response.specification_extension:type_name -> openapi.v3.NamedAny - 59, // 128: openapi.v3.ResponseOrReference.response:type_name -> openapi.v3.Response - 55, // 129: openapi.v3.ResponseOrReference.reference:type_name -> openapi.v3.Reference - 60, // 130: openapi.v3.Responses.default:type_name -> openapi.v3.ResponseOrReference - 39, // 131: openapi.v3.Responses.response_or_reference:type_name -> openapi.v3.NamedResponseOrReference - 29, // 132: openapi.v3.Responses.specification_extension:type_name -> openapi.v3.NamedAny - 39, // 133: openapi.v3.ResponsesOrReferences.additional_properties:type_name -> openapi.v3.NamedResponseOrReference - 9, // 134: openapi.v3.Schema.discriminator:type_name -> openapi.v3.Discriminator - 77, // 135: openapi.v3.Schema.xml:type_name -> openapi.v3.Xml - 17, // 136: openapi.v3.Schema.external_docs:type_name -> openapi.v3.ExternalDocs - 1, // 137: openapi.v3.Schema.example:type_name -> openapi.v3.Any - 1, // 138: openapi.v3.Schema.enum:type_name -> openapi.v3.Any - 64, // 139: openapi.v3.Schema.all_of:type_name -> openapi.v3.SchemaOrReference - 64, // 140: openapi.v3.Schema.one_of:type_name -> openapi.v3.SchemaOrReference - 64, // 141: openapi.v3.Schema.any_of:type_name -> openapi.v3.SchemaOrReference - 63, // 142: openapi.v3.Schema.not:type_name -> openapi.v3.Schema - 22, // 143: openapi.v3.Schema.items:type_name -> openapi.v3.ItemsItem - 54, // 144: openapi.v3.Schema.properties:type_name -> openapi.v3.Properties - 0, // 145: openapi.v3.Schema.additional_properties:type_name -> openapi.v3.AdditionalPropertiesItem - 8, // 146: openapi.v3.Schema.default:type_name -> openapi.v3.DefaultType - 29, // 147: openapi.v3.Schema.specification_extension:type_name -> openapi.v3.NamedAny - 63, // 148: openapi.v3.SchemaOrReference.schema:type_name -> openapi.v3.Schema - 55, // 149: openapi.v3.SchemaOrReference.reference:type_name -> openapi.v3.Reference - 40, // 150: openapi.v3.SchemasOrReferences.additional_properties:type_name -> openapi.v3.NamedSchemaOrReference - 44, // 151: openapi.v3.SecurityRequirement.additional_properties:type_name -> openapi.v3.NamedStringArray - 46, // 152: openapi.v3.SecurityScheme.flows:type_name -> openapi.v3.OauthFlows - 29, // 153: openapi.v3.SecurityScheme.specification_extension:type_name -> openapi.v3.NamedAny - 67, // 154: openapi.v3.SecuritySchemeOrReference.security_scheme:type_name -> openapi.v3.SecurityScheme - 55, // 155: openapi.v3.SecuritySchemeOrReference.reference:type_name -> openapi.v3.Reference - 41, // 156: openapi.v3.SecuritySchemesOrReferences.additional_properties:type_name -> openapi.v3.NamedSecuritySchemeOrReference - 72, // 157: openapi.v3.Server.variables:type_name -> openapi.v3.ServerVariables - 29, // 158: openapi.v3.Server.specification_extension:type_name -> openapi.v3.NamedAny - 29, // 159: openapi.v3.ServerVariable.specification_extension:type_name -> openapi.v3.NamedAny - 42, // 160: openapi.v3.ServerVariables.additional_properties:type_name -> openapi.v3.NamedServerVariable - 43, // 161: openapi.v3.Strings.additional_properties:type_name -> openapi.v3.NamedString - 17, // 162: openapi.v3.Tag.external_docs:type_name -> openapi.v3.ExternalDocs - 29, // 163: openapi.v3.Tag.specification_extension:type_name -> openapi.v3.NamedAny - 29, // 164: openapi.v3.Xml.specification_extension:type_name -> openapi.v3.NamedAny - 165, // [165:165] is the sub-list for method output_type - 165, // [165:165] is the sub-list for method input_type - 165, // [165:165] is the sub-list for extension type_name - 165, // [165:165] is the sub-list for extension extendee - 0, // [0:165] is the sub-list for field type_name -} - -func init() { file_openapiv3_OpenAPIv3_proto_init() } -func file_openapiv3_OpenAPIv3_proto_init() { - if File_openapiv3_OpenAPIv3_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_openapiv3_OpenAPIv3_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AdditionalPropertiesItem); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Any); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AnyOrExpression); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Callback); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CallbackOrReference); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CallbacksOrReferences); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Components); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Contact); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DefaultType); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Discriminator); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Document); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Encoding); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Encodings); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Example); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ExampleOrReference); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ExamplesOrReferences); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Expression); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ExternalDocs); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Header); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HeaderOrReference); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HeadersOrReferences); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Info); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ItemsItem); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*License); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Link); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LinkOrReference); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LinksOrReferences); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MediaType); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MediaTypes); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamedAny); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamedCallbackOrReference); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamedEncoding); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamedExampleOrReference); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[33].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamedHeaderOrReference); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[34].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamedLinkOrReference); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[35].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamedMediaType); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[36].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamedParameterOrReference); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[37].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamedPathItem); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[38].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamedRequestBodyOrReference); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[39].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamedResponseOrReference); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[40].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamedSchemaOrReference); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[41].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamedSecuritySchemeOrReference); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[42].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamedServerVariable); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[43].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamedString); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[44].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamedStringArray); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[45].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*OauthFlow); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[46].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*OauthFlows); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[47].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Object); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[48].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Operation); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[49].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Parameter); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[50].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ParameterOrReference); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[51].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ParametersOrReferences); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[52].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PathItem); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[53].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Paths); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[54].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Properties); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[55].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Reference); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[56].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RequestBodiesOrReferences); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[57].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RequestBody); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[58].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RequestBodyOrReference); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[59].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Response); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[60].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ResponseOrReference); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[61].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Responses); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[62].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ResponsesOrReferences); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[63].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Schema); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[64].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SchemaOrReference); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[65].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SchemasOrReferences); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[66].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SecurityRequirement); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[67].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SecurityScheme); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[68].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SecuritySchemeOrReference); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[69].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SecuritySchemesOrReferences); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[70].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Server); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[71].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ServerVariable); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[72].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ServerVariables); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[73].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SpecificationExtension); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[74].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StringArray); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[75].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Strings); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[76].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Tag); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[77].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Xml); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_openapiv3_OpenAPIv3_proto_msgTypes[0].OneofWrappers = []interface{}{ - (*AdditionalPropertiesItem_SchemaOrReference)(nil), - (*AdditionalPropertiesItem_Boolean)(nil), - } - file_openapiv3_OpenAPIv3_proto_msgTypes[2].OneofWrappers = []interface{}{ - (*AnyOrExpression_Any)(nil), - (*AnyOrExpression_Expression)(nil), - } - file_openapiv3_OpenAPIv3_proto_msgTypes[4].OneofWrappers = []interface{}{ - (*CallbackOrReference_Callback)(nil), - (*CallbackOrReference_Reference)(nil), - } - file_openapiv3_OpenAPIv3_proto_msgTypes[8].OneofWrappers = []interface{}{ - (*DefaultType_Number)(nil), - (*DefaultType_Boolean)(nil), - (*DefaultType_String_)(nil), - } - file_openapiv3_OpenAPIv3_proto_msgTypes[14].OneofWrappers = []interface{}{ - (*ExampleOrReference_Example)(nil), - (*ExampleOrReference_Reference)(nil), - } - file_openapiv3_OpenAPIv3_proto_msgTypes[19].OneofWrappers = []interface{}{ - (*HeaderOrReference_Header)(nil), - (*HeaderOrReference_Reference)(nil), - } - file_openapiv3_OpenAPIv3_proto_msgTypes[25].OneofWrappers = []interface{}{ - (*LinkOrReference_Link)(nil), - (*LinkOrReference_Reference)(nil), - } - file_openapiv3_OpenAPIv3_proto_msgTypes[50].OneofWrappers = []interface{}{ - (*ParameterOrReference_Parameter)(nil), - (*ParameterOrReference_Reference)(nil), - } - file_openapiv3_OpenAPIv3_proto_msgTypes[58].OneofWrappers = []interface{}{ - (*RequestBodyOrReference_RequestBody)(nil), - (*RequestBodyOrReference_Reference)(nil), - } - file_openapiv3_OpenAPIv3_proto_msgTypes[60].OneofWrappers = []interface{}{ - (*ResponseOrReference_Response)(nil), - (*ResponseOrReference_Reference)(nil), - } - file_openapiv3_OpenAPIv3_proto_msgTypes[64].OneofWrappers = []interface{}{ - (*SchemaOrReference_Schema)(nil), - (*SchemaOrReference_Reference)(nil), - } - file_openapiv3_OpenAPIv3_proto_msgTypes[68].OneofWrappers = []interface{}{ - (*SecuritySchemeOrReference_SecurityScheme)(nil), - (*SecuritySchemeOrReference_Reference)(nil), - } - file_openapiv3_OpenAPIv3_proto_msgTypes[73].OneofWrappers = []interface{}{ - (*SpecificationExtension_Number)(nil), - (*SpecificationExtension_Boolean)(nil), - (*SpecificationExtension_String_)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_openapiv3_OpenAPIv3_proto_rawDesc, - NumEnums: 0, - NumMessages: 78, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_openapiv3_OpenAPIv3_proto_goTypes, - DependencyIndexes: file_openapiv3_OpenAPIv3_proto_depIdxs, - MessageInfos: file_openapiv3_OpenAPIv3_proto_msgTypes, - }.Build() - File_openapiv3_OpenAPIv3_proto = out.File - file_openapiv3_OpenAPIv3_proto_rawDesc = nil - file_openapiv3_OpenAPIv3_proto_goTypes = nil - file_openapiv3_OpenAPIv3_proto_depIdxs = nil -} diff --git a/vendor/github.com/google/gnostic/openapiv3/OpenAPIv3.proto b/vendor/github.com/google/gnostic/openapiv3/OpenAPIv3.proto deleted file mode 100644 index 1be335b89..000000000 --- a/vendor/github.com/google/gnostic/openapiv3/OpenAPIv3.proto +++ /dev/null @@ -1,672 +0,0 @@ -// Copyright 2020 Google LLC. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// THIS FILE IS AUTOMATICALLY GENERATED. - -syntax = "proto3"; - -package openapi.v3; - -import "google/protobuf/any.proto"; - -// This option lets the proto compiler generate Java code inside the package -// name (see below) instead of inside an outer class. It creates a simpler -// developer experience by reducing one-level of name nesting and be -// consistent with most programming languages that don't support outer classes. -option java_multiple_files = true; - -// The Java outer classname should be the filename in UpperCamelCase. This -// class is only used to hold proto descriptor, so developers don't need to -// work with it directly. -option java_outer_classname = "OpenAPIProto"; - -// The Java package name must be proto package name with proper prefix. -option java_package = "org.openapi_v3"; - -// A reasonable prefix for the Objective-C symbols generated from the package. -// It should at a minimum be 3 characters long, all uppercase, and convention -// is to use an abbreviation of the package name. Something short, but -// hopefully unique enough to not conflict with things that may come along in -// the future. 'GPB' is reserved for the protocol buffer implementation itself. -option objc_class_prefix = "OAS"; - -// The Go package name. -option go_package = "./openapiv3;openapi_v3"; - -message AdditionalPropertiesItem { - oneof oneof { - SchemaOrReference schema_or_reference = 1; - bool boolean = 2; - } -} - -message Any { - google.protobuf.Any value = 1; - string yaml = 2; -} - -message AnyOrExpression { - oneof oneof { - Any any = 1; - Expression expression = 2; - } -} - -// A map of possible out-of band callbacks related to the parent operation. Each value in the map is a Path Item Object that describes a set of requests that may be initiated by the API provider and the expected responses. The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation. -message Callback { - repeated NamedPathItem path = 1; - repeated NamedAny specification_extension = 2; -} - -message CallbackOrReference { - oneof oneof { - Callback callback = 1; - Reference reference = 2; - } -} - -message CallbacksOrReferences { - repeated NamedCallbackOrReference additional_properties = 1; -} - -// Holds a set of reusable objects for different aspects of the OAS. All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object. -message Components { - SchemasOrReferences schemas = 1; - ResponsesOrReferences responses = 2; - ParametersOrReferences parameters = 3; - ExamplesOrReferences examples = 4; - RequestBodiesOrReferences request_bodies = 5; - HeadersOrReferences headers = 6; - SecuritySchemesOrReferences security_schemes = 7; - LinksOrReferences links = 8; - CallbacksOrReferences callbacks = 9; - repeated NamedAny specification_extension = 10; -} - -// Contact information for the exposed API. -message Contact { - string name = 1; - string url = 2; - string email = 3; - repeated NamedAny specification_extension = 4; -} - -message DefaultType { - oneof oneof { - double number = 1; - bool boolean = 2; - string string = 3; - } -} - -// When request bodies or response payloads may be one of a number of different schemas, a `discriminator` object can be used to aid in serialization, deserialization, and validation. The discriminator is a specific object in a schema which is used to inform the consumer of the specification of an alternative schema based on the value associated with it. When using the discriminator, _inline_ schemas will not be considered. -message Discriminator { - string property_name = 1; - Strings mapping = 2; - repeated NamedAny specification_extension = 3; -} - -message Document { - string openapi = 1; - Info info = 2; - repeated Server servers = 3; - Paths paths = 4; - Components components = 5; - repeated SecurityRequirement security = 6; - repeated Tag tags = 7; - ExternalDocs external_docs = 8; - repeated NamedAny specification_extension = 9; -} - -// A single encoding definition applied to a single schema property. -message Encoding { - string content_type = 1; - HeadersOrReferences headers = 2; - string style = 3; - bool explode = 4; - bool allow_reserved = 5; - repeated NamedAny specification_extension = 6; -} - -message Encodings { - repeated NamedEncoding additional_properties = 1; -} - -message Example { - string summary = 1; - string description = 2; - Any value = 3; - string external_value = 4; - repeated NamedAny specification_extension = 5; -} - -message ExampleOrReference { - oneof oneof { - Example example = 1; - Reference reference = 2; - } -} - -message ExamplesOrReferences { - repeated NamedExampleOrReference additional_properties = 1; -} - -message Expression { - repeated NamedAny additional_properties = 1; -} - -// Allows referencing an external resource for extended documentation. -message ExternalDocs { - string description = 1; - string url = 2; - repeated NamedAny specification_extension = 3; -} - -// The Header Object follows the structure of the Parameter Object with the following changes: 1. `name` MUST NOT be specified, it is given in the corresponding `headers` map. 1. `in` MUST NOT be specified, it is implicitly in `header`. 1. All traits that are affected by the location MUST be applicable to a location of `header` (for example, `style`). -message Header { - string description = 1; - bool required = 2; - bool deprecated = 3; - bool allow_empty_value = 4; - string style = 5; - bool explode = 6; - bool allow_reserved = 7; - SchemaOrReference schema = 8; - Any example = 9; - ExamplesOrReferences examples = 10; - MediaTypes content = 11; - repeated NamedAny specification_extension = 12; -} - -message HeaderOrReference { - oneof oneof { - Header header = 1; - Reference reference = 2; - } -} - -message HeadersOrReferences { - repeated NamedHeaderOrReference additional_properties = 1; -} - -// The object provides metadata about the API. The metadata MAY be used by the clients if needed, and MAY be presented in editing or documentation generation tools for convenience. -message Info { - string title = 1; - string description = 2; - string terms_of_service = 3; - Contact contact = 4; - License license = 5; - string version = 6; - repeated NamedAny specification_extension = 7; - string summary = 8; -} - -message ItemsItem { - repeated SchemaOrReference schema_or_reference = 1; -} - -// License information for the exposed API. -message License { - string name = 1; - string url = 2; - repeated NamedAny specification_extension = 3; -} - -// The `Link object` represents a possible design-time link for a response. The presence of a link does not guarantee the caller's ability to successfully invoke it, rather it provides a known relationship and traversal mechanism between responses and other operations. Unlike _dynamic_ links (i.e. links provided **in** the response payload), the OAS linking mechanism does not require link information in the runtime response. For computing links, and providing instructions to execute them, a runtime expression is used for accessing values in an operation and using them as parameters while invoking the linked operation. -message Link { - string operation_ref = 1; - string operation_id = 2; - AnyOrExpression parameters = 3; - AnyOrExpression request_body = 4; - string description = 5; - Server server = 6; - repeated NamedAny specification_extension = 7; -} - -message LinkOrReference { - oneof oneof { - Link link = 1; - Reference reference = 2; - } -} - -message LinksOrReferences { - repeated NamedLinkOrReference additional_properties = 1; -} - -// Each Media Type Object provides schema and examples for the media type identified by its key. -message MediaType { - SchemaOrReference schema = 1; - Any example = 2; - ExamplesOrReferences examples = 3; - Encodings encoding = 4; - repeated NamedAny specification_extension = 5; -} - -message MediaTypes { - repeated NamedMediaType additional_properties = 1; -} - -// Automatically-generated message used to represent maps of Any as ordered (name,value) pairs. -message NamedAny { - // Map key - string name = 1; - // Mapped value - Any value = 2; -} - -// Automatically-generated message used to represent maps of CallbackOrReference as ordered (name,value) pairs. -message NamedCallbackOrReference { - // Map key - string name = 1; - // Mapped value - CallbackOrReference value = 2; -} - -// Automatically-generated message used to represent maps of Encoding as ordered (name,value) pairs. -message NamedEncoding { - // Map key - string name = 1; - // Mapped value - Encoding value = 2; -} - -// Automatically-generated message used to represent maps of ExampleOrReference as ordered (name,value) pairs. -message NamedExampleOrReference { - // Map key - string name = 1; - // Mapped value - ExampleOrReference value = 2; -} - -// Automatically-generated message used to represent maps of HeaderOrReference as ordered (name,value) pairs. -message NamedHeaderOrReference { - // Map key - string name = 1; - // Mapped value - HeaderOrReference value = 2; -} - -// Automatically-generated message used to represent maps of LinkOrReference as ordered (name,value) pairs. -message NamedLinkOrReference { - // Map key - string name = 1; - // Mapped value - LinkOrReference value = 2; -} - -// Automatically-generated message used to represent maps of MediaType as ordered (name,value) pairs. -message NamedMediaType { - // Map key - string name = 1; - // Mapped value - MediaType value = 2; -} - -// Automatically-generated message used to represent maps of ParameterOrReference as ordered (name,value) pairs. -message NamedParameterOrReference { - // Map key - string name = 1; - // Mapped value - ParameterOrReference value = 2; -} - -// Automatically-generated message used to represent maps of PathItem as ordered (name,value) pairs. -message NamedPathItem { - // Map key - string name = 1; - // Mapped value - PathItem value = 2; -} - -// Automatically-generated message used to represent maps of RequestBodyOrReference as ordered (name,value) pairs. -message NamedRequestBodyOrReference { - // Map key - string name = 1; - // Mapped value - RequestBodyOrReference value = 2; -} - -// Automatically-generated message used to represent maps of ResponseOrReference as ordered (name,value) pairs. -message NamedResponseOrReference { - // Map key - string name = 1; - // Mapped value - ResponseOrReference value = 2; -} - -// Automatically-generated message used to represent maps of SchemaOrReference as ordered (name,value) pairs. -message NamedSchemaOrReference { - // Map key - string name = 1; - // Mapped value - SchemaOrReference value = 2; -} - -// Automatically-generated message used to represent maps of SecuritySchemeOrReference as ordered (name,value) pairs. -message NamedSecuritySchemeOrReference { - // Map key - string name = 1; - // Mapped value - SecuritySchemeOrReference value = 2; -} - -// Automatically-generated message used to represent maps of ServerVariable as ordered (name,value) pairs. -message NamedServerVariable { - // Map key - string name = 1; - // Mapped value - ServerVariable value = 2; -} - -// Automatically-generated message used to represent maps of string as ordered (name,value) pairs. -message NamedString { - // Map key - string name = 1; - // Mapped value - string value = 2; -} - -// Automatically-generated message used to represent maps of StringArray as ordered (name,value) pairs. -message NamedStringArray { - // Map key - string name = 1; - // Mapped value - StringArray value = 2; -} - -// Configuration details for a supported OAuth Flow -message OauthFlow { - string authorization_url = 1; - string token_url = 2; - string refresh_url = 3; - Strings scopes = 4; - repeated NamedAny specification_extension = 5; -} - -// Allows configuration of the supported OAuth Flows. -message OauthFlows { - OauthFlow implicit = 1; - OauthFlow password = 2; - OauthFlow client_credentials = 3; - OauthFlow authorization_code = 4; - repeated NamedAny specification_extension = 5; -} - -message Object { - repeated NamedAny additional_properties = 1; -} - -// Describes a single API operation on a path. -message Operation { - repeated string tags = 1; - string summary = 2; - string description = 3; - ExternalDocs external_docs = 4; - string operation_id = 5; - repeated ParameterOrReference parameters = 6; - RequestBodyOrReference request_body = 7; - Responses responses = 8; - CallbacksOrReferences callbacks = 9; - bool deprecated = 10; - repeated SecurityRequirement security = 11; - repeated Server servers = 12; - repeated NamedAny specification_extension = 13; -} - -// Describes a single operation parameter. A unique parameter is defined by a combination of a name and location. -message Parameter { - string name = 1; - string in = 2; - string description = 3; - bool required = 4; - bool deprecated = 5; - bool allow_empty_value = 6; - string style = 7; - bool explode = 8; - bool allow_reserved = 9; - SchemaOrReference schema = 10; - Any example = 11; - ExamplesOrReferences examples = 12; - MediaTypes content = 13; - repeated NamedAny specification_extension = 14; -} - -message ParameterOrReference { - oneof oneof { - Parameter parameter = 1; - Reference reference = 2; - } -} - -message ParametersOrReferences { - repeated NamedParameterOrReference additional_properties = 1; -} - -// Describes the operations available on a single path. A Path Item MAY be empty, due to ACL constraints. The path itself is still exposed to the documentation viewer but they will not know which operations and parameters are available. -message PathItem { - string _ref = 1; - string summary = 2; - string description = 3; - Operation get = 4; - Operation put = 5; - Operation post = 6; - Operation delete = 7; - Operation options = 8; - Operation head = 9; - Operation patch = 10; - Operation trace = 11; - repeated Server servers = 12; - repeated ParameterOrReference parameters = 13; - repeated NamedAny specification_extension = 14; -} - -// Holds the relative paths to the individual endpoints and their operations. The path is appended to the URL from the `Server Object` in order to construct the full URL. The Paths MAY be empty, due to ACL constraints. -message Paths { - repeated NamedPathItem path = 1; - repeated NamedAny specification_extension = 2; -} - -message Properties { - repeated NamedSchemaOrReference additional_properties = 1; -} - -// A simple object to allow referencing other components in the specification, internally and externally. The Reference Object is defined by JSON Reference and follows the same structure, behavior and rules. For this specification, reference resolution is accomplished as defined by the JSON Reference specification and not by the JSON Schema specification. -message Reference { - string _ref = 1; - string summary = 2; - string description = 3; -} - -message RequestBodiesOrReferences { - repeated NamedRequestBodyOrReference additional_properties = 1; -} - -// Describes a single request body. -message RequestBody { - string description = 1; - MediaTypes content = 2; - bool required = 3; - repeated NamedAny specification_extension = 4; -} - -message RequestBodyOrReference { - oneof oneof { - RequestBody request_body = 1; - Reference reference = 2; - } -} - -// Describes a single response from an API Operation, including design-time, static `links` to operations based on the response. -message Response { - string description = 1; - HeadersOrReferences headers = 2; - MediaTypes content = 3; - LinksOrReferences links = 4; - repeated NamedAny specification_extension = 5; -} - -message ResponseOrReference { - oneof oneof { - Response response = 1; - Reference reference = 2; - } -} - -// A container for the expected responses of an operation. The container maps a HTTP response code to the expected response. The documentation is not necessarily expected to cover all possible HTTP response codes because they may not be known in advance. However, documentation is expected to cover a successful operation response and any known errors. The `default` MAY be used as a default response object for all HTTP codes that are not covered individually by the specification. The `Responses Object` MUST contain at least one response code, and it SHOULD be the response for a successful operation call. -message Responses { - ResponseOrReference default = 1; - repeated NamedResponseOrReference response_or_reference = 2; - repeated NamedAny specification_extension = 3; -} - -message ResponsesOrReferences { - repeated NamedResponseOrReference additional_properties = 1; -} - -// The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is an extended subset of the JSON Schema Specification Wright Draft 00. For more information about the properties, see JSON Schema Core and JSON Schema Validation. Unless stated otherwise, the property definitions follow the JSON Schema. -message Schema { - bool nullable = 1; - Discriminator discriminator = 2; - bool read_only = 3; - bool write_only = 4; - Xml xml = 5; - ExternalDocs external_docs = 6; - Any example = 7; - bool deprecated = 8; - string title = 9; - double multiple_of = 10; - double maximum = 11; - bool exclusive_maximum = 12; - double minimum = 13; - bool exclusive_minimum = 14; - int64 max_length = 15; - int64 min_length = 16; - string pattern = 17; - int64 max_items = 18; - int64 min_items = 19; - bool unique_items = 20; - int64 max_properties = 21; - int64 min_properties = 22; - repeated string required = 23; - repeated Any enum = 24; - string type = 25; - repeated SchemaOrReference all_of = 26; - repeated SchemaOrReference one_of = 27; - repeated SchemaOrReference any_of = 28; - Schema not = 29; - ItemsItem items = 30; - Properties properties = 31; - AdditionalPropertiesItem additional_properties = 32; - DefaultType default = 33; - string description = 34; - string format = 35; - repeated NamedAny specification_extension = 36; -} - -message SchemaOrReference { - oneof oneof { - Schema schema = 1; - Reference reference = 2; - } -} - -message SchemasOrReferences { - repeated NamedSchemaOrReference additional_properties = 1; -} - -// Lists the required security schemes to execute this operation. The name used for each property MUST correspond to a security scheme declared in the Security Schemes under the Components Object. Security Requirement Objects that contain multiple schemes require that all schemes MUST be satisfied for a request to be authorized. This enables support for scenarios where multiple query parameters or HTTP headers are required to convey security information. When a list of Security Requirement Objects is defined on the OpenAPI Object or Operation Object, only one of the Security Requirement Objects in the list needs to be satisfied to authorize the request. -message SecurityRequirement { - repeated NamedStringArray additional_properties = 1; -} - -// Defines a security scheme that can be used by the operations. Supported schemes are HTTP authentication, an API key (either as a header, a cookie parameter or as a query parameter), mutual TLS (use of a client certificate), OAuth2's common flows (implicit, password, application and access code) as defined in RFC6749, and OpenID Connect. Please note that currently (2019) the implicit flow is about to be deprecated OAuth 2.0 Security Best Current Practice. Recommended for most use case is Authorization Code Grant flow with PKCE. -message SecurityScheme { - string type = 1; - string description = 2; - string name = 3; - string in = 4; - string scheme = 5; - string bearer_format = 6; - OauthFlows flows = 7; - string open_id_connect_url = 8; - repeated NamedAny specification_extension = 9; -} - -message SecuritySchemeOrReference { - oneof oneof { - SecurityScheme security_scheme = 1; - Reference reference = 2; - } -} - -message SecuritySchemesOrReferences { - repeated NamedSecuritySchemeOrReference additional_properties = 1; -} - -// An object representing a Server. -message Server { - string url = 1; - string description = 2; - ServerVariables variables = 3; - repeated NamedAny specification_extension = 4; -} - -// An object representing a Server Variable for server URL template substitution. -message ServerVariable { - repeated string enum = 1; - string default = 2; - string description = 3; - repeated NamedAny specification_extension = 4; -} - -message ServerVariables { - repeated NamedServerVariable additional_properties = 1; -} - -// Any property starting with x- is valid. -message SpecificationExtension { - oneof oneof { - double number = 1; - bool boolean = 2; - string string = 3; - } -} - -message StringArray { - repeated string value = 1; -} - -message Strings { - repeated NamedString additional_properties = 1; -} - -// Adds metadata to a single tag that is used by the Operation Object. It is not mandatory to have a Tag Object per tag defined in the Operation Object instances. -message Tag { - string name = 1; - string description = 2; - ExternalDocs external_docs = 3; - repeated NamedAny specification_extension = 4; -} - -// A metadata object that allows for more fine-tuned XML model definitions. When using arrays, XML element names are *not* inferred (for singular/plural forms) and the `name` property SHOULD be used to add that information. See examples for expected behavior. -message Xml { - string name = 1; - string namespace = 2; - string prefix = 3; - bool attribute = 4; - bool wrapped = 5; - repeated NamedAny specification_extension = 6; -} - diff --git a/vendor/github.com/google/gnostic/openapiv3/README.md b/vendor/github.com/google/gnostic/openapiv3/README.md deleted file mode 100644 index 5ee12d92e..000000000 --- a/vendor/github.com/google/gnostic/openapiv3/README.md +++ /dev/null @@ -1,21 +0,0 @@ -# OpenAPI v3 Protocol Buffer Models - -This directory contains a Protocol Buffer-language model and related code for -supporting OpenAPI v3. - -Gnostic applications and plugins can use OpenAPIv3.proto to generate Protocol -Buffer support code for their preferred languages. - -OpenAPIv3.go is used by Gnostic to read JSON and YAML OpenAPI descriptions into -the Protocol Buffer-based datastructures generated from OpenAPIv3.proto. - -OpenAPIv3.proto and OpenAPIv3.go are generated by the Gnostic compiler -generator, and OpenAPIv3.pb.go is generated by protoc, the Protocol Buffer -compiler, and protoc-gen-go, the Protocol Buffer Go code generation plugin. - -openapi-3.1.json is a JSON schema for OpenAPI 3.1 that is automatically -generated from the OpenAPI 3.1 specification. It is not an official JSON Schema -for OpenAPI. - -The schema-generator directory contains support code which generates -openapi-3.1.json from the OpenAPI 3.1 specification document (Markdown). diff --git a/vendor/github.com/google/gnostic/openapiv3/document.go b/vendor/github.com/google/gnostic/openapiv3/document.go deleted file mode 100644 index ef10d1d90..000000000 --- a/vendor/github.com/google/gnostic/openapiv3/document.go +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2020 Google LLC. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package openapi_v3 - -import ( - "gopkg.in/yaml.v3" - - "github.com/google/gnostic/compiler" -) - -// ParseDocument reads an OpenAPI v3 description from a YAML/JSON representation. -func ParseDocument(b []byte) (*Document, error) { - info, err := compiler.ReadInfoFromBytes("", b) - if err != nil { - return nil, err - } - root := info.Content[0] - return NewDocument(root, compiler.NewContextWithExtensions("$root", root, nil, nil)) -} - -// YAMLValue produces a serialized YAML representation of the document. -func (d *Document) YAMLValue(comment string) ([]byte, error) { - rawInfo := d.ToRawInfo() - rawInfo = &yaml.Node{ - Kind: yaml.DocumentNode, - Content: []*yaml.Node{rawInfo}, - HeadComment: comment, - } - return yaml.Marshal(rawInfo) -} diff --git a/vendor/github.com/google/gnostic/openapiv3/openapi-3.0.json b/vendor/github.com/google/gnostic/openapiv3/openapi-3.0.json deleted file mode 100644 index d5caed162..000000000 --- a/vendor/github.com/google/gnostic/openapiv3/openapi-3.0.json +++ /dev/null @@ -1,1251 +0,0 @@ -{ - "title": "A JSON Schema for OpenAPI 3.0.", - "id": "http://openapis.org/v3/schema.json#", - "$schema": "http://json-schema.org/draft-04/schema#", - "type": "object", - "description": "This is the root document object of the OpenAPI document.", - "required": [ - "openapi", - "info", - "paths" - ], - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - }, - "properties": { - "openapi": { - "type": "string" - }, - "info": { - "$ref": "#/definitions/info" - }, - "servers": { - "type": "array", - "items": { - "$ref": "#/definitions/server" - }, - "uniqueItems": true - }, - "paths": { - "$ref": "#/definitions/paths" - }, - "components": { - "$ref": "#/definitions/components" - }, - "security": { - "type": "array", - "items": { - "$ref": "#/definitions/securityRequirement" - }, - "uniqueItems": true - }, - "tags": { - "type": "array", - "items": { - "$ref": "#/definitions/tag" - }, - "uniqueItems": true - }, - "externalDocs": { - "$ref": "#/definitions/externalDocs" - } - }, - "definitions": { - "info": { - "type": "object", - "description": "The object provides metadata about the API. The metadata MAY be used by the clients if needed, and MAY be presented in editing or documentation generation tools for convenience.", - "required": [ - "title", - "version" - ], - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - }, - "properties": { - "title": { - "type": "string" - }, - "description": { - "type": "string" - }, - "termsOfService": { - "type": "string" - }, - "contact": { - "$ref": "#/definitions/contact" - }, - "license": { - "$ref": "#/definitions/license" - }, - "version": { - "type": "string" - } - } - }, - "contact": { - "type": "object", - "description": "Contact information for the exposed API.", - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - }, - "properties": { - "name": { - "type": "string" - }, - "url": { - "type": "string", - "format": "uri" - }, - "email": { - "type": "string", - "format": "email" - } - } - }, - "license": { - "type": "object", - "description": "License information for the exposed API.", - "required": [ - "name" - ], - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - }, - "properties": { - "name": { - "type": "string" - }, - "url": { - "type": "string" - } - } - }, - "server": { - "type": "object", - "description": "An object representing a Server.", - "required": [ - "url" - ], - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - }, - "properties": { - "url": { - "type": "string" - }, - "description": { - "type": "string" - }, - "variables": { - "$ref": "#/definitions/serverVariables" - } - } - }, - "serverVariable": { - "type": "object", - "description": "An object representing a Server Variable for server URL template substitution.", - "required": [ - "default" - ], - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - }, - "properties": { - "enum": { - "type": "array", - "items": { - "type": "string" - }, - "uniqueItems": true - }, - "default": { - "type": "string" - }, - "description": { - "type": "string" - } - } - }, - "components": { - "type": "object", - "description": "Holds a set of reusable objects for different aspects of the OAS. All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object.", - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - }, - "properties": { - "schemas": { - "$ref": "#/definitions/schemasOrReferences" - }, - "responses": { - "$ref": "#/definitions/responsesOrReferences" - }, - "parameters": { - "$ref": "#/definitions/parametersOrReferences" - }, - "examples": { - "$ref": "#/definitions/examplesOrReferences" - }, - "requestBodies": { - "$ref": "#/definitions/requestBodiesOrReferences" - }, - "headers": { - "$ref": "#/definitions/headersOrReferences" - }, - "securitySchemes": { - "$ref": "#/definitions/securitySchemesOrReferences" - }, - "links": { - "$ref": "#/definitions/linksOrReferences" - }, - "callbacks": { - "$ref": "#/definitions/callbacksOrReferences" - } - } - }, - "paths": { - "type": "object", - "description": "Holds the relative paths to the individual endpoints and their operations. The path is appended to the URL from the `Server Object` in order to construct the full URL. The Paths MAY be empty, due to ACL constraints.", - "additionalProperties": false, - "patternProperties": { - "^/": { - "$ref": "#/definitions/pathItem" - }, - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - } - }, - "pathItem": { - "type": "object", - "description": "Describes the operations available on a single path. A Path Item MAY be empty, due to ACL constraints. The path itself is still exposed to the documentation viewer but they will not know which operations and parameters are available.", - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - }, - "properties": { - "$ref": { - "type": "string" - }, - "summary": { - "type": "string" - }, - "description": { - "type": "string" - }, - "get": { - "$ref": "#/definitions/operation" - }, - "put": { - "$ref": "#/definitions/operation" - }, - "post": { - "$ref": "#/definitions/operation" - }, - "delete": { - "$ref": "#/definitions/operation" - }, - "options": { - "$ref": "#/definitions/operation" - }, - "head": { - "$ref": "#/definitions/operation" - }, - "patch": { - "$ref": "#/definitions/operation" - }, - "trace": { - "$ref": "#/definitions/operation" - }, - "servers": { - "type": "array", - "items": { - "$ref": "#/definitions/server" - }, - "uniqueItems": true - }, - "parameters": { - "type": "array", - "items": { - "$ref": "#/definitions/parameterOrReference" - }, - "uniqueItems": true - } - } - }, - "operation": { - "type": "object", - "description": "Describes a single API operation on a path.", - "required": [ - "responses" - ], - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - }, - "properties": { - "tags": { - "type": "array", - "items": { - "type": "string" - }, - "uniqueItems": true - }, - "summary": { - "type": "string" - }, - "description": { - "type": "string" - }, - "externalDocs": { - "$ref": "#/definitions/externalDocs" - }, - "operationId": { - "type": "string" - }, - "parameters": { - "type": "array", - "items": { - "$ref": "#/definitions/parameterOrReference" - }, - "uniqueItems": true - }, - "requestBody": { - "$ref": "#/definitions/requestBodyOrReference" - }, - "responses": { - "$ref": "#/definitions/responses" - }, - "callbacks": { - "$ref": "#/definitions/callbacksOrReferences" - }, - "deprecated": { - "type": "boolean" - }, - "security": { - "type": "array", - "items": { - "$ref": "#/definitions/securityRequirement" - }, - "uniqueItems": true - }, - "servers": { - "type": "array", - "items": { - "$ref": "#/definitions/server" - }, - "uniqueItems": true - } - } - }, - "externalDocs": { - "type": "object", - "description": "Allows referencing an external resource for extended documentation.", - "required": [ - "url" - ], - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - }, - "properties": { - "description": { - "type": "string" - }, - "url": { - "type": "string" - } - } - }, - "parameter": { - "type": "object", - "description": "Describes a single operation parameter. A unique parameter is defined by a combination of a name and location.", - "required": [ - "name", - "in" - ], - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - }, - "properties": { - "name": { - "type": "string" - }, - "in": { - "type": "string" - }, - "description": { - "type": "string" - }, - "required": { - "type": "boolean" - }, - "deprecated": { - "type": "boolean" - }, - "allowEmptyValue": { - "type": "boolean" - }, - "style": { - "type": "string" - }, - "explode": { - "type": "boolean" - }, - "allowReserved": { - "type": "boolean" - }, - "schema": { - "$ref": "#/definitions/schemaOrReference" - }, - "example": { - "$ref": "#/definitions/any" - }, - "examples": { - "$ref": "#/definitions/examplesOrReferences" - }, - "content": { - "$ref": "#/definitions/mediaTypes" - } - } - }, - "requestBody": { - "type": "object", - "description": "Describes a single request body.", - "required": [ - "content" - ], - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - }, - "properties": { - "description": { - "type": "string" - }, - "content": { - "$ref": "#/definitions/mediaTypes" - }, - "required": { - "type": "boolean" - } - } - }, - "mediaType": { - "type": "object", - "description": "Each Media Type Object provides schema and examples for the media type identified by its key.", - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - }, - "properties": { - "schema": { - "$ref": "#/definitions/schemaOrReference" - }, - "example": { - "$ref": "#/definitions/any" - }, - "examples": { - "$ref": "#/definitions/examplesOrReferences" - }, - "encoding": { - "$ref": "#/definitions/encodings" - } - } - }, - "encoding": { - "type": "object", - "description": "A single encoding definition applied to a single schema property.", - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - }, - "properties": { - "contentType": { - "type": "string" - }, - "headers": { - "$ref": "#/definitions/headersOrReferences" - }, - "style": { - "type": "string" - }, - "explode": { - "type": "boolean" - }, - "allowReserved": { - "type": "boolean" - } - } - }, - "responses": { - "type": "object", - "description": "A container for the expected responses of an operation. The container maps a HTTP response code to the expected response. The documentation is not necessarily expected to cover all possible HTTP response codes because they may not be known in advance. However, documentation is expected to cover a successful operation response and any known errors. The `default` MAY be used as a default response object for all HTTP codes that are not covered individually by the specification. The `Responses Object` MUST contain at least one response code, and it SHOULD be the response for a successful operation call.", - "additionalProperties": false, - "patternProperties": { - "^([0-9X]{3})$": { - "$ref": "#/definitions/responseOrReference" - }, - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - }, - "properties": { - "default": { - "$ref": "#/definitions/responseOrReference" - } - } - }, - "response": { - "type": "object", - "description": "Describes a single response from an API Operation, including design-time, static `links` to operations based on the response.", - "required": [ - "description" - ], - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - }, - "properties": { - "description": { - "type": "string" - }, - "headers": { - "$ref": "#/definitions/headersOrReferences" - }, - "content": { - "$ref": "#/definitions/mediaTypes" - }, - "links": { - "$ref": "#/definitions/linksOrReferences" - } - } - }, - "callback": { - "type": "object", - "description": "A map of possible out-of band callbacks related to the parent operation. Each value in the map is a Path Item Object that describes a set of requests that may be initiated by the API provider and the expected responses. The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.", - "additionalProperties": false, - "patternProperties": { - "^": { - "$ref": "#/definitions/pathItem" - }, - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - } - }, - "example": { - "type": "object", - "description": "", - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - }, - "properties": { - "summary": { - "type": "string" - }, - "description": { - "type": "string" - }, - "value": { - "$ref": "#/definitions/any" - }, - "externalValue": { - "type": "string" - } - } - }, - "link": { - "type": "object", - "description": "The `Link object` represents a possible design-time link for a response. The presence of a link does not guarantee the caller's ability to successfully invoke it, rather it provides a known relationship and traversal mechanism between responses and other operations. Unlike _dynamic_ links (i.e. links provided **in** the response payload), the OAS linking mechanism does not require link information in the runtime response. For computing links, and providing instructions to execute them, a runtime expression is used for accessing values in an operation and using them as parameters while invoking the linked operation.", - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - }, - "properties": { - "operationRef": { - "type": "string" - }, - "operationId": { - "type": "string" - }, - "parameters": { - "$ref": "#/definitions/anysOrExpressions" - }, - "requestBody": { - "$ref": "#/definitions/anyOrExpression" - }, - "description": { - "type": "string" - }, - "server": { - "$ref": "#/definitions/server" - } - } - }, - "header": { - "type": "object", - "description": "The Header Object follows the structure of the Parameter Object with the following changes: 1. `name` MUST NOT be specified, it is given in the corresponding `headers` map. 1. `in` MUST NOT be specified, it is implicitly in `header`. 1. All traits that are affected by the location MUST be applicable to a location of `header` (for example, `style`).", - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - }, - "properties": { - "description": { - "type": "string" - }, - "required": { - "type": "boolean" - }, - "deprecated": { - "type": "boolean" - }, - "allowEmptyValue": { - "type": "boolean" - }, - "style": { - "type": "string" - }, - "explode": { - "type": "boolean" - }, - "allowReserved": { - "type": "boolean" - }, - "schema": { - "$ref": "#/definitions/schemaOrReference" - }, - "example": { - "$ref": "#/definitions/any" - }, - "examples": { - "$ref": "#/definitions/examplesOrReferences" - }, - "content": { - "$ref": "#/definitions/mediaTypes" - } - } - }, - "tag": { - "type": "object", - "description": "Adds metadata to a single tag that is used by the Operation Object. It is not mandatory to have a Tag Object per tag defined in the Operation Object instances.", - "required": [ - "name" - ], - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - }, - "properties": { - "name": { - "type": "string" - }, - "description": { - "type": "string" - }, - "externalDocs": { - "$ref": "#/definitions/externalDocs" - } - } - }, - "reference": { - "type": "object", - "description": "A simple object to allow referencing other components in the specification, internally and externally. The Reference Object is defined by JSON Reference and follows the same structure, behavior and rules. For this specification, reference resolution is accomplished as defined by the JSON Reference specification and not by the JSON Schema specification.", - "required": [ - "$ref" - ], - "additionalProperties": false, - "properties": { - "$ref": { - "type": "string" - }, - "summary": { - "type": "string" - }, - "description": { - "type": "string" - } - } - }, - "schema": { - "type": "object", - "description": "The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is an extended subset of the JSON Schema Specification Wright Draft 00. For more information about the properties, see JSON Schema Core and JSON Schema Validation. Unless stated otherwise, the property definitions follow the JSON Schema.", - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - }, - "properties": { - "nullable": { - "type": "boolean" - }, - "discriminator": { - "$ref": "#/definitions/discriminator" - }, - "readOnly": { - "type": "boolean" - }, - "writeOnly": { - "type": "boolean" - }, - "xml": { - "$ref": "#/definitions/xml" - }, - "externalDocs": { - "$ref": "#/definitions/externalDocs" - }, - "example": { - "$ref": "#/definitions/any" - }, - "deprecated": { - "type": "boolean" - }, - "title": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/title" - }, - "multipleOf": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/multipleOf" - }, - "maximum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/maximum" - }, - "exclusiveMaximum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum" - }, - "minimum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/minimum" - }, - "exclusiveMinimum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum" - }, - "maxLength": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/maxLength" - }, - "minLength": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/minLength" - }, - "pattern": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/pattern" - }, - "maxItems": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/maxItems" - }, - "minItems": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/minItems" - }, - "uniqueItems": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/uniqueItems" - }, - "maxProperties": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/maxProperties" - }, - "minProperties": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/minProperties" - }, - "required": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/required" - }, - "enum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/enum" - }, - "type": { - "type": "string" - }, - "allOf": { - "type": "array", - "items": { - "$ref": "#/definitions/schemaOrReference" - }, - "minItems": 1 - }, - "oneOf": { - "type": "array", - "items": { - "$ref": "#/definitions/schemaOrReference" - }, - "minItems": 1 - }, - "anyOf": { - "type": "array", - "items": { - "$ref": "#/definitions/schemaOrReference" - }, - "minItems": 1 - }, - "not": { - "$ref": "#/definitions/schema" - }, - "items": { - "anyOf": [ - { - "$ref": "#/definitions/schemaOrReference" - }, - { - "type": "array", - "items": { - "$ref": "#/definitions/schemaOrReference" - }, - "minItems": 1 - } - ] - }, - "properties": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/schemaOrReference" - } - }, - "additionalProperties": { - "oneOf": [ - { - "$ref": "#/definitions/schemaOrReference" - }, - { - "type": "boolean" - } - ] - }, - "default": { - "$ref": "#/definitions/defaultType" - }, - "description": { - "type": "string" - }, - "format": { - "type": "string" - } - } - }, - "discriminator": { - "type": "object", - "description": "When request bodies or response payloads may be one of a number of different schemas, a `discriminator` object can be used to aid in serialization, deserialization, and validation. The discriminator is a specific object in a schema which is used to inform the consumer of the specification of an alternative schema based on the value associated with it. When using the discriminator, _inline_ schemas will not be considered.", - "required": [ - "propertyName" - ], - "additionalProperties": false, - "properties": { - "propertyName": { - "type": "string" - }, - "mapping": { - "$ref": "#/definitions/strings" - } - } - }, - "xml": { - "type": "object", - "description": "A metadata object that allows for more fine-tuned XML model definitions. When using arrays, XML element names are *not* inferred (for singular/plural forms) and the `name` property SHOULD be used to add that information. See examples for expected behavior.", - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - }, - "properties": { - "name": { - "type": "string" - }, - "namespace": { - "type": "string" - }, - "prefix": { - "type": "string" - }, - "attribute": { - "type": "boolean" - }, - "wrapped": { - "type": "boolean" - } - } - }, - "securityScheme": { - "type": "object", - "description": "Defines a security scheme that can be used by the operations. Supported schemes are HTTP authentication, an API key (either as a header or as a query parameter), OAuth2's common flows (implicit, password, application and access code) as defined in RFC6749, and OpenID Connect Discovery.", - "required": [ - "type" - ], - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - }, - "properties": { - "type": { - "type": "string" - }, - "description": { - "type": "string" - }, - "name": { - "type": "string" - }, - "in": { - "type": "string" - }, - "scheme": { - "type": "string" - }, - "bearerFormat": { - "type": "string" - }, - "flows": { - "$ref": "#/definitions/oauthFlows" - }, - "openIdConnectUrl": { - "type": "string" - } - } - }, - "oauthFlows": { - "type": "object", - "description": "Allows configuration of the supported OAuth Flows.", - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - }, - "properties": { - "implicit": { - "$ref": "#/definitions/oauthFlow" - }, - "password": { - "$ref": "#/definitions/oauthFlow" - }, - "clientCredentials": { - "$ref": "#/definitions/oauthFlow" - }, - "authorizationCode": { - "$ref": "#/definitions/oauthFlow" - } - } - }, - "oauthFlow": { - "type": "object", - "description": "Configuration details for a supported OAuth Flow", - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - }, - "properties": { - "authorizationUrl": { - "type": "string" - }, - "tokenUrl": { - "type": "string" - }, - "refreshUrl": { - "type": "string" - }, - "scopes": { - "$ref": "#/definitions/strings" - } - } - }, - "securityRequirement": { - "type": "object", - "description": "Lists the required security schemes to execute this operation. The name used for each property MUST correspond to a security scheme declared in the Security Schemes under the Components Object. Security Requirement Objects that contain multiple schemes require that all schemes MUST be satisfied for a request to be authorized. This enables support for scenarios where multiple query parameters or HTTP headers are required to convey security information. When a list of Security Requirement Objects is defined on the Open API object or Operation Object, only one of Security Requirement Objects in the list needs to be satisfied to authorize the request.", - "additionalProperties": false, - "patternProperties": { - "^[a-zA-Z0-9\\.\\-_]+$": { - "type": "array", - "items": { - "type": "string" - }, - "uniqueItems": true - } - } - }, - "anyOrExpression": { - "oneOf": [ - { - "$ref": "#/definitions/any" - }, - { - "$ref": "#/definitions/expression" - } - ] - }, - "callbackOrReference": { - "oneOf": [ - { - "$ref": "#/definitions/callback" - }, - { - "$ref": "#/definitions/reference" - } - ] - }, - "exampleOrReference": { - "oneOf": [ - { - "$ref": "#/definitions/example" - }, - { - "$ref": "#/definitions/reference" - } - ] - }, - "headerOrReference": { - "oneOf": [ - { - "$ref": "#/definitions/header" - }, - { - "$ref": "#/definitions/reference" - } - ] - }, - "linkOrReference": { - "oneOf": [ - { - "$ref": "#/definitions/link" - }, - { - "$ref": "#/definitions/reference" - } - ] - }, - "parameterOrReference": { - "oneOf": [ - { - "$ref": "#/definitions/parameter" - }, - { - "$ref": "#/definitions/reference" - } - ] - }, - "requestBodyOrReference": { - "oneOf": [ - { - "$ref": "#/definitions/requestBody" - }, - { - "$ref": "#/definitions/reference" - } - ] - }, - "responseOrReference": { - "oneOf": [ - { - "$ref": "#/definitions/response" - }, - { - "$ref": "#/definitions/reference" - } - ] - }, - "schemaOrReference": { - "oneOf": [ - { - "$ref": "#/definitions/schema" - }, - { - "$ref": "#/definitions/reference" - } - ] - }, - "securitySchemeOrReference": { - "oneOf": [ - { - "$ref": "#/definitions/securityScheme" - }, - { - "$ref": "#/definitions/reference" - } - ] - }, - "anysOrExpressions": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/anyOrExpression" - } - }, - "callbacksOrReferences": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/callbackOrReference" - } - }, - "encodings": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/encoding" - } - }, - "examplesOrReferences": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/exampleOrReference" - } - }, - "headersOrReferences": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/headerOrReference" - } - }, - "linksOrReferences": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/linkOrReference" - } - }, - "mediaTypes": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/mediaType" - } - }, - "parametersOrReferences": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/parameterOrReference" - } - }, - "requestBodiesOrReferences": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/requestBodyOrReference" - } - }, - "responsesOrReferences": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/responseOrReference" - } - }, - "schemasOrReferences": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/schemaOrReference" - } - }, - "securitySchemesOrReferences": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/securitySchemeOrReference" - } - }, - "serverVariables": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/serverVariable" - } - }, - "strings": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "object": { - "type": "object", - "additionalProperties": true - }, - "any": { - "additionalProperties": true - }, - "expression": { - "type": "object", - "additionalProperties": true - }, - "specificationExtension": { - "description": "Any property starting with x- is valid.", - "oneOf": [ - { - "type": "null" - }, - { - "type": "number" - }, - { - "type": "boolean" - }, - { - "type": "string" - }, - { - "type": "object" - }, - { - "type": "array" - } - ] - }, - "defaultType": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "array" - }, - { - "type": "object" - }, - { - "type": "number" - }, - { - "type": "boolean" - }, - { - "type": "string" - } - ] - } - } -} diff --git a/vendor/github.com/google/gnostic/openapiv3/openapi-3.1.json b/vendor/github.com/google/gnostic/openapiv3/openapi-3.1.json deleted file mode 100644 index ed0b83adf..000000000 --- a/vendor/github.com/google/gnostic/openapiv3/openapi-3.1.json +++ /dev/null @@ -1,1250 +0,0 @@ -{ - "title": "A JSON Schema for OpenAPI 3.0.", - "id": "http://openapis.org/v3/schema.json#", - "$schema": "http://json-schema.org/draft-04/schema#", - "type": "object", - "description": "This is the root document object of the OpenAPI document.", - "required": [ - "openapi", - "info", - "paths" - ], - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - }, - "properties": { - "openapi": { - "type": "string" - }, - "info": { - "$ref": "#/definitions/info" - }, - "servers": { - "type": "array", - "items": { - "$ref": "#/definitions/server" - }, - "uniqueItems": true - }, - "paths": { - "$ref": "#/definitions/paths" - }, - "components": { - "$ref": "#/definitions/components" - }, - "security": { - "type": "array", - "items": { - "$ref": "#/definitions/securityRequirement" - }, - "uniqueItems": true - }, - "tags": { - "type": "array", - "items": { - "$ref": "#/definitions/tag" - }, - "uniqueItems": true - }, - "externalDocs": { - "$ref": "#/definitions/externalDocs" - } - }, - "definitions": { - "info": { - "type": "object", - "description": "The object provides metadata about the API. The metadata MAY be used by the clients if needed, and MAY be presented in editing or documentation generation tools for convenience.", - "required": [ - "title", - "version" - ], - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - }, - "properties": { - "title": { - "type": "string" - }, - "description": { - "type": "string" - }, - "termsOfService": { - "type": "string" - }, - "contact": { - "$ref": "#/definitions/contact" - }, - "license": { - "$ref": "#/definitions/license" - }, - "version": { - "type": "string" - }, - "summary": { - "type": "string" - } - } - }, - "contact": { - "type": "object", - "description": "Contact information for the exposed API.", - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - }, - "properties": { - "name": { - "type": "string" - }, - "url": { - "type": "string", - "format": "uri" - }, - "email": { - "type": "string", - "format": "email" - } - } - }, - "license": { - "type": "object", - "description": "License information for the exposed API.", - "required": [ - "name" - ], - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - }, - "properties": { - "name": { - "type": "string" - }, - "url": { - "type": "string" - } - } - }, - "server": { - "type": "object", - "description": "An object representing a Server.", - "required": [ - "url" - ], - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - }, - "properties": { - "url": { - "type": "string" - }, - "description": { - "type": "string" - }, - "variables": { - "$ref": "#/definitions/serverVariables" - } - } - }, - "serverVariable": { - "type": "object", - "description": "An object representing a Server Variable for server URL template substitution.", - "required": [ - "default" - ], - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - }, - "properties": { - "enum": { - "type": "array", - "items": { - "type": "string" - }, - "uniqueItems": true - }, - "default": { - "type": "string" - }, - "description": { - "type": "string" - } - } - }, - "components": { - "type": "object", - "description": "Holds a set of reusable objects for different aspects of the OAS. All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object.", - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - }, - "properties": { - "schemas": { - "$ref": "#/definitions/schemasOrReferences" - }, - "responses": { - "$ref": "#/definitions/responsesOrReferences" - }, - "parameters": { - "$ref": "#/definitions/parametersOrReferences" - }, - "examples": { - "$ref": "#/definitions/examplesOrReferences" - }, - "requestBodies": { - "$ref": "#/definitions/requestBodiesOrReferences" - }, - "headers": { - "$ref": "#/definitions/headersOrReferences" - }, - "securitySchemes": { - "$ref": "#/definitions/securitySchemesOrReferences" - }, - "links": { - "$ref": "#/definitions/linksOrReferences" - }, - "callbacks": { - "$ref": "#/definitions/callbacksOrReferences" - } - } - }, - "paths": { - "type": "object", - "description": "Holds the relative paths to the individual endpoints and their operations. The path is appended to the URL from the `Server Object` in order to construct the full URL. The Paths MAY be empty, due to ACL constraints.", - "additionalProperties": false, - "patternProperties": { - "^/": { - "$ref": "#/definitions/pathItem" - }, - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - } - }, - "pathItem": { - "type": "object", - "description": "Describes the operations available on a single path. A Path Item MAY be empty, due to ACL constraints. The path itself is still exposed to the documentation viewer but they will not know which operations and parameters are available.", - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - }, - "properties": { - "$ref": { - "type": "string" - }, - "summary": { - "type": "string" - }, - "description": { - "type": "string" - }, - "get": { - "$ref": "#/definitions/operation" - }, - "put": { - "$ref": "#/definitions/operation" - }, - "post": { - "$ref": "#/definitions/operation" - }, - "delete": { - "$ref": "#/definitions/operation" - }, - "options": { - "$ref": "#/definitions/operation" - }, - "head": { - "$ref": "#/definitions/operation" - }, - "patch": { - "$ref": "#/definitions/operation" - }, - "trace": { - "$ref": "#/definitions/operation" - }, - "servers": { - "type": "array", - "items": { - "$ref": "#/definitions/server" - }, - "uniqueItems": true - }, - "parameters": { - "type": "array", - "items": { - "$ref": "#/definitions/parameterOrReference" - }, - "uniqueItems": true - } - } - }, - "operation": { - "type": "object", - "description": "Describes a single API operation on a path.", - "required": [ - "responses" - ], - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - }, - "properties": { - "tags": { - "type": "array", - "items": { - "type": "string" - }, - "uniqueItems": true - }, - "summary": { - "type": "string" - }, - "description": { - "type": "string" - }, - "externalDocs": { - "$ref": "#/definitions/externalDocs" - }, - "operationId": { - "type": "string" - }, - "parameters": { - "type": "array", - "items": { - "$ref": "#/definitions/parameterOrReference" - }, - "uniqueItems": true - }, - "requestBody": { - "$ref": "#/definitions/requestBodyOrReference" - }, - "responses": { - "$ref": "#/definitions/responses" - }, - "callbacks": { - "$ref": "#/definitions/callbacksOrReferences" - }, - "deprecated": { - "type": "boolean" - }, - "security": { - "type": "array", - "items": { - "$ref": "#/definitions/securityRequirement" - }, - "uniqueItems": true - }, - "servers": { - "type": "array", - "items": { - "$ref": "#/definitions/server" - }, - "uniqueItems": true - } - } - }, - "externalDocs": { - "type": "object", - "description": "Allows referencing an external resource for extended documentation.", - "required": [ - "url" - ], - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - }, - "properties": { - "description": { - "type": "string" - }, - "url": { - "type": "string" - } - } - }, - "parameter": { - "type": "object", - "description": "Describes a single operation parameter. A unique parameter is defined by a combination of a name and location.", - "required": [ - "name", - "in" - ], - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - }, - "properties": { - "name": { - "type": "string" - }, - "in": { - "type": "string" - }, - "description": { - "type": "string" - }, - "required": { - "type": "boolean" - }, - "deprecated": { - "type": "boolean" - }, - "allowEmptyValue": { - "type": "boolean" - }, - "style": { - "type": "string" - }, - "explode": { - "type": "boolean" - }, - "allowReserved": { - "type": "boolean" - }, - "schema": { - "$ref": "#/definitions/schemaOrReference" - }, - "example": { - "$ref": "#/definitions/any" - }, - "examples": { - "$ref": "#/definitions/examplesOrReferences" - }, - "content": { - "$ref": "#/definitions/mediaTypes" - } - } - }, - "requestBody": { - "type": "object", - "description": "Describes a single request body.", - "required": [ - "content" - ], - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - }, - "properties": { - "description": { - "type": "string" - }, - "content": { - "$ref": "#/definitions/mediaTypes" - }, - "required": { - "type": "boolean" - } - } - }, - "mediaType": { - "type": "object", - "description": "Each Media Type Object provides schema and examples for the media type identified by its key.", - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - }, - "properties": { - "schema": { - "$ref": "#/definitions/schemaOrReference" - }, - "example": { - "$ref": "#/definitions/any" - }, - "examples": { - "$ref": "#/definitions/examplesOrReferences" - }, - "encoding": { - "$ref": "#/definitions/encodings" - } - } - }, - "encoding": { - "type": "object", - "description": "A single encoding definition applied to a single schema property.", - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - }, - "properties": { - "contentType": { - "type": "string" - }, - "headers": { - "$ref": "#/definitions/headersOrReferences" - }, - "style": { - "type": "string" - }, - "explode": { - "type": "boolean" - }, - "allowReserved": { - "type": "boolean" - } - } - }, - "responses": { - "type": "object", - "description": "A container for the expected responses of an operation. The container maps a HTTP response code to the expected response. The documentation is not necessarily expected to cover all possible HTTP response codes because they may not be known in advance. However, documentation is expected to cover a successful operation response and any known errors. The `default` MAY be used as a default response object for all HTTP codes that are not covered individually by the specification. The `Responses Object` MUST contain at least one response code, and it SHOULD be the response for a successful operation call.", - "additionalProperties": false, - "patternProperties": { - "^([0-9X]{3})$": { - "$ref": "#/definitions/responseOrReference" - }, - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - }, - "properties": { - "default": { - "$ref": "#/definitions/responseOrReference" - } - } - }, - "response": { - "type": "object", - "description": "Describes a single response from an API Operation, including design-time, static `links` to operations based on the response.", - "required": [ - "description" - ], - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - }, - "properties": { - "description": { - "type": "string" - }, - "headers": { - "$ref": "#/definitions/headersOrReferences" - }, - "content": { - "$ref": "#/definitions/mediaTypes" - }, - "links": { - "$ref": "#/definitions/linksOrReferences" - } - } - }, - "callback": { - "type": "object", - "description": "A map of possible out-of band callbacks related to the parent operation. Each value in the map is a Path Item Object that describes a set of requests that may be initiated by the API provider and the expected responses. The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.", - "additionalProperties": false, - "patternProperties": { - "^": { - "$ref": "#/definitions/pathItem" - }, - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - } - }, - "example": { - "type": "object", - "description": "", - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - }, - "properties": { - "summary": { - "type": "string" - }, - "description": { - "type": "string" - }, - "value": { - "$ref": "#/definitions/any" - }, - "externalValue": { - "type": "string" - } - } - }, - "link": { - "type": "object", - "description": "The `Link object` represents a possible design-time link for a response. The presence of a link does not guarantee the caller's ability to successfully invoke it, rather it provides a known relationship and traversal mechanism between responses and other operations. Unlike _dynamic_ links (i.e. links provided **in** the response payload), the OAS linking mechanism does not require link information in the runtime response. For computing links, and providing instructions to execute them, a runtime expression is used for accessing values in an operation and using them as parameters while invoking the linked operation.", - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - }, - "properties": { - "operationRef": { - "type": "string" - }, - "operationId": { - "type": "string" - }, - "parameters": { - "$ref": "#/definitions/anyOrExpression" - }, - "requestBody": { - "$ref": "#/definitions/anyOrExpression" - }, - "description": { - "type": "string" - }, - "server": { - "$ref": "#/definitions/server" - } - } - }, - "header": { - "type": "object", - "description": "The Header Object follows the structure of the Parameter Object with the following changes: 1. `name` MUST NOT be specified, it is given in the corresponding `headers` map. 1. `in` MUST NOT be specified, it is implicitly in `header`. 1. All traits that are affected by the location MUST be applicable to a location of `header` (for example, `style`).", - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - }, - "properties": { - "description": { - "type": "string" - }, - "required": { - "type": "boolean" - }, - "deprecated": { - "type": "boolean" - }, - "allowEmptyValue": { - "type": "boolean" - }, - "style": { - "type": "string" - }, - "explode": { - "type": "boolean" - }, - "allowReserved": { - "type": "boolean" - }, - "schema": { - "$ref": "#/definitions/schemaOrReference" - }, - "example": { - "$ref": "#/definitions/any" - }, - "examples": { - "$ref": "#/definitions/examplesOrReferences" - }, - "content": { - "$ref": "#/definitions/mediaTypes" - } - } - }, - "tag": { - "type": "object", - "description": "Adds metadata to a single tag that is used by the Operation Object. It is not mandatory to have a Tag Object per tag defined in the Operation Object instances.", - "required": [ - "name" - ], - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - }, - "properties": { - "name": { - "type": "string" - }, - "description": { - "type": "string" - }, - "externalDocs": { - "$ref": "#/definitions/externalDocs" - } - } - }, - "reference": { - "type": "object", - "description": "A simple object to allow referencing other components in the specification, internally and externally. The Reference Object is defined by JSON Reference and follows the same structure, behavior and rules. For this specification, reference resolution is accomplished as defined by the JSON Reference specification and not by the JSON Schema specification.", - "required": [ - "$ref" - ], - "additionalProperties": false, - "properties": { - "$ref": { - "type": "string" - }, - "summary": { - "type": "string" - }, - "description": { - "type": "string" - } - } - }, - "schema": { - "type": "object", - "description": "The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is an extended subset of the JSON Schema Specification Wright Draft 00. For more information about the properties, see JSON Schema Core and JSON Schema Validation. Unless stated otherwise, the property definitions follow the JSON Schema.", - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - }, - "properties": { - "nullable": { - "type": "boolean" - }, - "discriminator": { - "$ref": "#/definitions/discriminator" - }, - "readOnly": { - "type": "boolean" - }, - "writeOnly": { - "type": "boolean" - }, - "xml": { - "$ref": "#/definitions/xml" - }, - "externalDocs": { - "$ref": "#/definitions/externalDocs" - }, - "example": { - "$ref": "#/definitions/any" - }, - "deprecated": { - "type": "boolean" - }, - "title": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/title" - }, - "multipleOf": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/multipleOf" - }, - "maximum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/maximum" - }, - "exclusiveMaximum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum" - }, - "minimum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/minimum" - }, - "exclusiveMinimum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum" - }, - "maxLength": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/maxLength" - }, - "minLength": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/minLength" - }, - "pattern": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/pattern" - }, - "maxItems": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/maxItems" - }, - "minItems": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/minItems" - }, - "uniqueItems": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/uniqueItems" - }, - "maxProperties": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/maxProperties" - }, - "minProperties": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/minProperties" - }, - "required": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/required" - }, - "enum": { - "$ref": "http://json-schema.org/draft-04/schema#/properties/enum" - }, - "type": { - "type": "string" - }, - "allOf": { - "type": "array", - "items": { - "$ref": "#/definitions/schemaOrReference" - }, - "minItems": 1 - }, - "oneOf": { - "type": "array", - "items": { - "$ref": "#/definitions/schemaOrReference" - }, - "minItems": 1 - }, - "anyOf": { - "type": "array", - "items": { - "$ref": "#/definitions/schemaOrReference" - }, - "minItems": 1 - }, - "not": { - "$ref": "#/definitions/schema" - }, - "items": { - "anyOf": [ - { - "$ref": "#/definitions/schemaOrReference" - }, - { - "type": "array", - "items": { - "$ref": "#/definitions/schemaOrReference" - }, - "minItems": 1 - } - ] - }, - "properties": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/schemaOrReference" - } - }, - "additionalProperties": { - "oneOf": [ - { - "$ref": "#/definitions/schemaOrReference" - }, - { - "type": "boolean" - } - ] - }, - "default": { - "$ref": "#/definitions/defaultType" - }, - "description": { - "type": "string" - }, - "format": { - "type": "string" - } - } - }, - "discriminator": { - "type": "object", - "description": "When request bodies or response payloads may be one of a number of different schemas, a `discriminator` object can be used to aid in serialization, deserialization, and validation. The discriminator is a specific object in a schema which is used to inform the consumer of the specification of an alternative schema based on the value associated with it. When using the discriminator, _inline_ schemas will not be considered.", - "required": [ - "propertyName" - ], - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - }, - "properties": { - "propertyName": { - "type": "string" - }, - "mapping": { - "$ref": "#/definitions/strings" - } - } - }, - "xml": { - "type": "object", - "description": "A metadata object that allows for more fine-tuned XML model definitions. When using arrays, XML element names are *not* inferred (for singular/plural forms) and the `name` property SHOULD be used to add that information. See examples for expected behavior.", - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - }, - "properties": { - "name": { - "type": "string" - }, - "namespace": { - "type": "string" - }, - "prefix": { - "type": "string" - }, - "attribute": { - "type": "boolean" - }, - "wrapped": { - "type": "boolean" - } - } - }, - "securityScheme": { - "type": "object", - "description": "Defines a security scheme that can be used by the operations. Supported schemes are HTTP authentication, an API key (either as a header, a cookie parameter or as a query parameter), mutual TLS (use of a client certificate), OAuth2's common flows (implicit, password, application and access code) as defined in RFC6749, and OpenID Connect. Please note that currently (2019) the implicit flow is about to be deprecated OAuth 2.0 Security Best Current Practice. Recommended for most use case is Authorization Code Grant flow with PKCE.", - "required": [ - "type" - ], - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - }, - "properties": { - "type": { - "type": "string" - }, - "description": { - "type": "string" - }, - "name": { - "type": "string" - }, - "in": { - "type": "string" - }, - "scheme": { - "type": "string" - }, - "bearerFormat": { - "type": "string" - }, - "flows": { - "$ref": "#/definitions/oauthFlows" - }, - "openIdConnectUrl": { - "type": "string" - } - } - }, - "oauthFlows": { - "type": "object", - "description": "Allows configuration of the supported OAuth Flows.", - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - }, - "properties": { - "implicit": { - "$ref": "#/definitions/oauthFlow" - }, - "password": { - "$ref": "#/definitions/oauthFlow" - }, - "clientCredentials": { - "$ref": "#/definitions/oauthFlow" - }, - "authorizationCode": { - "$ref": "#/definitions/oauthFlow" - } - } - }, - "oauthFlow": { - "type": "object", - "description": "Configuration details for a supported OAuth Flow", - "additionalProperties": false, - "patternProperties": { - "^x-": { - "$ref": "#/definitions/specificationExtension" - } - }, - "properties": { - "authorizationUrl": { - "type": "string" - }, - "tokenUrl": { - "type": "string" - }, - "refreshUrl": { - "type": "string" - }, - "scopes": { - "$ref": "#/definitions/strings" - } - } - }, - "securityRequirement": { - "type": "object", - "description": "Lists the required security schemes to execute this operation. The name used for each property MUST correspond to a security scheme declared in the Security Schemes under the Components Object. Security Requirement Objects that contain multiple schemes require that all schemes MUST be satisfied for a request to be authorized. This enables support for scenarios where multiple query parameters or HTTP headers are required to convey security information. When a list of Security Requirement Objects is defined on the OpenAPI Object or Operation Object, only one of the Security Requirement Objects in the list needs to be satisfied to authorize the request.", - "additionalProperties": { - "type": "array", - "items": { - "type": "string" - }, - "uniqueItems": true - } - }, - "anyOrExpression": { - "oneOf": [ - { - "$ref": "#/definitions/any" - }, - { - "$ref": "#/definitions/expression" - } - ] - }, - "callbackOrReference": { - "oneOf": [ - { - "$ref": "#/definitions/callback" - }, - { - "$ref": "#/definitions/reference" - } - ] - }, - "exampleOrReference": { - "oneOf": [ - { - "$ref": "#/definitions/example" - }, - { - "$ref": "#/definitions/reference" - } - ] - }, - "headerOrReference": { - "oneOf": [ - { - "$ref": "#/definitions/header" - }, - { - "$ref": "#/definitions/reference" - } - ] - }, - "linkOrReference": { - "oneOf": [ - { - "$ref": "#/definitions/link" - }, - { - "$ref": "#/definitions/reference" - } - ] - }, - "parameterOrReference": { - "oneOf": [ - { - "$ref": "#/definitions/parameter" - }, - { - "$ref": "#/definitions/reference" - } - ] - }, - "requestBodyOrReference": { - "oneOf": [ - { - "$ref": "#/definitions/requestBody" - }, - { - "$ref": "#/definitions/reference" - } - ] - }, - "responseOrReference": { - "oneOf": [ - { - "$ref": "#/definitions/response" - }, - { - "$ref": "#/definitions/reference" - } - ] - }, - "schemaOrReference": { - "oneOf": [ - { - "$ref": "#/definitions/schema" - }, - { - "$ref": "#/definitions/reference" - } - ] - }, - "securitySchemeOrReference": { - "oneOf": [ - { - "$ref": "#/definitions/securityScheme" - }, - { - "$ref": "#/definitions/reference" - } - ] - }, - "callbacksOrReferences": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/callbackOrReference" - } - }, - "encodings": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/encoding" - } - }, - "examplesOrReferences": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/exampleOrReference" - } - }, - "headersOrReferences": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/headerOrReference" - } - }, - "linksOrReferences": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/linkOrReference" - } - }, - "mediaTypes": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/mediaType" - } - }, - "parametersOrReferences": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/parameterOrReference" - } - }, - "requestBodiesOrReferences": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/requestBodyOrReference" - } - }, - "responsesOrReferences": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/responseOrReference" - } - }, - "schemasOrReferences": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/schemaOrReference" - } - }, - "securitySchemesOrReferences": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/securitySchemeOrReference" - } - }, - "serverVariables": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/serverVariable" - } - }, - "strings": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "object": { - "type": "object", - "additionalProperties": true - }, - "any": { - "additionalProperties": true - }, - "expression": { - "type": "object", - "additionalProperties": true - }, - "specificationExtension": { - "description": "Any property starting with x- is valid.", - "oneOf": [ - { - "type": "null" - }, - { - "type": "number" - }, - { - "type": "boolean" - }, - { - "type": "string" - }, - { - "type": "object" - }, - { - "type": "array" - } - ] - }, - "defaultType": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "array" - }, - { - "type": "object" - }, - { - "type": "number" - }, - { - "type": "boolean" - }, - { - "type": "string" - } - ] - } - } -} diff --git a/vendor/github.com/google/go-cmp/LICENSE b/vendor/github.com/google/go-cmp/LICENSE deleted file mode 100644 index 32017f8fa..000000000 --- a/vendor/github.com/google/go-cmp/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2017 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/google/go-cmp/cmp/compare.go b/vendor/github.com/google/go-cmp/cmp/compare.go deleted file mode 100644 index fd2b3a42b..000000000 --- a/vendor/github.com/google/go-cmp/cmp/compare.go +++ /dev/null @@ -1,667 +0,0 @@ -// Copyright 2017, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package cmp determines equality of values. -// -// This package is intended to be a more powerful and safer alternative to -// reflect.DeepEqual for comparing whether two values are semantically equal. -// It is intended to only be used in tests, as performance is not a goal and -// it may panic if it cannot compare the values. Its propensity towards -// panicking means that its unsuitable for production environments where a -// spurious panic may be fatal. -// -// The primary features of cmp are: -// -// • When the default behavior of equality does not suit the needs of the test, -// custom equality functions can override the equality operation. -// For example, an equality function may report floats as equal so long as they -// are within some tolerance of each other. -// -// • Types that have an Equal method may use that method to determine equality. -// This allows package authors to determine the equality operation for the types -// that they define. -// -// • If no custom equality functions are used and no Equal method is defined, -// equality is determined by recursively comparing the primitive kinds on both -// values, much like reflect.DeepEqual. Unlike reflect.DeepEqual, unexported -// fields are not compared by default; they result in panics unless suppressed -// by using an Ignore option (see cmpopts.IgnoreUnexported) or explicitly -// compared using the Exporter option. -package cmp - -import ( - "fmt" - "reflect" - "strings" - - "github.com/google/go-cmp/cmp/internal/diff" - "github.com/google/go-cmp/cmp/internal/function" - "github.com/google/go-cmp/cmp/internal/value" -) - -// TODO(≥go1.18): Use any instead of interface{}. - -// Equal reports whether x and y are equal by recursively applying the -// following rules in the given order to x and y and all of their sub-values: -// -// • Let S be the set of all Ignore, Transformer, and Comparer options that -// remain after applying all path filters, value filters, and type filters. -// If at least one Ignore exists in S, then the comparison is ignored. -// If the number of Transformer and Comparer options in S is greater than one, -// then Equal panics because it is ambiguous which option to use. -// If S contains a single Transformer, then use that to transform the current -// values and recursively call Equal on the output values. -// If S contains a single Comparer, then use that to compare the current values. -// Otherwise, evaluation proceeds to the next rule. -// -// • If the values have an Equal method of the form "(T) Equal(T) bool" or -// "(T) Equal(I) bool" where T is assignable to I, then use the result of -// x.Equal(y) even if x or y is nil. Otherwise, no such method exists and -// evaluation proceeds to the next rule. -// -// • Lastly, try to compare x and y based on their basic kinds. -// Simple kinds like booleans, integers, floats, complex numbers, strings, and -// channels are compared using the equivalent of the == operator in Go. -// Functions are only equal if they are both nil, otherwise they are unequal. -// -// Structs are equal if recursively calling Equal on all fields report equal. -// If a struct contains unexported fields, Equal panics unless an Ignore option -// (e.g., cmpopts.IgnoreUnexported) ignores that field or the Exporter option -// explicitly permits comparing the unexported field. -// -// Slices are equal if they are both nil or both non-nil, where recursively -// calling Equal on all non-ignored slice or array elements report equal. -// Empty non-nil slices and nil slices are not equal; to equate empty slices, -// consider using cmpopts.EquateEmpty. -// -// Maps are equal if they are both nil or both non-nil, where recursively -// calling Equal on all non-ignored map entries report equal. -// Map keys are equal according to the == operator. -// To use custom comparisons for map keys, consider using cmpopts.SortMaps. -// Empty non-nil maps and nil maps are not equal; to equate empty maps, -// consider using cmpopts.EquateEmpty. -// -// Pointers and interfaces are equal if they are both nil or both non-nil, -// where they have the same underlying concrete type and recursively -// calling Equal on the underlying values reports equal. -// -// Before recursing into a pointer, slice element, or map, the current path -// is checked to detect whether the address has already been visited. -// If there is a cycle, then the pointed at values are considered equal -// only if both addresses were previously visited in the same path step. -func Equal(x, y interface{}, opts ...Option) bool { - s := newState(opts) - s.compareAny(rootStep(x, y)) - return s.result.Equal() -} - -// Diff returns a human-readable report of the differences between two values: -// y - x. It returns an empty string if and only if Equal returns true for the -// same input values and options. -// -// The output is displayed as a literal in pseudo-Go syntax. -// At the start of each line, a "-" prefix indicates an element removed from x, -// a "+" prefix to indicates an element added from y, and the lack of a prefix -// indicates an element common to both x and y. If possible, the output -// uses fmt.Stringer.String or error.Error methods to produce more humanly -// readable outputs. In such cases, the string is prefixed with either an -// 's' or 'e' character, respectively, to indicate that the method was called. -// -// Do not depend on this output being stable. If you need the ability to -// programmatically interpret the difference, consider using a custom Reporter. -func Diff(x, y interface{}, opts ...Option) string { - s := newState(opts) - - // Optimization: If there are no other reporters, we can optimize for the - // common case where the result is equal (and thus no reported difference). - // This avoids the expensive construction of a difference tree. - if len(s.reporters) == 0 { - s.compareAny(rootStep(x, y)) - if s.result.Equal() { - return "" - } - s.result = diff.Result{} // Reset results - } - - r := new(defaultReporter) - s.reporters = append(s.reporters, reporter{r}) - s.compareAny(rootStep(x, y)) - d := r.String() - if (d == "") != s.result.Equal() { - panic("inconsistent difference and equality results") - } - return d -} - -// rootStep constructs the first path step. If x and y have differing types, -// then they are stored within an empty interface type. -func rootStep(x, y interface{}) PathStep { - vx := reflect.ValueOf(x) - vy := reflect.ValueOf(y) - - // If the inputs are different types, auto-wrap them in an empty interface - // so that they have the same parent type. - var t reflect.Type - if !vx.IsValid() || !vy.IsValid() || vx.Type() != vy.Type() { - t = reflect.TypeOf((*interface{})(nil)).Elem() - if vx.IsValid() { - vvx := reflect.New(t).Elem() - vvx.Set(vx) - vx = vvx - } - if vy.IsValid() { - vvy := reflect.New(t).Elem() - vvy.Set(vy) - vy = vvy - } - } else { - t = vx.Type() - } - - return &pathStep{t, vx, vy} -} - -type state struct { - // These fields represent the "comparison state". - // Calling statelessCompare must not result in observable changes to these. - result diff.Result // The current result of comparison - curPath Path // The current path in the value tree - curPtrs pointerPath // The current set of visited pointers - reporters []reporter // Optional reporters - - // recChecker checks for infinite cycles applying the same set of - // transformers upon the output of itself. - recChecker recChecker - - // dynChecker triggers pseudo-random checks for option correctness. - // It is safe for statelessCompare to mutate this value. - dynChecker dynChecker - - // These fields, once set by processOption, will not change. - exporters []exporter // List of exporters for structs with unexported fields - opts Options // List of all fundamental and filter options -} - -func newState(opts []Option) *state { - // Always ensure a validator option exists to validate the inputs. - s := &state{opts: Options{validator{}}} - s.curPtrs.Init() - s.processOption(Options(opts)) - return s -} - -func (s *state) processOption(opt Option) { - switch opt := opt.(type) { - case nil: - case Options: - for _, o := range opt { - s.processOption(o) - } - case coreOption: - type filtered interface { - isFiltered() bool - } - if fopt, ok := opt.(filtered); ok && !fopt.isFiltered() { - panic(fmt.Sprintf("cannot use an unfiltered option: %v", opt)) - } - s.opts = append(s.opts, opt) - case exporter: - s.exporters = append(s.exporters, opt) - case reporter: - s.reporters = append(s.reporters, opt) - default: - panic(fmt.Sprintf("unknown option %T", opt)) - } -} - -// statelessCompare compares two values and returns the result. -// This function is stateless in that it does not alter the current result, -// or output to any registered reporters. -func (s *state) statelessCompare(step PathStep) diff.Result { - // We do not save and restore curPath and curPtrs because all of the - // compareX methods should properly push and pop from them. - // It is an implementation bug if the contents of the paths differ from - // when calling this function to when returning from it. - - oldResult, oldReporters := s.result, s.reporters - s.result = diff.Result{} // Reset result - s.reporters = nil // Remove reporters to avoid spurious printouts - s.compareAny(step) - res := s.result - s.result, s.reporters = oldResult, oldReporters - return res -} - -func (s *state) compareAny(step PathStep) { - // Update the path stack. - s.curPath.push(step) - defer s.curPath.pop() - for _, r := range s.reporters { - r.PushStep(step) - defer r.PopStep() - } - s.recChecker.Check(s.curPath) - - // Cycle-detection for slice elements (see NOTE in compareSlice). - t := step.Type() - vx, vy := step.Values() - if si, ok := step.(SliceIndex); ok && si.isSlice && vx.IsValid() && vy.IsValid() { - px, py := vx.Addr(), vy.Addr() - if eq, visited := s.curPtrs.Push(px, py); visited { - s.report(eq, reportByCycle) - return - } - defer s.curPtrs.Pop(px, py) - } - - // Rule 1: Check whether an option applies on this node in the value tree. - if s.tryOptions(t, vx, vy) { - return - } - - // Rule 2: Check whether the type has a valid Equal method. - if s.tryMethod(t, vx, vy) { - return - } - - // Rule 3: Compare based on the underlying kind. - switch t.Kind() { - case reflect.Bool: - s.report(vx.Bool() == vy.Bool(), 0) - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - s.report(vx.Int() == vy.Int(), 0) - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - s.report(vx.Uint() == vy.Uint(), 0) - case reflect.Float32, reflect.Float64: - s.report(vx.Float() == vy.Float(), 0) - case reflect.Complex64, reflect.Complex128: - s.report(vx.Complex() == vy.Complex(), 0) - case reflect.String: - s.report(vx.String() == vy.String(), 0) - case reflect.Chan, reflect.UnsafePointer: - s.report(vx.Pointer() == vy.Pointer(), 0) - case reflect.Func: - s.report(vx.IsNil() && vy.IsNil(), 0) - case reflect.Struct: - s.compareStruct(t, vx, vy) - case reflect.Slice, reflect.Array: - s.compareSlice(t, vx, vy) - case reflect.Map: - s.compareMap(t, vx, vy) - case reflect.Ptr: - s.comparePtr(t, vx, vy) - case reflect.Interface: - s.compareInterface(t, vx, vy) - default: - panic(fmt.Sprintf("%v kind not handled", t.Kind())) - } -} - -func (s *state) tryOptions(t reflect.Type, vx, vy reflect.Value) bool { - // Evaluate all filters and apply the remaining options. - if opt := s.opts.filter(s, t, vx, vy); opt != nil { - opt.apply(s, vx, vy) - return true - } - return false -} - -func (s *state) tryMethod(t reflect.Type, vx, vy reflect.Value) bool { - // Check if this type even has an Equal method. - m, ok := t.MethodByName("Equal") - if !ok || !function.IsType(m.Type, function.EqualAssignable) { - return false - } - - eq := s.callTTBFunc(m.Func, vx, vy) - s.report(eq, reportByMethod) - return true -} - -func (s *state) callTRFunc(f, v reflect.Value, step Transform) reflect.Value { - if !s.dynChecker.Next() { - return f.Call([]reflect.Value{v})[0] - } - - // Run the function twice and ensure that we get the same results back. - // We run in goroutines so that the race detector (if enabled) can detect - // unsafe mutations to the input. - c := make(chan reflect.Value) - go detectRaces(c, f, v) - got := <-c - want := f.Call([]reflect.Value{v})[0] - if step.vx, step.vy = got, want; !s.statelessCompare(step).Equal() { - // To avoid false-positives with non-reflexive equality operations, - // we sanity check whether a value is equal to itself. - if step.vx, step.vy = want, want; !s.statelessCompare(step).Equal() { - return want - } - panic(fmt.Sprintf("non-deterministic function detected: %s", function.NameOf(f))) - } - return want -} - -func (s *state) callTTBFunc(f, x, y reflect.Value) bool { - if !s.dynChecker.Next() { - return f.Call([]reflect.Value{x, y})[0].Bool() - } - - // Swapping the input arguments is sufficient to check that - // f is symmetric and deterministic. - // We run in goroutines so that the race detector (if enabled) can detect - // unsafe mutations to the input. - c := make(chan reflect.Value) - go detectRaces(c, f, y, x) - got := <-c - want := f.Call([]reflect.Value{x, y})[0].Bool() - if !got.IsValid() || got.Bool() != want { - panic(fmt.Sprintf("non-deterministic or non-symmetric function detected: %s", function.NameOf(f))) - } - return want -} - -func detectRaces(c chan<- reflect.Value, f reflect.Value, vs ...reflect.Value) { - var ret reflect.Value - defer func() { - recover() // Ignore panics, let the other call to f panic instead - c <- ret - }() - ret = f.Call(vs)[0] -} - -func (s *state) compareStruct(t reflect.Type, vx, vy reflect.Value) { - var addr bool - var vax, vay reflect.Value // Addressable versions of vx and vy - - var mayForce, mayForceInit bool - step := StructField{&structField{}} - for i := 0; i < t.NumField(); i++ { - step.typ = t.Field(i).Type - step.vx = vx.Field(i) - step.vy = vy.Field(i) - step.name = t.Field(i).Name - step.idx = i - step.unexported = !isExported(step.name) - if step.unexported { - if step.name == "_" { - continue - } - // Defer checking of unexported fields until later to give an - // Ignore a chance to ignore the field. - if !vax.IsValid() || !vay.IsValid() { - // For retrieveUnexportedField to work, the parent struct must - // be addressable. Create a new copy of the values if - // necessary to make them addressable. - addr = vx.CanAddr() || vy.CanAddr() - vax = makeAddressable(vx) - vay = makeAddressable(vy) - } - if !mayForceInit { - for _, xf := range s.exporters { - mayForce = mayForce || xf(t) - } - mayForceInit = true - } - step.mayForce = mayForce - step.paddr = addr - step.pvx = vax - step.pvy = vay - step.field = t.Field(i) - } - s.compareAny(step) - } -} - -func (s *state) compareSlice(t reflect.Type, vx, vy reflect.Value) { - isSlice := t.Kind() == reflect.Slice - if isSlice && (vx.IsNil() || vy.IsNil()) { - s.report(vx.IsNil() && vy.IsNil(), 0) - return - } - - // NOTE: It is incorrect to call curPtrs.Push on the slice header pointer - // since slices represents a list of pointers, rather than a single pointer. - // The pointer checking logic must be handled on a per-element basis - // in compareAny. - // - // A slice header (see reflect.SliceHeader) in Go is a tuple of a starting - // pointer P, a length N, and a capacity C. Supposing each slice element has - // a memory size of M, then the slice is equivalent to the list of pointers: - // [P+i*M for i in range(N)] - // - // For example, v[:0] and v[:1] are slices with the same starting pointer, - // but they are clearly different values. Using the slice pointer alone - // violates the assumption that equal pointers implies equal values. - - step := SliceIndex{&sliceIndex{pathStep: pathStep{typ: t.Elem()}, isSlice: isSlice}} - withIndexes := func(ix, iy int) SliceIndex { - if ix >= 0 { - step.vx, step.xkey = vx.Index(ix), ix - } else { - step.vx, step.xkey = reflect.Value{}, -1 - } - if iy >= 0 { - step.vy, step.ykey = vy.Index(iy), iy - } else { - step.vy, step.ykey = reflect.Value{}, -1 - } - return step - } - - // Ignore options are able to ignore missing elements in a slice. - // However, detecting these reliably requires an optimal differencing - // algorithm, for which diff.Difference is not. - // - // Instead, we first iterate through both slices to detect which elements - // would be ignored if standing alone. The index of non-discarded elements - // are stored in a separate slice, which diffing is then performed on. - var indexesX, indexesY []int - var ignoredX, ignoredY []bool - for ix := 0; ix < vx.Len(); ix++ { - ignored := s.statelessCompare(withIndexes(ix, -1)).NumDiff == 0 - if !ignored { - indexesX = append(indexesX, ix) - } - ignoredX = append(ignoredX, ignored) - } - for iy := 0; iy < vy.Len(); iy++ { - ignored := s.statelessCompare(withIndexes(-1, iy)).NumDiff == 0 - if !ignored { - indexesY = append(indexesY, iy) - } - ignoredY = append(ignoredY, ignored) - } - - // Compute an edit-script for slices vx and vy (excluding ignored elements). - edits := diff.Difference(len(indexesX), len(indexesY), func(ix, iy int) diff.Result { - return s.statelessCompare(withIndexes(indexesX[ix], indexesY[iy])) - }) - - // Replay the ignore-scripts and the edit-script. - var ix, iy int - for ix < vx.Len() || iy < vy.Len() { - var e diff.EditType - switch { - case ix < len(ignoredX) && ignoredX[ix]: - e = diff.UniqueX - case iy < len(ignoredY) && ignoredY[iy]: - e = diff.UniqueY - default: - e, edits = edits[0], edits[1:] - } - switch e { - case diff.UniqueX: - s.compareAny(withIndexes(ix, -1)) - ix++ - case diff.UniqueY: - s.compareAny(withIndexes(-1, iy)) - iy++ - default: - s.compareAny(withIndexes(ix, iy)) - ix++ - iy++ - } - } -} - -func (s *state) compareMap(t reflect.Type, vx, vy reflect.Value) { - if vx.IsNil() || vy.IsNil() { - s.report(vx.IsNil() && vy.IsNil(), 0) - return - } - - // Cycle-detection for maps. - if eq, visited := s.curPtrs.Push(vx, vy); visited { - s.report(eq, reportByCycle) - return - } - defer s.curPtrs.Pop(vx, vy) - - // We combine and sort the two map keys so that we can perform the - // comparisons in a deterministic order. - step := MapIndex{&mapIndex{pathStep: pathStep{typ: t.Elem()}}} - for _, k := range value.SortKeys(append(vx.MapKeys(), vy.MapKeys()...)) { - step.vx = vx.MapIndex(k) - step.vy = vy.MapIndex(k) - step.key = k - if !step.vx.IsValid() && !step.vy.IsValid() { - // It is possible for both vx and vy to be invalid if the - // key contained a NaN value in it. - // - // Even with the ability to retrieve NaN keys in Go 1.12, - // there still isn't a sensible way to compare the values since - // a NaN key may map to multiple unordered values. - // The most reasonable way to compare NaNs would be to compare the - // set of values. However, this is impossible to do efficiently - // since set equality is provably an O(n^2) operation given only - // an Equal function. If we had a Less function or Hash function, - // this could be done in O(n*log(n)) or O(n), respectively. - // - // Rather than adding complex logic to deal with NaNs, make it - // the user's responsibility to compare such obscure maps. - const help = "consider providing a Comparer to compare the map" - panic(fmt.Sprintf("%#v has map key with NaNs\n%s", s.curPath, help)) - } - s.compareAny(step) - } -} - -func (s *state) comparePtr(t reflect.Type, vx, vy reflect.Value) { - if vx.IsNil() || vy.IsNil() { - s.report(vx.IsNil() && vy.IsNil(), 0) - return - } - - // Cycle-detection for pointers. - if eq, visited := s.curPtrs.Push(vx, vy); visited { - s.report(eq, reportByCycle) - return - } - defer s.curPtrs.Pop(vx, vy) - - vx, vy = vx.Elem(), vy.Elem() - s.compareAny(Indirect{&indirect{pathStep{t.Elem(), vx, vy}}}) -} - -func (s *state) compareInterface(t reflect.Type, vx, vy reflect.Value) { - if vx.IsNil() || vy.IsNil() { - s.report(vx.IsNil() && vy.IsNil(), 0) - return - } - vx, vy = vx.Elem(), vy.Elem() - if vx.Type() != vy.Type() { - s.report(false, 0) - return - } - s.compareAny(TypeAssertion{&typeAssertion{pathStep{vx.Type(), vx, vy}}}) -} - -func (s *state) report(eq bool, rf resultFlags) { - if rf&reportByIgnore == 0 { - if eq { - s.result.NumSame++ - rf |= reportEqual - } else { - s.result.NumDiff++ - rf |= reportUnequal - } - } - for _, r := range s.reporters { - r.Report(Result{flags: rf}) - } -} - -// recChecker tracks the state needed to periodically perform checks that -// user provided transformers are not stuck in an infinitely recursive cycle. -type recChecker struct{ next int } - -// Check scans the Path for any recursive transformers and panics when any -// recursive transformers are detected. Note that the presence of a -// recursive Transformer does not necessarily imply an infinite cycle. -// As such, this check only activates after some minimal number of path steps. -func (rc *recChecker) Check(p Path) { - const minLen = 1 << 16 - if rc.next == 0 { - rc.next = minLen - } - if len(p) < rc.next { - return - } - rc.next <<= 1 - - // Check whether the same transformer has appeared at least twice. - var ss []string - m := map[Option]int{} - for _, ps := range p { - if t, ok := ps.(Transform); ok { - t := t.Option() - if m[t] == 1 { // Transformer was used exactly once before - tf := t.(*transformer).fnc.Type() - ss = append(ss, fmt.Sprintf("%v: %v => %v", t, tf.In(0), tf.Out(0))) - } - m[t]++ - } - } - if len(ss) > 0 { - const warning = "recursive set of Transformers detected" - const help = "consider using cmpopts.AcyclicTransformer" - set := strings.Join(ss, "\n\t") - panic(fmt.Sprintf("%s:\n\t%s\n%s", warning, set, help)) - } -} - -// dynChecker tracks the state needed to periodically perform checks that -// user provided functions are symmetric and deterministic. -// The zero value is safe for immediate use. -type dynChecker struct{ curr, next int } - -// Next increments the state and reports whether a check should be performed. -// -// Checks occur every Nth function call, where N is a triangular number: -// 0 1 3 6 10 15 21 28 36 45 55 66 78 91 105 120 136 153 171 190 ... -// See https://en.wikipedia.org/wiki/Triangular_number -// -// This sequence ensures that the cost of checks drops significantly as -// the number of functions calls grows larger. -func (dc *dynChecker) Next() bool { - ok := dc.curr == dc.next - if ok { - dc.curr = 0 - dc.next++ - } - dc.curr++ - return ok -} - -// makeAddressable returns a value that is always addressable. -// It returns the input verbatim if it is already addressable, -// otherwise it creates a new value and returns an addressable copy. -func makeAddressable(v reflect.Value) reflect.Value { - if v.CanAddr() { - return v - } - vc := reflect.New(v.Type()).Elem() - vc.Set(v) - return vc -} diff --git a/vendor/github.com/google/go-cmp/cmp/export_panic.go b/vendor/github.com/google/go-cmp/cmp/export_panic.go deleted file mode 100644 index ae851fe53..000000000 --- a/vendor/github.com/google/go-cmp/cmp/export_panic.go +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2017, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build purego -// +build purego - -package cmp - -import "reflect" - -const supportExporters = false - -func retrieveUnexportedField(reflect.Value, reflect.StructField, bool) reflect.Value { - panic("no support for forcibly accessing unexported fields") -} diff --git a/vendor/github.com/google/go-cmp/cmp/export_unsafe.go b/vendor/github.com/google/go-cmp/cmp/export_unsafe.go deleted file mode 100644 index e2c0f74e8..000000000 --- a/vendor/github.com/google/go-cmp/cmp/export_unsafe.go +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2017, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build !purego -// +build !purego - -package cmp - -import ( - "reflect" - "unsafe" -) - -const supportExporters = true - -// retrieveUnexportedField uses unsafe to forcibly retrieve any field from -// a struct such that the value has read-write permissions. -// -// The parent struct, v, must be addressable, while f must be a StructField -// describing the field to retrieve. If addr is false, -// then the returned value will be shallowed copied to be non-addressable. -func retrieveUnexportedField(v reflect.Value, f reflect.StructField, addr bool) reflect.Value { - ve := reflect.NewAt(f.Type, unsafe.Pointer(uintptr(unsafe.Pointer(v.UnsafeAddr()))+f.Offset)).Elem() - if !addr { - // A field is addressable if and only if the struct is addressable. - // If the original parent value was not addressable, shallow copy the - // value to make it non-addressable to avoid leaking an implementation - // detail of how forcibly exporting a field works. - if ve.Kind() == reflect.Interface && ve.IsNil() { - return reflect.Zero(f.Type) - } - return reflect.ValueOf(ve.Interface()).Convert(f.Type) - } - return ve -} diff --git a/vendor/github.com/google/go-cmp/cmp/internal/diff/debug_disable.go b/vendor/github.com/google/go-cmp/cmp/internal/diff/debug_disable.go deleted file mode 100644 index 36062a604..000000000 --- a/vendor/github.com/google/go-cmp/cmp/internal/diff/debug_disable.go +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2017, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build !cmp_debug -// +build !cmp_debug - -package diff - -var debug debugger - -type debugger struct{} - -func (debugger) Begin(_, _ int, f EqualFunc, _, _ *EditScript) EqualFunc { - return f -} -func (debugger) Update() {} -func (debugger) Finish() {} diff --git a/vendor/github.com/google/go-cmp/cmp/internal/diff/debug_enable.go b/vendor/github.com/google/go-cmp/cmp/internal/diff/debug_enable.go deleted file mode 100644 index a3b97a1ad..000000000 --- a/vendor/github.com/google/go-cmp/cmp/internal/diff/debug_enable.go +++ /dev/null @@ -1,123 +0,0 @@ -// Copyright 2017, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build cmp_debug -// +build cmp_debug - -package diff - -import ( - "fmt" - "strings" - "sync" - "time" -) - -// The algorithm can be seen running in real-time by enabling debugging: -// go test -tags=cmp_debug -v -// -// Example output: -// === RUN TestDifference/#34 -// ┌───────────────────────────────┐ -// │ \ · · · · · · · · · · · · · · │ -// │ · # · · · · · · · · · · · · · │ -// │ · \ · · · · · · · · · · · · · │ -// │ · · \ · · · · · · · · · · · · │ -// │ · · · X # · · · · · · · · · · │ -// │ · · · # \ · · · · · · · · · · │ -// │ · · · · · # # · · · · · · · · │ -// │ · · · · · # \ · · · · · · · · │ -// │ · · · · · · · \ · · · · · · · │ -// │ · · · · · · · · \ · · · · · · │ -// │ · · · · · · · · · \ · · · · · │ -// │ · · · · · · · · · · \ · · # · │ -// │ · · · · · · · · · · · \ # # · │ -// │ · · · · · · · · · · · # # # · │ -// │ · · · · · · · · · · # # # # · │ -// │ · · · · · · · · · # # # # # · │ -// │ · · · · · · · · · · · · · · \ │ -// └───────────────────────────────┘ -// [.Y..M.XY......YXYXY.|] -// -// The grid represents the edit-graph where the horizontal axis represents -// list X and the vertical axis represents list Y. The start of the two lists -// is the top-left, while the ends are the bottom-right. The '·' represents -// an unexplored node in the graph. The '\' indicates that the two symbols -// from list X and Y are equal. The 'X' indicates that two symbols are similar -// (but not exactly equal) to each other. The '#' indicates that the two symbols -// are different (and not similar). The algorithm traverses this graph trying to -// make the paths starting in the top-left and the bottom-right connect. -// -// The series of '.', 'X', 'Y', and 'M' characters at the bottom represents -// the currently established path from the forward and reverse searches, -// separated by a '|' character. - -const ( - updateDelay = 100 * time.Millisecond - finishDelay = 500 * time.Millisecond - ansiTerminal = true // ANSI escape codes used to move terminal cursor -) - -var debug debugger - -type debugger struct { - sync.Mutex - p1, p2 EditScript - fwdPath, revPath *EditScript - grid []byte - lines int -} - -func (dbg *debugger) Begin(nx, ny int, f EqualFunc, p1, p2 *EditScript) EqualFunc { - dbg.Lock() - dbg.fwdPath, dbg.revPath = p1, p2 - top := "┌─" + strings.Repeat("──", nx) + "┐\n" - row := "│ " + strings.Repeat("· ", nx) + "│\n" - btm := "└─" + strings.Repeat("──", nx) + "┘\n" - dbg.grid = []byte(top + strings.Repeat(row, ny) + btm) - dbg.lines = strings.Count(dbg.String(), "\n") - fmt.Print(dbg) - - // Wrap the EqualFunc so that we can intercept each result. - return func(ix, iy int) (r Result) { - cell := dbg.grid[len(top)+iy*len(row):][len("│ ")+len("· ")*ix:][:len("·")] - for i := range cell { - cell[i] = 0 // Zero out the multiple bytes of UTF-8 middle-dot - } - switch r = f(ix, iy); { - case r.Equal(): - cell[0] = '\\' - case r.Similar(): - cell[0] = 'X' - default: - cell[0] = '#' - } - return - } -} - -func (dbg *debugger) Update() { - dbg.print(updateDelay) -} - -func (dbg *debugger) Finish() { - dbg.print(finishDelay) - dbg.Unlock() -} - -func (dbg *debugger) String() string { - dbg.p1, dbg.p2 = *dbg.fwdPath, dbg.p2[:0] - for i := len(*dbg.revPath) - 1; i >= 0; i-- { - dbg.p2 = append(dbg.p2, (*dbg.revPath)[i]) - } - return fmt.Sprintf("%s[%v|%v]\n\n", dbg.grid, dbg.p1, dbg.p2) -} - -func (dbg *debugger) print(d time.Duration) { - if ansiTerminal { - fmt.Printf("\x1b[%dA", dbg.lines) // Reset terminal cursor - } - fmt.Print(dbg) - time.Sleep(d) -} diff --git a/vendor/github.com/google/go-cmp/cmp/internal/diff/diff.go b/vendor/github.com/google/go-cmp/cmp/internal/diff/diff.go deleted file mode 100644 index bc196b16c..000000000 --- a/vendor/github.com/google/go-cmp/cmp/internal/diff/diff.go +++ /dev/null @@ -1,398 +0,0 @@ -// Copyright 2017, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package diff implements an algorithm for producing edit-scripts. -// The edit-script is a sequence of operations needed to transform one list -// of symbols into another (or vice-versa). The edits allowed are insertions, -// deletions, and modifications. The summation of all edits is called the -// Levenshtein distance as this problem is well-known in computer science. -// -// This package prioritizes performance over accuracy. That is, the run time -// is more important than obtaining a minimal Levenshtein distance. -package diff - -import ( - "math/rand" - "time" - - "github.com/google/go-cmp/cmp/internal/flags" -) - -// EditType represents a single operation within an edit-script. -type EditType uint8 - -const ( - // Identity indicates that a symbol pair is identical in both list X and Y. - Identity EditType = iota - // UniqueX indicates that a symbol only exists in X and not Y. - UniqueX - // UniqueY indicates that a symbol only exists in Y and not X. - UniqueY - // Modified indicates that a symbol pair is a modification of each other. - Modified -) - -// EditScript represents the series of differences between two lists. -type EditScript []EditType - -// String returns a human-readable string representing the edit-script where -// Identity, UniqueX, UniqueY, and Modified are represented by the -// '.', 'X', 'Y', and 'M' characters, respectively. -func (es EditScript) String() string { - b := make([]byte, len(es)) - for i, e := range es { - switch e { - case Identity: - b[i] = '.' - case UniqueX: - b[i] = 'X' - case UniqueY: - b[i] = 'Y' - case Modified: - b[i] = 'M' - default: - panic("invalid edit-type") - } - } - return string(b) -} - -// stats returns a histogram of the number of each type of edit operation. -func (es EditScript) stats() (s struct{ NI, NX, NY, NM int }) { - for _, e := range es { - switch e { - case Identity: - s.NI++ - case UniqueX: - s.NX++ - case UniqueY: - s.NY++ - case Modified: - s.NM++ - default: - panic("invalid edit-type") - } - } - return -} - -// Dist is the Levenshtein distance and is guaranteed to be 0 if and only if -// lists X and Y are equal. -func (es EditScript) Dist() int { return len(es) - es.stats().NI } - -// LenX is the length of the X list. -func (es EditScript) LenX() int { return len(es) - es.stats().NY } - -// LenY is the length of the Y list. -func (es EditScript) LenY() int { return len(es) - es.stats().NX } - -// EqualFunc reports whether the symbols at indexes ix and iy are equal. -// When called by Difference, the index is guaranteed to be within nx and ny. -type EqualFunc func(ix int, iy int) Result - -// Result is the result of comparison. -// NumSame is the number of sub-elements that are equal. -// NumDiff is the number of sub-elements that are not equal. -type Result struct{ NumSame, NumDiff int } - -// BoolResult returns a Result that is either Equal or not Equal. -func BoolResult(b bool) Result { - if b { - return Result{NumSame: 1} // Equal, Similar - } else { - return Result{NumDiff: 2} // Not Equal, not Similar - } -} - -// Equal indicates whether the symbols are equal. Two symbols are equal -// if and only if NumDiff == 0. If Equal, then they are also Similar. -func (r Result) Equal() bool { return r.NumDiff == 0 } - -// Similar indicates whether two symbols are similar and may be represented -// by using the Modified type. As a special case, we consider binary comparisons -// (i.e., those that return Result{1, 0} or Result{0, 1}) to be similar. -// -// The exact ratio of NumSame to NumDiff to determine similarity may change. -func (r Result) Similar() bool { - // Use NumSame+1 to offset NumSame so that binary comparisons are similar. - return r.NumSame+1 >= r.NumDiff -} - -var randBool = rand.New(rand.NewSource(time.Now().Unix())).Intn(2) == 0 - -// Difference reports whether two lists of lengths nx and ny are equal -// given the definition of equality provided as f. -// -// This function returns an edit-script, which is a sequence of operations -// needed to convert one list into the other. The following invariants for -// the edit-script are maintained: -// • eq == (es.Dist()==0) -// • nx == es.LenX() -// • ny == es.LenY() -// -// This algorithm is not guaranteed to be an optimal solution (i.e., one that -// produces an edit-script with a minimal Levenshtein distance). This algorithm -// favors performance over optimality. The exact output is not guaranteed to -// be stable and may change over time. -func Difference(nx, ny int, f EqualFunc) (es EditScript) { - // This algorithm is based on traversing what is known as an "edit-graph". - // See Figure 1 from "An O(ND) Difference Algorithm and Its Variations" - // by Eugene W. Myers. Since D can be as large as N itself, this is - // effectively O(N^2). Unlike the algorithm from that paper, we are not - // interested in the optimal path, but at least some "decent" path. - // - // For example, let X and Y be lists of symbols: - // X = [A B C A B B A] - // Y = [C B A B A C] - // - // The edit-graph can be drawn as the following: - // A B C A B B A - // ┌─────────────┐ - // C │_|_|\|_|_|_|_│ 0 - // B │_|\|_|_|\|\|_│ 1 - // A │\|_|_|\|_|_|\│ 2 - // B │_|\|_|_|\|\|_│ 3 - // A │\|_|_|\|_|_|\│ 4 - // C │ | |\| | | | │ 5 - // └─────────────┘ 6 - // 0 1 2 3 4 5 6 7 - // - // List X is written along the horizontal axis, while list Y is written - // along the vertical axis. At any point on this grid, if the symbol in - // list X matches the corresponding symbol in list Y, then a '\' is drawn. - // The goal of any minimal edit-script algorithm is to find a path from the - // top-left corner to the bottom-right corner, while traveling through the - // fewest horizontal or vertical edges. - // A horizontal edge is equivalent to inserting a symbol from list X. - // A vertical edge is equivalent to inserting a symbol from list Y. - // A diagonal edge is equivalent to a matching symbol between both X and Y. - - // Invariants: - // • 0 ≤ fwdPath.X ≤ (fwdFrontier.X, revFrontier.X) ≤ revPath.X ≤ nx - // • 0 ≤ fwdPath.Y ≤ (fwdFrontier.Y, revFrontier.Y) ≤ revPath.Y ≤ ny - // - // In general: - // • fwdFrontier.X < revFrontier.X - // • fwdFrontier.Y < revFrontier.Y - // Unless, it is time for the algorithm to terminate. - fwdPath := path{+1, point{0, 0}, make(EditScript, 0, (nx+ny)/2)} - revPath := path{-1, point{nx, ny}, make(EditScript, 0)} - fwdFrontier := fwdPath.point // Forward search frontier - revFrontier := revPath.point // Reverse search frontier - - // Search budget bounds the cost of searching for better paths. - // The longest sequence of non-matching symbols that can be tolerated is - // approximately the square-root of the search budget. - searchBudget := 4 * (nx + ny) // O(n) - - // Running the tests with the "cmp_debug" build tag prints a visualization - // of the algorithm running in real-time. This is educational for - // understanding how the algorithm works. See debug_enable.go. - f = debug.Begin(nx, ny, f, &fwdPath.es, &revPath.es) - - // The algorithm below is a greedy, meet-in-the-middle algorithm for - // computing sub-optimal edit-scripts between two lists. - // - // The algorithm is approximately as follows: - // • Searching for differences switches back-and-forth between - // a search that starts at the beginning (the top-left corner), and - // a search that starts at the end (the bottom-right corner). The goal of - // the search is connect with the search from the opposite corner. - // • As we search, we build a path in a greedy manner, where the first - // match seen is added to the path (this is sub-optimal, but provides a - // decent result in practice). When matches are found, we try the next pair - // of symbols in the lists and follow all matches as far as possible. - // • When searching for matches, we search along a diagonal going through - // through the "frontier" point. If no matches are found, we advance the - // frontier towards the opposite corner. - // • This algorithm terminates when either the X coordinates or the - // Y coordinates of the forward and reverse frontier points ever intersect. - - // This algorithm is correct even if searching only in the forward direction - // or in the reverse direction. We do both because it is commonly observed - // that two lists commonly differ because elements were added to the front - // or end of the other list. - // - // Non-deterministically start with either the forward or reverse direction - // to introduce some deliberate instability so that we have the flexibility - // to change this algorithm in the future. - if flags.Deterministic || randBool { - goto forwardSearch - } else { - goto reverseSearch - } - -forwardSearch: - { - // Forward search from the beginning. - if fwdFrontier.X >= revFrontier.X || fwdFrontier.Y >= revFrontier.Y || searchBudget == 0 { - goto finishSearch - } - for stop1, stop2, i := false, false, 0; !(stop1 && stop2) && searchBudget > 0; i++ { - // Search in a diagonal pattern for a match. - z := zigzag(i) - p := point{fwdFrontier.X + z, fwdFrontier.Y - z} - switch { - case p.X >= revPath.X || p.Y < fwdPath.Y: - stop1 = true // Hit top-right corner - case p.Y >= revPath.Y || p.X < fwdPath.X: - stop2 = true // Hit bottom-left corner - case f(p.X, p.Y).Equal(): - // Match found, so connect the path to this point. - fwdPath.connect(p, f) - fwdPath.append(Identity) - // Follow sequence of matches as far as possible. - for fwdPath.X < revPath.X && fwdPath.Y < revPath.Y { - if !f(fwdPath.X, fwdPath.Y).Equal() { - break - } - fwdPath.append(Identity) - } - fwdFrontier = fwdPath.point - stop1, stop2 = true, true - default: - searchBudget-- // Match not found - } - debug.Update() - } - // Advance the frontier towards reverse point. - if revPath.X-fwdFrontier.X >= revPath.Y-fwdFrontier.Y { - fwdFrontier.X++ - } else { - fwdFrontier.Y++ - } - goto reverseSearch - } - -reverseSearch: - { - // Reverse search from the end. - if fwdFrontier.X >= revFrontier.X || fwdFrontier.Y >= revFrontier.Y || searchBudget == 0 { - goto finishSearch - } - for stop1, stop2, i := false, false, 0; !(stop1 && stop2) && searchBudget > 0; i++ { - // Search in a diagonal pattern for a match. - z := zigzag(i) - p := point{revFrontier.X - z, revFrontier.Y + z} - switch { - case fwdPath.X >= p.X || revPath.Y < p.Y: - stop1 = true // Hit bottom-left corner - case fwdPath.Y >= p.Y || revPath.X < p.X: - stop2 = true // Hit top-right corner - case f(p.X-1, p.Y-1).Equal(): - // Match found, so connect the path to this point. - revPath.connect(p, f) - revPath.append(Identity) - // Follow sequence of matches as far as possible. - for fwdPath.X < revPath.X && fwdPath.Y < revPath.Y { - if !f(revPath.X-1, revPath.Y-1).Equal() { - break - } - revPath.append(Identity) - } - revFrontier = revPath.point - stop1, stop2 = true, true - default: - searchBudget-- // Match not found - } - debug.Update() - } - // Advance the frontier towards forward point. - if revFrontier.X-fwdPath.X >= revFrontier.Y-fwdPath.Y { - revFrontier.X-- - } else { - revFrontier.Y-- - } - goto forwardSearch - } - -finishSearch: - // Join the forward and reverse paths and then append the reverse path. - fwdPath.connect(revPath.point, f) - for i := len(revPath.es) - 1; i >= 0; i-- { - t := revPath.es[i] - revPath.es = revPath.es[:i] - fwdPath.append(t) - } - debug.Finish() - return fwdPath.es -} - -type path struct { - dir int // +1 if forward, -1 if reverse - point // Leading point of the EditScript path - es EditScript -} - -// connect appends any necessary Identity, Modified, UniqueX, or UniqueY types -// to the edit-script to connect p.point to dst. -func (p *path) connect(dst point, f EqualFunc) { - if p.dir > 0 { - // Connect in forward direction. - for dst.X > p.X && dst.Y > p.Y { - switch r := f(p.X, p.Y); { - case r.Equal(): - p.append(Identity) - case r.Similar(): - p.append(Modified) - case dst.X-p.X >= dst.Y-p.Y: - p.append(UniqueX) - default: - p.append(UniqueY) - } - } - for dst.X > p.X { - p.append(UniqueX) - } - for dst.Y > p.Y { - p.append(UniqueY) - } - } else { - // Connect in reverse direction. - for p.X > dst.X && p.Y > dst.Y { - switch r := f(p.X-1, p.Y-1); { - case r.Equal(): - p.append(Identity) - case r.Similar(): - p.append(Modified) - case p.Y-dst.Y >= p.X-dst.X: - p.append(UniqueY) - default: - p.append(UniqueX) - } - } - for p.X > dst.X { - p.append(UniqueX) - } - for p.Y > dst.Y { - p.append(UniqueY) - } - } -} - -func (p *path) append(t EditType) { - p.es = append(p.es, t) - switch t { - case Identity, Modified: - p.add(p.dir, p.dir) - case UniqueX: - p.add(p.dir, 0) - case UniqueY: - p.add(0, p.dir) - } - debug.Update() -} - -type point struct{ X, Y int } - -func (p *point) add(dx, dy int) { p.X += dx; p.Y += dy } - -// zigzag maps a consecutive sequence of integers to a zig-zag sequence. -// [0 1 2 3 4 5 ...] => [0 -1 +1 -2 +2 ...] -func zigzag(x int) int { - if x&1 != 0 { - x = ^x - } - return x >> 1 -} diff --git a/vendor/github.com/google/go-cmp/cmp/internal/flags/flags.go b/vendor/github.com/google/go-cmp/cmp/internal/flags/flags.go deleted file mode 100644 index d8e459c9b..000000000 --- a/vendor/github.com/google/go-cmp/cmp/internal/flags/flags.go +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright 2019, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package flags - -// Deterministic controls whether the output of Diff should be deterministic. -// This is only used for testing. -var Deterministic bool diff --git a/vendor/github.com/google/go-cmp/cmp/internal/function/func.go b/vendor/github.com/google/go-cmp/cmp/internal/function/func.go deleted file mode 100644 index d127d4362..000000000 --- a/vendor/github.com/google/go-cmp/cmp/internal/function/func.go +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright 2017, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package function provides functionality for identifying function types. -package function - -import ( - "reflect" - "regexp" - "runtime" - "strings" -) - -type funcType int - -const ( - _ funcType = iota - - tbFunc // func(T) bool - ttbFunc // func(T, T) bool - trbFunc // func(T, R) bool - tibFunc // func(T, I) bool - trFunc // func(T) R - - Equal = ttbFunc // func(T, T) bool - EqualAssignable = tibFunc // func(T, I) bool; encapsulates func(T, T) bool - Transformer = trFunc // func(T) R - ValueFilter = ttbFunc // func(T, T) bool - Less = ttbFunc // func(T, T) bool - ValuePredicate = tbFunc // func(T) bool - KeyValuePredicate = trbFunc // func(T, R) bool -) - -var boolType = reflect.TypeOf(true) - -// IsType reports whether the reflect.Type is of the specified function type. -func IsType(t reflect.Type, ft funcType) bool { - if t == nil || t.Kind() != reflect.Func || t.IsVariadic() { - return false - } - ni, no := t.NumIn(), t.NumOut() - switch ft { - case tbFunc: // func(T) bool - if ni == 1 && no == 1 && t.Out(0) == boolType { - return true - } - case ttbFunc: // func(T, T) bool - if ni == 2 && no == 1 && t.In(0) == t.In(1) && t.Out(0) == boolType { - return true - } - case trbFunc: // func(T, R) bool - if ni == 2 && no == 1 && t.Out(0) == boolType { - return true - } - case tibFunc: // func(T, I) bool - if ni == 2 && no == 1 && t.In(0).AssignableTo(t.In(1)) && t.Out(0) == boolType { - return true - } - case trFunc: // func(T) R - if ni == 1 && no == 1 { - return true - } - } - return false -} - -var lastIdentRx = regexp.MustCompile(`[_\p{L}][_\p{L}\p{N}]*$`) - -// NameOf returns the name of the function value. -func NameOf(v reflect.Value) string { - fnc := runtime.FuncForPC(v.Pointer()) - if fnc == nil { - return "" - } - fullName := fnc.Name() // e.g., "long/path/name/mypkg.(*MyType).(long/path/name/mypkg.myMethod)-fm" - - // Method closures have a "-fm" suffix. - fullName = strings.TrimSuffix(fullName, "-fm") - - var name string - for len(fullName) > 0 { - inParen := strings.HasSuffix(fullName, ")") - fullName = strings.TrimSuffix(fullName, ")") - - s := lastIdentRx.FindString(fullName) - if s == "" { - break - } - name = s + "." + name - fullName = strings.TrimSuffix(fullName, s) - - if i := strings.LastIndexByte(fullName, '('); inParen && i >= 0 { - fullName = fullName[:i] - } - fullName = strings.TrimSuffix(fullName, ".") - } - return strings.TrimSuffix(name, ".") -} diff --git a/vendor/github.com/google/go-cmp/cmp/internal/value/name.go b/vendor/github.com/google/go-cmp/cmp/internal/value/name.go deleted file mode 100644 index 7b498bb2c..000000000 --- a/vendor/github.com/google/go-cmp/cmp/internal/value/name.go +++ /dev/null @@ -1,164 +0,0 @@ -// Copyright 2020, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package value - -import ( - "reflect" - "strconv" -) - -var anyType = reflect.TypeOf((*interface{})(nil)).Elem() - -// TypeString is nearly identical to reflect.Type.String, -// but has an additional option to specify that full type names be used. -func TypeString(t reflect.Type, qualified bool) string { - return string(appendTypeName(nil, t, qualified, false)) -} - -func appendTypeName(b []byte, t reflect.Type, qualified, elideFunc bool) []byte { - // BUG: Go reflection provides no way to disambiguate two named types - // of the same name and within the same package, - // but declared within the namespace of different functions. - - // Use the "any" alias instead of "interface{}" for better readability. - if t == anyType { - return append(b, "any"...) - } - - // Named type. - if t.Name() != "" { - if qualified && t.PkgPath() != "" { - b = append(b, '"') - b = append(b, t.PkgPath()...) - b = append(b, '"') - b = append(b, '.') - b = append(b, t.Name()...) - } else { - b = append(b, t.String()...) - } - return b - } - - // Unnamed type. - switch k := t.Kind(); k { - case reflect.Bool, reflect.String, reflect.UnsafePointer, - reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, - reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr, - reflect.Float32, reflect.Float64, reflect.Complex64, reflect.Complex128: - b = append(b, k.String()...) - case reflect.Chan: - if t.ChanDir() == reflect.RecvDir { - b = append(b, "<-"...) - } - b = append(b, "chan"...) - if t.ChanDir() == reflect.SendDir { - b = append(b, "<-"...) - } - b = append(b, ' ') - b = appendTypeName(b, t.Elem(), qualified, false) - case reflect.Func: - if !elideFunc { - b = append(b, "func"...) - } - b = append(b, '(') - for i := 0; i < t.NumIn(); i++ { - if i > 0 { - b = append(b, ", "...) - } - if i == t.NumIn()-1 && t.IsVariadic() { - b = append(b, "..."...) - b = appendTypeName(b, t.In(i).Elem(), qualified, false) - } else { - b = appendTypeName(b, t.In(i), qualified, false) - } - } - b = append(b, ')') - switch t.NumOut() { - case 0: - // Do nothing - case 1: - b = append(b, ' ') - b = appendTypeName(b, t.Out(0), qualified, false) - default: - b = append(b, " ("...) - for i := 0; i < t.NumOut(); i++ { - if i > 0 { - b = append(b, ", "...) - } - b = appendTypeName(b, t.Out(i), qualified, false) - } - b = append(b, ')') - } - case reflect.Struct: - b = append(b, "struct{ "...) - for i := 0; i < t.NumField(); i++ { - if i > 0 { - b = append(b, "; "...) - } - sf := t.Field(i) - if !sf.Anonymous { - if qualified && sf.PkgPath != "" { - b = append(b, '"') - b = append(b, sf.PkgPath...) - b = append(b, '"') - b = append(b, '.') - } - b = append(b, sf.Name...) - b = append(b, ' ') - } - b = appendTypeName(b, sf.Type, qualified, false) - if sf.Tag != "" { - b = append(b, ' ') - b = strconv.AppendQuote(b, string(sf.Tag)) - } - } - if b[len(b)-1] == ' ' { - b = b[:len(b)-1] - } else { - b = append(b, ' ') - } - b = append(b, '}') - case reflect.Slice, reflect.Array: - b = append(b, '[') - if k == reflect.Array { - b = strconv.AppendUint(b, uint64(t.Len()), 10) - } - b = append(b, ']') - b = appendTypeName(b, t.Elem(), qualified, false) - case reflect.Map: - b = append(b, "map["...) - b = appendTypeName(b, t.Key(), qualified, false) - b = append(b, ']') - b = appendTypeName(b, t.Elem(), qualified, false) - case reflect.Ptr: - b = append(b, '*') - b = appendTypeName(b, t.Elem(), qualified, false) - case reflect.Interface: - b = append(b, "interface{ "...) - for i := 0; i < t.NumMethod(); i++ { - if i > 0 { - b = append(b, "; "...) - } - m := t.Method(i) - if qualified && m.PkgPath != "" { - b = append(b, '"') - b = append(b, m.PkgPath...) - b = append(b, '"') - b = append(b, '.') - } - b = append(b, m.Name...) - b = appendTypeName(b, m.Type, qualified, true) - } - if b[len(b)-1] == ' ' { - b = b[:len(b)-1] - } else { - b = append(b, ' ') - } - b = append(b, '}') - default: - panic("invalid kind: " + k.String()) - } - return b -} diff --git a/vendor/github.com/google/go-cmp/cmp/internal/value/pointer_purego.go b/vendor/github.com/google/go-cmp/cmp/internal/value/pointer_purego.go deleted file mode 100644 index 1a71bfcbd..000000000 --- a/vendor/github.com/google/go-cmp/cmp/internal/value/pointer_purego.go +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2018, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build purego -// +build purego - -package value - -import "reflect" - -// Pointer is an opaque typed pointer and is guaranteed to be comparable. -type Pointer struct { - p uintptr - t reflect.Type -} - -// PointerOf returns a Pointer from v, which must be a -// reflect.Ptr, reflect.Slice, or reflect.Map. -func PointerOf(v reflect.Value) Pointer { - // NOTE: Storing a pointer as an uintptr is technically incorrect as it - // assumes that the GC implementation does not use a moving collector. - return Pointer{v.Pointer(), v.Type()} -} - -// IsNil reports whether the pointer is nil. -func (p Pointer) IsNil() bool { - return p.p == 0 -} - -// Uintptr returns the pointer as a uintptr. -func (p Pointer) Uintptr() uintptr { - return p.p -} diff --git a/vendor/github.com/google/go-cmp/cmp/internal/value/pointer_unsafe.go b/vendor/github.com/google/go-cmp/cmp/internal/value/pointer_unsafe.go deleted file mode 100644 index 16e6860af..000000000 --- a/vendor/github.com/google/go-cmp/cmp/internal/value/pointer_unsafe.go +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2018, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build !purego -// +build !purego - -package value - -import ( - "reflect" - "unsafe" -) - -// Pointer is an opaque typed pointer and is guaranteed to be comparable. -type Pointer struct { - p unsafe.Pointer - t reflect.Type -} - -// PointerOf returns a Pointer from v, which must be a -// reflect.Ptr, reflect.Slice, or reflect.Map. -func PointerOf(v reflect.Value) Pointer { - // The proper representation of a pointer is unsafe.Pointer, - // which is necessary if the GC ever uses a moving collector. - return Pointer{unsafe.Pointer(v.Pointer()), v.Type()} -} - -// IsNil reports whether the pointer is nil. -func (p Pointer) IsNil() bool { - return p.p == nil -} - -// Uintptr returns the pointer as a uintptr. -func (p Pointer) Uintptr() uintptr { - return uintptr(p.p) -} diff --git a/vendor/github.com/google/go-cmp/cmp/internal/value/sort.go b/vendor/github.com/google/go-cmp/cmp/internal/value/sort.go deleted file mode 100644 index 98533b036..000000000 --- a/vendor/github.com/google/go-cmp/cmp/internal/value/sort.go +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright 2017, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package value - -import ( - "fmt" - "math" - "reflect" - "sort" -) - -// SortKeys sorts a list of map keys, deduplicating keys if necessary. -// The type of each value must be comparable. -func SortKeys(vs []reflect.Value) []reflect.Value { - if len(vs) == 0 { - return vs - } - - // Sort the map keys. - sort.SliceStable(vs, func(i, j int) bool { return isLess(vs[i], vs[j]) }) - - // Deduplicate keys (fails for NaNs). - vs2 := vs[:1] - for _, v := range vs[1:] { - if isLess(vs2[len(vs2)-1], v) { - vs2 = append(vs2, v) - } - } - return vs2 -} - -// isLess is a generic function for sorting arbitrary map keys. -// The inputs must be of the same type and must be comparable. -func isLess(x, y reflect.Value) bool { - switch x.Type().Kind() { - case reflect.Bool: - return !x.Bool() && y.Bool() - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return x.Int() < y.Int() - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - return x.Uint() < y.Uint() - case reflect.Float32, reflect.Float64: - // NOTE: This does not sort -0 as less than +0 - // since Go maps treat -0 and +0 as equal keys. - fx, fy := x.Float(), y.Float() - return fx < fy || math.IsNaN(fx) && !math.IsNaN(fy) - case reflect.Complex64, reflect.Complex128: - cx, cy := x.Complex(), y.Complex() - rx, ix, ry, iy := real(cx), imag(cx), real(cy), imag(cy) - if rx == ry || (math.IsNaN(rx) && math.IsNaN(ry)) { - return ix < iy || math.IsNaN(ix) && !math.IsNaN(iy) - } - return rx < ry || math.IsNaN(rx) && !math.IsNaN(ry) - case reflect.Ptr, reflect.UnsafePointer, reflect.Chan: - return x.Pointer() < y.Pointer() - case reflect.String: - return x.String() < y.String() - case reflect.Array: - for i := 0; i < x.Len(); i++ { - if isLess(x.Index(i), y.Index(i)) { - return true - } - if isLess(y.Index(i), x.Index(i)) { - return false - } - } - return false - case reflect.Struct: - for i := 0; i < x.NumField(); i++ { - if isLess(x.Field(i), y.Field(i)) { - return true - } - if isLess(y.Field(i), x.Field(i)) { - return false - } - } - return false - case reflect.Interface: - vx, vy := x.Elem(), y.Elem() - if !vx.IsValid() || !vy.IsValid() { - return !vx.IsValid() && vy.IsValid() - } - tx, ty := vx.Type(), vy.Type() - if tx == ty { - return isLess(x.Elem(), y.Elem()) - } - if tx.Kind() != ty.Kind() { - return vx.Kind() < vy.Kind() - } - if tx.String() != ty.String() { - return tx.String() < ty.String() - } - if tx.PkgPath() != ty.PkgPath() { - return tx.PkgPath() < ty.PkgPath() - } - // This can happen in rare situations, so we fallback to just comparing - // the unique pointer for a reflect.Type. This guarantees deterministic - // ordering within a program, but it is obviously not stable. - return reflect.ValueOf(vx.Type()).Pointer() < reflect.ValueOf(vy.Type()).Pointer() - default: - // Must be Func, Map, or Slice; which are not comparable. - panic(fmt.Sprintf("%T is not comparable", x.Type())) - } -} diff --git a/vendor/github.com/google/go-cmp/cmp/internal/value/zero.go b/vendor/github.com/google/go-cmp/cmp/internal/value/zero.go deleted file mode 100644 index 9147a2997..000000000 --- a/vendor/github.com/google/go-cmp/cmp/internal/value/zero.go +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2017, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package value - -import ( - "math" - "reflect" -) - -// IsZero reports whether v is the zero value. -// This does not rely on Interface and so can be used on unexported fields. -func IsZero(v reflect.Value) bool { - switch v.Kind() { - case reflect.Bool: - return v.Bool() == false - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return v.Int() == 0 - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - return v.Uint() == 0 - case reflect.Float32, reflect.Float64: - return math.Float64bits(v.Float()) == 0 - case reflect.Complex64, reflect.Complex128: - return math.Float64bits(real(v.Complex())) == 0 && math.Float64bits(imag(v.Complex())) == 0 - case reflect.String: - return v.String() == "" - case reflect.UnsafePointer: - return v.Pointer() == 0 - case reflect.Chan, reflect.Func, reflect.Interface, reflect.Ptr, reflect.Map, reflect.Slice: - return v.IsNil() - case reflect.Array: - for i := 0; i < v.Len(); i++ { - if !IsZero(v.Index(i)) { - return false - } - } - return true - case reflect.Struct: - for i := 0; i < v.NumField(); i++ { - if !IsZero(v.Field(i)) { - return false - } - } - return true - } - return false -} diff --git a/vendor/github.com/google/go-cmp/cmp/options.go b/vendor/github.com/google/go-cmp/cmp/options.go deleted file mode 100644 index e57b9eb53..000000000 --- a/vendor/github.com/google/go-cmp/cmp/options.go +++ /dev/null @@ -1,552 +0,0 @@ -// Copyright 2017, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package cmp - -import ( - "fmt" - "reflect" - "regexp" - "strings" - - "github.com/google/go-cmp/cmp/internal/function" -) - -// Option configures for specific behavior of Equal and Diff. In particular, -// the fundamental Option functions (Ignore, Transformer, and Comparer), -// configure how equality is determined. -// -// The fundamental options may be composed with filters (FilterPath and -// FilterValues) to control the scope over which they are applied. -// -// The cmp/cmpopts package provides helper functions for creating options that -// may be used with Equal and Diff. -type Option interface { - // filter applies all filters and returns the option that remains. - // Each option may only read s.curPath and call s.callTTBFunc. - // - // An Options is returned only if multiple comparers or transformers - // can apply simultaneously and will only contain values of those types - // or sub-Options containing values of those types. - filter(s *state, t reflect.Type, vx, vy reflect.Value) applicableOption -} - -// applicableOption represents the following types: -// Fundamental: ignore | validator | *comparer | *transformer -// Grouping: Options -type applicableOption interface { - Option - - // apply executes the option, which may mutate s or panic. - apply(s *state, vx, vy reflect.Value) -} - -// coreOption represents the following types: -// Fundamental: ignore | validator | *comparer | *transformer -// Filters: *pathFilter | *valuesFilter -type coreOption interface { - Option - isCore() -} - -type core struct{} - -func (core) isCore() {} - -// Options is a list of Option values that also satisfies the Option interface. -// Helper comparison packages may return an Options value when packing multiple -// Option values into a single Option. When this package processes an Options, -// it will be implicitly expanded into a flat list. -// -// Applying a filter on an Options is equivalent to applying that same filter -// on all individual options held within. -type Options []Option - -func (opts Options) filter(s *state, t reflect.Type, vx, vy reflect.Value) (out applicableOption) { - for _, opt := range opts { - switch opt := opt.filter(s, t, vx, vy); opt.(type) { - case ignore: - return ignore{} // Only ignore can short-circuit evaluation - case validator: - out = validator{} // Takes precedence over comparer or transformer - case *comparer, *transformer, Options: - switch out.(type) { - case nil: - out = opt - case validator: - // Keep validator - case *comparer, *transformer, Options: - out = Options{out, opt} // Conflicting comparers or transformers - } - } - } - return out -} - -func (opts Options) apply(s *state, _, _ reflect.Value) { - const warning = "ambiguous set of applicable options" - const help = "consider using filters to ensure at most one Comparer or Transformer may apply" - var ss []string - for _, opt := range flattenOptions(nil, opts) { - ss = append(ss, fmt.Sprint(opt)) - } - set := strings.Join(ss, "\n\t") - panic(fmt.Sprintf("%s at %#v:\n\t%s\n%s", warning, s.curPath, set, help)) -} - -func (opts Options) String() string { - var ss []string - for _, opt := range opts { - ss = append(ss, fmt.Sprint(opt)) - } - return fmt.Sprintf("Options{%s}", strings.Join(ss, ", ")) -} - -// FilterPath returns a new Option where opt is only evaluated if filter f -// returns true for the current Path in the value tree. -// -// This filter is called even if a slice element or map entry is missing and -// provides an opportunity to ignore such cases. The filter function must be -// symmetric such that the filter result is identical regardless of whether the -// missing value is from x or y. -// -// The option passed in may be an Ignore, Transformer, Comparer, Options, or -// a previously filtered Option. -func FilterPath(f func(Path) bool, opt Option) Option { - if f == nil { - panic("invalid path filter function") - } - if opt := normalizeOption(opt); opt != nil { - return &pathFilter{fnc: f, opt: opt} - } - return nil -} - -type pathFilter struct { - core - fnc func(Path) bool - opt Option -} - -func (f pathFilter) filter(s *state, t reflect.Type, vx, vy reflect.Value) applicableOption { - if f.fnc(s.curPath) { - return f.opt.filter(s, t, vx, vy) - } - return nil -} - -func (f pathFilter) String() string { - return fmt.Sprintf("FilterPath(%s, %v)", function.NameOf(reflect.ValueOf(f.fnc)), f.opt) -} - -// FilterValues returns a new Option where opt is only evaluated if filter f, -// which is a function of the form "func(T, T) bool", returns true for the -// current pair of values being compared. If either value is invalid or -// the type of the values is not assignable to T, then this filter implicitly -// returns false. -// -// The filter function must be -// symmetric (i.e., agnostic to the order of the inputs) and -// deterministic (i.e., produces the same result when given the same inputs). -// If T is an interface, it is possible that f is called with two values with -// different concrete types that both implement T. -// -// The option passed in may be an Ignore, Transformer, Comparer, Options, or -// a previously filtered Option. -func FilterValues(f interface{}, opt Option) Option { - v := reflect.ValueOf(f) - if !function.IsType(v.Type(), function.ValueFilter) || v.IsNil() { - panic(fmt.Sprintf("invalid values filter function: %T", f)) - } - if opt := normalizeOption(opt); opt != nil { - vf := &valuesFilter{fnc: v, opt: opt} - if ti := v.Type().In(0); ti.Kind() != reflect.Interface || ti.NumMethod() > 0 { - vf.typ = ti - } - return vf - } - return nil -} - -type valuesFilter struct { - core - typ reflect.Type // T - fnc reflect.Value // func(T, T) bool - opt Option -} - -func (f valuesFilter) filter(s *state, t reflect.Type, vx, vy reflect.Value) applicableOption { - if !vx.IsValid() || !vx.CanInterface() || !vy.IsValid() || !vy.CanInterface() { - return nil - } - if (f.typ == nil || t.AssignableTo(f.typ)) && s.callTTBFunc(f.fnc, vx, vy) { - return f.opt.filter(s, t, vx, vy) - } - return nil -} - -func (f valuesFilter) String() string { - return fmt.Sprintf("FilterValues(%s, %v)", function.NameOf(f.fnc), f.opt) -} - -// Ignore is an Option that causes all comparisons to be ignored. -// This value is intended to be combined with FilterPath or FilterValues. -// It is an error to pass an unfiltered Ignore option to Equal. -func Ignore() Option { return ignore{} } - -type ignore struct{ core } - -func (ignore) isFiltered() bool { return false } -func (ignore) filter(_ *state, _ reflect.Type, _, _ reflect.Value) applicableOption { return ignore{} } -func (ignore) apply(s *state, _, _ reflect.Value) { s.report(true, reportByIgnore) } -func (ignore) String() string { return "Ignore()" } - -// validator is a sentinel Option type to indicate that some options could not -// be evaluated due to unexported fields, missing slice elements, or -// missing map entries. Both values are validator only for unexported fields. -type validator struct{ core } - -func (validator) filter(_ *state, _ reflect.Type, vx, vy reflect.Value) applicableOption { - if !vx.IsValid() || !vy.IsValid() { - return validator{} - } - if !vx.CanInterface() || !vy.CanInterface() { - return validator{} - } - return nil -} -func (validator) apply(s *state, vx, vy reflect.Value) { - // Implies missing slice element or map entry. - if !vx.IsValid() || !vy.IsValid() { - s.report(vx.IsValid() == vy.IsValid(), 0) - return - } - - // Unable to Interface implies unexported field without visibility access. - if !vx.CanInterface() || !vy.CanInterface() { - help := "consider using a custom Comparer; if you control the implementation of type, you can also consider using an Exporter, AllowUnexported, or cmpopts.IgnoreUnexported" - var name string - if t := s.curPath.Index(-2).Type(); t.Name() != "" { - // Named type with unexported fields. - name = fmt.Sprintf("%q.%v", t.PkgPath(), t.Name()) // e.g., "path/to/package".MyType - if _, ok := reflect.New(t).Interface().(error); ok { - help = "consider using cmpopts.EquateErrors to compare error values" - } - } else { - // Unnamed type with unexported fields. Derive PkgPath from field. - var pkgPath string - for i := 0; i < t.NumField() && pkgPath == ""; i++ { - pkgPath = t.Field(i).PkgPath - } - name = fmt.Sprintf("%q.(%v)", pkgPath, t.String()) // e.g., "path/to/package".(struct { a int }) - } - panic(fmt.Sprintf("cannot handle unexported field at %#v:\n\t%v\n%s", s.curPath, name, help)) - } - - panic("not reachable") -} - -// identRx represents a valid identifier according to the Go specification. -const identRx = `[_\p{L}][_\p{L}\p{N}]*` - -var identsRx = regexp.MustCompile(`^` + identRx + `(\.` + identRx + `)*$`) - -// Transformer returns an Option that applies a transformation function that -// converts values of a certain type into that of another. -// -// The transformer f must be a function "func(T) R" that converts values of -// type T to those of type R and is implicitly filtered to input values -// assignable to T. The transformer must not mutate T in any way. -// -// To help prevent some cases of infinite recursive cycles applying the -// same transform to the output of itself (e.g., in the case where the -// input and output types are the same), an implicit filter is added such that -// a transformer is applicable only if that exact transformer is not already -// in the tail of the Path since the last non-Transform step. -// For situations where the implicit filter is still insufficient, -// consider using cmpopts.AcyclicTransformer, which adds a filter -// to prevent the transformer from being recursively applied upon itself. -// -// The name is a user provided label that is used as the Transform.Name in the -// transformation PathStep (and eventually shown in the Diff output). -// The name must be a valid identifier or qualified identifier in Go syntax. -// If empty, an arbitrary name is used. -func Transformer(name string, f interface{}) Option { - v := reflect.ValueOf(f) - if !function.IsType(v.Type(), function.Transformer) || v.IsNil() { - panic(fmt.Sprintf("invalid transformer function: %T", f)) - } - if name == "" { - name = function.NameOf(v) - if !identsRx.MatchString(name) { - name = "λ" // Lambda-symbol as placeholder name - } - } else if !identsRx.MatchString(name) { - panic(fmt.Sprintf("invalid name: %q", name)) - } - tr := &transformer{name: name, fnc: reflect.ValueOf(f)} - if ti := v.Type().In(0); ti.Kind() != reflect.Interface || ti.NumMethod() > 0 { - tr.typ = ti - } - return tr -} - -type transformer struct { - core - name string - typ reflect.Type // T - fnc reflect.Value // func(T) R -} - -func (tr *transformer) isFiltered() bool { return tr.typ != nil } - -func (tr *transformer) filter(s *state, t reflect.Type, _, _ reflect.Value) applicableOption { - for i := len(s.curPath) - 1; i >= 0; i-- { - if t, ok := s.curPath[i].(Transform); !ok { - break // Hit most recent non-Transform step - } else if tr == t.trans { - return nil // Cannot directly use same Transform - } - } - if tr.typ == nil || t.AssignableTo(tr.typ) { - return tr - } - return nil -} - -func (tr *transformer) apply(s *state, vx, vy reflect.Value) { - step := Transform{&transform{pathStep{typ: tr.fnc.Type().Out(0)}, tr}} - vvx := s.callTRFunc(tr.fnc, vx, step) - vvy := s.callTRFunc(tr.fnc, vy, step) - step.vx, step.vy = vvx, vvy - s.compareAny(step) -} - -func (tr transformer) String() string { - return fmt.Sprintf("Transformer(%s, %s)", tr.name, function.NameOf(tr.fnc)) -} - -// Comparer returns an Option that determines whether two values are equal -// to each other. -// -// The comparer f must be a function "func(T, T) bool" and is implicitly -// filtered to input values assignable to T. If T is an interface, it is -// possible that f is called with two values of different concrete types that -// both implement T. -// -// The equality function must be: -// • Symmetric: equal(x, y) == equal(y, x) -// • Deterministic: equal(x, y) == equal(x, y) -// • Pure: equal(x, y) does not modify x or y -func Comparer(f interface{}) Option { - v := reflect.ValueOf(f) - if !function.IsType(v.Type(), function.Equal) || v.IsNil() { - panic(fmt.Sprintf("invalid comparer function: %T", f)) - } - cm := &comparer{fnc: v} - if ti := v.Type().In(0); ti.Kind() != reflect.Interface || ti.NumMethod() > 0 { - cm.typ = ti - } - return cm -} - -type comparer struct { - core - typ reflect.Type // T - fnc reflect.Value // func(T, T) bool -} - -func (cm *comparer) isFiltered() bool { return cm.typ != nil } - -func (cm *comparer) filter(_ *state, t reflect.Type, _, _ reflect.Value) applicableOption { - if cm.typ == nil || t.AssignableTo(cm.typ) { - return cm - } - return nil -} - -func (cm *comparer) apply(s *state, vx, vy reflect.Value) { - eq := s.callTTBFunc(cm.fnc, vx, vy) - s.report(eq, reportByFunc) -} - -func (cm comparer) String() string { - return fmt.Sprintf("Comparer(%s)", function.NameOf(cm.fnc)) -} - -// Exporter returns an Option that specifies whether Equal is allowed to -// introspect into the unexported fields of certain struct types. -// -// Users of this option must understand that comparing on unexported fields -// from external packages is not safe since changes in the internal -// implementation of some external package may cause the result of Equal -// to unexpectedly change. However, it may be valid to use this option on types -// defined in an internal package where the semantic meaning of an unexported -// field is in the control of the user. -// -// In many cases, a custom Comparer should be used instead that defines -// equality as a function of the public API of a type rather than the underlying -// unexported implementation. -// -// For example, the reflect.Type documentation defines equality to be determined -// by the == operator on the interface (essentially performing a shallow pointer -// comparison) and most attempts to compare *regexp.Regexp types are interested -// in only checking that the regular expression strings are equal. -// Both of these are accomplished using Comparers: -// -// Comparer(func(x, y reflect.Type) bool { return x == y }) -// Comparer(func(x, y *regexp.Regexp) bool { return x.String() == y.String() }) -// -// In other cases, the cmpopts.IgnoreUnexported option can be used to ignore -// all unexported fields on specified struct types. -func Exporter(f func(reflect.Type) bool) Option { - if !supportExporters { - panic("Exporter is not supported on purego builds") - } - return exporter(f) -} - -type exporter func(reflect.Type) bool - -func (exporter) filter(_ *state, _ reflect.Type, _, _ reflect.Value) applicableOption { - panic("not implemented") -} - -// AllowUnexported returns an Options that allows Equal to forcibly introspect -// unexported fields of the specified struct types. -// -// See Exporter for the proper use of this option. -func AllowUnexported(types ...interface{}) Option { - m := make(map[reflect.Type]bool) - for _, typ := range types { - t := reflect.TypeOf(typ) - if t.Kind() != reflect.Struct { - panic(fmt.Sprintf("invalid struct type: %T", typ)) - } - m[t] = true - } - return exporter(func(t reflect.Type) bool { return m[t] }) -} - -// Result represents the comparison result for a single node and -// is provided by cmp when calling Result (see Reporter). -type Result struct { - _ [0]func() // Make Result incomparable - flags resultFlags -} - -// Equal reports whether the node was determined to be equal or not. -// As a special case, ignored nodes are considered equal. -func (r Result) Equal() bool { - return r.flags&(reportEqual|reportByIgnore) != 0 -} - -// ByIgnore reports whether the node is equal because it was ignored. -// This never reports true if Equal reports false. -func (r Result) ByIgnore() bool { - return r.flags&reportByIgnore != 0 -} - -// ByMethod reports whether the Equal method determined equality. -func (r Result) ByMethod() bool { - return r.flags&reportByMethod != 0 -} - -// ByFunc reports whether a Comparer function determined equality. -func (r Result) ByFunc() bool { - return r.flags&reportByFunc != 0 -} - -// ByCycle reports whether a reference cycle was detected. -func (r Result) ByCycle() bool { - return r.flags&reportByCycle != 0 -} - -type resultFlags uint - -const ( - _ resultFlags = (1 << iota) / 2 - - reportEqual - reportUnequal - reportByIgnore - reportByMethod - reportByFunc - reportByCycle -) - -// Reporter is an Option that can be passed to Equal. When Equal traverses -// the value trees, it calls PushStep as it descends into each node in the -// tree and PopStep as it ascend out of the node. The leaves of the tree are -// either compared (determined to be equal or not equal) or ignored and reported -// as such by calling the Report method. -func Reporter(r interface { - // PushStep is called when a tree-traversal operation is performed. - // The PathStep itself is only valid until the step is popped. - // The PathStep.Values are valid for the duration of the entire traversal - // and must not be mutated. - // - // Equal always calls PushStep at the start to provide an operation-less - // PathStep used to report the root values. - // - // Within a slice, the exact set of inserted, removed, or modified elements - // is unspecified and may change in future implementations. - // The entries of a map are iterated through in an unspecified order. - PushStep(PathStep) - - // Report is called exactly once on leaf nodes to report whether the - // comparison identified the node as equal, unequal, or ignored. - // A leaf node is one that is immediately preceded by and followed by - // a pair of PushStep and PopStep calls. - Report(Result) - - // PopStep ascends back up the value tree. - // There is always a matching pop call for every push call. - PopStep() -}) Option { - return reporter{r} -} - -type reporter struct{ reporterIface } -type reporterIface interface { - PushStep(PathStep) - Report(Result) - PopStep() -} - -func (reporter) filter(_ *state, _ reflect.Type, _, _ reflect.Value) applicableOption { - panic("not implemented") -} - -// normalizeOption normalizes the input options such that all Options groups -// are flattened and groups with a single element are reduced to that element. -// Only coreOptions and Options containing coreOptions are allowed. -func normalizeOption(src Option) Option { - switch opts := flattenOptions(nil, Options{src}); len(opts) { - case 0: - return nil - case 1: - return opts[0] - default: - return opts - } -} - -// flattenOptions copies all options in src to dst as a flat list. -// Only coreOptions and Options containing coreOptions are allowed. -func flattenOptions(dst, src Options) Options { - for _, opt := range src { - switch opt := opt.(type) { - case nil: - continue - case Options: - dst = flattenOptions(dst, opt) - case coreOption: - dst = append(dst, opt) - default: - panic(fmt.Sprintf("invalid option type: %T", opt)) - } - } - return dst -} diff --git a/vendor/github.com/google/go-cmp/cmp/path.go b/vendor/github.com/google/go-cmp/cmp/path.go deleted file mode 100644 index c71003463..000000000 --- a/vendor/github.com/google/go-cmp/cmp/path.go +++ /dev/null @@ -1,378 +0,0 @@ -// Copyright 2017, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package cmp - -import ( - "fmt" - "reflect" - "strings" - "unicode" - "unicode/utf8" - - "github.com/google/go-cmp/cmp/internal/value" -) - -// Path is a list of PathSteps describing the sequence of operations to get -// from some root type to the current position in the value tree. -// The first Path element is always an operation-less PathStep that exists -// simply to identify the initial type. -// -// When traversing structs with embedded structs, the embedded struct will -// always be accessed as a field before traversing the fields of the -// embedded struct themselves. That is, an exported field from the -// embedded struct will never be accessed directly from the parent struct. -type Path []PathStep - -// PathStep is a union-type for specific operations to traverse -// a value's tree structure. Users of this package never need to implement -// these types as values of this type will be returned by this package. -// -// Implementations of this interface are -// StructField, SliceIndex, MapIndex, Indirect, TypeAssertion, and Transform. -type PathStep interface { - String() string - - // Type is the resulting type after performing the path step. - Type() reflect.Type - - // Values is the resulting values after performing the path step. - // The type of each valid value is guaranteed to be identical to Type. - // - // In some cases, one or both may be invalid or have restrictions: - // • For StructField, both are not interface-able if the current field - // is unexported and the struct type is not explicitly permitted by - // an Exporter to traverse unexported fields. - // • For SliceIndex, one may be invalid if an element is missing from - // either the x or y slice. - // • For MapIndex, one may be invalid if an entry is missing from - // either the x or y map. - // - // The provided values must not be mutated. - Values() (vx, vy reflect.Value) -} - -var ( - _ PathStep = StructField{} - _ PathStep = SliceIndex{} - _ PathStep = MapIndex{} - _ PathStep = Indirect{} - _ PathStep = TypeAssertion{} - _ PathStep = Transform{} -) - -func (pa *Path) push(s PathStep) { - *pa = append(*pa, s) -} - -func (pa *Path) pop() { - *pa = (*pa)[:len(*pa)-1] -} - -// Last returns the last PathStep in the Path. -// If the path is empty, this returns a non-nil PathStep that reports a nil Type. -func (pa Path) Last() PathStep { - return pa.Index(-1) -} - -// Index returns the ith step in the Path and supports negative indexing. -// A negative index starts counting from the tail of the Path such that -1 -// refers to the last step, -2 refers to the second-to-last step, and so on. -// If index is invalid, this returns a non-nil PathStep that reports a nil Type. -func (pa Path) Index(i int) PathStep { - if i < 0 { - i = len(pa) + i - } - if i < 0 || i >= len(pa) { - return pathStep{} - } - return pa[i] -} - -// String returns the simplified path to a node. -// The simplified path only contains struct field accesses. -// -// For example: -// MyMap.MySlices.MyField -func (pa Path) String() string { - var ss []string - for _, s := range pa { - if _, ok := s.(StructField); ok { - ss = append(ss, s.String()) - } - } - return strings.TrimPrefix(strings.Join(ss, ""), ".") -} - -// GoString returns the path to a specific node using Go syntax. -// -// For example: -// (*root.MyMap["key"].(*mypkg.MyStruct).MySlices)[2][3].MyField -func (pa Path) GoString() string { - var ssPre, ssPost []string - var numIndirect int - for i, s := range pa { - var nextStep PathStep - if i+1 < len(pa) { - nextStep = pa[i+1] - } - switch s := s.(type) { - case Indirect: - numIndirect++ - pPre, pPost := "(", ")" - switch nextStep.(type) { - case Indirect: - continue // Next step is indirection, so let them batch up - case StructField: - numIndirect-- // Automatic indirection on struct fields - case nil: - pPre, pPost = "", "" // Last step; no need for parenthesis - } - if numIndirect > 0 { - ssPre = append(ssPre, pPre+strings.Repeat("*", numIndirect)) - ssPost = append(ssPost, pPost) - } - numIndirect = 0 - continue - case Transform: - ssPre = append(ssPre, s.trans.name+"(") - ssPost = append(ssPost, ")") - continue - } - ssPost = append(ssPost, s.String()) - } - for i, j := 0, len(ssPre)-1; i < j; i, j = i+1, j-1 { - ssPre[i], ssPre[j] = ssPre[j], ssPre[i] - } - return strings.Join(ssPre, "") + strings.Join(ssPost, "") -} - -type pathStep struct { - typ reflect.Type - vx, vy reflect.Value -} - -func (ps pathStep) Type() reflect.Type { return ps.typ } -func (ps pathStep) Values() (vx, vy reflect.Value) { return ps.vx, ps.vy } -func (ps pathStep) String() string { - if ps.typ == nil { - return "" - } - s := ps.typ.String() - if s == "" || strings.ContainsAny(s, "{}\n") { - return "root" // Type too simple or complex to print - } - return fmt.Sprintf("{%s}", s) -} - -// StructField represents a struct field access on a field called Name. -type StructField struct{ *structField } -type structField struct { - pathStep - name string - idx int - - // These fields are used for forcibly accessing an unexported field. - // pvx, pvy, and field are only valid if unexported is true. - unexported bool - mayForce bool // Forcibly allow visibility - paddr bool // Was parent addressable? - pvx, pvy reflect.Value // Parent values (always addressable) - field reflect.StructField // Field information -} - -func (sf StructField) Type() reflect.Type { return sf.typ } -func (sf StructField) Values() (vx, vy reflect.Value) { - if !sf.unexported { - return sf.vx, sf.vy // CanInterface reports true - } - - // Forcibly obtain read-write access to an unexported struct field. - if sf.mayForce { - vx = retrieveUnexportedField(sf.pvx, sf.field, sf.paddr) - vy = retrieveUnexportedField(sf.pvy, sf.field, sf.paddr) - return vx, vy // CanInterface reports true - } - return sf.vx, sf.vy // CanInterface reports false -} -func (sf StructField) String() string { return fmt.Sprintf(".%s", sf.name) } - -// Name is the field name. -func (sf StructField) Name() string { return sf.name } - -// Index is the index of the field in the parent struct type. -// See reflect.Type.Field. -func (sf StructField) Index() int { return sf.idx } - -// SliceIndex is an index operation on a slice or array at some index Key. -type SliceIndex struct{ *sliceIndex } -type sliceIndex struct { - pathStep - xkey, ykey int - isSlice bool // False for reflect.Array -} - -func (si SliceIndex) Type() reflect.Type { return si.typ } -func (si SliceIndex) Values() (vx, vy reflect.Value) { return si.vx, si.vy } -func (si SliceIndex) String() string { - switch { - case si.xkey == si.ykey: - return fmt.Sprintf("[%d]", si.xkey) - case si.ykey == -1: - // [5->?] means "I don't know where X[5] went" - return fmt.Sprintf("[%d->?]", si.xkey) - case si.xkey == -1: - // [?->3] means "I don't know where Y[3] came from" - return fmt.Sprintf("[?->%d]", si.ykey) - default: - // [5->3] means "X[5] moved to Y[3]" - return fmt.Sprintf("[%d->%d]", si.xkey, si.ykey) - } -} - -// Key is the index key; it may return -1 if in a split state -func (si SliceIndex) Key() int { - if si.xkey != si.ykey { - return -1 - } - return si.xkey -} - -// SplitKeys are the indexes for indexing into slices in the -// x and y values, respectively. These indexes may differ due to the -// insertion or removal of an element in one of the slices, causing -// all of the indexes to be shifted. If an index is -1, then that -// indicates that the element does not exist in the associated slice. -// -// Key is guaranteed to return -1 if and only if the indexes returned -// by SplitKeys are not the same. SplitKeys will never return -1 for -// both indexes. -func (si SliceIndex) SplitKeys() (ix, iy int) { return si.xkey, si.ykey } - -// MapIndex is an index operation on a map at some index Key. -type MapIndex struct{ *mapIndex } -type mapIndex struct { - pathStep - key reflect.Value -} - -func (mi MapIndex) Type() reflect.Type { return mi.typ } -func (mi MapIndex) Values() (vx, vy reflect.Value) { return mi.vx, mi.vy } -func (mi MapIndex) String() string { return fmt.Sprintf("[%#v]", mi.key) } - -// Key is the value of the map key. -func (mi MapIndex) Key() reflect.Value { return mi.key } - -// Indirect represents pointer indirection on the parent type. -type Indirect struct{ *indirect } -type indirect struct { - pathStep -} - -func (in Indirect) Type() reflect.Type { return in.typ } -func (in Indirect) Values() (vx, vy reflect.Value) { return in.vx, in.vy } -func (in Indirect) String() string { return "*" } - -// TypeAssertion represents a type assertion on an interface. -type TypeAssertion struct{ *typeAssertion } -type typeAssertion struct { - pathStep -} - -func (ta TypeAssertion) Type() reflect.Type { return ta.typ } -func (ta TypeAssertion) Values() (vx, vy reflect.Value) { return ta.vx, ta.vy } -func (ta TypeAssertion) String() string { return fmt.Sprintf(".(%v)", ta.typ) } - -// Transform is a transformation from the parent type to the current type. -type Transform struct{ *transform } -type transform struct { - pathStep - trans *transformer -} - -func (tf Transform) Type() reflect.Type { return tf.typ } -func (tf Transform) Values() (vx, vy reflect.Value) { return tf.vx, tf.vy } -func (tf Transform) String() string { return fmt.Sprintf("%s()", tf.trans.name) } - -// Name is the name of the Transformer. -func (tf Transform) Name() string { return tf.trans.name } - -// Func is the function pointer to the transformer function. -func (tf Transform) Func() reflect.Value { return tf.trans.fnc } - -// Option returns the originally constructed Transformer option. -// The == operator can be used to detect the exact option used. -func (tf Transform) Option() Option { return tf.trans } - -// pointerPath represents a dual-stack of pointers encountered when -// recursively traversing the x and y values. This data structure supports -// detection of cycles and determining whether the cycles are equal. -// In Go, cycles can occur via pointers, slices, and maps. -// -// The pointerPath uses a map to represent a stack; where descension into a -// pointer pushes the address onto the stack, and ascension from a pointer -// pops the address from the stack. Thus, when traversing into a pointer from -// reflect.Ptr, reflect.Slice element, or reflect.Map, we can detect cycles -// by checking whether the pointer has already been visited. The cycle detection -// uses a separate stack for the x and y values. -// -// If a cycle is detected we need to determine whether the two pointers -// should be considered equal. The definition of equality chosen by Equal -// requires two graphs to have the same structure. To determine this, both the -// x and y values must have a cycle where the previous pointers were also -// encountered together as a pair. -// -// Semantically, this is equivalent to augmenting Indirect, SliceIndex, and -// MapIndex with pointer information for the x and y values. -// Suppose px and py are two pointers to compare, we then search the -// Path for whether px was ever encountered in the Path history of x, and -// similarly so with py. If either side has a cycle, the comparison is only -// equal if both px and py have a cycle resulting from the same PathStep. -// -// Using a map as a stack is more performant as we can perform cycle detection -// in O(1) instead of O(N) where N is len(Path). -type pointerPath struct { - // mx is keyed by x pointers, where the value is the associated y pointer. - mx map[value.Pointer]value.Pointer - // my is keyed by y pointers, where the value is the associated x pointer. - my map[value.Pointer]value.Pointer -} - -func (p *pointerPath) Init() { - p.mx = make(map[value.Pointer]value.Pointer) - p.my = make(map[value.Pointer]value.Pointer) -} - -// Push indicates intent to descend into pointers vx and vy where -// visited reports whether either has been seen before. If visited before, -// equal reports whether both pointers were encountered together. -// Pop must be called if and only if the pointers were never visited. -// -// The pointers vx and vy must be a reflect.Ptr, reflect.Slice, or reflect.Map -// and be non-nil. -func (p pointerPath) Push(vx, vy reflect.Value) (equal, visited bool) { - px := value.PointerOf(vx) - py := value.PointerOf(vy) - _, ok1 := p.mx[px] - _, ok2 := p.my[py] - if ok1 || ok2 { - equal = p.mx[px] == py && p.my[py] == px // Pointers paired together - return equal, true - } - p.mx[px] = py - p.my[py] = px - return false, false -} - -// Pop ascends from pointers vx and vy. -func (p pointerPath) Pop(vx, vy reflect.Value) { - delete(p.mx, value.PointerOf(vx)) - delete(p.my, value.PointerOf(vy)) -} - -// isExported reports whether the identifier is exported. -func isExported(id string) bool { - r, _ := utf8.DecodeRuneInString(id) - return unicode.IsUpper(r) -} diff --git a/vendor/github.com/google/go-cmp/cmp/report.go b/vendor/github.com/google/go-cmp/cmp/report.go deleted file mode 100644 index f43cd12eb..000000000 --- a/vendor/github.com/google/go-cmp/cmp/report.go +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2017, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package cmp - -// defaultReporter implements the reporter interface. -// -// As Equal serially calls the PushStep, Report, and PopStep methods, the -// defaultReporter constructs a tree-based representation of the compared value -// and the result of each comparison (see valueNode). -// -// When the String method is called, the FormatDiff method transforms the -// valueNode tree into a textNode tree, which is a tree-based representation -// of the textual output (see textNode). -// -// Lastly, the textNode.String method produces the final report as a string. -type defaultReporter struct { - root *valueNode - curr *valueNode -} - -func (r *defaultReporter) PushStep(ps PathStep) { - r.curr = r.curr.PushStep(ps) - if r.root == nil { - r.root = r.curr - } -} -func (r *defaultReporter) Report(rs Result) { - r.curr.Report(rs) -} -func (r *defaultReporter) PopStep() { - r.curr = r.curr.PopStep() -} - -// String provides a full report of the differences detected as a structured -// literal in pseudo-Go syntax. String may only be called after the entire tree -// has been traversed. -func (r *defaultReporter) String() string { - assert(r.root != nil && r.curr == nil) - if r.root.NumDiff == 0 { - return "" - } - ptrs := new(pointerReferences) - text := formatOptions{}.FormatDiff(r.root, ptrs) - resolveReferences(text) - return text.String() -} - -func assert(ok bool) { - if !ok { - panic("assertion failure") - } -} diff --git a/vendor/github.com/google/go-cmp/cmp/report_compare.go b/vendor/github.com/google/go-cmp/cmp/report_compare.go deleted file mode 100644 index 1ef65ac1d..000000000 --- a/vendor/github.com/google/go-cmp/cmp/report_compare.go +++ /dev/null @@ -1,435 +0,0 @@ -// Copyright 2019, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package cmp - -import ( - "fmt" - "reflect" - - "github.com/google/go-cmp/cmp/internal/value" -) - -// numContextRecords is the number of surrounding equal records to print. -const numContextRecords = 2 - -type diffMode byte - -const ( - diffUnknown diffMode = 0 - diffIdentical diffMode = ' ' - diffRemoved diffMode = '-' - diffInserted diffMode = '+' -) - -type typeMode int - -const ( - // emitType always prints the type. - emitType typeMode = iota - // elideType never prints the type. - elideType - // autoType prints the type only for composite kinds - // (i.e., structs, slices, arrays, and maps). - autoType -) - -type formatOptions struct { - // DiffMode controls the output mode of FormatDiff. - // - // If diffUnknown, then produce a diff of the x and y values. - // If diffIdentical, then emit values as if they were equal. - // If diffRemoved, then only emit x values (ignoring y values). - // If diffInserted, then only emit y values (ignoring x values). - DiffMode diffMode - - // TypeMode controls whether to print the type for the current node. - // - // As a general rule of thumb, we always print the type of the next node - // after an interface, and always elide the type of the next node after - // a slice or map node. - TypeMode typeMode - - // formatValueOptions are options specific to printing reflect.Values. - formatValueOptions -} - -func (opts formatOptions) WithDiffMode(d diffMode) formatOptions { - opts.DiffMode = d - return opts -} -func (opts formatOptions) WithTypeMode(t typeMode) formatOptions { - opts.TypeMode = t - return opts -} -func (opts formatOptions) WithVerbosity(level int) formatOptions { - opts.VerbosityLevel = level - opts.LimitVerbosity = true - return opts -} -func (opts formatOptions) verbosity() uint { - switch { - case opts.VerbosityLevel < 0: - return 0 - case opts.VerbosityLevel > 16: - return 16 // some reasonable maximum to avoid shift overflow - default: - return uint(opts.VerbosityLevel) - } -} - -const maxVerbosityPreset = 6 - -// verbosityPreset modifies the verbosity settings given an index -// between 0 and maxVerbosityPreset, inclusive. -func verbosityPreset(opts formatOptions, i int) formatOptions { - opts.VerbosityLevel = int(opts.verbosity()) + 2*i - if i > 0 { - opts.AvoidStringer = true - } - if i >= maxVerbosityPreset { - opts.PrintAddresses = true - opts.QualifiedNames = true - } - return opts -} - -// FormatDiff converts a valueNode tree into a textNode tree, where the later -// is a textual representation of the differences detected in the former. -func (opts formatOptions) FormatDiff(v *valueNode, ptrs *pointerReferences) (out textNode) { - if opts.DiffMode == diffIdentical { - opts = opts.WithVerbosity(1) - } else if opts.verbosity() < 3 { - opts = opts.WithVerbosity(3) - } - - // Check whether we have specialized formatting for this node. - // This is not necessary, but helpful for producing more readable outputs. - if opts.CanFormatDiffSlice(v) { - return opts.FormatDiffSlice(v) - } - - var parentKind reflect.Kind - if v.parent != nil && v.parent.TransformerName == "" { - parentKind = v.parent.Type.Kind() - } - - // For leaf nodes, format the value based on the reflect.Values alone. - // As a special case, treat equal []byte as a leaf nodes. - isBytes := v.Type.Kind() == reflect.Slice && v.Type.Elem() == reflect.TypeOf(byte(0)) - isEqualBytes := isBytes && v.NumDiff+v.NumIgnored+v.NumTransformed == 0 - if v.MaxDepth == 0 || isEqualBytes { - switch opts.DiffMode { - case diffUnknown, diffIdentical: - // Format Equal. - if v.NumDiff == 0 { - outx := opts.FormatValue(v.ValueX, parentKind, ptrs) - outy := opts.FormatValue(v.ValueY, parentKind, ptrs) - if v.NumIgnored > 0 && v.NumSame == 0 { - return textEllipsis - } else if outx.Len() < outy.Len() { - return outx - } else { - return outy - } - } - - // Format unequal. - assert(opts.DiffMode == diffUnknown) - var list textList - outx := opts.WithTypeMode(elideType).FormatValue(v.ValueX, parentKind, ptrs) - outy := opts.WithTypeMode(elideType).FormatValue(v.ValueY, parentKind, ptrs) - for i := 0; i <= maxVerbosityPreset && outx != nil && outy != nil && outx.Equal(outy); i++ { - opts2 := verbosityPreset(opts, i).WithTypeMode(elideType) - outx = opts2.FormatValue(v.ValueX, parentKind, ptrs) - outy = opts2.FormatValue(v.ValueY, parentKind, ptrs) - } - if outx != nil { - list = append(list, textRecord{Diff: '-', Value: outx}) - } - if outy != nil { - list = append(list, textRecord{Diff: '+', Value: outy}) - } - return opts.WithTypeMode(emitType).FormatType(v.Type, list) - case diffRemoved: - return opts.FormatValue(v.ValueX, parentKind, ptrs) - case diffInserted: - return opts.FormatValue(v.ValueY, parentKind, ptrs) - default: - panic("invalid diff mode") - } - } - - // Register slice element to support cycle detection. - if parentKind == reflect.Slice { - ptrRefs := ptrs.PushPair(v.ValueX, v.ValueY, opts.DiffMode, true) - defer ptrs.Pop() - defer func() { out = wrapTrunkReferences(ptrRefs, out) }() - } - - // Descend into the child value node. - if v.TransformerName != "" { - out := opts.WithTypeMode(emitType).FormatDiff(v.Value, ptrs) - out = &textWrap{Prefix: "Inverse(" + v.TransformerName + ", ", Value: out, Suffix: ")"} - return opts.FormatType(v.Type, out) - } else { - switch k := v.Type.Kind(); k { - case reflect.Struct, reflect.Array, reflect.Slice: - out = opts.formatDiffList(v.Records, k, ptrs) - out = opts.FormatType(v.Type, out) - case reflect.Map: - // Register map to support cycle detection. - ptrRefs := ptrs.PushPair(v.ValueX, v.ValueY, opts.DiffMode, false) - defer ptrs.Pop() - - out = opts.formatDiffList(v.Records, k, ptrs) - out = wrapTrunkReferences(ptrRefs, out) - out = opts.FormatType(v.Type, out) - case reflect.Ptr: - // Register pointer to support cycle detection. - ptrRefs := ptrs.PushPair(v.ValueX, v.ValueY, opts.DiffMode, false) - defer ptrs.Pop() - - out = opts.FormatDiff(v.Value, ptrs) - out = wrapTrunkReferences(ptrRefs, out) - out = &textWrap{Prefix: "&", Value: out} - case reflect.Interface: - out = opts.WithTypeMode(emitType).FormatDiff(v.Value, ptrs) - default: - panic(fmt.Sprintf("%v cannot have children", k)) - } - return out - } -} - -func (opts formatOptions) formatDiffList(recs []reportRecord, k reflect.Kind, ptrs *pointerReferences) textNode { - // Derive record name based on the data structure kind. - var name string - var formatKey func(reflect.Value) string - switch k { - case reflect.Struct: - name = "field" - opts = opts.WithTypeMode(autoType) - formatKey = func(v reflect.Value) string { return v.String() } - case reflect.Slice, reflect.Array: - name = "element" - opts = opts.WithTypeMode(elideType) - formatKey = func(reflect.Value) string { return "" } - case reflect.Map: - name = "entry" - opts = opts.WithTypeMode(elideType) - formatKey = func(v reflect.Value) string { return formatMapKey(v, false, ptrs) } - } - - maxLen := -1 - if opts.LimitVerbosity { - if opts.DiffMode == diffIdentical { - maxLen = ((1 << opts.verbosity()) >> 1) << 2 // 0, 4, 8, 16, 32, etc... - } else { - maxLen = (1 << opts.verbosity()) << 1 // 2, 4, 8, 16, 32, 64, etc... - } - opts.VerbosityLevel-- - } - - // Handle unification. - switch opts.DiffMode { - case diffIdentical, diffRemoved, diffInserted: - var list textList - var deferredEllipsis bool // Add final "..." to indicate records were dropped - for _, r := range recs { - if len(list) == maxLen { - deferredEllipsis = true - break - } - - // Elide struct fields that are zero value. - if k == reflect.Struct { - var isZero bool - switch opts.DiffMode { - case diffIdentical: - isZero = value.IsZero(r.Value.ValueX) || value.IsZero(r.Value.ValueY) - case diffRemoved: - isZero = value.IsZero(r.Value.ValueX) - case diffInserted: - isZero = value.IsZero(r.Value.ValueY) - } - if isZero { - continue - } - } - // Elide ignored nodes. - if r.Value.NumIgnored > 0 && r.Value.NumSame+r.Value.NumDiff == 0 { - deferredEllipsis = !(k == reflect.Slice || k == reflect.Array) - if !deferredEllipsis { - list.AppendEllipsis(diffStats{}) - } - continue - } - if out := opts.FormatDiff(r.Value, ptrs); out != nil { - list = append(list, textRecord{Key: formatKey(r.Key), Value: out}) - } - } - if deferredEllipsis { - list.AppendEllipsis(diffStats{}) - } - return &textWrap{Prefix: "{", Value: list, Suffix: "}"} - case diffUnknown: - default: - panic("invalid diff mode") - } - - // Handle differencing. - var numDiffs int - var list textList - var keys []reflect.Value // invariant: len(list) == len(keys) - groups := coalesceAdjacentRecords(name, recs) - maxGroup := diffStats{Name: name} - for i, ds := range groups { - if maxLen >= 0 && numDiffs >= maxLen { - maxGroup = maxGroup.Append(ds) - continue - } - - // Handle equal records. - if ds.NumDiff() == 0 { - // Compute the number of leading and trailing records to print. - var numLo, numHi int - numEqual := ds.NumIgnored + ds.NumIdentical - for numLo < numContextRecords && numLo+numHi < numEqual && i != 0 { - if r := recs[numLo].Value; r.NumIgnored > 0 && r.NumSame+r.NumDiff == 0 { - break - } - numLo++ - } - for numHi < numContextRecords && numLo+numHi < numEqual && i != len(groups)-1 { - if r := recs[numEqual-numHi-1].Value; r.NumIgnored > 0 && r.NumSame+r.NumDiff == 0 { - break - } - numHi++ - } - if numEqual-(numLo+numHi) == 1 && ds.NumIgnored == 0 { - numHi++ // Avoid pointless coalescing of a single equal record - } - - // Format the equal values. - for _, r := range recs[:numLo] { - out := opts.WithDiffMode(diffIdentical).FormatDiff(r.Value, ptrs) - list = append(list, textRecord{Key: formatKey(r.Key), Value: out}) - keys = append(keys, r.Key) - } - if numEqual > numLo+numHi { - ds.NumIdentical -= numLo + numHi - list.AppendEllipsis(ds) - for len(keys) < len(list) { - keys = append(keys, reflect.Value{}) - } - } - for _, r := range recs[numEqual-numHi : numEqual] { - out := opts.WithDiffMode(diffIdentical).FormatDiff(r.Value, ptrs) - list = append(list, textRecord{Key: formatKey(r.Key), Value: out}) - keys = append(keys, r.Key) - } - recs = recs[numEqual:] - continue - } - - // Handle unequal records. - for _, r := range recs[:ds.NumDiff()] { - switch { - case opts.CanFormatDiffSlice(r.Value): - out := opts.FormatDiffSlice(r.Value) - list = append(list, textRecord{Key: formatKey(r.Key), Value: out}) - keys = append(keys, r.Key) - case r.Value.NumChildren == r.Value.MaxDepth: - outx := opts.WithDiffMode(diffRemoved).FormatDiff(r.Value, ptrs) - outy := opts.WithDiffMode(diffInserted).FormatDiff(r.Value, ptrs) - for i := 0; i <= maxVerbosityPreset && outx != nil && outy != nil && outx.Equal(outy); i++ { - opts2 := verbosityPreset(opts, i) - outx = opts2.WithDiffMode(diffRemoved).FormatDiff(r.Value, ptrs) - outy = opts2.WithDiffMode(diffInserted).FormatDiff(r.Value, ptrs) - } - if outx != nil { - list = append(list, textRecord{Diff: diffRemoved, Key: formatKey(r.Key), Value: outx}) - keys = append(keys, r.Key) - } - if outy != nil { - list = append(list, textRecord{Diff: diffInserted, Key: formatKey(r.Key), Value: outy}) - keys = append(keys, r.Key) - } - default: - out := opts.FormatDiff(r.Value, ptrs) - list = append(list, textRecord{Key: formatKey(r.Key), Value: out}) - keys = append(keys, r.Key) - } - } - recs = recs[ds.NumDiff():] - numDiffs += ds.NumDiff() - } - if maxGroup.IsZero() { - assert(len(recs) == 0) - } else { - list.AppendEllipsis(maxGroup) - for len(keys) < len(list) { - keys = append(keys, reflect.Value{}) - } - } - assert(len(list) == len(keys)) - - // For maps, the default formatting logic uses fmt.Stringer which may - // produce ambiguous output. Avoid calling String to disambiguate. - if k == reflect.Map { - var ambiguous bool - seenKeys := map[string]reflect.Value{} - for i, currKey := range keys { - if currKey.IsValid() { - strKey := list[i].Key - prevKey, seen := seenKeys[strKey] - if seen && prevKey.CanInterface() && currKey.CanInterface() { - ambiguous = prevKey.Interface() != currKey.Interface() - if ambiguous { - break - } - } - seenKeys[strKey] = currKey - } - } - if ambiguous { - for i, k := range keys { - if k.IsValid() { - list[i].Key = formatMapKey(k, true, ptrs) - } - } - } - } - - return &textWrap{Prefix: "{", Value: list, Suffix: "}"} -} - -// coalesceAdjacentRecords coalesces the list of records into groups of -// adjacent equal, or unequal counts. -func coalesceAdjacentRecords(name string, recs []reportRecord) (groups []diffStats) { - var prevCase int // Arbitrary index into which case last occurred - lastStats := func(i int) *diffStats { - if prevCase != i { - groups = append(groups, diffStats{Name: name}) - prevCase = i - } - return &groups[len(groups)-1] - } - for _, r := range recs { - switch rv := r.Value; { - case rv.NumIgnored > 0 && rv.NumSame+rv.NumDiff == 0: - lastStats(1).NumIgnored++ - case rv.NumDiff == 0: - lastStats(1).NumIdentical++ - case rv.NumDiff > 0 && !rv.ValueY.IsValid(): - lastStats(2).NumRemoved++ - case rv.NumDiff > 0 && !rv.ValueX.IsValid(): - lastStats(2).NumInserted++ - default: - lastStats(2).NumModified++ - } - } - return groups -} diff --git a/vendor/github.com/google/go-cmp/cmp/report_references.go b/vendor/github.com/google/go-cmp/cmp/report_references.go deleted file mode 100644 index be31b33a9..000000000 --- a/vendor/github.com/google/go-cmp/cmp/report_references.go +++ /dev/null @@ -1,264 +0,0 @@ -// Copyright 2020, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package cmp - -import ( - "fmt" - "reflect" - "strings" - - "github.com/google/go-cmp/cmp/internal/flags" - "github.com/google/go-cmp/cmp/internal/value" -) - -const ( - pointerDelimPrefix = "⟪" - pointerDelimSuffix = "⟫" -) - -// formatPointer prints the address of the pointer. -func formatPointer(p value.Pointer, withDelims bool) string { - v := p.Uintptr() - if flags.Deterministic { - v = 0xdeadf00f // Only used for stable testing purposes - } - if withDelims { - return pointerDelimPrefix + formatHex(uint64(v)) + pointerDelimSuffix - } - return formatHex(uint64(v)) -} - -// pointerReferences is a stack of pointers visited so far. -type pointerReferences [][2]value.Pointer - -func (ps *pointerReferences) PushPair(vx, vy reflect.Value, d diffMode, deref bool) (pp [2]value.Pointer) { - if deref && vx.IsValid() { - vx = vx.Addr() - } - if deref && vy.IsValid() { - vy = vy.Addr() - } - switch d { - case diffUnknown, diffIdentical: - pp = [2]value.Pointer{value.PointerOf(vx), value.PointerOf(vy)} - case diffRemoved: - pp = [2]value.Pointer{value.PointerOf(vx), value.Pointer{}} - case diffInserted: - pp = [2]value.Pointer{value.Pointer{}, value.PointerOf(vy)} - } - *ps = append(*ps, pp) - return pp -} - -func (ps *pointerReferences) Push(v reflect.Value) (p value.Pointer, seen bool) { - p = value.PointerOf(v) - for _, pp := range *ps { - if p == pp[0] || p == pp[1] { - return p, true - } - } - *ps = append(*ps, [2]value.Pointer{p, p}) - return p, false -} - -func (ps *pointerReferences) Pop() { - *ps = (*ps)[:len(*ps)-1] -} - -// trunkReferences is metadata for a textNode indicating that the sub-tree -// represents the value for either pointer in a pair of references. -type trunkReferences struct{ pp [2]value.Pointer } - -// trunkReference is metadata for a textNode indicating that the sub-tree -// represents the value for the given pointer reference. -type trunkReference struct{ p value.Pointer } - -// leafReference is metadata for a textNode indicating that the value is -// truncated as it refers to another part of the tree (i.e., a trunk). -type leafReference struct{ p value.Pointer } - -func wrapTrunkReferences(pp [2]value.Pointer, s textNode) textNode { - switch { - case pp[0].IsNil(): - return &textWrap{Value: s, Metadata: trunkReference{pp[1]}} - case pp[1].IsNil(): - return &textWrap{Value: s, Metadata: trunkReference{pp[0]}} - case pp[0] == pp[1]: - return &textWrap{Value: s, Metadata: trunkReference{pp[0]}} - default: - return &textWrap{Value: s, Metadata: trunkReferences{pp}} - } -} -func wrapTrunkReference(p value.Pointer, printAddress bool, s textNode) textNode { - var prefix string - if printAddress { - prefix = formatPointer(p, true) - } - return &textWrap{Prefix: prefix, Value: s, Metadata: trunkReference{p}} -} -func makeLeafReference(p value.Pointer, printAddress bool) textNode { - out := &textWrap{Prefix: "(", Value: textEllipsis, Suffix: ")"} - var prefix string - if printAddress { - prefix = formatPointer(p, true) - } - return &textWrap{Prefix: prefix, Value: out, Metadata: leafReference{p}} -} - -// resolveReferences walks the textNode tree searching for any leaf reference -// metadata and resolves each against the corresponding trunk references. -// Since pointer addresses in memory are not particularly readable to the user, -// it replaces each pointer value with an arbitrary and unique reference ID. -func resolveReferences(s textNode) { - var walkNodes func(textNode, func(textNode)) - walkNodes = func(s textNode, f func(textNode)) { - f(s) - switch s := s.(type) { - case *textWrap: - walkNodes(s.Value, f) - case textList: - for _, r := range s { - walkNodes(r.Value, f) - } - } - } - - // Collect all trunks and leaves with reference metadata. - var trunks, leaves []*textWrap - walkNodes(s, func(s textNode) { - if s, ok := s.(*textWrap); ok { - switch s.Metadata.(type) { - case leafReference: - leaves = append(leaves, s) - case trunkReference, trunkReferences: - trunks = append(trunks, s) - } - } - }) - - // No leaf references to resolve. - if len(leaves) == 0 { - return - } - - // Collect the set of all leaf references to resolve. - leafPtrs := make(map[value.Pointer]bool) - for _, leaf := range leaves { - leafPtrs[leaf.Metadata.(leafReference).p] = true - } - - // Collect the set of trunk pointers that are always paired together. - // This allows us to assign a single ID to both pointers for brevity. - // If a pointer in a pair ever occurs by itself or as a different pair, - // then the pair is broken. - pairedTrunkPtrs := make(map[value.Pointer]value.Pointer) - unpair := func(p value.Pointer) { - if !pairedTrunkPtrs[p].IsNil() { - pairedTrunkPtrs[pairedTrunkPtrs[p]] = value.Pointer{} // invalidate other half - } - pairedTrunkPtrs[p] = value.Pointer{} // invalidate this half - } - for _, trunk := range trunks { - switch p := trunk.Metadata.(type) { - case trunkReference: - unpair(p.p) // standalone pointer cannot be part of a pair - case trunkReferences: - p0, ok0 := pairedTrunkPtrs[p.pp[0]] - p1, ok1 := pairedTrunkPtrs[p.pp[1]] - switch { - case !ok0 && !ok1: - // Register the newly seen pair. - pairedTrunkPtrs[p.pp[0]] = p.pp[1] - pairedTrunkPtrs[p.pp[1]] = p.pp[0] - case ok0 && ok1 && p0 == p.pp[1] && p1 == p.pp[0]: - // Exact pair already seen; do nothing. - default: - // Pair conflicts with some other pair; break all pairs. - unpair(p.pp[0]) - unpair(p.pp[1]) - } - } - } - - // Correlate each pointer referenced by leaves to a unique identifier, - // and print the IDs for each trunk that matches those pointers. - var nextID uint - ptrIDs := make(map[value.Pointer]uint) - newID := func() uint { - id := nextID - nextID++ - return id - } - for _, trunk := range trunks { - switch p := trunk.Metadata.(type) { - case trunkReference: - if print := leafPtrs[p.p]; print { - id, ok := ptrIDs[p.p] - if !ok { - id = newID() - ptrIDs[p.p] = id - } - trunk.Prefix = updateReferencePrefix(trunk.Prefix, formatReference(id)) - } - case trunkReferences: - print0 := leafPtrs[p.pp[0]] - print1 := leafPtrs[p.pp[1]] - if print0 || print1 { - id0, ok0 := ptrIDs[p.pp[0]] - id1, ok1 := ptrIDs[p.pp[1]] - isPair := pairedTrunkPtrs[p.pp[0]] == p.pp[1] && pairedTrunkPtrs[p.pp[1]] == p.pp[0] - if isPair { - var id uint - assert(ok0 == ok1) // must be seen together or not at all - if ok0 { - assert(id0 == id1) // must have the same ID - id = id0 - } else { - id = newID() - ptrIDs[p.pp[0]] = id - ptrIDs[p.pp[1]] = id - } - trunk.Prefix = updateReferencePrefix(trunk.Prefix, formatReference(id)) - } else { - if print0 && !ok0 { - id0 = newID() - ptrIDs[p.pp[0]] = id0 - } - if print1 && !ok1 { - id1 = newID() - ptrIDs[p.pp[1]] = id1 - } - switch { - case print0 && print1: - trunk.Prefix = updateReferencePrefix(trunk.Prefix, formatReference(id0)+","+formatReference(id1)) - case print0: - trunk.Prefix = updateReferencePrefix(trunk.Prefix, formatReference(id0)) - case print1: - trunk.Prefix = updateReferencePrefix(trunk.Prefix, formatReference(id1)) - } - } - } - } - } - - // Update all leaf references with the unique identifier. - for _, leaf := range leaves { - if id, ok := ptrIDs[leaf.Metadata.(leafReference).p]; ok { - leaf.Prefix = updateReferencePrefix(leaf.Prefix, formatReference(id)) - } - } -} - -func formatReference(id uint) string { - return fmt.Sprintf("ref#%d", id) -} - -func updateReferencePrefix(prefix, ref string) string { - if prefix == "" { - return pointerDelimPrefix + ref + pointerDelimSuffix - } - suffix := strings.TrimPrefix(prefix, pointerDelimPrefix) - return pointerDelimPrefix + ref + ": " + suffix -} diff --git a/vendor/github.com/google/go-cmp/cmp/report_reflect.go b/vendor/github.com/google/go-cmp/cmp/report_reflect.go deleted file mode 100644 index 287b89358..000000000 --- a/vendor/github.com/google/go-cmp/cmp/report_reflect.go +++ /dev/null @@ -1,407 +0,0 @@ -// Copyright 2019, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package cmp - -import ( - "bytes" - "fmt" - "reflect" - "strconv" - "strings" - "unicode" - "unicode/utf8" - - "github.com/google/go-cmp/cmp/internal/value" -) - -type formatValueOptions struct { - // AvoidStringer controls whether to avoid calling custom stringer - // methods like error.Error or fmt.Stringer.String. - AvoidStringer bool - - // PrintAddresses controls whether to print the address of all pointers, - // slice elements, and maps. - PrintAddresses bool - - // QualifiedNames controls whether FormatType uses the fully qualified name - // (including the full package path as opposed to just the package name). - QualifiedNames bool - - // VerbosityLevel controls the amount of output to produce. - // A higher value produces more output. A value of zero or lower produces - // no output (represented using an ellipsis). - // If LimitVerbosity is false, then the level is treated as infinite. - VerbosityLevel int - - // LimitVerbosity specifies that formatting should respect VerbosityLevel. - LimitVerbosity bool -} - -// FormatType prints the type as if it were wrapping s. -// This may return s as-is depending on the current type and TypeMode mode. -func (opts formatOptions) FormatType(t reflect.Type, s textNode) textNode { - // Check whether to emit the type or not. - switch opts.TypeMode { - case autoType: - switch t.Kind() { - case reflect.Struct, reflect.Slice, reflect.Array, reflect.Map: - if s.Equal(textNil) { - return s - } - default: - return s - } - if opts.DiffMode == diffIdentical { - return s // elide type for identical nodes - } - case elideType: - return s - } - - // Determine the type label, applying special handling for unnamed types. - typeName := value.TypeString(t, opts.QualifiedNames) - if t.Name() == "" { - // According to Go grammar, certain type literals contain symbols that - // do not strongly bind to the next lexicographical token (e.g., *T). - switch t.Kind() { - case reflect.Chan, reflect.Func, reflect.Ptr: - typeName = "(" + typeName + ")" - } - } - return &textWrap{Prefix: typeName, Value: wrapParens(s)} -} - -// wrapParens wraps s with a set of parenthesis, but avoids it if the -// wrapped node itself is already surrounded by a pair of parenthesis or braces. -// It handles unwrapping one level of pointer-reference nodes. -func wrapParens(s textNode) textNode { - var refNode *textWrap - if s2, ok := s.(*textWrap); ok { - // Unwrap a single pointer reference node. - switch s2.Metadata.(type) { - case leafReference, trunkReference, trunkReferences: - refNode = s2 - if s3, ok := refNode.Value.(*textWrap); ok { - s2 = s3 - } - } - - // Already has delimiters that make parenthesis unnecessary. - hasParens := strings.HasPrefix(s2.Prefix, "(") && strings.HasSuffix(s2.Suffix, ")") - hasBraces := strings.HasPrefix(s2.Prefix, "{") && strings.HasSuffix(s2.Suffix, "}") - if hasParens || hasBraces { - return s - } - } - if refNode != nil { - refNode.Value = &textWrap{Prefix: "(", Value: refNode.Value, Suffix: ")"} - return s - } - return &textWrap{Prefix: "(", Value: s, Suffix: ")"} -} - -// FormatValue prints the reflect.Value, taking extra care to avoid descending -// into pointers already in ptrs. As pointers are visited, ptrs is also updated. -func (opts formatOptions) FormatValue(v reflect.Value, parentKind reflect.Kind, ptrs *pointerReferences) (out textNode) { - if !v.IsValid() { - return nil - } - t := v.Type() - - // Check slice element for cycles. - if parentKind == reflect.Slice { - ptrRef, visited := ptrs.Push(v.Addr()) - if visited { - return makeLeafReference(ptrRef, false) - } - defer ptrs.Pop() - defer func() { out = wrapTrunkReference(ptrRef, false, out) }() - } - - // Check whether there is an Error or String method to call. - if !opts.AvoidStringer && v.CanInterface() { - // Avoid calling Error or String methods on nil receivers since many - // implementations crash when doing so. - if (t.Kind() != reflect.Ptr && t.Kind() != reflect.Interface) || !v.IsNil() { - var prefix, strVal string - func() { - // Swallow and ignore any panics from String or Error. - defer func() { recover() }() - switch v := v.Interface().(type) { - case error: - strVal = v.Error() - prefix = "e" - case fmt.Stringer: - strVal = v.String() - prefix = "s" - } - }() - if prefix != "" { - return opts.formatString(prefix, strVal) - } - } - } - - // Check whether to explicitly wrap the result with the type. - var skipType bool - defer func() { - if !skipType { - out = opts.FormatType(t, out) - } - }() - - switch t.Kind() { - case reflect.Bool: - return textLine(fmt.Sprint(v.Bool())) - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return textLine(fmt.Sprint(v.Int())) - case reflect.Uint, reflect.Uint16, reflect.Uint32, reflect.Uint64: - return textLine(fmt.Sprint(v.Uint())) - case reflect.Uint8: - if parentKind == reflect.Slice || parentKind == reflect.Array { - return textLine(formatHex(v.Uint())) - } - return textLine(fmt.Sprint(v.Uint())) - case reflect.Uintptr: - return textLine(formatHex(v.Uint())) - case reflect.Float32, reflect.Float64: - return textLine(fmt.Sprint(v.Float())) - case reflect.Complex64, reflect.Complex128: - return textLine(fmt.Sprint(v.Complex())) - case reflect.String: - return opts.formatString("", v.String()) - case reflect.UnsafePointer, reflect.Chan, reflect.Func: - return textLine(formatPointer(value.PointerOf(v), true)) - case reflect.Struct: - var list textList - v := makeAddressable(v) // needed for retrieveUnexportedField - maxLen := v.NumField() - if opts.LimitVerbosity { - maxLen = ((1 << opts.verbosity()) >> 1) << 2 // 0, 4, 8, 16, 32, etc... - opts.VerbosityLevel-- - } - for i := 0; i < v.NumField(); i++ { - vv := v.Field(i) - if value.IsZero(vv) { - continue // Elide fields with zero values - } - if len(list) == maxLen { - list.AppendEllipsis(diffStats{}) - break - } - sf := t.Field(i) - if supportExporters && !isExported(sf.Name) { - vv = retrieveUnexportedField(v, sf, true) - } - s := opts.WithTypeMode(autoType).FormatValue(vv, t.Kind(), ptrs) - list = append(list, textRecord{Key: sf.Name, Value: s}) - } - return &textWrap{Prefix: "{", Value: list, Suffix: "}"} - case reflect.Slice: - if v.IsNil() { - return textNil - } - - // Check whether this is a []byte of text data. - if t.Elem() == reflect.TypeOf(byte(0)) { - b := v.Bytes() - isPrintSpace := func(r rune) bool { return unicode.IsPrint(r) || unicode.IsSpace(r) } - if len(b) > 0 && utf8.Valid(b) && len(bytes.TrimFunc(b, isPrintSpace)) == 0 { - out = opts.formatString("", string(b)) - skipType = true - return opts.FormatType(t, out) - } - } - - fallthrough - case reflect.Array: - maxLen := v.Len() - if opts.LimitVerbosity { - maxLen = ((1 << opts.verbosity()) >> 1) << 2 // 0, 4, 8, 16, 32, etc... - opts.VerbosityLevel-- - } - var list textList - for i := 0; i < v.Len(); i++ { - if len(list) == maxLen { - list.AppendEllipsis(diffStats{}) - break - } - s := opts.WithTypeMode(elideType).FormatValue(v.Index(i), t.Kind(), ptrs) - list = append(list, textRecord{Value: s}) - } - - out = &textWrap{Prefix: "{", Value: list, Suffix: "}"} - if t.Kind() == reflect.Slice && opts.PrintAddresses { - header := fmt.Sprintf("ptr:%v, len:%d, cap:%d", formatPointer(value.PointerOf(v), false), v.Len(), v.Cap()) - out = &textWrap{Prefix: pointerDelimPrefix + header + pointerDelimSuffix, Value: out} - } - return out - case reflect.Map: - if v.IsNil() { - return textNil - } - - // Check pointer for cycles. - ptrRef, visited := ptrs.Push(v) - if visited { - return makeLeafReference(ptrRef, opts.PrintAddresses) - } - defer ptrs.Pop() - - maxLen := v.Len() - if opts.LimitVerbosity { - maxLen = ((1 << opts.verbosity()) >> 1) << 2 // 0, 4, 8, 16, 32, etc... - opts.VerbosityLevel-- - } - var list textList - for _, k := range value.SortKeys(v.MapKeys()) { - if len(list) == maxLen { - list.AppendEllipsis(diffStats{}) - break - } - sk := formatMapKey(k, false, ptrs) - sv := opts.WithTypeMode(elideType).FormatValue(v.MapIndex(k), t.Kind(), ptrs) - list = append(list, textRecord{Key: sk, Value: sv}) - } - - out = &textWrap{Prefix: "{", Value: list, Suffix: "}"} - out = wrapTrunkReference(ptrRef, opts.PrintAddresses, out) - return out - case reflect.Ptr: - if v.IsNil() { - return textNil - } - - // Check pointer for cycles. - ptrRef, visited := ptrs.Push(v) - if visited { - out = makeLeafReference(ptrRef, opts.PrintAddresses) - return &textWrap{Prefix: "&", Value: out} - } - defer ptrs.Pop() - - // Skip the name only if this is an unnamed pointer type. - // Otherwise taking the address of a value does not reproduce - // the named pointer type. - if v.Type().Name() == "" { - skipType = true // Let the underlying value print the type instead - } - out = opts.FormatValue(v.Elem(), t.Kind(), ptrs) - out = wrapTrunkReference(ptrRef, opts.PrintAddresses, out) - out = &textWrap{Prefix: "&", Value: out} - return out - case reflect.Interface: - if v.IsNil() { - return textNil - } - // Interfaces accept different concrete types, - // so configure the underlying value to explicitly print the type. - return opts.WithTypeMode(emitType).FormatValue(v.Elem(), t.Kind(), ptrs) - default: - panic(fmt.Sprintf("%v kind not handled", v.Kind())) - } -} - -func (opts formatOptions) formatString(prefix, s string) textNode { - maxLen := len(s) - maxLines := strings.Count(s, "\n") + 1 - if opts.LimitVerbosity { - maxLen = (1 << opts.verbosity()) << 5 // 32, 64, 128, 256, etc... - maxLines = (1 << opts.verbosity()) << 2 // 4, 8, 16, 32, 64, etc... - } - - // For multiline strings, use the triple-quote syntax, - // but only use it when printing removed or inserted nodes since - // we only want the extra verbosity for those cases. - lines := strings.Split(strings.TrimSuffix(s, "\n"), "\n") - isTripleQuoted := len(lines) >= 4 && (opts.DiffMode == '-' || opts.DiffMode == '+') - for i := 0; i < len(lines) && isTripleQuoted; i++ { - lines[i] = strings.TrimPrefix(strings.TrimSuffix(lines[i], "\r"), "\r") // trim leading/trailing carriage returns for legacy Windows endline support - isPrintable := func(r rune) bool { - return unicode.IsPrint(r) || r == '\t' // specially treat tab as printable - } - line := lines[i] - isTripleQuoted = !strings.HasPrefix(strings.TrimPrefix(line, prefix), `"""`) && !strings.HasPrefix(line, "...") && strings.TrimFunc(line, isPrintable) == "" && len(line) <= maxLen - } - if isTripleQuoted { - var list textList - list = append(list, textRecord{Diff: opts.DiffMode, Value: textLine(prefix + `"""`), ElideComma: true}) - for i, line := range lines { - if numElided := len(lines) - i; i == maxLines-1 && numElided > 1 { - comment := commentString(fmt.Sprintf("%d elided lines", numElided)) - list = append(list, textRecord{Diff: opts.DiffMode, Value: textEllipsis, ElideComma: true, Comment: comment}) - break - } - list = append(list, textRecord{Diff: opts.DiffMode, Value: textLine(line), ElideComma: true}) - } - list = append(list, textRecord{Diff: opts.DiffMode, Value: textLine(prefix + `"""`), ElideComma: true}) - return &textWrap{Prefix: "(", Value: list, Suffix: ")"} - } - - // Format the string as a single-line quoted string. - if len(s) > maxLen+len(textEllipsis) { - return textLine(prefix + formatString(s[:maxLen]) + string(textEllipsis)) - } - return textLine(prefix + formatString(s)) -} - -// formatMapKey formats v as if it were a map key. -// The result is guaranteed to be a single line. -func formatMapKey(v reflect.Value, disambiguate bool, ptrs *pointerReferences) string { - var opts formatOptions - opts.DiffMode = diffIdentical - opts.TypeMode = elideType - opts.PrintAddresses = disambiguate - opts.AvoidStringer = disambiguate - opts.QualifiedNames = disambiguate - opts.VerbosityLevel = maxVerbosityPreset - opts.LimitVerbosity = true - s := opts.FormatValue(v, reflect.Map, ptrs).String() - return strings.TrimSpace(s) -} - -// formatString prints s as a double-quoted or backtick-quoted string. -func formatString(s string) string { - // Use quoted string if it the same length as a raw string literal. - // Otherwise, attempt to use the raw string form. - qs := strconv.Quote(s) - if len(qs) == 1+len(s)+1 { - return qs - } - - // Disallow newlines to ensure output is a single line. - // Only allow printable runes for readability purposes. - rawInvalid := func(r rune) bool { - return r == '`' || r == '\n' || !(unicode.IsPrint(r) || r == '\t') - } - if utf8.ValidString(s) && strings.IndexFunc(s, rawInvalid) < 0 { - return "`" + s + "`" - } - return qs -} - -// formatHex prints u as a hexadecimal integer in Go notation. -func formatHex(u uint64) string { - var f string - switch { - case u <= 0xff: - f = "0x%02x" - case u <= 0xffff: - f = "0x%04x" - case u <= 0xffffff: - f = "0x%06x" - case u <= 0xffffffff: - f = "0x%08x" - case u <= 0xffffffffff: - f = "0x%010x" - case u <= 0xffffffffffff: - f = "0x%012x" - case u <= 0xffffffffffffff: - f = "0x%014x" - case u <= 0xffffffffffffffff: - f = "0x%016x" - } - return fmt.Sprintf(f, u) -} diff --git a/vendor/github.com/google/go-cmp/cmp/report_slices.go b/vendor/github.com/google/go-cmp/cmp/report_slices.go deleted file mode 100644 index 68b5c1ae1..000000000 --- a/vendor/github.com/google/go-cmp/cmp/report_slices.go +++ /dev/null @@ -1,613 +0,0 @@ -// Copyright 2019, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package cmp - -import ( - "bytes" - "fmt" - "math" - "reflect" - "strconv" - "strings" - "unicode" - "unicode/utf8" - - "github.com/google/go-cmp/cmp/internal/diff" -) - -// CanFormatDiffSlice reports whether we support custom formatting for nodes -// that are slices of primitive kinds or strings. -func (opts formatOptions) CanFormatDiffSlice(v *valueNode) bool { - switch { - case opts.DiffMode != diffUnknown: - return false // Must be formatting in diff mode - case v.NumDiff == 0: - return false // No differences detected - case !v.ValueX.IsValid() || !v.ValueY.IsValid(): - return false // Both values must be valid - case v.NumIgnored > 0: - return false // Some ignore option was used - case v.NumTransformed > 0: - return false // Some transform option was used - case v.NumCompared > 1: - return false // More than one comparison was used - case v.NumCompared == 1 && v.Type.Name() != "": - // The need for cmp to check applicability of options on every element - // in a slice is a significant performance detriment for large []byte. - // The workaround is to specify Comparer(bytes.Equal), - // which enables cmp to compare []byte more efficiently. - // If they differ, we still want to provide batched diffing. - // The logic disallows named types since they tend to have their own - // String method, with nicer formatting than what this provides. - return false - } - - // Check whether this is an interface with the same concrete types. - t := v.Type - vx, vy := v.ValueX, v.ValueY - if t.Kind() == reflect.Interface && !vx.IsNil() && !vy.IsNil() && vx.Elem().Type() == vy.Elem().Type() { - vx, vy = vx.Elem(), vy.Elem() - t = vx.Type() - } - - // Check whether we provide specialized diffing for this type. - switch t.Kind() { - case reflect.String: - case reflect.Array, reflect.Slice: - // Only slices of primitive types have specialized handling. - switch t.Elem().Kind() { - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, - reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr, - reflect.Bool, reflect.Float32, reflect.Float64, reflect.Complex64, reflect.Complex128: - default: - return false - } - - // Both slice values have to be non-empty. - if t.Kind() == reflect.Slice && (vx.Len() == 0 || vy.Len() == 0) { - return false - } - - // If a sufficient number of elements already differ, - // use specialized formatting even if length requirement is not met. - if v.NumDiff > v.NumSame { - return true - } - default: - return false - } - - // Use specialized string diffing for longer slices or strings. - const minLength = 32 - return vx.Len() >= minLength && vy.Len() >= minLength -} - -// FormatDiffSlice prints a diff for the slices (or strings) represented by v. -// This provides custom-tailored logic to make printing of differences in -// textual strings and slices of primitive kinds more readable. -func (opts formatOptions) FormatDiffSlice(v *valueNode) textNode { - assert(opts.DiffMode == diffUnknown) - t, vx, vy := v.Type, v.ValueX, v.ValueY - if t.Kind() == reflect.Interface { - vx, vy = vx.Elem(), vy.Elem() - t = vx.Type() - opts = opts.WithTypeMode(emitType) - } - - // Auto-detect the type of the data. - var sx, sy string - var ssx, ssy []string - var isString, isMostlyText, isPureLinedText, isBinary bool - switch { - case t.Kind() == reflect.String: - sx, sy = vx.String(), vy.String() - isString = true - case t.Kind() == reflect.Slice && t.Elem() == reflect.TypeOf(byte(0)): - sx, sy = string(vx.Bytes()), string(vy.Bytes()) - isString = true - case t.Kind() == reflect.Array: - // Arrays need to be addressable for slice operations to work. - vx2, vy2 := reflect.New(t).Elem(), reflect.New(t).Elem() - vx2.Set(vx) - vy2.Set(vy) - vx, vy = vx2, vy2 - } - if isString { - var numTotalRunes, numValidRunes, numLines, lastLineIdx, maxLineLen int - for i, r := range sx + sy { - numTotalRunes++ - if (unicode.IsPrint(r) || unicode.IsSpace(r)) && r != utf8.RuneError { - numValidRunes++ - } - if r == '\n' { - if maxLineLen < i-lastLineIdx { - maxLineLen = i - lastLineIdx - } - lastLineIdx = i + 1 - numLines++ - } - } - isPureText := numValidRunes == numTotalRunes - isMostlyText = float64(numValidRunes) > math.Floor(0.90*float64(numTotalRunes)) - isPureLinedText = isPureText && numLines >= 4 && maxLineLen <= 1024 - isBinary = !isMostlyText - - // Avoid diffing by lines if it produces a significantly more complex - // edit script than diffing by bytes. - if isPureLinedText { - ssx = strings.Split(sx, "\n") - ssy = strings.Split(sy, "\n") - esLines := diff.Difference(len(ssx), len(ssy), func(ix, iy int) diff.Result { - return diff.BoolResult(ssx[ix] == ssy[iy]) - }) - esBytes := diff.Difference(len(sx), len(sy), func(ix, iy int) diff.Result { - return diff.BoolResult(sx[ix] == sy[iy]) - }) - efficiencyLines := float64(esLines.Dist()) / float64(len(esLines)) - efficiencyBytes := float64(esBytes.Dist()) / float64(len(esBytes)) - isPureLinedText = efficiencyLines < 4*efficiencyBytes - } - } - - // Format the string into printable records. - var list textList - var delim string - switch { - // If the text appears to be multi-lined text, - // then perform differencing across individual lines. - case isPureLinedText: - list = opts.formatDiffSlice( - reflect.ValueOf(ssx), reflect.ValueOf(ssy), 1, "line", - func(v reflect.Value, d diffMode) textRecord { - s := formatString(v.Index(0).String()) - return textRecord{Diff: d, Value: textLine(s)} - }, - ) - delim = "\n" - - // If possible, use a custom triple-quote (""") syntax for printing - // differences in a string literal. This format is more readable, - // but has edge-cases where differences are visually indistinguishable. - // This format is avoided under the following conditions: - // • A line starts with `"""` - // • A line starts with "..." - // • A line contains non-printable characters - // • Adjacent different lines differ only by whitespace - // - // For example: - // """ - // ... // 3 identical lines - // foo - // bar - // - baz - // + BAZ - // """ - isTripleQuoted := true - prevRemoveLines := map[string]bool{} - prevInsertLines := map[string]bool{} - var list2 textList - list2 = append(list2, textRecord{Value: textLine(`"""`), ElideComma: true}) - for _, r := range list { - if !r.Value.Equal(textEllipsis) { - line, _ := strconv.Unquote(string(r.Value.(textLine))) - line = strings.TrimPrefix(strings.TrimSuffix(line, "\r"), "\r") // trim leading/trailing carriage returns for legacy Windows endline support - normLine := strings.Map(func(r rune) rune { - if unicode.IsSpace(r) { - return -1 // drop whitespace to avoid visually indistinguishable output - } - return r - }, line) - isPrintable := func(r rune) bool { - return unicode.IsPrint(r) || r == '\t' // specially treat tab as printable - } - isTripleQuoted = !strings.HasPrefix(line, `"""`) && !strings.HasPrefix(line, "...") && strings.TrimFunc(line, isPrintable) == "" - switch r.Diff { - case diffRemoved: - isTripleQuoted = isTripleQuoted && !prevInsertLines[normLine] - prevRemoveLines[normLine] = true - case diffInserted: - isTripleQuoted = isTripleQuoted && !prevRemoveLines[normLine] - prevInsertLines[normLine] = true - } - if !isTripleQuoted { - break - } - r.Value = textLine(line) - r.ElideComma = true - } - if !(r.Diff == diffRemoved || r.Diff == diffInserted) { // start a new non-adjacent difference group - prevRemoveLines = map[string]bool{} - prevInsertLines = map[string]bool{} - } - list2 = append(list2, r) - } - if r := list2[len(list2)-1]; r.Diff == diffIdentical && len(r.Value.(textLine)) == 0 { - list2 = list2[:len(list2)-1] // elide single empty line at the end - } - list2 = append(list2, textRecord{Value: textLine(`"""`), ElideComma: true}) - if isTripleQuoted { - var out textNode = &textWrap{Prefix: "(", Value: list2, Suffix: ")"} - switch t.Kind() { - case reflect.String: - if t != reflect.TypeOf(string("")) { - out = opts.FormatType(t, out) - } - case reflect.Slice: - // Always emit type for slices since the triple-quote syntax - // looks like a string (not a slice). - opts = opts.WithTypeMode(emitType) - out = opts.FormatType(t, out) - } - return out - } - - // If the text appears to be single-lined text, - // then perform differencing in approximately fixed-sized chunks. - // The output is printed as quoted strings. - case isMostlyText: - list = opts.formatDiffSlice( - reflect.ValueOf(sx), reflect.ValueOf(sy), 64, "byte", - func(v reflect.Value, d diffMode) textRecord { - s := formatString(v.String()) - return textRecord{Diff: d, Value: textLine(s)} - }, - ) - - // If the text appears to be binary data, - // then perform differencing in approximately fixed-sized chunks. - // The output is inspired by hexdump. - case isBinary: - list = opts.formatDiffSlice( - reflect.ValueOf(sx), reflect.ValueOf(sy), 16, "byte", - func(v reflect.Value, d diffMode) textRecord { - var ss []string - for i := 0; i < v.Len(); i++ { - ss = append(ss, formatHex(v.Index(i).Uint())) - } - s := strings.Join(ss, ", ") - comment := commentString(fmt.Sprintf("%c|%v|", d, formatASCII(v.String()))) - return textRecord{Diff: d, Value: textLine(s), Comment: comment} - }, - ) - - // For all other slices of primitive types, - // then perform differencing in approximately fixed-sized chunks. - // The size of each chunk depends on the width of the element kind. - default: - var chunkSize int - if t.Elem().Kind() == reflect.Bool { - chunkSize = 16 - } else { - switch t.Elem().Bits() { - case 8: - chunkSize = 16 - case 16: - chunkSize = 12 - case 32: - chunkSize = 8 - default: - chunkSize = 8 - } - } - list = opts.formatDiffSlice( - vx, vy, chunkSize, t.Elem().Kind().String(), - func(v reflect.Value, d diffMode) textRecord { - var ss []string - for i := 0; i < v.Len(); i++ { - switch t.Elem().Kind() { - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - ss = append(ss, fmt.Sprint(v.Index(i).Int())) - case reflect.Uint, reflect.Uint16, reflect.Uint32, reflect.Uint64: - ss = append(ss, fmt.Sprint(v.Index(i).Uint())) - case reflect.Uint8, reflect.Uintptr: - ss = append(ss, formatHex(v.Index(i).Uint())) - case reflect.Bool, reflect.Float32, reflect.Float64, reflect.Complex64, reflect.Complex128: - ss = append(ss, fmt.Sprint(v.Index(i).Interface())) - } - } - s := strings.Join(ss, ", ") - return textRecord{Diff: d, Value: textLine(s)} - }, - ) - } - - // Wrap the output with appropriate type information. - var out textNode = &textWrap{Prefix: "{", Value: list, Suffix: "}"} - if !isMostlyText { - // The "{...}" byte-sequence literal is not valid Go syntax for strings. - // Emit the type for extra clarity (e.g. "string{...}"). - if t.Kind() == reflect.String { - opts = opts.WithTypeMode(emitType) - } - return opts.FormatType(t, out) - } - switch t.Kind() { - case reflect.String: - out = &textWrap{Prefix: "strings.Join(", Value: out, Suffix: fmt.Sprintf(", %q)", delim)} - if t != reflect.TypeOf(string("")) { - out = opts.FormatType(t, out) - } - case reflect.Slice: - out = &textWrap{Prefix: "bytes.Join(", Value: out, Suffix: fmt.Sprintf(", %q)", delim)} - if t != reflect.TypeOf([]byte(nil)) { - out = opts.FormatType(t, out) - } - } - return out -} - -// formatASCII formats s as an ASCII string. -// This is useful for printing binary strings in a semi-legible way. -func formatASCII(s string) string { - b := bytes.Repeat([]byte{'.'}, len(s)) - for i := 0; i < len(s); i++ { - if ' ' <= s[i] && s[i] <= '~' { - b[i] = s[i] - } - } - return string(b) -} - -func (opts formatOptions) formatDiffSlice( - vx, vy reflect.Value, chunkSize int, name string, - makeRec func(reflect.Value, diffMode) textRecord, -) (list textList) { - eq := func(ix, iy int) bool { - return vx.Index(ix).Interface() == vy.Index(iy).Interface() - } - es := diff.Difference(vx.Len(), vy.Len(), func(ix, iy int) diff.Result { - return diff.BoolResult(eq(ix, iy)) - }) - - appendChunks := func(v reflect.Value, d diffMode) int { - n0 := v.Len() - for v.Len() > 0 { - n := chunkSize - if n > v.Len() { - n = v.Len() - } - list = append(list, makeRec(v.Slice(0, n), d)) - v = v.Slice(n, v.Len()) - } - return n0 - v.Len() - } - - var numDiffs int - maxLen := -1 - if opts.LimitVerbosity { - maxLen = (1 << opts.verbosity()) << 2 // 4, 8, 16, 32, 64, etc... - opts.VerbosityLevel-- - } - - groups := coalesceAdjacentEdits(name, es) - groups = coalesceInterveningIdentical(groups, chunkSize/4) - groups = cleanupSurroundingIdentical(groups, eq) - maxGroup := diffStats{Name: name} - for i, ds := range groups { - if maxLen >= 0 && numDiffs >= maxLen { - maxGroup = maxGroup.Append(ds) - continue - } - - // Print equal. - if ds.NumDiff() == 0 { - // Compute the number of leading and trailing equal bytes to print. - var numLo, numHi int - numEqual := ds.NumIgnored + ds.NumIdentical - for numLo < chunkSize*numContextRecords && numLo+numHi < numEqual && i != 0 { - numLo++ - } - for numHi < chunkSize*numContextRecords && numLo+numHi < numEqual && i != len(groups)-1 { - numHi++ - } - if numEqual-(numLo+numHi) <= chunkSize && ds.NumIgnored == 0 { - numHi = numEqual - numLo // Avoid pointless coalescing of single equal row - } - - // Print the equal bytes. - appendChunks(vx.Slice(0, numLo), diffIdentical) - if numEqual > numLo+numHi { - ds.NumIdentical -= numLo + numHi - list.AppendEllipsis(ds) - } - appendChunks(vx.Slice(numEqual-numHi, numEqual), diffIdentical) - vx = vx.Slice(numEqual, vx.Len()) - vy = vy.Slice(numEqual, vy.Len()) - continue - } - - // Print unequal. - len0 := len(list) - nx := appendChunks(vx.Slice(0, ds.NumIdentical+ds.NumRemoved+ds.NumModified), diffRemoved) - vx = vx.Slice(nx, vx.Len()) - ny := appendChunks(vy.Slice(0, ds.NumIdentical+ds.NumInserted+ds.NumModified), diffInserted) - vy = vy.Slice(ny, vy.Len()) - numDiffs += len(list) - len0 - } - if maxGroup.IsZero() { - assert(vx.Len() == 0 && vy.Len() == 0) - } else { - list.AppendEllipsis(maxGroup) - } - return list -} - -// coalesceAdjacentEdits coalesces the list of edits into groups of adjacent -// equal or unequal counts. -// -// Example: -// -// Input: "..XXY...Y" -// Output: [ -// {NumIdentical: 2}, -// {NumRemoved: 2, NumInserted 1}, -// {NumIdentical: 3}, -// {NumInserted: 1}, -// ] -// -func coalesceAdjacentEdits(name string, es diff.EditScript) (groups []diffStats) { - var prevMode byte - lastStats := func(mode byte) *diffStats { - if prevMode != mode { - groups = append(groups, diffStats{Name: name}) - prevMode = mode - } - return &groups[len(groups)-1] - } - for _, e := range es { - switch e { - case diff.Identity: - lastStats('=').NumIdentical++ - case diff.UniqueX: - lastStats('!').NumRemoved++ - case diff.UniqueY: - lastStats('!').NumInserted++ - case diff.Modified: - lastStats('!').NumModified++ - } - } - return groups -} - -// coalesceInterveningIdentical coalesces sufficiently short (<= windowSize) -// equal groups into adjacent unequal groups that currently result in a -// dual inserted/removed printout. This acts as a high-pass filter to smooth -// out high-frequency changes within the windowSize. -// -// Example: -// -// WindowSize: 16, -// Input: [ -// {NumIdentical: 61}, // group 0 -// {NumRemoved: 3, NumInserted: 1}, // group 1 -// {NumIdentical: 6}, // ├── coalesce -// {NumInserted: 2}, // ├── coalesce -// {NumIdentical: 1}, // ├── coalesce -// {NumRemoved: 9}, // └── coalesce -// {NumIdentical: 64}, // group 2 -// {NumRemoved: 3, NumInserted: 1}, // group 3 -// {NumIdentical: 6}, // ├── coalesce -// {NumInserted: 2}, // ├── coalesce -// {NumIdentical: 1}, // ├── coalesce -// {NumRemoved: 7}, // ├── coalesce -// {NumIdentical: 1}, // ├── coalesce -// {NumRemoved: 2}, // └── coalesce -// {NumIdentical: 63}, // group 4 -// ] -// Output: [ -// {NumIdentical: 61}, -// {NumIdentical: 7, NumRemoved: 12, NumInserted: 3}, -// {NumIdentical: 64}, -// {NumIdentical: 8, NumRemoved: 12, NumInserted: 3}, -// {NumIdentical: 63}, -// ] -// -func coalesceInterveningIdentical(groups []diffStats, windowSize int) []diffStats { - groups, groupsOrig := groups[:0], groups - for i, ds := range groupsOrig { - if len(groups) >= 2 && ds.NumDiff() > 0 { - prev := &groups[len(groups)-2] // Unequal group - curr := &groups[len(groups)-1] // Equal group - next := &groupsOrig[i] // Unequal group - hadX, hadY := prev.NumRemoved > 0, prev.NumInserted > 0 - hasX, hasY := next.NumRemoved > 0, next.NumInserted > 0 - if ((hadX || hasX) && (hadY || hasY)) && curr.NumIdentical <= windowSize { - *prev = prev.Append(*curr).Append(*next) - groups = groups[:len(groups)-1] // Truncate off equal group - continue - } - } - groups = append(groups, ds) - } - return groups -} - -// cleanupSurroundingIdentical scans through all unequal groups, and -// moves any leading sequence of equal elements to the preceding equal group and -// moves and trailing sequence of equal elements to the succeeding equal group. -// -// This is necessary since coalesceInterveningIdentical may coalesce edit groups -// together such that leading/trailing spans of equal elements becomes possible. -// Note that this can occur even with an optimal diffing algorithm. -// -// Example: -// -// Input: [ -// {NumIdentical: 61}, -// {NumIdentical: 1 , NumRemoved: 11, NumInserted: 2}, // assume 3 leading identical elements -// {NumIdentical: 67}, -// {NumIdentical: 7, NumRemoved: 12, NumInserted: 3}, // assume 10 trailing identical elements -// {NumIdentical: 54}, -// ] -// Output: [ -// {NumIdentical: 64}, // incremented by 3 -// {NumRemoved: 9}, -// {NumIdentical: 67}, -// {NumRemoved: 9}, -// {NumIdentical: 64}, // incremented by 10 -// ] -// -func cleanupSurroundingIdentical(groups []diffStats, eq func(i, j int) bool) []diffStats { - var ix, iy int // indexes into sequence x and y - for i, ds := range groups { - // Handle equal group. - if ds.NumDiff() == 0 { - ix += ds.NumIdentical - iy += ds.NumIdentical - continue - } - - // Handle unequal group. - nx := ds.NumIdentical + ds.NumRemoved + ds.NumModified - ny := ds.NumIdentical + ds.NumInserted + ds.NumModified - var numLeadingIdentical, numTrailingIdentical int - for j := 0; j < nx && j < ny && eq(ix+j, iy+j); j++ { - numLeadingIdentical++ - } - for j := 0; j < nx && j < ny && eq(ix+nx-1-j, iy+ny-1-j); j++ { - numTrailingIdentical++ - } - if numIdentical := numLeadingIdentical + numTrailingIdentical; numIdentical > 0 { - if numLeadingIdentical > 0 { - // Remove leading identical span from this group and - // insert it into the preceding group. - if i-1 >= 0 { - groups[i-1].NumIdentical += numLeadingIdentical - } else { - // No preceding group exists, so prepend a new group, - // but do so after we finish iterating over all groups. - defer func() { - groups = append([]diffStats{{Name: groups[0].Name, NumIdentical: numLeadingIdentical}}, groups...) - }() - } - // Increment indexes since the preceding group would have handled this. - ix += numLeadingIdentical - iy += numLeadingIdentical - } - if numTrailingIdentical > 0 { - // Remove trailing identical span from this group and - // insert it into the succeeding group. - if i+1 < len(groups) { - groups[i+1].NumIdentical += numTrailingIdentical - } else { - // No succeeding group exists, so append a new group, - // but do so after we finish iterating over all groups. - defer func() { - groups = append(groups, diffStats{Name: groups[len(groups)-1].Name, NumIdentical: numTrailingIdentical}) - }() - } - // Do not increment indexes since the succeeding group will handle this. - } - - // Update this group since some identical elements were removed. - nx -= numIdentical - ny -= numIdentical - groups[i] = diffStats{Name: ds.Name, NumRemoved: nx, NumInserted: ny} - } - ix += nx - iy += ny - } - return groups -} diff --git a/vendor/github.com/google/go-cmp/cmp/report_text.go b/vendor/github.com/google/go-cmp/cmp/report_text.go deleted file mode 100644 index 0fd46d7ff..000000000 --- a/vendor/github.com/google/go-cmp/cmp/report_text.go +++ /dev/null @@ -1,431 +0,0 @@ -// Copyright 2019, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package cmp - -import ( - "bytes" - "fmt" - "math/rand" - "strings" - "time" - "unicode/utf8" - - "github.com/google/go-cmp/cmp/internal/flags" -) - -var randBool = rand.New(rand.NewSource(time.Now().Unix())).Intn(2) == 0 - -const maxColumnLength = 80 - -type indentMode int - -func (n indentMode) appendIndent(b []byte, d diffMode) []byte { - // The output of Diff is documented as being unstable to provide future - // flexibility in changing the output for more humanly readable reports. - // This logic intentionally introduces instability to the exact output - // so that users can detect accidental reliance on stability early on, - // rather than much later when an actual change to the format occurs. - if flags.Deterministic || randBool { - // Use regular spaces (U+0020). - switch d { - case diffUnknown, diffIdentical: - b = append(b, " "...) - case diffRemoved: - b = append(b, "- "...) - case diffInserted: - b = append(b, "+ "...) - } - } else { - // Use non-breaking spaces (U+00a0). - switch d { - case diffUnknown, diffIdentical: - b = append(b, "  "...) - case diffRemoved: - b = append(b, "- "...) - case diffInserted: - b = append(b, "+ "...) - } - } - return repeatCount(n).appendChar(b, '\t') -} - -type repeatCount int - -func (n repeatCount) appendChar(b []byte, c byte) []byte { - for ; n > 0; n-- { - b = append(b, c) - } - return b -} - -// textNode is a simplified tree-based representation of structured text. -// Possible node types are textWrap, textList, or textLine. -type textNode interface { - // Len reports the length in bytes of a single-line version of the tree. - // Nested textRecord.Diff and textRecord.Comment fields are ignored. - Len() int - // Equal reports whether the two trees are structurally identical. - // Nested textRecord.Diff and textRecord.Comment fields are compared. - Equal(textNode) bool - // String returns the string representation of the text tree. - // It is not guaranteed that len(x.String()) == x.Len(), - // nor that x.String() == y.String() implies that x.Equal(y). - String() string - - // formatCompactTo formats the contents of the tree as a single-line string - // to the provided buffer. Any nested textRecord.Diff and textRecord.Comment - // fields are ignored. - // - // However, not all nodes in the tree should be collapsed as a single-line. - // If a node can be collapsed as a single-line, it is replaced by a textLine - // node. Since the top-level node cannot replace itself, this also returns - // the current node itself. - // - // This does not mutate the receiver. - formatCompactTo([]byte, diffMode) ([]byte, textNode) - // formatExpandedTo formats the contents of the tree as a multi-line string - // to the provided buffer. In order for column alignment to operate well, - // formatCompactTo must be called before calling formatExpandedTo. - formatExpandedTo([]byte, diffMode, indentMode) []byte -} - -// textWrap is a wrapper that concatenates a prefix and/or a suffix -// to the underlying node. -type textWrap struct { - Prefix string // e.g., "bytes.Buffer{" - Value textNode // textWrap | textList | textLine - Suffix string // e.g., "}" - Metadata interface{} // arbitrary metadata; has no effect on formatting -} - -func (s *textWrap) Len() int { - return len(s.Prefix) + s.Value.Len() + len(s.Suffix) -} -func (s1 *textWrap) Equal(s2 textNode) bool { - if s2, ok := s2.(*textWrap); ok { - return s1.Prefix == s2.Prefix && s1.Value.Equal(s2.Value) && s1.Suffix == s2.Suffix - } - return false -} -func (s *textWrap) String() string { - var d diffMode - var n indentMode - _, s2 := s.formatCompactTo(nil, d) - b := n.appendIndent(nil, d) // Leading indent - b = s2.formatExpandedTo(b, d, n) // Main body - b = append(b, '\n') // Trailing newline - return string(b) -} -func (s *textWrap) formatCompactTo(b []byte, d diffMode) ([]byte, textNode) { - n0 := len(b) // Original buffer length - b = append(b, s.Prefix...) - b, s.Value = s.Value.formatCompactTo(b, d) - b = append(b, s.Suffix...) - if _, ok := s.Value.(textLine); ok { - return b, textLine(b[n0:]) - } - return b, s -} -func (s *textWrap) formatExpandedTo(b []byte, d diffMode, n indentMode) []byte { - b = append(b, s.Prefix...) - b = s.Value.formatExpandedTo(b, d, n) - b = append(b, s.Suffix...) - return b -} - -// textList is a comma-separated list of textWrap or textLine nodes. -// The list may be formatted as multi-lines or single-line at the discretion -// of the textList.formatCompactTo method. -type textList []textRecord -type textRecord struct { - Diff diffMode // e.g., 0 or '-' or '+' - Key string // e.g., "MyField" - Value textNode // textWrap | textLine - ElideComma bool // avoid trailing comma - Comment fmt.Stringer // e.g., "6 identical fields" -} - -// AppendEllipsis appends a new ellipsis node to the list if none already -// exists at the end. If cs is non-zero it coalesces the statistics with the -// previous diffStats. -func (s *textList) AppendEllipsis(ds diffStats) { - hasStats := !ds.IsZero() - if len(*s) == 0 || !(*s)[len(*s)-1].Value.Equal(textEllipsis) { - if hasStats { - *s = append(*s, textRecord{Value: textEllipsis, ElideComma: true, Comment: ds}) - } else { - *s = append(*s, textRecord{Value: textEllipsis, ElideComma: true}) - } - return - } - if hasStats { - (*s)[len(*s)-1].Comment = (*s)[len(*s)-1].Comment.(diffStats).Append(ds) - } -} - -func (s textList) Len() (n int) { - for i, r := range s { - n += len(r.Key) - if r.Key != "" { - n += len(": ") - } - n += r.Value.Len() - if i < len(s)-1 { - n += len(", ") - } - } - return n -} - -func (s1 textList) Equal(s2 textNode) bool { - if s2, ok := s2.(textList); ok { - if len(s1) != len(s2) { - return false - } - for i := range s1 { - r1, r2 := s1[i], s2[i] - if !(r1.Diff == r2.Diff && r1.Key == r2.Key && r1.Value.Equal(r2.Value) && r1.Comment == r2.Comment) { - return false - } - } - return true - } - return false -} - -func (s textList) String() string { - return (&textWrap{Prefix: "{", Value: s, Suffix: "}"}).String() -} - -func (s textList) formatCompactTo(b []byte, d diffMode) ([]byte, textNode) { - s = append(textList(nil), s...) // Avoid mutating original - - // Determine whether we can collapse this list as a single line. - n0 := len(b) // Original buffer length - var multiLine bool - for i, r := range s { - if r.Diff == diffInserted || r.Diff == diffRemoved { - multiLine = true - } - b = append(b, r.Key...) - if r.Key != "" { - b = append(b, ": "...) - } - b, s[i].Value = r.Value.formatCompactTo(b, d|r.Diff) - if _, ok := s[i].Value.(textLine); !ok { - multiLine = true - } - if r.Comment != nil { - multiLine = true - } - if i < len(s)-1 { - b = append(b, ", "...) - } - } - // Force multi-lined output when printing a removed/inserted node that - // is sufficiently long. - if (d == diffInserted || d == diffRemoved) && len(b[n0:]) > maxColumnLength { - multiLine = true - } - if !multiLine { - return b, textLine(b[n0:]) - } - return b, s -} - -func (s textList) formatExpandedTo(b []byte, d diffMode, n indentMode) []byte { - alignKeyLens := s.alignLens( - func(r textRecord) bool { - _, isLine := r.Value.(textLine) - return r.Key == "" || !isLine - }, - func(r textRecord) int { return utf8.RuneCountInString(r.Key) }, - ) - alignValueLens := s.alignLens( - func(r textRecord) bool { - _, isLine := r.Value.(textLine) - return !isLine || r.Value.Equal(textEllipsis) || r.Comment == nil - }, - func(r textRecord) int { return utf8.RuneCount(r.Value.(textLine)) }, - ) - - // Format lists of simple lists in a batched form. - // If the list is sequence of only textLine values, - // then batch multiple values on a single line. - var isSimple bool - for _, r := range s { - _, isLine := r.Value.(textLine) - isSimple = r.Diff == 0 && r.Key == "" && isLine && r.Comment == nil - if !isSimple { - break - } - } - if isSimple { - n++ - var batch []byte - emitBatch := func() { - if len(batch) > 0 { - b = n.appendIndent(append(b, '\n'), d) - b = append(b, bytes.TrimRight(batch, " ")...) - batch = batch[:0] - } - } - for _, r := range s { - line := r.Value.(textLine) - if len(batch)+len(line)+len(", ") > maxColumnLength { - emitBatch() - } - batch = append(batch, line...) - batch = append(batch, ", "...) - } - emitBatch() - n-- - return n.appendIndent(append(b, '\n'), d) - } - - // Format the list as a multi-lined output. - n++ - for i, r := range s { - b = n.appendIndent(append(b, '\n'), d|r.Diff) - if r.Key != "" { - b = append(b, r.Key+": "...) - } - b = alignKeyLens[i].appendChar(b, ' ') - - b = r.Value.formatExpandedTo(b, d|r.Diff, n) - if !r.ElideComma { - b = append(b, ',') - } - b = alignValueLens[i].appendChar(b, ' ') - - if r.Comment != nil { - b = append(b, " // "+r.Comment.String()...) - } - } - n-- - - return n.appendIndent(append(b, '\n'), d) -} - -func (s textList) alignLens( - skipFunc func(textRecord) bool, - lenFunc func(textRecord) int, -) []repeatCount { - var startIdx, endIdx, maxLen int - lens := make([]repeatCount, len(s)) - for i, r := range s { - if skipFunc(r) { - for j := startIdx; j < endIdx && j < len(s); j++ { - lens[j] = repeatCount(maxLen - lenFunc(s[j])) - } - startIdx, endIdx, maxLen = i+1, i+1, 0 - } else { - if maxLen < lenFunc(r) { - maxLen = lenFunc(r) - } - endIdx = i + 1 - } - } - for j := startIdx; j < endIdx && j < len(s); j++ { - lens[j] = repeatCount(maxLen - lenFunc(s[j])) - } - return lens -} - -// textLine is a single-line segment of text and is always a leaf node -// in the textNode tree. -type textLine []byte - -var ( - textNil = textLine("nil") - textEllipsis = textLine("...") -) - -func (s textLine) Len() int { - return len(s) -} -func (s1 textLine) Equal(s2 textNode) bool { - if s2, ok := s2.(textLine); ok { - return bytes.Equal([]byte(s1), []byte(s2)) - } - return false -} -func (s textLine) String() string { - return string(s) -} -func (s textLine) formatCompactTo(b []byte, d diffMode) ([]byte, textNode) { - return append(b, s...), s -} -func (s textLine) formatExpandedTo(b []byte, _ diffMode, _ indentMode) []byte { - return append(b, s...) -} - -type diffStats struct { - Name string - NumIgnored int - NumIdentical int - NumRemoved int - NumInserted int - NumModified int -} - -func (s diffStats) IsZero() bool { - s.Name = "" - return s == diffStats{} -} - -func (s diffStats) NumDiff() int { - return s.NumRemoved + s.NumInserted + s.NumModified -} - -func (s diffStats) Append(ds diffStats) diffStats { - assert(s.Name == ds.Name) - s.NumIgnored += ds.NumIgnored - s.NumIdentical += ds.NumIdentical - s.NumRemoved += ds.NumRemoved - s.NumInserted += ds.NumInserted - s.NumModified += ds.NumModified - return s -} - -// String prints a humanly-readable summary of coalesced records. -// -// Example: -// diffStats{Name: "Field", NumIgnored: 5}.String() => "5 ignored fields" -func (s diffStats) String() string { - var ss []string - var sum int - labels := [...]string{"ignored", "identical", "removed", "inserted", "modified"} - counts := [...]int{s.NumIgnored, s.NumIdentical, s.NumRemoved, s.NumInserted, s.NumModified} - for i, n := range counts { - if n > 0 { - ss = append(ss, fmt.Sprintf("%d %v", n, labels[i])) - } - sum += n - } - - // Pluralize the name (adjusting for some obscure English grammar rules). - name := s.Name - if sum > 1 { - name += "s" - if strings.HasSuffix(name, "ys") { - name = name[:len(name)-2] + "ies" // e.g., "entrys" => "entries" - } - } - - // Format the list according to English grammar (with Oxford comma). - switch n := len(ss); n { - case 0: - return "" - case 1, 2: - return strings.Join(ss, " and ") + " " + name - default: - return strings.Join(ss[:n-1], ", ") + ", and " + ss[n-1] + " " + name - } -} - -type commentString string - -func (s commentString) String() string { return string(s) } diff --git a/vendor/github.com/google/go-cmp/cmp/report_value.go b/vendor/github.com/google/go-cmp/cmp/report_value.go deleted file mode 100644 index 668d470fd..000000000 --- a/vendor/github.com/google/go-cmp/cmp/report_value.go +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright 2019, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package cmp - -import "reflect" - -// valueNode represents a single node within a report, which is a -// structured representation of the value tree, containing information -// regarding which nodes are equal or not. -type valueNode struct { - parent *valueNode - - Type reflect.Type - ValueX reflect.Value - ValueY reflect.Value - - // NumSame is the number of leaf nodes that are equal. - // All descendants are equal only if NumDiff is 0. - NumSame int - // NumDiff is the number of leaf nodes that are not equal. - NumDiff int - // NumIgnored is the number of leaf nodes that are ignored. - NumIgnored int - // NumCompared is the number of leaf nodes that were compared - // using an Equal method or Comparer function. - NumCompared int - // NumTransformed is the number of non-leaf nodes that were transformed. - NumTransformed int - // NumChildren is the number of transitive descendants of this node. - // This counts from zero; thus, leaf nodes have no descendants. - NumChildren int - // MaxDepth is the maximum depth of the tree. This counts from zero; - // thus, leaf nodes have a depth of zero. - MaxDepth int - - // Records is a list of struct fields, slice elements, or map entries. - Records []reportRecord // If populated, implies Value is not populated - - // Value is the result of a transformation, pointer indirect, of - // type assertion. - Value *valueNode // If populated, implies Records is not populated - - // TransformerName is the name of the transformer. - TransformerName string // If non-empty, implies Value is populated -} -type reportRecord struct { - Key reflect.Value // Invalid for slice element - Value *valueNode -} - -func (parent *valueNode) PushStep(ps PathStep) (child *valueNode) { - vx, vy := ps.Values() - child = &valueNode{parent: parent, Type: ps.Type(), ValueX: vx, ValueY: vy} - switch s := ps.(type) { - case StructField: - assert(parent.Value == nil) - parent.Records = append(parent.Records, reportRecord{Key: reflect.ValueOf(s.Name()), Value: child}) - case SliceIndex: - assert(parent.Value == nil) - parent.Records = append(parent.Records, reportRecord{Value: child}) - case MapIndex: - assert(parent.Value == nil) - parent.Records = append(parent.Records, reportRecord{Key: s.Key(), Value: child}) - case Indirect: - assert(parent.Value == nil && parent.Records == nil) - parent.Value = child - case TypeAssertion: - assert(parent.Value == nil && parent.Records == nil) - parent.Value = child - case Transform: - assert(parent.Value == nil && parent.Records == nil) - parent.Value = child - parent.TransformerName = s.Name() - parent.NumTransformed++ - default: - assert(parent == nil) // Must be the root step - } - return child -} - -func (r *valueNode) Report(rs Result) { - assert(r.MaxDepth == 0) // May only be called on leaf nodes - - if rs.ByIgnore() { - r.NumIgnored++ - } else { - if rs.Equal() { - r.NumSame++ - } else { - r.NumDiff++ - } - } - assert(r.NumSame+r.NumDiff+r.NumIgnored == 1) - - if rs.ByMethod() { - r.NumCompared++ - } - if rs.ByFunc() { - r.NumCompared++ - } - assert(r.NumCompared <= 1) -} - -func (child *valueNode) PopStep() (parent *valueNode) { - if child.parent == nil { - return nil - } - parent = child.parent - parent.NumSame += child.NumSame - parent.NumDiff += child.NumDiff - parent.NumIgnored += child.NumIgnored - parent.NumCompared += child.NumCompared - parent.NumTransformed += child.NumTransformed - parent.NumChildren += child.NumChildren + 1 - if parent.MaxDepth < child.MaxDepth+1 { - parent.MaxDepth = child.MaxDepth + 1 - } - return parent -} diff --git a/vendor/github.com/google/gofuzz/.travis.yml b/vendor/github.com/google/gofuzz/.travis.yml deleted file mode 100644 index 061d72ae0..000000000 --- a/vendor/github.com/google/gofuzz/.travis.yml +++ /dev/null @@ -1,10 +0,0 @@ -language: go - -go: - - 1.11.x - - 1.12.x - - 1.13.x - - master - -script: - - go test -cover diff --git a/vendor/github.com/google/gofuzz/CONTRIBUTING.md b/vendor/github.com/google/gofuzz/CONTRIBUTING.md deleted file mode 100644 index 97c1b34fd..000000000 --- a/vendor/github.com/google/gofuzz/CONTRIBUTING.md +++ /dev/null @@ -1,67 +0,0 @@ -# How to contribute # - -We'd love to accept your patches and contributions to this project. There are -just a few small guidelines you need to follow. - - -## Contributor License Agreement ## - -Contributions to any Google project must be accompanied by a Contributor -License Agreement. This is not a copyright **assignment**, it simply gives -Google permission to use and redistribute your contributions as part of the -project. - - * If you are an individual writing original source code and you're sure you - own the intellectual property, then you'll need to sign an [individual - CLA][]. - - * If you work for a company that wants to allow you to contribute your work, - then you'll need to sign a [corporate CLA][]. - -You generally only need to submit a CLA once, so if you've already submitted -one (even if it was for a different project), you probably don't need to do it -again. - -[individual CLA]: https://developers.google.com/open-source/cla/individual -[corporate CLA]: https://developers.google.com/open-source/cla/corporate - - -## Submitting a patch ## - - 1. It's generally best to start by opening a new issue describing the bug or - feature you're intending to fix. Even if you think it's relatively minor, - it's helpful to know what people are working on. Mention in the initial - issue that you are planning to work on that bug or feature so that it can - be assigned to you. - - 1. Follow the normal process of [forking][] the project, and setup a new - branch to work in. It's important that each group of changes be done in - separate branches in order to ensure that a pull request only includes the - commits related to that bug or feature. - - 1. Go makes it very simple to ensure properly formatted code, so always run - `go fmt` on your code before committing it. You should also run - [golint][] over your code. As noted in the [golint readme][], it's not - strictly necessary that your code be completely "lint-free", but this will - help you find common style issues. - - 1. Any significant changes should almost always be accompanied by tests. The - project already has good test coverage, so look at some of the existing - tests if you're unsure how to go about it. [gocov][] and [gocov-html][] - are invaluable tools for seeing which parts of your code aren't being - exercised by your tests. - - 1. Do your best to have [well-formed commit messages][] for each change. - This provides consistency throughout the project, and ensures that commit - messages are able to be formatted properly by various git tools. - - 1. Finally, push the commits to your fork and submit a [pull request][]. - -[forking]: https://help.github.com/articles/fork-a-repo -[golint]: https://github.com/golang/lint -[golint readme]: https://github.com/golang/lint/blob/master/README -[gocov]: https://github.com/axw/gocov -[gocov-html]: https://github.com/matm/gocov-html -[well-formed commit messages]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html -[squash]: http://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits -[pull request]: https://help.github.com/articles/creating-a-pull-request diff --git a/vendor/github.com/google/gofuzz/LICENSE b/vendor/github.com/google/gofuzz/LICENSE deleted file mode 100644 index d64569567..000000000 --- a/vendor/github.com/google/gofuzz/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/github.com/google/gofuzz/README.md b/vendor/github.com/google/gofuzz/README.md deleted file mode 100644 index b503aae7d..000000000 --- a/vendor/github.com/google/gofuzz/README.md +++ /dev/null @@ -1,89 +0,0 @@ -gofuzz -====== - -gofuzz is a library for populating go objects with random values. - -[![GoDoc](https://godoc.org/github.com/google/gofuzz?status.svg)](https://godoc.org/github.com/google/gofuzz) -[![Travis](https://travis-ci.org/google/gofuzz.svg?branch=master)](https://travis-ci.org/google/gofuzz) - -This is useful for testing: - -* Do your project's objects really serialize/unserialize correctly in all cases? -* Is there an incorrectly formatted object that will cause your project to panic? - -Import with ```import "github.com/google/gofuzz"``` - -You can use it on single variables: -```go -f := fuzz.New() -var myInt int -f.Fuzz(&myInt) // myInt gets a random value. -``` - -You can use it on maps: -```go -f := fuzz.New().NilChance(0).NumElements(1, 1) -var myMap map[ComplexKeyType]string -f.Fuzz(&myMap) // myMap will have exactly one element. -``` - -Customize the chance of getting a nil pointer: -```go -f := fuzz.New().NilChance(.5) -var fancyStruct struct { - A, B, C, D *string -} -f.Fuzz(&fancyStruct) // About half the pointers should be set. -``` - -You can even customize the randomization completely if needed: -```go -type MyEnum string -const ( - A MyEnum = "A" - B MyEnum = "B" -) -type MyInfo struct { - Type MyEnum - AInfo *string - BInfo *string -} - -f := fuzz.New().NilChance(0).Funcs( - func(e *MyInfo, c fuzz.Continue) { - switch c.Intn(2) { - case 0: - e.Type = A - c.Fuzz(&e.AInfo) - case 1: - e.Type = B - c.Fuzz(&e.BInfo) - } - }, -) - -var myObject MyInfo -f.Fuzz(&myObject) // Type will correspond to whether A or B info is set. -``` - -See more examples in ```example_test.go```. - -You can use this library for easier [go-fuzz](https://github.com/dvyukov/go-fuzz)ing. -go-fuzz provides the user a byte-slice, which should be converted to different inputs -for the tested function. This library can help convert the byte slice. Consider for -example a fuzz test for a the function `mypackage.MyFunc` that takes an int arguments: -```go -// +build gofuzz -package mypackage - -import fuzz "github.com/google/gofuzz" - -func Fuzz(data []byte) int { - var i int - fuzz.NewFromGoFuzz(data).Fuzz(&i) - MyFunc(i) - return 0 -} -``` - -Happy testing! diff --git a/vendor/github.com/google/gofuzz/bytesource/bytesource.go b/vendor/github.com/google/gofuzz/bytesource/bytesource.go deleted file mode 100644 index 5bb365949..000000000 --- a/vendor/github.com/google/gofuzz/bytesource/bytesource.go +++ /dev/null @@ -1,81 +0,0 @@ -/* -Copyright 2014 Google Inc. All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Package bytesource provides a rand.Source64 that is determined by a slice of bytes. -package bytesource - -import ( - "bytes" - "encoding/binary" - "io" - "math/rand" -) - -// ByteSource implements rand.Source64 determined by a slice of bytes. The random numbers are -// generated from each 8 bytes in the slice, until the last bytes are consumed, from which a -// fallback pseudo random source is created in case more random numbers are required. -// It also exposes a `bytes.Reader` API, which lets callers consume the bytes directly. -type ByteSource struct { - *bytes.Reader - fallback rand.Source -} - -// New returns a new ByteSource from a given slice of bytes. -func New(input []byte) *ByteSource { - s := &ByteSource{ - Reader: bytes.NewReader(input), - fallback: rand.NewSource(0), - } - if len(input) > 0 { - s.fallback = rand.NewSource(int64(s.consumeUint64())) - } - return s -} - -func (s *ByteSource) Uint64() uint64 { - // Return from input if it was not exhausted. - if s.Len() > 0 { - return s.consumeUint64() - } - - // Input was exhausted, return random number from fallback (in this case fallback should not be - // nil). Try first having a Uint64 output (Should work in current rand implementation), - // otherwise return a conversion of Int63. - if s64, ok := s.fallback.(rand.Source64); ok { - return s64.Uint64() - } - return uint64(s.fallback.Int63()) -} - -func (s *ByteSource) Int63() int64 { - return int64(s.Uint64() >> 1) -} - -func (s *ByteSource) Seed(seed int64) { - s.fallback = rand.NewSource(seed) - s.Reader = bytes.NewReader(nil) -} - -// consumeUint64 reads 8 bytes from the input and convert them to a uint64. It assumes that the the -// bytes reader is not empty. -func (s *ByteSource) consumeUint64() uint64 { - var bytes [8]byte - _, err := s.Read(bytes[:]) - if err != nil && err != io.EOF { - panic("failed reading source") // Should not happen. - } - return binary.BigEndian.Uint64(bytes[:]) -} diff --git a/vendor/github.com/google/gofuzz/doc.go b/vendor/github.com/google/gofuzz/doc.go deleted file mode 100644 index 9f9956d4a..000000000 --- a/vendor/github.com/google/gofuzz/doc.go +++ /dev/null @@ -1,18 +0,0 @@ -/* -Copyright 2014 Google Inc. All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Package fuzz is a library for populating go objects with random values. -package fuzz diff --git a/vendor/github.com/google/gofuzz/fuzz.go b/vendor/github.com/google/gofuzz/fuzz.go deleted file mode 100644 index 761520a8c..000000000 --- a/vendor/github.com/google/gofuzz/fuzz.go +++ /dev/null @@ -1,605 +0,0 @@ -/* -Copyright 2014 Google Inc. All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package fuzz - -import ( - "fmt" - "math/rand" - "reflect" - "regexp" - "time" - - "github.com/google/gofuzz/bytesource" - "strings" -) - -// fuzzFuncMap is a map from a type to a fuzzFunc that handles that type. -type fuzzFuncMap map[reflect.Type]reflect.Value - -// Fuzzer knows how to fill any object with random fields. -type Fuzzer struct { - fuzzFuncs fuzzFuncMap - defaultFuzzFuncs fuzzFuncMap - r *rand.Rand - nilChance float64 - minElements int - maxElements int - maxDepth int - skipFieldPatterns []*regexp.Regexp -} - -// New returns a new Fuzzer. Customize your Fuzzer further by calling Funcs, -// RandSource, NilChance, or NumElements in any order. -func New() *Fuzzer { - return NewWithSeed(time.Now().UnixNano()) -} - -func NewWithSeed(seed int64) *Fuzzer { - f := &Fuzzer{ - defaultFuzzFuncs: fuzzFuncMap{ - reflect.TypeOf(&time.Time{}): reflect.ValueOf(fuzzTime), - }, - - fuzzFuncs: fuzzFuncMap{}, - r: rand.New(rand.NewSource(seed)), - nilChance: .2, - minElements: 1, - maxElements: 10, - maxDepth: 100, - } - return f -} - -// NewFromGoFuzz is a helper function that enables using gofuzz (this -// project) with go-fuzz (https://github.com/dvyukov/go-fuzz) for continuous -// fuzzing. Essentially, it enables translating the fuzzing bytes from -// go-fuzz to any Go object using this library. -// -// This implementation promises a constant translation from a given slice of -// bytes to the fuzzed objects. This promise will remain over future -// versions of Go and of this library. -// -// Note: the returned Fuzzer should not be shared between multiple goroutines, -// as its deterministic output will no longer be available. -// -// Example: use go-fuzz to test the function `MyFunc(int)` in the package -// `mypackage`. Add the file: "mypacakge_fuzz.go" with the content: -// -// // +build gofuzz -// package mypacakge -// import fuzz "github.com/google/gofuzz" -// func Fuzz(data []byte) int { -// var i int -// fuzz.NewFromGoFuzz(data).Fuzz(&i) -// MyFunc(i) -// return 0 -// } -func NewFromGoFuzz(data []byte) *Fuzzer { - return New().RandSource(bytesource.New(data)) -} - -// Funcs adds each entry in fuzzFuncs as a custom fuzzing function. -// -// Each entry in fuzzFuncs must be a function taking two parameters. -// The first parameter must be a pointer or map. It is the variable that -// function will fill with random data. The second parameter must be a -// fuzz.Continue, which will provide a source of randomness and a way -// to automatically continue fuzzing smaller pieces of the first parameter. -// -// These functions are called sensibly, e.g., if you wanted custom string -// fuzzing, the function `func(s *string, c fuzz.Continue)` would get -// called and passed the address of strings. Maps and pointers will always -// be made/new'd for you, ignoring the NilChange option. For slices, it -// doesn't make much sense to pre-create them--Fuzzer doesn't know how -// long you want your slice--so take a pointer to a slice, and make it -// yourself. (If you don't want your map/pointer type pre-made, take a -// pointer to it, and make it yourself.) See the examples for a range of -// custom functions. -func (f *Fuzzer) Funcs(fuzzFuncs ...interface{}) *Fuzzer { - for i := range fuzzFuncs { - v := reflect.ValueOf(fuzzFuncs[i]) - if v.Kind() != reflect.Func { - panic("Need only funcs!") - } - t := v.Type() - if t.NumIn() != 2 || t.NumOut() != 0 { - panic("Need 2 in and 0 out params!") - } - argT := t.In(0) - switch argT.Kind() { - case reflect.Ptr, reflect.Map: - default: - panic("fuzzFunc must take pointer or map type") - } - if t.In(1) != reflect.TypeOf(Continue{}) { - panic("fuzzFunc's second parameter must be type fuzz.Continue") - } - f.fuzzFuncs[argT] = v - } - return f -} - -// RandSource causes f to get values from the given source of randomness. -// Use if you want deterministic fuzzing. -func (f *Fuzzer) RandSource(s rand.Source) *Fuzzer { - f.r = rand.New(s) - return f -} - -// NilChance sets the probability of creating a nil pointer, map, or slice to -// 'p'. 'p' should be between 0 (no nils) and 1 (all nils), inclusive. -func (f *Fuzzer) NilChance(p float64) *Fuzzer { - if p < 0 || p > 1 { - panic("p should be between 0 and 1, inclusive.") - } - f.nilChance = p - return f -} - -// NumElements sets the minimum and maximum number of elements that will be -// added to a non-nil map or slice. -func (f *Fuzzer) NumElements(atLeast, atMost int) *Fuzzer { - if atLeast > atMost { - panic("atLeast must be <= atMost") - } - if atLeast < 0 { - panic("atLeast must be >= 0") - } - f.minElements = atLeast - f.maxElements = atMost - return f -} - -func (f *Fuzzer) genElementCount() int { - if f.minElements == f.maxElements { - return f.minElements - } - return f.minElements + f.r.Intn(f.maxElements-f.minElements+1) -} - -func (f *Fuzzer) genShouldFill() bool { - return f.r.Float64() >= f.nilChance -} - -// MaxDepth sets the maximum number of recursive fuzz calls that will be made -// before stopping. This includes struct members, pointers, and map and slice -// elements. -func (f *Fuzzer) MaxDepth(d int) *Fuzzer { - f.maxDepth = d - return f -} - -// Skip fields which match the supplied pattern. Call this multiple times if needed -// This is useful to skip XXX_ fields generated by protobuf -func (f *Fuzzer) SkipFieldsWithPattern(pattern *regexp.Regexp) *Fuzzer { - f.skipFieldPatterns = append(f.skipFieldPatterns, pattern) - return f -} - -// Fuzz recursively fills all of obj's fields with something random. First -// this tries to find a custom fuzz function (see Funcs). If there is no -// custom function this tests whether the object implements fuzz.Interface and, -// if so, calls Fuzz on it to fuzz itself. If that fails, this will see if -// there is a default fuzz function provided by this package. If all of that -// fails, this will generate random values for all primitive fields and then -// recurse for all non-primitives. -// -// This is safe for cyclic or tree-like structs, up to a limit. Use the -// MaxDepth method to adjust how deep you need it to recurse. -// -// obj must be a pointer. Only exported (public) fields can be set (thanks, -// golang :/ ) Intended for tests, so will panic on bad input or unimplemented -// fields. -func (f *Fuzzer) Fuzz(obj interface{}) { - v := reflect.ValueOf(obj) - if v.Kind() != reflect.Ptr { - panic("needed ptr!") - } - v = v.Elem() - f.fuzzWithContext(v, 0) -} - -// FuzzNoCustom is just like Fuzz, except that any custom fuzz function for -// obj's type will not be called and obj will not be tested for fuzz.Interface -// conformance. This applies only to obj and not other instances of obj's -// type. -// Not safe for cyclic or tree-like structs! -// obj must be a pointer. Only exported (public) fields can be set (thanks, golang :/ ) -// Intended for tests, so will panic on bad input or unimplemented fields. -func (f *Fuzzer) FuzzNoCustom(obj interface{}) { - v := reflect.ValueOf(obj) - if v.Kind() != reflect.Ptr { - panic("needed ptr!") - } - v = v.Elem() - f.fuzzWithContext(v, flagNoCustomFuzz) -} - -const ( - // Do not try to find a custom fuzz function. Does not apply recursively. - flagNoCustomFuzz uint64 = 1 << iota -) - -func (f *Fuzzer) fuzzWithContext(v reflect.Value, flags uint64) { - fc := &fuzzerContext{fuzzer: f} - fc.doFuzz(v, flags) -} - -// fuzzerContext carries context about a single fuzzing run, which lets Fuzzer -// be thread-safe. -type fuzzerContext struct { - fuzzer *Fuzzer - curDepth int -} - -func (fc *fuzzerContext) doFuzz(v reflect.Value, flags uint64) { - if fc.curDepth >= fc.fuzzer.maxDepth { - return - } - fc.curDepth++ - defer func() { fc.curDepth-- }() - - if !v.CanSet() { - return - } - - if flags&flagNoCustomFuzz == 0 { - // Check for both pointer and non-pointer custom functions. - if v.CanAddr() && fc.tryCustom(v.Addr()) { - return - } - if fc.tryCustom(v) { - return - } - } - - if fn, ok := fillFuncMap[v.Kind()]; ok { - fn(v, fc.fuzzer.r) - return - } - - switch v.Kind() { - case reflect.Map: - if fc.fuzzer.genShouldFill() { - v.Set(reflect.MakeMap(v.Type())) - n := fc.fuzzer.genElementCount() - for i := 0; i < n; i++ { - key := reflect.New(v.Type().Key()).Elem() - fc.doFuzz(key, 0) - val := reflect.New(v.Type().Elem()).Elem() - fc.doFuzz(val, 0) - v.SetMapIndex(key, val) - } - return - } - v.Set(reflect.Zero(v.Type())) - case reflect.Ptr: - if fc.fuzzer.genShouldFill() { - v.Set(reflect.New(v.Type().Elem())) - fc.doFuzz(v.Elem(), 0) - return - } - v.Set(reflect.Zero(v.Type())) - case reflect.Slice: - if fc.fuzzer.genShouldFill() { - n := fc.fuzzer.genElementCount() - v.Set(reflect.MakeSlice(v.Type(), n, n)) - for i := 0; i < n; i++ { - fc.doFuzz(v.Index(i), 0) - } - return - } - v.Set(reflect.Zero(v.Type())) - case reflect.Array: - if fc.fuzzer.genShouldFill() { - n := v.Len() - for i := 0; i < n; i++ { - fc.doFuzz(v.Index(i), 0) - } - return - } - v.Set(reflect.Zero(v.Type())) - case reflect.Struct: - for i := 0; i < v.NumField(); i++ { - skipField := false - fieldName := v.Type().Field(i).Name - for _, pattern := range fc.fuzzer.skipFieldPatterns { - if pattern.MatchString(fieldName) { - skipField = true - break - } - } - if !skipField { - fc.doFuzz(v.Field(i), 0) - } - } - case reflect.Chan: - fallthrough - case reflect.Func: - fallthrough - case reflect.Interface: - fallthrough - default: - panic(fmt.Sprintf("Can't handle %#v", v.Interface())) - } -} - -// tryCustom searches for custom handlers, and returns true iff it finds a match -// and successfully randomizes v. -func (fc *fuzzerContext) tryCustom(v reflect.Value) bool { - // First: see if we have a fuzz function for it. - doCustom, ok := fc.fuzzer.fuzzFuncs[v.Type()] - if !ok { - // Second: see if it can fuzz itself. - if v.CanInterface() { - intf := v.Interface() - if fuzzable, ok := intf.(Interface); ok { - fuzzable.Fuzz(Continue{fc: fc, Rand: fc.fuzzer.r}) - return true - } - } - // Finally: see if there is a default fuzz function. - doCustom, ok = fc.fuzzer.defaultFuzzFuncs[v.Type()] - if !ok { - return false - } - } - - switch v.Kind() { - case reflect.Ptr: - if v.IsNil() { - if !v.CanSet() { - return false - } - v.Set(reflect.New(v.Type().Elem())) - } - case reflect.Map: - if v.IsNil() { - if !v.CanSet() { - return false - } - v.Set(reflect.MakeMap(v.Type())) - } - default: - return false - } - - doCustom.Call([]reflect.Value{v, reflect.ValueOf(Continue{ - fc: fc, - Rand: fc.fuzzer.r, - })}) - return true -} - -// Interface represents an object that knows how to fuzz itself. Any time we -// find a type that implements this interface we will delegate the act of -// fuzzing itself. -type Interface interface { - Fuzz(c Continue) -} - -// Continue can be passed to custom fuzzing functions to allow them to use -// the correct source of randomness and to continue fuzzing their members. -type Continue struct { - fc *fuzzerContext - - // For convenience, Continue implements rand.Rand via embedding. - // Use this for generating any randomness if you want your fuzzing - // to be repeatable for a given seed. - *rand.Rand -} - -// Fuzz continues fuzzing obj. obj must be a pointer. -func (c Continue) Fuzz(obj interface{}) { - v := reflect.ValueOf(obj) - if v.Kind() != reflect.Ptr { - panic("needed ptr!") - } - v = v.Elem() - c.fc.doFuzz(v, 0) -} - -// FuzzNoCustom continues fuzzing obj, except that any custom fuzz function for -// obj's type will not be called and obj will not be tested for fuzz.Interface -// conformance. This applies only to obj and not other instances of obj's -// type. -func (c Continue) FuzzNoCustom(obj interface{}) { - v := reflect.ValueOf(obj) - if v.Kind() != reflect.Ptr { - panic("needed ptr!") - } - v = v.Elem() - c.fc.doFuzz(v, flagNoCustomFuzz) -} - -// RandString makes a random string up to 20 characters long. The returned string -// may include a variety of (valid) UTF-8 encodings. -func (c Continue) RandString() string { - return randString(c.Rand) -} - -// RandUint64 makes random 64 bit numbers. -// Weirdly, rand doesn't have a function that gives you 64 random bits. -func (c Continue) RandUint64() uint64 { - return randUint64(c.Rand) -} - -// RandBool returns true or false randomly. -func (c Continue) RandBool() bool { - return randBool(c.Rand) -} - -func fuzzInt(v reflect.Value, r *rand.Rand) { - v.SetInt(int64(randUint64(r))) -} - -func fuzzUint(v reflect.Value, r *rand.Rand) { - v.SetUint(randUint64(r)) -} - -func fuzzTime(t *time.Time, c Continue) { - var sec, nsec int64 - // Allow for about 1000 years of random time values, which keeps things - // like JSON parsing reasonably happy. - sec = c.Rand.Int63n(1000 * 365 * 24 * 60 * 60) - c.Fuzz(&nsec) - *t = time.Unix(sec, nsec) -} - -var fillFuncMap = map[reflect.Kind]func(reflect.Value, *rand.Rand){ - reflect.Bool: func(v reflect.Value, r *rand.Rand) { - v.SetBool(randBool(r)) - }, - reflect.Int: fuzzInt, - reflect.Int8: fuzzInt, - reflect.Int16: fuzzInt, - reflect.Int32: fuzzInt, - reflect.Int64: fuzzInt, - reflect.Uint: fuzzUint, - reflect.Uint8: fuzzUint, - reflect.Uint16: fuzzUint, - reflect.Uint32: fuzzUint, - reflect.Uint64: fuzzUint, - reflect.Uintptr: fuzzUint, - reflect.Float32: func(v reflect.Value, r *rand.Rand) { - v.SetFloat(float64(r.Float32())) - }, - reflect.Float64: func(v reflect.Value, r *rand.Rand) { - v.SetFloat(r.Float64()) - }, - reflect.Complex64: func(v reflect.Value, r *rand.Rand) { - v.SetComplex(complex128(complex(r.Float32(), r.Float32()))) - }, - reflect.Complex128: func(v reflect.Value, r *rand.Rand) { - v.SetComplex(complex(r.Float64(), r.Float64())) - }, - reflect.String: func(v reflect.Value, r *rand.Rand) { - v.SetString(randString(r)) - }, - reflect.UnsafePointer: func(v reflect.Value, r *rand.Rand) { - panic("unimplemented") - }, -} - -// randBool returns true or false randomly. -func randBool(r *rand.Rand) bool { - return r.Int31()&(1<<30) == 0 -} - -type int63nPicker interface { - Int63n(int64) int64 -} - -// UnicodeRange describes a sequential range of unicode characters. -// Last must be numerically greater than First. -type UnicodeRange struct { - First, Last rune -} - -// UnicodeRanges describes an arbitrary number of sequential ranges of unicode characters. -// To be useful, each range must have at least one character (First <= Last) and -// there must be at least one range. -type UnicodeRanges []UnicodeRange - -// choose returns a random unicode character from the given range, using the -// given randomness source. -func (ur UnicodeRange) choose(r int63nPicker) rune { - count := int64(ur.Last - ur.First + 1) - return ur.First + rune(r.Int63n(count)) -} - -// CustomStringFuzzFunc constructs a FuzzFunc which produces random strings. -// Each character is selected from the range ur. If there are no characters -// in the range (cr.Last < cr.First), this will panic. -func (ur UnicodeRange) CustomStringFuzzFunc() func(s *string, c Continue) { - ur.check() - return func(s *string, c Continue) { - *s = ur.randString(c.Rand) - } -} - -// check is a function that used to check whether the first of ur(UnicodeRange) -// is greater than the last one. -func (ur UnicodeRange) check() { - if ur.Last < ur.First { - panic("The last encoding must be greater than the first one.") - } -} - -// randString of UnicodeRange makes a random string up to 20 characters long. -// Each character is selected form ur(UnicodeRange). -func (ur UnicodeRange) randString(r *rand.Rand) string { - n := r.Intn(20) - sb := strings.Builder{} - sb.Grow(n) - for i := 0; i < n; i++ { - sb.WriteRune(ur.choose(r)) - } - return sb.String() -} - -// defaultUnicodeRanges sets a default unicode range when user do not set -// CustomStringFuzzFunc() but wants fuzz string. -var defaultUnicodeRanges = UnicodeRanges{ - {' ', '~'}, // ASCII characters - {'\u00a0', '\u02af'}, // Multi-byte encoded characters - {'\u4e00', '\u9fff'}, // Common CJK (even longer encodings) -} - -// CustomStringFuzzFunc constructs a FuzzFunc which produces random strings. -// Each character is selected from one of the ranges of ur(UnicodeRanges). -// Each range has an equal probability of being chosen. If there are no ranges, -// or a selected range has no characters (.Last < .First), this will panic. -// Do not modify any of the ranges in ur after calling this function. -func (ur UnicodeRanges) CustomStringFuzzFunc() func(s *string, c Continue) { - // Check unicode ranges slice is empty. - if len(ur) == 0 { - panic("UnicodeRanges is empty.") - } - // if not empty, each range should be checked. - for i := range ur { - ur[i].check() - } - return func(s *string, c Continue) { - *s = ur.randString(c.Rand) - } -} - -// randString of UnicodeRanges makes a random string up to 20 characters long. -// Each character is selected form one of the ranges of ur(UnicodeRanges), -// and each range has an equal probability of being chosen. -func (ur UnicodeRanges) randString(r *rand.Rand) string { - n := r.Intn(20) - sb := strings.Builder{} - sb.Grow(n) - for i := 0; i < n; i++ { - sb.WriteRune(ur[r.Intn(len(ur))].choose(r)) - } - return sb.String() -} - -// randString makes a random string up to 20 characters long. The returned string -// may include a variety of (valid) UTF-8 encodings. -func randString(r *rand.Rand) string { - return defaultUnicodeRanges.randString(r) -} - -// randUint64 makes random 64 bit numbers. -// Weirdly, rand doesn't have a function that gives you 64 random bits. -func randUint64(r *rand.Rand) uint64 { - return uint64(r.Uint32())<<32 | uint64(r.Uint32()) -} diff --git a/vendor/github.com/google/uuid/.travis.yml b/vendor/github.com/google/uuid/.travis.yml deleted file mode 100644 index d8156a60b..000000000 --- a/vendor/github.com/google/uuid/.travis.yml +++ /dev/null @@ -1,9 +0,0 @@ -language: go - -go: - - 1.4.3 - - 1.5.3 - - tip - -script: - - go test -v ./... diff --git a/vendor/github.com/google/uuid/CONTRIBUTING.md b/vendor/github.com/google/uuid/CONTRIBUTING.md deleted file mode 100644 index 04fdf09f1..000000000 --- a/vendor/github.com/google/uuid/CONTRIBUTING.md +++ /dev/null @@ -1,10 +0,0 @@ -# How to contribute - -We definitely welcome patches and contribution to this project! - -### Legal requirements - -In order to protect both you and ourselves, you will need to sign the -[Contributor License Agreement](https://cla.developers.google.com/clas). - -You may have already signed it for other Google projects. diff --git a/vendor/github.com/google/uuid/CONTRIBUTORS b/vendor/github.com/google/uuid/CONTRIBUTORS deleted file mode 100644 index b4bb97f6b..000000000 --- a/vendor/github.com/google/uuid/CONTRIBUTORS +++ /dev/null @@ -1,9 +0,0 @@ -Paul Borman -bmatsuo -shawnps -theory -jboverfelt -dsymonds -cd1 -wallclockbuilder -dansouza diff --git a/vendor/github.com/google/uuid/LICENSE b/vendor/github.com/google/uuid/LICENSE deleted file mode 100644 index 5dc68268d..000000000 --- a/vendor/github.com/google/uuid/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2009,2014 Google Inc. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/google/uuid/README.md b/vendor/github.com/google/uuid/README.md deleted file mode 100644 index f765a46f9..000000000 --- a/vendor/github.com/google/uuid/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# uuid ![build status](https://travis-ci.org/google/uuid.svg?branch=master) -The uuid package generates and inspects UUIDs based on -[RFC 4122](http://tools.ietf.org/html/rfc4122) -and DCE 1.1: Authentication and Security Services. - -This package is based on the github.com/pborman/uuid package (previously named -code.google.com/p/go-uuid). It differs from these earlier packages in that -a UUID is a 16 byte array rather than a byte slice. One loss due to this -change is the ability to represent an invalid UUID (vs a NIL UUID). - -###### Install -`go get github.com/google/uuid` - -###### Documentation -[![GoDoc](https://godoc.org/github.com/google/uuid?status.svg)](http://godoc.org/github.com/google/uuid) - -Full `go doc` style documentation for the package can be viewed online without -installing this package by using the GoDoc site here: -http://pkg.go.dev/github.com/google/uuid diff --git a/vendor/github.com/google/uuid/dce.go b/vendor/github.com/google/uuid/dce.go deleted file mode 100644 index fa820b9d3..000000000 --- a/vendor/github.com/google/uuid/dce.go +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2016 Google Inc. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package uuid - -import ( - "encoding/binary" - "fmt" - "os" -) - -// A Domain represents a Version 2 domain -type Domain byte - -// Domain constants for DCE Security (Version 2) UUIDs. -const ( - Person = Domain(0) - Group = Domain(1) - Org = Domain(2) -) - -// NewDCESecurity returns a DCE Security (Version 2) UUID. -// -// The domain should be one of Person, Group or Org. -// On a POSIX system the id should be the users UID for the Person -// domain and the users GID for the Group. The meaning of id for -// the domain Org or on non-POSIX systems is site defined. -// -// For a given domain/id pair the same token may be returned for up to -// 7 minutes and 10 seconds. -func NewDCESecurity(domain Domain, id uint32) (UUID, error) { - uuid, err := NewUUID() - if err == nil { - uuid[6] = (uuid[6] & 0x0f) | 0x20 // Version 2 - uuid[9] = byte(domain) - binary.BigEndian.PutUint32(uuid[0:], id) - } - return uuid, err -} - -// NewDCEPerson returns a DCE Security (Version 2) UUID in the person -// domain with the id returned by os.Getuid. -// -// NewDCESecurity(Person, uint32(os.Getuid())) -func NewDCEPerson() (UUID, error) { - return NewDCESecurity(Person, uint32(os.Getuid())) -} - -// NewDCEGroup returns a DCE Security (Version 2) UUID in the group -// domain with the id returned by os.Getgid. -// -// NewDCESecurity(Group, uint32(os.Getgid())) -func NewDCEGroup() (UUID, error) { - return NewDCESecurity(Group, uint32(os.Getgid())) -} - -// Domain returns the domain for a Version 2 UUID. Domains are only defined -// for Version 2 UUIDs. -func (uuid UUID) Domain() Domain { - return Domain(uuid[9]) -} - -// ID returns the id for a Version 2 UUID. IDs are only defined for Version 2 -// UUIDs. -func (uuid UUID) ID() uint32 { - return binary.BigEndian.Uint32(uuid[0:4]) -} - -func (d Domain) String() string { - switch d { - case Person: - return "Person" - case Group: - return "Group" - case Org: - return "Org" - } - return fmt.Sprintf("Domain%d", int(d)) -} diff --git a/vendor/github.com/google/uuid/doc.go b/vendor/github.com/google/uuid/doc.go deleted file mode 100644 index 5b8a4b9af..000000000 --- a/vendor/github.com/google/uuid/doc.go +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright 2016 Google Inc. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package uuid generates and inspects UUIDs. -// -// UUIDs are based on RFC 4122 and DCE 1.1: Authentication and Security -// Services. -// -// A UUID is a 16 byte (128 bit) array. UUIDs may be used as keys to -// maps or compared directly. -package uuid diff --git a/vendor/github.com/google/uuid/hash.go b/vendor/github.com/google/uuid/hash.go deleted file mode 100644 index b17461631..000000000 --- a/vendor/github.com/google/uuid/hash.go +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2016 Google Inc. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package uuid - -import ( - "crypto/md5" - "crypto/sha1" - "hash" -) - -// Well known namespace IDs and UUIDs -var ( - NameSpaceDNS = Must(Parse("6ba7b810-9dad-11d1-80b4-00c04fd430c8")) - NameSpaceURL = Must(Parse("6ba7b811-9dad-11d1-80b4-00c04fd430c8")) - NameSpaceOID = Must(Parse("6ba7b812-9dad-11d1-80b4-00c04fd430c8")) - NameSpaceX500 = Must(Parse("6ba7b814-9dad-11d1-80b4-00c04fd430c8")) - Nil UUID // empty UUID, all zeros -) - -// NewHash returns a new UUID derived from the hash of space concatenated with -// data generated by h. The hash should be at least 16 byte in length. The -// first 16 bytes of the hash are used to form the UUID. The version of the -// UUID will be the lower 4 bits of version. NewHash is used to implement -// NewMD5 and NewSHA1. -func NewHash(h hash.Hash, space UUID, data []byte, version int) UUID { - h.Reset() - h.Write(space[:]) - h.Write(data) - s := h.Sum(nil) - var uuid UUID - copy(uuid[:], s) - uuid[6] = (uuid[6] & 0x0f) | uint8((version&0xf)<<4) - uuid[8] = (uuid[8] & 0x3f) | 0x80 // RFC 4122 variant - return uuid -} - -// NewMD5 returns a new MD5 (Version 3) UUID based on the -// supplied name space and data. It is the same as calling: -// -// NewHash(md5.New(), space, data, 3) -func NewMD5(space UUID, data []byte) UUID { - return NewHash(md5.New(), space, data, 3) -} - -// NewSHA1 returns a new SHA1 (Version 5) UUID based on the -// supplied name space and data. It is the same as calling: -// -// NewHash(sha1.New(), space, data, 5) -func NewSHA1(space UUID, data []byte) UUID { - return NewHash(sha1.New(), space, data, 5) -} diff --git a/vendor/github.com/google/uuid/marshal.go b/vendor/github.com/google/uuid/marshal.go deleted file mode 100644 index 14bd34072..000000000 --- a/vendor/github.com/google/uuid/marshal.go +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2016 Google Inc. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package uuid - -import "fmt" - -// MarshalText implements encoding.TextMarshaler. -func (uuid UUID) MarshalText() ([]byte, error) { - var js [36]byte - encodeHex(js[:], uuid) - return js[:], nil -} - -// UnmarshalText implements encoding.TextUnmarshaler. -func (uuid *UUID) UnmarshalText(data []byte) error { - id, err := ParseBytes(data) - if err != nil { - return err - } - *uuid = id - return nil -} - -// MarshalBinary implements encoding.BinaryMarshaler. -func (uuid UUID) MarshalBinary() ([]byte, error) { - return uuid[:], nil -} - -// UnmarshalBinary implements encoding.BinaryUnmarshaler. -func (uuid *UUID) UnmarshalBinary(data []byte) error { - if len(data) != 16 { - return fmt.Errorf("invalid UUID (got %d bytes)", len(data)) - } - copy(uuid[:], data) - return nil -} diff --git a/vendor/github.com/google/uuid/node.go b/vendor/github.com/google/uuid/node.go deleted file mode 100644 index d651a2b06..000000000 --- a/vendor/github.com/google/uuid/node.go +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright 2016 Google Inc. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package uuid - -import ( - "sync" -) - -var ( - nodeMu sync.Mutex - ifname string // name of interface being used - nodeID [6]byte // hardware for version 1 UUIDs - zeroID [6]byte // nodeID with only 0's -) - -// NodeInterface returns the name of the interface from which the NodeID was -// derived. The interface "user" is returned if the NodeID was set by -// SetNodeID. -func NodeInterface() string { - defer nodeMu.Unlock() - nodeMu.Lock() - return ifname -} - -// SetNodeInterface selects the hardware address to be used for Version 1 UUIDs. -// If name is "" then the first usable interface found will be used or a random -// Node ID will be generated. If a named interface cannot be found then false -// is returned. -// -// SetNodeInterface never fails when name is "". -func SetNodeInterface(name string) bool { - defer nodeMu.Unlock() - nodeMu.Lock() - return setNodeInterface(name) -} - -func setNodeInterface(name string) bool { - iname, addr := getHardwareInterface(name) // null implementation for js - if iname != "" && addr != nil { - ifname = iname - copy(nodeID[:], addr) - return true - } - - // We found no interfaces with a valid hardware address. If name - // does not specify a specific interface generate a random Node ID - // (section 4.1.6) - if name == "" { - ifname = "random" - randomBits(nodeID[:]) - return true - } - return false -} - -// NodeID returns a slice of a copy of the current Node ID, setting the Node ID -// if not already set. -func NodeID() []byte { - defer nodeMu.Unlock() - nodeMu.Lock() - if nodeID == zeroID { - setNodeInterface("") - } - nid := nodeID - return nid[:] -} - -// SetNodeID sets the Node ID to be used for Version 1 UUIDs. The first 6 bytes -// of id are used. If id is less than 6 bytes then false is returned and the -// Node ID is not set. -func SetNodeID(id []byte) bool { - if len(id) < 6 { - return false - } - defer nodeMu.Unlock() - nodeMu.Lock() - copy(nodeID[:], id) - ifname = "user" - return true -} - -// NodeID returns the 6 byte node id encoded in uuid. It returns nil if uuid is -// not valid. The NodeID is only well defined for version 1 and 2 UUIDs. -func (uuid UUID) NodeID() []byte { - var node [6]byte - copy(node[:], uuid[10:]) - return node[:] -} diff --git a/vendor/github.com/google/uuid/node_js.go b/vendor/github.com/google/uuid/node_js.go deleted file mode 100644 index 24b78edc9..000000000 --- a/vendor/github.com/google/uuid/node_js.go +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright 2017 Google Inc. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build js - -package uuid - -// getHardwareInterface returns nil values for the JS version of the code. -// This remvoves the "net" dependency, because it is not used in the browser. -// Using the "net" library inflates the size of the transpiled JS code by 673k bytes. -func getHardwareInterface(name string) (string, []byte) { return "", nil } diff --git a/vendor/github.com/google/uuid/node_net.go b/vendor/github.com/google/uuid/node_net.go deleted file mode 100644 index 0cbbcddbd..000000000 --- a/vendor/github.com/google/uuid/node_net.go +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2017 Google Inc. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !js - -package uuid - -import "net" - -var interfaces []net.Interface // cached list of interfaces - -// getHardwareInterface returns the name and hardware address of interface name. -// If name is "" then the name and hardware address of one of the system's -// interfaces is returned. If no interfaces are found (name does not exist or -// there are no interfaces) then "", nil is returned. -// -// Only addresses of at least 6 bytes are returned. -func getHardwareInterface(name string) (string, []byte) { - if interfaces == nil { - var err error - interfaces, err = net.Interfaces() - if err != nil { - return "", nil - } - } - for _, ifs := range interfaces { - if len(ifs.HardwareAddr) >= 6 && (name == "" || name == ifs.Name) { - return ifs.Name, ifs.HardwareAddr - } - } - return "", nil -} diff --git a/vendor/github.com/google/uuid/sql.go b/vendor/github.com/google/uuid/sql.go deleted file mode 100644 index f326b54db..000000000 --- a/vendor/github.com/google/uuid/sql.go +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2016 Google Inc. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package uuid - -import ( - "database/sql/driver" - "fmt" -) - -// Scan implements sql.Scanner so UUIDs can be read from databases transparently -// Currently, database types that map to string and []byte are supported. Please -// consult database-specific driver documentation for matching types. -func (uuid *UUID) Scan(src interface{}) error { - switch src := src.(type) { - case nil: - return nil - - case string: - // if an empty UUID comes from a table, we return a null UUID - if src == "" { - return nil - } - - // see Parse for required string format - u, err := Parse(src) - if err != nil { - return fmt.Errorf("Scan: %v", err) - } - - *uuid = u - - case []byte: - // if an empty UUID comes from a table, we return a null UUID - if len(src) == 0 { - return nil - } - - // assumes a simple slice of bytes if 16 bytes - // otherwise attempts to parse - if len(src) != 16 { - return uuid.Scan(string(src)) - } - copy((*uuid)[:], src) - - default: - return fmt.Errorf("Scan: unable to scan type %T into UUID", src) - } - - return nil -} - -// Value implements sql.Valuer so that UUIDs can be written to databases -// transparently. Currently, UUIDs map to strings. Please consult -// database-specific driver documentation for matching types. -func (uuid UUID) Value() (driver.Value, error) { - return uuid.String(), nil -} diff --git a/vendor/github.com/google/uuid/time.go b/vendor/github.com/google/uuid/time.go deleted file mode 100644 index e6ef06cdc..000000000 --- a/vendor/github.com/google/uuid/time.go +++ /dev/null @@ -1,123 +0,0 @@ -// Copyright 2016 Google Inc. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package uuid - -import ( - "encoding/binary" - "sync" - "time" -) - -// A Time represents a time as the number of 100's of nanoseconds since 15 Oct -// 1582. -type Time int64 - -const ( - lillian = 2299160 // Julian day of 15 Oct 1582 - unix = 2440587 // Julian day of 1 Jan 1970 - epoch = unix - lillian // Days between epochs - g1582 = epoch * 86400 // seconds between epochs - g1582ns100 = g1582 * 10000000 // 100s of a nanoseconds between epochs -) - -var ( - timeMu sync.Mutex - lasttime uint64 // last time we returned - clockSeq uint16 // clock sequence for this run - - timeNow = time.Now // for testing -) - -// UnixTime converts t the number of seconds and nanoseconds using the Unix -// epoch of 1 Jan 1970. -func (t Time) UnixTime() (sec, nsec int64) { - sec = int64(t - g1582ns100) - nsec = (sec % 10000000) * 100 - sec /= 10000000 - return sec, nsec -} - -// GetTime returns the current Time (100s of nanoseconds since 15 Oct 1582) and -// clock sequence as well as adjusting the clock sequence as needed. An error -// is returned if the current time cannot be determined. -func GetTime() (Time, uint16, error) { - defer timeMu.Unlock() - timeMu.Lock() - return getTime() -} - -func getTime() (Time, uint16, error) { - t := timeNow() - - // If we don't have a clock sequence already, set one. - if clockSeq == 0 { - setClockSequence(-1) - } - now := uint64(t.UnixNano()/100) + g1582ns100 - - // If time has gone backwards with this clock sequence then we - // increment the clock sequence - if now <= lasttime { - clockSeq = ((clockSeq + 1) & 0x3fff) | 0x8000 - } - lasttime = now - return Time(now), clockSeq, nil -} - -// ClockSequence returns the current clock sequence, generating one if not -// already set. The clock sequence is only used for Version 1 UUIDs. -// -// The uuid package does not use global static storage for the clock sequence or -// the last time a UUID was generated. Unless SetClockSequence is used, a new -// random clock sequence is generated the first time a clock sequence is -// requested by ClockSequence, GetTime, or NewUUID. (section 4.2.1.1) -func ClockSequence() int { - defer timeMu.Unlock() - timeMu.Lock() - return clockSequence() -} - -func clockSequence() int { - if clockSeq == 0 { - setClockSequence(-1) - } - return int(clockSeq & 0x3fff) -} - -// SetClockSequence sets the clock sequence to the lower 14 bits of seq. Setting to -// -1 causes a new sequence to be generated. -func SetClockSequence(seq int) { - defer timeMu.Unlock() - timeMu.Lock() - setClockSequence(seq) -} - -func setClockSequence(seq int) { - if seq == -1 { - var b [2]byte - randomBits(b[:]) // clock sequence - seq = int(b[0])<<8 | int(b[1]) - } - oldSeq := clockSeq - clockSeq = uint16(seq&0x3fff) | 0x8000 // Set our variant - if oldSeq != clockSeq { - lasttime = 0 - } -} - -// Time returns the time in 100s of nanoseconds since 15 Oct 1582 encoded in -// uuid. The time is only defined for version 1 and 2 UUIDs. -func (uuid UUID) Time() Time { - time := int64(binary.BigEndian.Uint32(uuid[0:4])) - time |= int64(binary.BigEndian.Uint16(uuid[4:6])) << 32 - time |= int64(binary.BigEndian.Uint16(uuid[6:8])&0xfff) << 48 - return Time(time) -} - -// ClockSequence returns the clock sequence encoded in uuid. -// The clock sequence is only well defined for version 1 and 2 UUIDs. -func (uuid UUID) ClockSequence() int { - return int(binary.BigEndian.Uint16(uuid[8:10])) & 0x3fff -} diff --git a/vendor/github.com/google/uuid/util.go b/vendor/github.com/google/uuid/util.go deleted file mode 100644 index 5ea6c7378..000000000 --- a/vendor/github.com/google/uuid/util.go +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2016 Google Inc. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package uuid - -import ( - "io" -) - -// randomBits completely fills slice b with random data. -func randomBits(b []byte) { - if _, err := io.ReadFull(rander, b); err != nil { - panic(err.Error()) // rand should never fail - } -} - -// xvalues returns the value of a byte as a hexadecimal digit or 255. -var xvalues = [256]byte{ - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 255, 255, 255, 255, 255, 255, - 255, 10, 11, 12, 13, 14, 15, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 10, 11, 12, 13, 14, 15, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, -} - -// xtob converts hex characters x1 and x2 into a byte. -func xtob(x1, x2 byte) (byte, bool) { - b1 := xvalues[x1] - b2 := xvalues[x2] - return (b1 << 4) | b2, b1 != 255 && b2 != 255 -} diff --git a/vendor/github.com/google/uuid/uuid.go b/vendor/github.com/google/uuid/uuid.go deleted file mode 100644 index 524404cc5..000000000 --- a/vendor/github.com/google/uuid/uuid.go +++ /dev/null @@ -1,245 +0,0 @@ -// Copyright 2018 Google Inc. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package uuid - -import ( - "bytes" - "crypto/rand" - "encoding/hex" - "errors" - "fmt" - "io" - "strings" -) - -// A UUID is a 128 bit (16 byte) Universal Unique IDentifier as defined in RFC -// 4122. -type UUID [16]byte - -// A Version represents a UUID's version. -type Version byte - -// A Variant represents a UUID's variant. -type Variant byte - -// Constants returned by Variant. -const ( - Invalid = Variant(iota) // Invalid UUID - RFC4122 // The variant specified in RFC4122 - Reserved // Reserved, NCS backward compatibility. - Microsoft // Reserved, Microsoft Corporation backward compatibility. - Future // Reserved for future definition. -) - -var rander = rand.Reader // random function - -// Parse decodes s into a UUID or returns an error. Both the standard UUID -// forms of xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx and -// urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx are decoded as well as the -// Microsoft encoding {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} and the raw hex -// encoding: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx. -func Parse(s string) (UUID, error) { - var uuid UUID - switch len(s) { - // xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - case 36: - - // urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - case 36 + 9: - if strings.ToLower(s[:9]) != "urn:uuid:" { - return uuid, fmt.Errorf("invalid urn prefix: %q", s[:9]) - } - s = s[9:] - - // {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} - case 36 + 2: - s = s[1:] - - // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - case 32: - var ok bool - for i := range uuid { - uuid[i], ok = xtob(s[i*2], s[i*2+1]) - if !ok { - return uuid, errors.New("invalid UUID format") - } - } - return uuid, nil - default: - return uuid, fmt.Errorf("invalid UUID length: %d", len(s)) - } - // s is now at least 36 bytes long - // it must be of the form xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - if s[8] != '-' || s[13] != '-' || s[18] != '-' || s[23] != '-' { - return uuid, errors.New("invalid UUID format") - } - for i, x := range [16]int{ - 0, 2, 4, 6, - 9, 11, - 14, 16, - 19, 21, - 24, 26, 28, 30, 32, 34} { - v, ok := xtob(s[x], s[x+1]) - if !ok { - return uuid, errors.New("invalid UUID format") - } - uuid[i] = v - } - return uuid, nil -} - -// ParseBytes is like Parse, except it parses a byte slice instead of a string. -func ParseBytes(b []byte) (UUID, error) { - var uuid UUID - switch len(b) { - case 36: // xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - case 36 + 9: // urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - if !bytes.Equal(bytes.ToLower(b[:9]), []byte("urn:uuid:")) { - return uuid, fmt.Errorf("invalid urn prefix: %q", b[:9]) - } - b = b[9:] - case 36 + 2: // {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} - b = b[1:] - case 32: // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - var ok bool - for i := 0; i < 32; i += 2 { - uuid[i/2], ok = xtob(b[i], b[i+1]) - if !ok { - return uuid, errors.New("invalid UUID format") - } - } - return uuid, nil - default: - return uuid, fmt.Errorf("invalid UUID length: %d", len(b)) - } - // s is now at least 36 bytes long - // it must be of the form xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - if b[8] != '-' || b[13] != '-' || b[18] != '-' || b[23] != '-' { - return uuid, errors.New("invalid UUID format") - } - for i, x := range [16]int{ - 0, 2, 4, 6, - 9, 11, - 14, 16, - 19, 21, - 24, 26, 28, 30, 32, 34} { - v, ok := xtob(b[x], b[x+1]) - if !ok { - return uuid, errors.New("invalid UUID format") - } - uuid[i] = v - } - return uuid, nil -} - -// MustParse is like Parse but panics if the string cannot be parsed. -// It simplifies safe initialization of global variables holding compiled UUIDs. -func MustParse(s string) UUID { - uuid, err := Parse(s) - if err != nil { - panic(`uuid: Parse(` + s + `): ` + err.Error()) - } - return uuid -} - -// FromBytes creates a new UUID from a byte slice. Returns an error if the slice -// does not have a length of 16. The bytes are copied from the slice. -func FromBytes(b []byte) (uuid UUID, err error) { - err = uuid.UnmarshalBinary(b) - return uuid, err -} - -// Must returns uuid if err is nil and panics otherwise. -func Must(uuid UUID, err error) UUID { - if err != nil { - panic(err) - } - return uuid -} - -// String returns the string form of uuid, xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -// , or "" if uuid is invalid. -func (uuid UUID) String() string { - var buf [36]byte - encodeHex(buf[:], uuid) - return string(buf[:]) -} - -// URN returns the RFC 2141 URN form of uuid, -// urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, or "" if uuid is invalid. -func (uuid UUID) URN() string { - var buf [36 + 9]byte - copy(buf[:], "urn:uuid:") - encodeHex(buf[9:], uuid) - return string(buf[:]) -} - -func encodeHex(dst []byte, uuid UUID) { - hex.Encode(dst, uuid[:4]) - dst[8] = '-' - hex.Encode(dst[9:13], uuid[4:6]) - dst[13] = '-' - hex.Encode(dst[14:18], uuid[6:8]) - dst[18] = '-' - hex.Encode(dst[19:23], uuid[8:10]) - dst[23] = '-' - hex.Encode(dst[24:], uuid[10:]) -} - -// Variant returns the variant encoded in uuid. -func (uuid UUID) Variant() Variant { - switch { - case (uuid[8] & 0xc0) == 0x80: - return RFC4122 - case (uuid[8] & 0xe0) == 0xc0: - return Microsoft - case (uuid[8] & 0xe0) == 0xe0: - return Future - default: - return Reserved - } -} - -// Version returns the version of uuid. -func (uuid UUID) Version() Version { - return Version(uuid[6] >> 4) -} - -func (v Version) String() string { - if v > 15 { - return fmt.Sprintf("BAD_VERSION_%d", v) - } - return fmt.Sprintf("VERSION_%d", v) -} - -func (v Variant) String() string { - switch v { - case RFC4122: - return "RFC4122" - case Reserved: - return "Reserved" - case Microsoft: - return "Microsoft" - case Future: - return "Future" - case Invalid: - return "Invalid" - } - return fmt.Sprintf("BadVariant%d", int(v)) -} - -// SetRand sets the random number generator to r, which implements io.Reader. -// If r.Read returns an error when the package requests random data then -// a panic will be issued. -// -// Calling SetRand with nil sets the random number generator to the default -// generator. -func SetRand(r io.Reader) { - if r == nil { - rander = rand.Reader - return - } - rander = r -} diff --git a/vendor/github.com/google/uuid/version1.go b/vendor/github.com/google/uuid/version1.go deleted file mode 100644 index 463109629..000000000 --- a/vendor/github.com/google/uuid/version1.go +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2016 Google Inc. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package uuid - -import ( - "encoding/binary" -) - -// NewUUID returns a Version 1 UUID based on the current NodeID and clock -// sequence, and the current time. If the NodeID has not been set by SetNodeID -// or SetNodeInterface then it will be set automatically. If the NodeID cannot -// be set NewUUID returns nil. If clock sequence has not been set by -// SetClockSequence then it will be set automatically. If GetTime fails to -// return the current NewUUID returns nil and an error. -// -// In most cases, New should be used. -func NewUUID() (UUID, error) { - var uuid UUID - now, seq, err := GetTime() - if err != nil { - return uuid, err - } - - timeLow := uint32(now & 0xffffffff) - timeMid := uint16((now >> 32) & 0xffff) - timeHi := uint16((now >> 48) & 0x0fff) - timeHi |= 0x1000 // Version 1 - - binary.BigEndian.PutUint32(uuid[0:], timeLow) - binary.BigEndian.PutUint16(uuid[4:], timeMid) - binary.BigEndian.PutUint16(uuid[6:], timeHi) - binary.BigEndian.PutUint16(uuid[8:], seq) - - nodeMu.Lock() - if nodeID == zeroID { - setNodeInterface("") - } - copy(uuid[10:], nodeID[:]) - nodeMu.Unlock() - - return uuid, nil -} diff --git a/vendor/github.com/google/uuid/version4.go b/vendor/github.com/google/uuid/version4.go deleted file mode 100644 index c110465db..000000000 --- a/vendor/github.com/google/uuid/version4.go +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2016 Google Inc. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package uuid - -import "io" - -// New creates a new random UUID or panics. New is equivalent to -// the expression -// -// uuid.Must(uuid.NewRandom()) -func New() UUID { - return Must(NewRandom()) -} - -// NewRandom returns a Random (Version 4) UUID. -// -// The strength of the UUIDs is based on the strength of the crypto/rand -// package. -// -// A note about uniqueness derived from the UUID Wikipedia entry: -// -// Randomly generated UUIDs have 122 random bits. One's annual risk of being -// hit by a meteorite is estimated to be one chance in 17 billion, that -// means the probability is about 0.00000000006 (6 × 10−11), -// equivalent to the odds of creating a few tens of trillions of UUIDs in a -// year and having one duplicate. -func NewRandom() (UUID, error) { - return NewRandomFromReader(rander) -} - -// NewRandomFromReader returns a UUID based on bytes read from a given io.Reader. -func NewRandomFromReader(r io.Reader) (UUID, error) { - var uuid UUID - _, err := io.ReadFull(r, uuid[:]) - if err != nil { - return Nil, err - } - uuid[6] = (uuid[6] & 0x0f) | 0x40 // Version 4 - uuid[8] = (uuid[8] & 0x3f) | 0x80 // Variant is 10 - return uuid, nil -} diff --git a/vendor/github.com/huandu/xstrings/.gitignore b/vendor/github.com/huandu/xstrings/.gitignore deleted file mode 100644 index daf913b1b..000000000 --- a/vendor/github.com/huandu/xstrings/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -# Compiled Object files, Static and Dynamic libs (Shared Objects) -*.o -*.a -*.so - -# Folders -_obj -_test - -# Architecture specific extensions/prefixes -*.[568vq] -[568vq].out - -*.cgo1.go -*.cgo2.c -_cgo_defun.c -_cgo_gotypes.go -_cgo_export.* - -_testmain.go - -*.exe -*.test -*.prof diff --git a/vendor/github.com/huandu/xstrings/.travis.yml b/vendor/github.com/huandu/xstrings/.travis.yml deleted file mode 100644 index d6460be41..000000000 --- a/vendor/github.com/huandu/xstrings/.travis.yml +++ /dev/null @@ -1,7 +0,0 @@ -language: go -install: - - go get golang.org/x/tools/cmd/cover - - go get github.com/mattn/goveralls -script: - - go test -v -covermode=count -coverprofile=coverage.out - - 'if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ ! -z "$COVERALLS_TOKEN" ]; then $HOME/gopath/bin/goveralls -coverprofile=coverage.out -service=travis-ci -repotoken $COVERALLS_TOKEN; fi' diff --git a/vendor/github.com/huandu/xstrings/CONTRIBUTING.md b/vendor/github.com/huandu/xstrings/CONTRIBUTING.md deleted file mode 100644 index d7b4b8d58..000000000 --- a/vendor/github.com/huandu/xstrings/CONTRIBUTING.md +++ /dev/null @@ -1,23 +0,0 @@ -# Contributing # - -Thanks for your contribution in advance. No matter what you will contribute to this project, pull request or bug report or feature discussion, it's always highly appreciated. - -## New API or feature ## - -I want to speak more about how to add new functions to this package. - -Package `xstring` is a collection of useful string functions which should be implemented in Go. It's a bit subject to say which function should be included and which should not. I set up following rules in order to make it clear and as objective as possible. - -* Rule 1: Only string algorithm, which takes string as input, can be included. -* Rule 2: If a function has been implemented in package `string`, it must not be included. -* Rule 3: If a function is not language neutral, it must not be included. -* Rule 4: If a function is a part of standard library in other languages, it can be included. -* Rule 5: If a function is quite useful in some famous framework or library, it can be included. - -New function must be discussed in project issues before submitting any code. If a pull request with new functions is sent without any ref issue, it will be rejected. - -## Pull request ## - -Pull request is always welcome. Just make sure you have run `go fmt` and all test cases passed before submit. - -If the pull request is to add a new API or feature, don't forget to update README.md and add new API in function list. diff --git a/vendor/github.com/huandu/xstrings/LICENSE b/vendor/github.com/huandu/xstrings/LICENSE deleted file mode 100644 index 270177259..000000000 --- a/vendor/github.com/huandu/xstrings/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Huan Du - -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/vendor/github.com/huandu/xstrings/README.md b/vendor/github.com/huandu/xstrings/README.md deleted file mode 100644 index 292bf2f39..000000000 --- a/vendor/github.com/huandu/xstrings/README.md +++ /dev/null @@ -1,117 +0,0 @@ -# xstrings # - -[![Build Status](https://travis-ci.org/huandu/xstrings.svg?branch=master)](https://travis-ci.org/huandu/xstrings) -[![GoDoc](https://godoc.org/github.com/huandu/xstrings?status.svg)](https://godoc.org/github.com/huandu/xstrings) -[![Go Report](https://goreportcard.com/badge/github.com/huandu/xstrings)](https://goreportcard.com/report/github.com/huandu/xstrings) -[![Coverage Status](https://coveralls.io/repos/github/huandu/xstrings/badge.svg?branch=master)](https://coveralls.io/github/huandu/xstrings?branch=master) - -Go package [xstrings](https://godoc.org/github.com/huandu/xstrings) is a collection of string functions, which are widely used in other languages but absent in Go package [strings](http://golang.org/pkg/strings). - -All functions are well tested and carefully tuned for performance. - -## Propose a new function ## - -Please review [contributing guideline](CONTRIBUTING.md) and [create new issue](https://github.com/huandu/xstrings/issues) to state why it should be included. - -## Install ## - -Use `go get` to install this library. - - go get github.com/huandu/xstrings - -## API document ## - -See [GoDoc](https://godoc.org/github.com/huandu/xstrings) for full document. - -## Function list ## - -Go functions have a unique naming style. One, who has experience in other language but new in Go, may have difficulties to find out right string function to use. - -Here is a list of functions in [strings](http://golang.org/pkg/strings) and [xstrings](https://godoc.org/github.com/huandu/xstrings) with enough extra information about how to map these functions to their friends in other languages. Hope this list could be helpful for fresh gophers. - -### Package `xstrings` functions ### - -*Keep this table sorted by Function in ascending order.* - -| Function | Friends | # | -| -------- | ------- | --- | -| [Center](https://godoc.org/github.com/huandu/xstrings#Center) | `str.center` in Python; `String#center` in Ruby | [#30](https://github.com/huandu/xstrings/issues/30) | -| [Count](https://godoc.org/github.com/huandu/xstrings#Count) | `String#count` in Ruby | [#16](https://github.com/huandu/xstrings/issues/16) | -| [Delete](https://godoc.org/github.com/huandu/xstrings#Delete) | `String#delete` in Ruby | [#17](https://github.com/huandu/xstrings/issues/17) | -| [ExpandTabs](https://godoc.org/github.com/huandu/xstrings#ExpandTabs) | `str.expandtabs` in Python | [#27](https://github.com/huandu/xstrings/issues/27) | -| [FirstRuneToLower](https://godoc.org/github.com/huandu/xstrings#FirstRuneToLower) | `lcfirst` in PHP or Perl | [#15](https://github.com/huandu/xstrings/issues/15) | -| [FirstRuneToUpper](https://godoc.org/github.com/huandu/xstrings#FirstRuneToUpper) | `String#capitalize` in Ruby; `ucfirst` in PHP or Perl | [#15](https://github.com/huandu/xstrings/issues/15) | -| [Insert](https://godoc.org/github.com/huandu/xstrings#Insert) | `String#insert` in Ruby | [#18](https://github.com/huandu/xstrings/issues/18) | -| [LastPartition](https://godoc.org/github.com/huandu/xstrings#LastPartition) | `str.rpartition` in Python; `String#rpartition` in Ruby | [#19](https://github.com/huandu/xstrings/issues/19) | -| [LeftJustify](https://godoc.org/github.com/huandu/xstrings#LeftJustify) | `str.ljust` in Python; `String#ljust` in Ruby | [#28](https://github.com/huandu/xstrings/issues/28) | -| [Len](https://godoc.org/github.com/huandu/xstrings#Len) | `mb_strlen` in PHP | [#23](https://github.com/huandu/xstrings/issues/23) | -| [Partition](https://godoc.org/github.com/huandu/xstrings#Partition) | `str.partition` in Python; `String#partition` in Ruby | [#10](https://github.com/huandu/xstrings/issues/10) | -| [Reverse](https://godoc.org/github.com/huandu/xstrings#Reverse) | `String#reverse` in Ruby; `strrev` in PHP; `reverse` in Perl | [#7](https://github.com/huandu/xstrings/issues/7) | -| [RightJustify](https://godoc.org/github.com/huandu/xstrings#RightJustify) | `str.rjust` in Python; `String#rjust` in Ruby | [#29](https://github.com/huandu/xstrings/issues/29) | -| [RuneWidth](https://godoc.org/github.com/huandu/xstrings#RuneWidth) | - | [#27](https://github.com/huandu/xstrings/issues/27) | -| [Scrub](https://godoc.org/github.com/huandu/xstrings#Scrub) | `String#scrub` in Ruby | [#20](https://github.com/huandu/xstrings/issues/20) | -| [Shuffle](https://godoc.org/github.com/huandu/xstrings#Shuffle) | `str_shuffle` in PHP | [#13](https://github.com/huandu/xstrings/issues/13) | -| [ShuffleSource](https://godoc.org/github.com/huandu/xstrings#ShuffleSource) | `str_shuffle` in PHP | [#13](https://github.com/huandu/xstrings/issues/13) | -| [Slice](https://godoc.org/github.com/huandu/xstrings#Slice) | `mb_substr` in PHP | [#9](https://github.com/huandu/xstrings/issues/9) | -| [Squeeze](https://godoc.org/github.com/huandu/xstrings#Squeeze) | `String#squeeze` in Ruby | [#11](https://github.com/huandu/xstrings/issues/11) | -| [Successor](https://godoc.org/github.com/huandu/xstrings#Successor) | `String#succ` or `String#next` in Ruby | [#22](https://github.com/huandu/xstrings/issues/22) | -| [SwapCase](https://godoc.org/github.com/huandu/xstrings#SwapCase) | `str.swapcase` in Python; `String#swapcase` in Ruby | [#12](https://github.com/huandu/xstrings/issues/12) | -| [ToCamelCase](https://godoc.org/github.com/huandu/xstrings#ToCamelCase) | `String#camelize` in RoR | [#1](https://github.com/huandu/xstrings/issues/1) | -| [ToKebab](https://godoc.org/github.com/huandu/xstrings#ToKebabCase) | - | [#41](https://github.com/huandu/xstrings/issues/41) | -| [ToSnakeCase](https://godoc.org/github.com/huandu/xstrings#ToSnakeCase) | `String#underscore` in RoR | [#1](https://github.com/huandu/xstrings/issues/1) | -| [Translate](https://godoc.org/github.com/huandu/xstrings#Translate) | `str.translate` in Python; `String#tr` in Ruby; `strtr` in PHP; `tr///` in Perl | [#21](https://github.com/huandu/xstrings/issues/21) | -| [Width](https://godoc.org/github.com/huandu/xstrings#Width) | `mb_strwidth` in PHP | [#26](https://github.com/huandu/xstrings/issues/26) | -| [WordCount](https://godoc.org/github.com/huandu/xstrings#WordCount) | `str_word_count` in PHP | [#14](https://github.com/huandu/xstrings/issues/14) | -| [WordSplit](https://godoc.org/github.com/huandu/xstrings#WordSplit) | - | [#14](https://github.com/huandu/xstrings/issues/14) | - -### Package `strings` functions ### - -*Keep this table sorted by Function in ascending order.* - -| Function | Friends | -| -------- | ------- | -| [Contains](http://golang.org/pkg/strings/#Contains) | `String#include?` in Ruby | -| [ContainsAny](http://golang.org/pkg/strings/#ContainsAny) | - | -| [ContainsRune](http://golang.org/pkg/strings/#ContainsRune) | - | -| [Count](http://golang.org/pkg/strings/#Count) | `str.count` in Python; `substr_count` in PHP | -| [EqualFold](http://golang.org/pkg/strings/#EqualFold) | `stricmp` in PHP; `String#casecmp` in Ruby | -| [Fields](http://golang.org/pkg/strings/#Fields) | `str.split` in Python; `split` in Perl; `String#split` in Ruby | -| [FieldsFunc](http://golang.org/pkg/strings/#FieldsFunc) | - | -| [HasPrefix](http://golang.org/pkg/strings/#HasPrefix) | `str.startswith` in Python; `String#start_with?` in Ruby | -| [HasSuffix](http://golang.org/pkg/strings/#HasSuffix) | `str.endswith` in Python; `String#end_with?` in Ruby | -| [Index](http://golang.org/pkg/strings/#Index) | `str.index` in Python; `String#index` in Ruby; `strpos` in PHP; `index` in Perl | -| [IndexAny](http://golang.org/pkg/strings/#IndexAny) | - | -| [IndexByte](http://golang.org/pkg/strings/#IndexByte) | - | -| [IndexFunc](http://golang.org/pkg/strings/#IndexFunc) | - | -| [IndexRune](http://golang.org/pkg/strings/#IndexRune) | - | -| [Join](http://golang.org/pkg/strings/#Join) | `str.join` in Python; `Array#join` in Ruby; `implode` in PHP; `join` in Perl | -| [LastIndex](http://golang.org/pkg/strings/#LastIndex) | `str.rindex` in Python; `String#rindex`; `strrpos` in PHP; `rindex` in Perl | -| [LastIndexAny](http://golang.org/pkg/strings/#LastIndexAny) | - | -| [LastIndexFunc](http://golang.org/pkg/strings/#LastIndexFunc) | - | -| [Map](http://golang.org/pkg/strings/#Map) | `String#each_codepoint` in Ruby | -| [Repeat](http://golang.org/pkg/strings/#Repeat) | operator `*` in Python and Ruby; `str_repeat` in PHP | -| [Replace](http://golang.org/pkg/strings/#Replace) | `str.replace` in Python; `String#sub` in Ruby; `str_replace` in PHP | -| [Split](http://golang.org/pkg/strings/#Split) | `str.split` in Python; `String#split` in Ruby; `explode` in PHP; `split` in Perl | -| [SplitAfter](http://golang.org/pkg/strings/#SplitAfter) | - | -| [SplitAfterN](http://golang.org/pkg/strings/#SplitAfterN) | - | -| [SplitN](http://golang.org/pkg/strings/#SplitN) | `str.split` in Python; `String#split` in Ruby; `explode` in PHP; `split` in Perl | -| [Title](http://golang.org/pkg/strings/#Title) | `str.title` in Python | -| [ToLower](http://golang.org/pkg/strings/#ToLower) | `str.lower` in Python; `String#downcase` in Ruby; `strtolower` in PHP; `lc` in Perl | -| [ToLowerSpecial](http://golang.org/pkg/strings/#ToLowerSpecial) | - | -| [ToTitle](http://golang.org/pkg/strings/#ToTitle) | - | -| [ToTitleSpecial](http://golang.org/pkg/strings/#ToTitleSpecial) | - | -| [ToUpper](http://golang.org/pkg/strings/#ToUpper) | `str.upper` in Python; `String#upcase` in Ruby; `strtoupper` in PHP; `uc` in Perl | -| [ToUpperSpecial](http://golang.org/pkg/strings/#ToUpperSpecial) | - | -| [Trim](http://golang.org/pkg/strings/#Trim) | `str.strip` in Python; `String#strip` in Ruby; `trim` in PHP | -| [TrimFunc](http://golang.org/pkg/strings/#TrimFunc) | - | -| [TrimLeft](http://golang.org/pkg/strings/#TrimLeft) | `str.lstrip` in Python; `String#lstrip` in Ruby; `ltrim` in PHP | -| [TrimLeftFunc](http://golang.org/pkg/strings/#TrimLeftFunc) | - | -| [TrimPrefix](http://golang.org/pkg/strings/#TrimPrefix) | - | -| [TrimRight](http://golang.org/pkg/strings/#TrimRight) | `str.rstrip` in Python; `String#rstrip` in Ruby; `rtrim` in PHP | -| [TrimRightFunc](http://golang.org/pkg/strings/#TrimRightFunc) | - | -| [TrimSpace](http://golang.org/pkg/strings/#TrimSpace) | `str.strip` in Python; `String#strip` in Ruby; `trim` in PHP | -| [TrimSuffix](http://golang.org/pkg/strings/#TrimSuffix) | `String#chomp` in Ruby; `chomp` in Perl | - -## License ## - -This library is licensed under MIT license. See LICENSE for details. diff --git a/vendor/github.com/huandu/xstrings/common.go b/vendor/github.com/huandu/xstrings/common.go deleted file mode 100644 index f427cc84e..000000000 --- a/vendor/github.com/huandu/xstrings/common.go +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015 Huan Du. All rights reserved. -// Licensed under the MIT license that can be found in the LICENSE file. - -package xstrings - -const bufferMaxInitGrowSize = 2048 - -// Lazy initialize a buffer. -func allocBuffer(orig, cur string) *stringBuilder { - output := &stringBuilder{} - maxSize := len(orig) * 4 - - // Avoid to reserve too much memory at once. - if maxSize > bufferMaxInitGrowSize { - maxSize = bufferMaxInitGrowSize - } - - output.Grow(maxSize) - output.WriteString(orig[:len(orig)-len(cur)]) - return output -} diff --git a/vendor/github.com/huandu/xstrings/convert.go b/vendor/github.com/huandu/xstrings/convert.go deleted file mode 100644 index 3d5a34950..000000000 --- a/vendor/github.com/huandu/xstrings/convert.go +++ /dev/null @@ -1,590 +0,0 @@ -// Copyright 2015 Huan Du. All rights reserved. -// Licensed under the MIT license that can be found in the LICENSE file. - -package xstrings - -import ( - "math/rand" - "unicode" - "unicode/utf8" -) - -// ToCamelCase is to convert words separated by space, underscore and hyphen to camel case. -// -// Some samples. -// "some_words" => "SomeWords" -// "http_server" => "HttpServer" -// "no_https" => "NoHttps" -// "_complex__case_" => "_Complex_Case_" -// "some words" => "SomeWords" -func ToCamelCase(str string) string { - if len(str) == 0 { - return "" - } - - buf := &stringBuilder{} - var r0, r1 rune - var size int - - // leading connector will appear in output. - for len(str) > 0 { - r0, size = utf8.DecodeRuneInString(str) - str = str[size:] - - if !isConnector(r0) { - r0 = unicode.ToUpper(r0) - break - } - - buf.WriteRune(r0) - } - - if len(str) == 0 { - // A special case for a string contains only 1 rune. - if size != 0 { - buf.WriteRune(r0) - } - - return buf.String() - } - - for len(str) > 0 { - r1 = r0 - r0, size = utf8.DecodeRuneInString(str) - str = str[size:] - - if isConnector(r0) && isConnector(r1) { - buf.WriteRune(r1) - continue - } - - if isConnector(r1) { - r0 = unicode.ToUpper(r0) - } else { - r0 = unicode.ToLower(r0) - buf.WriteRune(r1) - } - } - - buf.WriteRune(r0) - return buf.String() -} - -// ToSnakeCase can convert all upper case characters in a string to -// snake case format. -// -// Some samples. -// "FirstName" => "first_name" -// "HTTPServer" => "http_server" -// "NoHTTPS" => "no_https" -// "GO_PATH" => "go_path" -// "GO PATH" => "go_path" // space is converted to underscore. -// "GO-PATH" => "go_path" // hyphen is converted to underscore. -// "http2xx" => "http_2xx" // insert an underscore before a number and after an alphabet. -// "HTTP20xOK" => "http_20x_ok" -// "Duration2m3s" => "duration_2m3s" -// "Bld4Floor3rd" => "bld4_floor_3rd" -func ToSnakeCase(str string) string { - return camelCaseToLowerCase(str, '_') -} - -// ToKebabCase can convert all upper case characters in a string to -// kebab case format. -// -// Some samples. -// "FirstName" => "first-name" -// "HTTPServer" => "http-server" -// "NoHTTPS" => "no-https" -// "GO_PATH" => "go-path" -// "GO PATH" => "go-path" // space is converted to '-'. -// "GO-PATH" => "go-path" // hyphen is converted to '-'. -// "http2xx" => "http-2xx" // insert an underscore before a number and after an alphabet. -// "HTTP20xOK" => "http-20x-ok" -// "Duration2m3s" => "duration-2m3s" -// "Bld4Floor3rd" => "bld4-floor-3rd" -func ToKebabCase(str string) string { - return camelCaseToLowerCase(str, '-') -} - -func camelCaseToLowerCase(str string, connector rune) string { - if len(str) == 0 { - return "" - } - - buf := &stringBuilder{} - wt, word, remaining := nextWord(str) - - for len(remaining) > 0 { - if wt != connectorWord { - toLower(buf, wt, word, connector) - } - - prev := wt - last := word - wt, word, remaining = nextWord(remaining) - - switch prev { - case numberWord: - for wt == alphabetWord || wt == numberWord { - toLower(buf, wt, word, connector) - wt, word, remaining = nextWord(remaining) - } - - if wt != invalidWord && wt != punctWord { - buf.WriteRune(connector) - } - - case connectorWord: - toLower(buf, prev, last, connector) - - case punctWord: - // nothing. - - default: - if wt != numberWord { - if wt != connectorWord && wt != punctWord { - buf.WriteRune(connector) - } - - break - } - - if len(remaining) == 0 { - break - } - - last := word - wt, word, remaining = nextWord(remaining) - - // consider number as a part of previous word. - // e.g. "Bld4Floor" => "bld4_floor" - if wt != alphabetWord { - toLower(buf, numberWord, last, connector) - - if wt != connectorWord && wt != punctWord { - buf.WriteRune(connector) - } - - break - } - - // if there are some lower case letters following a number, - // add connector before the number. - // e.g. "HTTP2xx" => "http_2xx" - buf.WriteRune(connector) - toLower(buf, numberWord, last, connector) - - for wt == alphabetWord || wt == numberWord { - toLower(buf, wt, word, connector) - wt, word, remaining = nextWord(remaining) - } - - if wt != invalidWord && wt != connectorWord && wt != punctWord { - buf.WriteRune(connector) - } - } - } - - toLower(buf, wt, word, connector) - return buf.String() -} - -func isConnector(r rune) bool { - return r == '-' || r == '_' || unicode.IsSpace(r) -} - -type wordType int - -const ( - invalidWord wordType = iota - numberWord - upperCaseWord - alphabetWord - connectorWord - punctWord - otherWord -) - -func nextWord(str string) (wt wordType, word, remaining string) { - if len(str) == 0 { - return - } - - var offset int - remaining = str - r, size := nextValidRune(remaining, utf8.RuneError) - offset += size - - if r == utf8.RuneError { - wt = invalidWord - word = str[:offset] - remaining = str[offset:] - return - } - - switch { - case isConnector(r): - wt = connectorWord - remaining = remaining[size:] - - for len(remaining) > 0 { - r, size = nextValidRune(remaining, r) - - if !isConnector(r) { - break - } - - offset += size - remaining = remaining[size:] - } - - case unicode.IsPunct(r): - wt = punctWord - remaining = remaining[size:] - - for len(remaining) > 0 { - r, size = nextValidRune(remaining, r) - - if !unicode.IsPunct(r) { - break - } - - offset += size - remaining = remaining[size:] - } - - case unicode.IsUpper(r): - wt = upperCaseWord - remaining = remaining[size:] - - if len(remaining) == 0 { - break - } - - r, size = nextValidRune(remaining, r) - - switch { - case unicode.IsUpper(r): - prevSize := size - offset += size - remaining = remaining[size:] - - for len(remaining) > 0 { - r, size = nextValidRune(remaining, r) - - if !unicode.IsUpper(r) { - break - } - - prevSize = size - offset += size - remaining = remaining[size:] - } - - // it's a bit complex when dealing with a case like "HTTPStatus". - // it's expected to be splitted into "HTTP" and "Status". - // Therefore "S" should be in remaining instead of word. - if len(remaining) > 0 && isAlphabet(r) { - offset -= prevSize - remaining = str[offset:] - } - - case isAlphabet(r): - offset += size - remaining = remaining[size:] - - for len(remaining) > 0 { - r, size = nextValidRune(remaining, r) - - if !isAlphabet(r) || unicode.IsUpper(r) { - break - } - - offset += size - remaining = remaining[size:] - } - } - - case isAlphabet(r): - wt = alphabetWord - remaining = remaining[size:] - - for len(remaining) > 0 { - r, size = nextValidRune(remaining, r) - - if !isAlphabet(r) || unicode.IsUpper(r) { - break - } - - offset += size - remaining = remaining[size:] - } - - case unicode.IsNumber(r): - wt = numberWord - remaining = remaining[size:] - - for len(remaining) > 0 { - r, size = nextValidRune(remaining, r) - - if !unicode.IsNumber(r) { - break - } - - offset += size - remaining = remaining[size:] - } - - default: - wt = otherWord - remaining = remaining[size:] - - for len(remaining) > 0 { - r, size = nextValidRune(remaining, r) - - if size == 0 || isConnector(r) || isAlphabet(r) || unicode.IsNumber(r) || unicode.IsPunct(r) { - break - } - - offset += size - remaining = remaining[size:] - } - } - - word = str[:offset] - return -} - -func nextValidRune(str string, prev rune) (r rune, size int) { - var sz int - - for len(str) > 0 { - r, sz = utf8.DecodeRuneInString(str) - size += sz - - if r != utf8.RuneError { - return - } - - str = str[sz:] - } - - r = prev - return -} - -func toLower(buf *stringBuilder, wt wordType, str string, connector rune) { - buf.Grow(buf.Len() + len(str)) - - if wt != upperCaseWord && wt != connectorWord { - buf.WriteString(str) - return - } - - for len(str) > 0 { - r, size := utf8.DecodeRuneInString(str) - str = str[size:] - - if isConnector(r) { - buf.WriteRune(connector) - } else if unicode.IsUpper(r) { - buf.WriteRune(unicode.ToLower(r)) - } else { - buf.WriteRune(r) - } - } -} - -// SwapCase will swap characters case from upper to lower or lower to upper. -func SwapCase(str string) string { - var r rune - var size int - - buf := &stringBuilder{} - - for len(str) > 0 { - r, size = utf8.DecodeRuneInString(str) - - switch { - case unicode.IsUpper(r): - buf.WriteRune(unicode.ToLower(r)) - - case unicode.IsLower(r): - buf.WriteRune(unicode.ToUpper(r)) - - default: - buf.WriteRune(r) - } - - str = str[size:] - } - - return buf.String() -} - -// FirstRuneToUpper converts first rune to upper case if necessary. -func FirstRuneToUpper(str string) string { - if str == "" { - return str - } - - r, size := utf8.DecodeRuneInString(str) - - if !unicode.IsLower(r) { - return str - } - - buf := &stringBuilder{} - buf.WriteRune(unicode.ToUpper(r)) - buf.WriteString(str[size:]) - return buf.String() -} - -// FirstRuneToLower converts first rune to lower case if necessary. -func FirstRuneToLower(str string) string { - if str == "" { - return str - } - - r, size := utf8.DecodeRuneInString(str) - - if !unicode.IsUpper(r) { - return str - } - - buf := &stringBuilder{} - buf.WriteRune(unicode.ToLower(r)) - buf.WriteString(str[size:]) - return buf.String() -} - -// Shuffle randomizes runes in a string and returns the result. -// It uses default random source in `math/rand`. -func Shuffle(str string) string { - if str == "" { - return str - } - - runes := []rune(str) - index := 0 - - for i := len(runes) - 1; i > 0; i-- { - index = rand.Intn(i + 1) - - if i != index { - runes[i], runes[index] = runes[index], runes[i] - } - } - - return string(runes) -} - -// ShuffleSource randomizes runes in a string with given random source. -func ShuffleSource(str string, src rand.Source) string { - if str == "" { - return str - } - - runes := []rune(str) - index := 0 - r := rand.New(src) - - for i := len(runes) - 1; i > 0; i-- { - index = r.Intn(i + 1) - - if i != index { - runes[i], runes[index] = runes[index], runes[i] - } - } - - return string(runes) -} - -// Successor returns the successor to string. -// -// If there is one alphanumeric rune is found in string, increase the rune by 1. -// If increment generates a "carry", the rune to the left of it is incremented. -// This process repeats until there is no carry, adding an additional rune if necessary. -// -// If there is no alphanumeric rune, the rightmost rune will be increased by 1 -// regardless whether the result is a valid rune or not. -// -// Only following characters are alphanumeric. -// * a - z -// * A - Z -// * 0 - 9 -// -// Samples (borrowed from ruby's String#succ document): -// "abcd" => "abce" -// "THX1138" => "THX1139" -// "<>" => "<>" -// "1999zzz" => "2000aaa" -// "ZZZ9999" => "AAAA0000" -// "***" => "**+" -func Successor(str string) string { - if str == "" { - return str - } - - var r rune - var i int - carry := ' ' - runes := []rune(str) - l := len(runes) - lastAlphanumeric := l - - for i = l - 1; i >= 0; i-- { - r = runes[i] - - if ('a' <= r && r <= 'y') || - ('A' <= r && r <= 'Y') || - ('0' <= r && r <= '8') { - runes[i]++ - carry = ' ' - lastAlphanumeric = i - break - } - - switch r { - case 'z': - runes[i] = 'a' - carry = 'a' - lastAlphanumeric = i - - case 'Z': - runes[i] = 'A' - carry = 'A' - lastAlphanumeric = i - - case '9': - runes[i] = '0' - carry = '0' - lastAlphanumeric = i - } - } - - // Needs to add one character for carry. - if i < 0 && carry != ' ' { - buf := &stringBuilder{} - buf.Grow(l + 4) // Reserve enough space for write. - - if lastAlphanumeric != 0 { - buf.WriteString(str[:lastAlphanumeric]) - } - - buf.WriteRune(carry) - - for _, r = range runes[lastAlphanumeric:] { - buf.WriteRune(r) - } - - return buf.String() - } - - // No alphanumeric character. Simply increase last rune's value. - if lastAlphanumeric == l { - runes[l-1]++ - } - - return string(runes) -} diff --git a/vendor/github.com/huandu/xstrings/count.go b/vendor/github.com/huandu/xstrings/count.go deleted file mode 100644 index f96e38703..000000000 --- a/vendor/github.com/huandu/xstrings/count.go +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright 2015 Huan Du. All rights reserved. -// Licensed under the MIT license that can be found in the LICENSE file. - -package xstrings - -import ( - "unicode" - "unicode/utf8" -) - -// Len returns str's utf8 rune length. -func Len(str string) int { - return utf8.RuneCountInString(str) -} - -// WordCount returns number of words in a string. -// -// Word is defined as a locale dependent string containing alphabetic characters, -// which may also contain but not start with `'` and `-` characters. -func WordCount(str string) int { - var r rune - var size, n int - - inWord := false - - for len(str) > 0 { - r, size = utf8.DecodeRuneInString(str) - - switch { - case isAlphabet(r): - if !inWord { - inWord = true - n++ - } - - case inWord && (r == '\'' || r == '-'): - // Still in word. - - default: - inWord = false - } - - str = str[size:] - } - - return n -} - -const minCJKCharacter = '\u3400' - -// Checks r is a letter but not CJK character. -func isAlphabet(r rune) bool { - if !unicode.IsLetter(r) { - return false - } - - switch { - // Quick check for non-CJK character. - case r < minCJKCharacter: - return true - - // Common CJK characters. - case r >= '\u4E00' && r <= '\u9FCC': - return false - - // Rare CJK characters. - case r >= '\u3400' && r <= '\u4D85': - return false - - // Rare and historic CJK characters. - case r >= '\U00020000' && r <= '\U0002B81D': - return false - } - - return true -} - -// Width returns string width in monotype font. -// Multi-byte characters are usually twice the width of single byte characters. -// -// Algorithm comes from `mb_strwidth` in PHP. -// http://php.net/manual/en/function.mb-strwidth.php -func Width(str string) int { - var r rune - var size, n int - - for len(str) > 0 { - r, size = utf8.DecodeRuneInString(str) - n += RuneWidth(r) - str = str[size:] - } - - return n -} - -// RuneWidth returns character width in monotype font. -// Multi-byte characters are usually twice the width of single byte characters. -// -// Algorithm comes from `mb_strwidth` in PHP. -// http://php.net/manual/en/function.mb-strwidth.php -func RuneWidth(r rune) int { - switch { - case r == utf8.RuneError || r < '\x20': - return 0 - - case '\x20' <= r && r < '\u2000': - return 1 - - case '\u2000' <= r && r < '\uFF61': - return 2 - - case '\uFF61' <= r && r < '\uFFA0': - return 1 - - case '\uFFA0' <= r: - return 2 - } - - return 0 -} diff --git a/vendor/github.com/huandu/xstrings/doc.go b/vendor/github.com/huandu/xstrings/doc.go deleted file mode 100644 index 1a6ef069f..000000000 --- a/vendor/github.com/huandu/xstrings/doc.go +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright 2015 Huan Du. All rights reserved. -// Licensed under the MIT license that can be found in the LICENSE file. - -// Package xstrings is to provide string algorithms which are useful but not included in `strings` package. -// See project home page for details. https://github.com/huandu/xstrings -// -// Package xstrings assumes all strings are encoded in utf8. -package xstrings diff --git a/vendor/github.com/huandu/xstrings/format.go b/vendor/github.com/huandu/xstrings/format.go deleted file mode 100644 index 8cd76c525..000000000 --- a/vendor/github.com/huandu/xstrings/format.go +++ /dev/null @@ -1,169 +0,0 @@ -// Copyright 2015 Huan Du. All rights reserved. -// Licensed under the MIT license that can be found in the LICENSE file. - -package xstrings - -import ( - "unicode/utf8" -) - -// ExpandTabs can expand tabs ('\t') rune in str to one or more spaces dpending on -// current column and tabSize. -// The column number is reset to zero after each newline ('\n') occurring in the str. -// -// ExpandTabs uses RuneWidth to decide rune's width. -// For example, CJK characters will be treated as two characters. -// -// If tabSize <= 0, ExpandTabs panics with error. -// -// Samples: -// ExpandTabs("a\tbc\tdef\tghij\tk", 4) => "a bc def ghij k" -// ExpandTabs("abcdefg\thij\nk\tl", 4) => "abcdefg hij\nk l" -// ExpandTabs("z中\t文\tw", 4) => "z中 文 w" -func ExpandTabs(str string, tabSize int) string { - if tabSize <= 0 { - panic("tab size must be positive") - } - - var r rune - var i, size, column, expand int - var output *stringBuilder - - orig := str - - for len(str) > 0 { - r, size = utf8.DecodeRuneInString(str) - - if r == '\t' { - expand = tabSize - column%tabSize - - if output == nil { - output = allocBuffer(orig, str) - } - - for i = 0; i < expand; i++ { - output.WriteRune(' ') - } - - column += expand - } else { - if r == '\n' { - column = 0 - } else { - column += RuneWidth(r) - } - - if output != nil { - output.WriteRune(r) - } - } - - str = str[size:] - } - - if output == nil { - return orig - } - - return output.String() -} - -// LeftJustify returns a string with pad string at right side if str's rune length is smaller than length. -// If str's rune length is larger than length, str itself will be returned. -// -// If pad is an empty string, str will be returned. -// -// Samples: -// LeftJustify("hello", 4, " ") => "hello" -// LeftJustify("hello", 10, " ") => "hello " -// LeftJustify("hello", 10, "123") => "hello12312" -func LeftJustify(str string, length int, pad string) string { - l := Len(str) - - if l >= length || pad == "" { - return str - } - - remains := length - l - padLen := Len(pad) - - output := &stringBuilder{} - output.Grow(len(str) + (remains/padLen+1)*len(pad)) - output.WriteString(str) - writePadString(output, pad, padLen, remains) - return output.String() -} - -// RightJustify returns a string with pad string at left side if str's rune length is smaller than length. -// If str's rune length is larger than length, str itself will be returned. -// -// If pad is an empty string, str will be returned. -// -// Samples: -// RightJustify("hello", 4, " ") => "hello" -// RightJustify("hello", 10, " ") => " hello" -// RightJustify("hello", 10, "123") => "12312hello" -func RightJustify(str string, length int, pad string) string { - l := Len(str) - - if l >= length || pad == "" { - return str - } - - remains := length - l - padLen := Len(pad) - - output := &stringBuilder{} - output.Grow(len(str) + (remains/padLen+1)*len(pad)) - writePadString(output, pad, padLen, remains) - output.WriteString(str) - return output.String() -} - -// Center returns a string with pad string at both side if str's rune length is smaller than length. -// If str's rune length is larger than length, str itself will be returned. -// -// If pad is an empty string, str will be returned. -// -// Samples: -// Center("hello", 4, " ") => "hello" -// Center("hello", 10, " ") => " hello " -// Center("hello", 10, "123") => "12hello123" -func Center(str string, length int, pad string) string { - l := Len(str) - - if l >= length || pad == "" { - return str - } - - remains := length - l - padLen := Len(pad) - - output := &stringBuilder{} - output.Grow(len(str) + (remains/padLen+1)*len(pad)) - writePadString(output, pad, padLen, remains/2) - output.WriteString(str) - writePadString(output, pad, padLen, (remains+1)/2) - return output.String() -} - -func writePadString(output *stringBuilder, pad string, padLen, remains int) { - var r rune - var size int - - repeats := remains / padLen - - for i := 0; i < repeats; i++ { - output.WriteString(pad) - } - - remains = remains % padLen - - if remains != 0 { - for i := 0; i < remains; i++ { - r, size = utf8.DecodeRuneInString(pad) - output.WriteRune(r) - pad = pad[size:] - } - } -} diff --git a/vendor/github.com/huandu/xstrings/manipulate.go b/vendor/github.com/huandu/xstrings/manipulate.go deleted file mode 100644 index 64075f9bb..000000000 --- a/vendor/github.com/huandu/xstrings/manipulate.go +++ /dev/null @@ -1,216 +0,0 @@ -// Copyright 2015 Huan Du. All rights reserved. -// Licensed under the MIT license that can be found in the LICENSE file. - -package xstrings - -import ( - "strings" - "unicode/utf8" -) - -// Reverse a utf8 encoded string. -func Reverse(str string) string { - var size int - - tail := len(str) - buf := make([]byte, tail) - s := buf - - for len(str) > 0 { - _, size = utf8.DecodeRuneInString(str) - tail -= size - s = append(s[:tail], []byte(str[:size])...) - str = str[size:] - } - - return string(buf) -} - -// Slice a string by rune. -// -// Start must satisfy 0 <= start <= rune length. -// -// End can be positive, zero or negative. -// If end >= 0, start and end must satisfy start <= end <= rune length. -// If end < 0, it means slice to the end of string. -// -// Otherwise, Slice will panic as out of range. -func Slice(str string, start, end int) string { - var size, startPos, endPos int - - origin := str - - if start < 0 || end > len(str) || (end >= 0 && start > end) { - panic("out of range") - } - - if end >= 0 { - end -= start - } - - for start > 0 && len(str) > 0 { - _, size = utf8.DecodeRuneInString(str) - start-- - startPos += size - str = str[size:] - } - - if end < 0 { - return origin[startPos:] - } - - endPos = startPos - - for end > 0 && len(str) > 0 { - _, size = utf8.DecodeRuneInString(str) - end-- - endPos += size - str = str[size:] - } - - if len(str) == 0 && (start > 0 || end > 0) { - panic("out of range") - } - - return origin[startPos:endPos] -} - -// Partition splits a string by sep into three parts. -// The return value is a slice of strings with head, match and tail. -// -// If str contains sep, for example "hello" and "l", Partition returns -// "he", "l", "lo" -// -// If str doesn't contain sep, for example "hello" and "x", Partition returns -// "hello", "", "" -func Partition(str, sep string) (head, match, tail string) { - index := strings.Index(str, sep) - - if index == -1 { - head = str - return - } - - head = str[:index] - match = str[index : index+len(sep)] - tail = str[index+len(sep):] - return -} - -// LastPartition splits a string by last instance of sep into three parts. -// The return value is a slice of strings with head, match and tail. -// -// If str contains sep, for example "hello" and "l", LastPartition returns -// "hel", "l", "o" -// -// If str doesn't contain sep, for example "hello" and "x", LastPartition returns -// "", "", "hello" -func LastPartition(str, sep string) (head, match, tail string) { - index := strings.LastIndex(str, sep) - - if index == -1 { - tail = str - return - } - - head = str[:index] - match = str[index : index+len(sep)] - tail = str[index+len(sep):] - return -} - -// Insert src into dst at given rune index. -// Index is counted by runes instead of bytes. -// -// If index is out of range of dst, panic with out of range. -func Insert(dst, src string, index int) string { - return Slice(dst, 0, index) + src + Slice(dst, index, -1) -} - -// Scrub scrubs invalid utf8 bytes with repl string. -// Adjacent invalid bytes are replaced only once. -func Scrub(str, repl string) string { - var buf *stringBuilder - var r rune - var size, pos int - var hasError bool - - origin := str - - for len(str) > 0 { - r, size = utf8.DecodeRuneInString(str) - - if r == utf8.RuneError { - if !hasError { - if buf == nil { - buf = &stringBuilder{} - } - - buf.WriteString(origin[:pos]) - hasError = true - } - } else if hasError { - hasError = false - buf.WriteString(repl) - - origin = origin[pos:] - pos = 0 - } - - pos += size - str = str[size:] - } - - if buf != nil { - buf.WriteString(origin) - return buf.String() - } - - // No invalid byte. - return origin -} - -// WordSplit splits a string into words. Returns a slice of words. -// If there is no word in a string, return nil. -// -// Word is defined as a locale dependent string containing alphabetic characters, -// which may also contain but not start with `'` and `-` characters. -func WordSplit(str string) []string { - var word string - var words []string - var r rune - var size, pos int - - inWord := false - - for len(str) > 0 { - r, size = utf8.DecodeRuneInString(str) - - switch { - case isAlphabet(r): - if !inWord { - inWord = true - word = str - pos = 0 - } - - case inWord && (r == '\'' || r == '-'): - // Still in word. - - default: - if inWord { - inWord = false - words = append(words, word[:pos]) - } - } - - pos += size - str = str[size:] - } - - if inWord { - words = append(words, word[:pos]) - } - - return words -} diff --git a/vendor/github.com/huandu/xstrings/stringbuilder.go b/vendor/github.com/huandu/xstrings/stringbuilder.go deleted file mode 100644 index bb0919d32..000000000 --- a/vendor/github.com/huandu/xstrings/stringbuilder.go +++ /dev/null @@ -1,7 +0,0 @@ -//+build go1.10 - -package xstrings - -import "strings" - -type stringBuilder = strings.Builder diff --git a/vendor/github.com/huandu/xstrings/stringbuilder_go110.go b/vendor/github.com/huandu/xstrings/stringbuilder_go110.go deleted file mode 100644 index dac389d13..000000000 --- a/vendor/github.com/huandu/xstrings/stringbuilder_go110.go +++ /dev/null @@ -1,9 +0,0 @@ -//+build !go1.10 - -package xstrings - -import "bytes" - -type stringBuilder struct { - bytes.Buffer -} diff --git a/vendor/github.com/huandu/xstrings/translate.go b/vendor/github.com/huandu/xstrings/translate.go deleted file mode 100644 index 42e694fb1..000000000 --- a/vendor/github.com/huandu/xstrings/translate.go +++ /dev/null @@ -1,546 +0,0 @@ -// Copyright 2015 Huan Du. All rights reserved. -// Licensed under the MIT license that can be found in the LICENSE file. - -package xstrings - -import ( - "unicode" - "unicode/utf8" -) - -type runeRangeMap struct { - FromLo rune // Lower bound of range map. - FromHi rune // An inclusive higher bound of range map. - ToLo rune - ToHi rune -} - -type runeDict struct { - Dict [unicode.MaxASCII + 1]rune -} - -type runeMap map[rune]rune - -// Translator can translate string with pre-compiled from and to patterns. -// If a from/to pattern pair needs to be used more than once, it's recommended -// to create a Translator and reuse it. -type Translator struct { - quickDict *runeDict // A quick dictionary to look up rune by index. Only available for latin runes. - runeMap runeMap // Rune map for translation. - ranges []*runeRangeMap // Ranges of runes. - mappedRune rune // If mappedRune >= 0, all matched runes are translated to the mappedRune. - reverted bool // If to pattern is empty, all matched characters will be deleted. - hasPattern bool -} - -// NewTranslator creates new Translator through a from/to pattern pair. -func NewTranslator(from, to string) *Translator { - tr := &Translator{} - - if from == "" { - return tr - } - - reverted := from[0] == '^' - deletion := len(to) == 0 - - if reverted { - from = from[1:] - } - - var fromStart, fromEnd, fromRangeStep rune - var toStart, toEnd, toRangeStep rune - var fromRangeSize, toRangeSize rune - var singleRunes []rune - - // Update the to rune range. - updateRange := func() { - // No more rune to read in the to rune pattern. - if toEnd == utf8.RuneError { - return - } - - if toRangeStep == 0 { - to, toStart, toEnd, toRangeStep = nextRuneRange(to, toEnd) - return - } - - // Current range is not empty. Consume 1 rune from start. - if toStart != toEnd { - toStart += toRangeStep - return - } - - // No more rune. Repeat the last rune. - if to == "" { - toEnd = utf8.RuneError - return - } - - // Both start and end are used. Read two more runes from the to pattern. - to, toStart, toEnd, toRangeStep = nextRuneRange(to, utf8.RuneError) - } - - if deletion { - toStart = utf8.RuneError - toEnd = utf8.RuneError - } else { - // If from pattern is reverted, only the last rune in the to pattern will be used. - if reverted { - var size int - - for len(to) > 0 { - toStart, size = utf8.DecodeRuneInString(to) - to = to[size:] - } - - toEnd = utf8.RuneError - } else { - to, toStart, toEnd, toRangeStep = nextRuneRange(to, utf8.RuneError) - } - } - - fromEnd = utf8.RuneError - - for len(from) > 0 { - from, fromStart, fromEnd, fromRangeStep = nextRuneRange(from, fromEnd) - - // fromStart is a single character. Just map it with a rune in the to pattern. - if fromRangeStep == 0 { - singleRunes = tr.addRune(fromStart, toStart, singleRunes) - updateRange() - continue - } - - for toEnd != utf8.RuneError && fromStart != fromEnd { - // If mapped rune is a single character instead of a range, simply shift first - // rune in the range. - if toRangeStep == 0 { - singleRunes = tr.addRune(fromStart, toStart, singleRunes) - updateRange() - fromStart += fromRangeStep - continue - } - - fromRangeSize = (fromEnd - fromStart) * fromRangeStep - toRangeSize = (toEnd - toStart) * toRangeStep - - // Not enough runes in the to pattern. Need to read more. - if fromRangeSize > toRangeSize { - fromStart, toStart = tr.addRuneRange(fromStart, fromStart+toRangeSize*fromRangeStep, toStart, toEnd, singleRunes) - fromStart += fromRangeStep - updateRange() - - // Edge case: If fromRangeSize == toRangeSize + 1, the last fromStart value needs be considered - // as a single rune. - if fromStart == fromEnd { - singleRunes = tr.addRune(fromStart, toStart, singleRunes) - updateRange() - } - - continue - } - - fromStart, toStart = tr.addRuneRange(fromStart, fromEnd, toStart, toStart+fromRangeSize*toRangeStep, singleRunes) - updateRange() - break - } - - if fromStart == fromEnd { - fromEnd = utf8.RuneError - continue - } - - _, toStart = tr.addRuneRange(fromStart, fromEnd, toStart, toStart, singleRunes) - fromEnd = utf8.RuneError - } - - if fromEnd != utf8.RuneError { - tr.addRune(fromEnd, toStart, singleRunes) - } - - tr.reverted = reverted - tr.mappedRune = -1 - tr.hasPattern = true - - // Translate RuneError only if in deletion or reverted mode. - if deletion || reverted { - tr.mappedRune = toStart - } - - return tr -} - -func (tr *Translator) addRune(from, to rune, singleRunes []rune) []rune { - if from <= unicode.MaxASCII { - if tr.quickDict == nil { - tr.quickDict = &runeDict{} - } - - tr.quickDict.Dict[from] = to - } else { - if tr.runeMap == nil { - tr.runeMap = make(runeMap) - } - - tr.runeMap[from] = to - } - - singleRunes = append(singleRunes, from) - return singleRunes -} - -func (tr *Translator) addRuneRange(fromLo, fromHi, toLo, toHi rune, singleRunes []rune) (rune, rune) { - var r rune - var rrm *runeRangeMap - - if fromLo < fromHi { - rrm = &runeRangeMap{ - FromLo: fromLo, - FromHi: fromHi, - ToLo: toLo, - ToHi: toHi, - } - } else { - rrm = &runeRangeMap{ - FromLo: fromHi, - FromHi: fromLo, - ToLo: toHi, - ToHi: toLo, - } - } - - // If there is any single rune conflicts with this rune range, clear single rune record. - for _, r = range singleRunes { - if rrm.FromLo <= r && r <= rrm.FromHi { - if r <= unicode.MaxASCII { - tr.quickDict.Dict[r] = 0 - } else { - delete(tr.runeMap, r) - } - } - } - - tr.ranges = append(tr.ranges, rrm) - return fromHi, toHi -} - -func nextRuneRange(str string, last rune) (remaining string, start, end rune, rangeStep rune) { - var r rune - var size int - - remaining = str - escaping := false - isRange := false - - for len(remaining) > 0 { - r, size = utf8.DecodeRuneInString(remaining) - remaining = remaining[size:] - - // Parse special characters. - if !escaping { - if r == '\\' { - escaping = true - continue - } - - if r == '-' { - // Ignore slash at beginning of string. - if last == utf8.RuneError { - continue - } - - start = last - isRange = true - continue - } - } - - escaping = false - - if last != utf8.RuneError { - // This is a range which start and end are the same. - // Considier it as a normal character. - if isRange && last == r { - isRange = false - continue - } - - start = last - end = r - - if isRange { - if start < end { - rangeStep = 1 - } else { - rangeStep = -1 - } - } - - return - } - - last = r - } - - start = last - end = utf8.RuneError - return -} - -// Translate str with a from/to pattern pair. -// -// See comment in Translate function for usage and samples. -func (tr *Translator) Translate(str string) string { - if !tr.hasPattern || str == "" { - return str - } - - var r rune - var size int - var needTr bool - - orig := str - - var output *stringBuilder - - for len(str) > 0 { - r, size = utf8.DecodeRuneInString(str) - r, needTr = tr.TranslateRune(r) - - if needTr && output == nil { - output = allocBuffer(orig, str) - } - - if r != utf8.RuneError && output != nil { - output.WriteRune(r) - } - - str = str[size:] - } - - // No character is translated. - if output == nil { - return orig - } - - return output.String() -} - -// TranslateRune return translated rune and true if r matches the from pattern. -// If r doesn't match the pattern, original r is returned and translated is false. -func (tr *Translator) TranslateRune(r rune) (result rune, translated bool) { - switch { - case tr.quickDict != nil: - if r <= unicode.MaxASCII { - result = tr.quickDict.Dict[r] - - if result != 0 { - translated = true - - if tr.mappedRune >= 0 { - result = tr.mappedRune - } - - break - } - } - - fallthrough - - case tr.runeMap != nil: - var ok bool - - if result, ok = tr.runeMap[r]; ok { - translated = true - - if tr.mappedRune >= 0 { - result = tr.mappedRune - } - - break - } - - fallthrough - - default: - var rrm *runeRangeMap - ranges := tr.ranges - - for i := len(ranges) - 1; i >= 0; i-- { - rrm = ranges[i] - - if rrm.FromLo <= r && r <= rrm.FromHi { - translated = true - - if tr.mappedRune >= 0 { - result = tr.mappedRune - break - } - - if rrm.ToLo < rrm.ToHi { - result = rrm.ToLo + r - rrm.FromLo - } else if rrm.ToLo > rrm.ToHi { - // ToHi can be smaller than ToLo if range is from higher to lower. - result = rrm.ToLo - r + rrm.FromLo - } else { - result = rrm.ToLo - } - - break - } - } - } - - if tr.reverted { - if !translated { - result = tr.mappedRune - } - - translated = !translated - } - - if !translated { - result = r - } - - return -} - -// HasPattern returns true if Translator has one pattern at least. -func (tr *Translator) HasPattern() bool { - return tr.hasPattern -} - -// Translate str with the characters defined in from replaced by characters defined in to. -// -// From and to are patterns representing a set of characters. Pattern is defined as following. -// -// * Special characters -// * '-' means a range of runes, e.g. -// * "a-z" means all characters from 'a' to 'z' inclusive; -// * "z-a" means all characters from 'z' to 'a' inclusive. -// * '^' as first character means a set of all runes excepted listed, e.g. -// * "^a-z" means all characters except 'a' to 'z' inclusive. -// * '\' escapes special characters. -// * Normal character represents itself, e.g. "abc" is a set including 'a', 'b' and 'c'. -// -// Translate will try to find a 1:1 mapping from from to to. -// If to is smaller than from, last rune in to will be used to map "out of range" characters in from. -// -// Note that '^' only works in the from pattern. It will be considered as a normal character in the to pattern. -// -// If the to pattern is an empty string, Translate works exactly the same as Delete. -// -// Samples: -// Translate("hello", "aeiou", "12345") => "h2ll4" -// Translate("hello", "a-z", "A-Z") => "HELLO" -// Translate("hello", "z-a", "a-z") => "svool" -// Translate("hello", "aeiou", "*") => "h*ll*" -// Translate("hello", "^l", "*") => "**ll*" -// Translate("hello ^ world", `\^lo`, "*") => "he*** * w*r*d" -func Translate(str, from, to string) string { - tr := NewTranslator(from, to) - return tr.Translate(str) -} - -// Delete runes in str matching the pattern. -// Pattern is defined in Translate function. -// -// Samples: -// Delete("hello", "aeiou") => "hll" -// Delete("hello", "a-k") => "llo" -// Delete("hello", "^a-k") => "he" -func Delete(str, pattern string) string { - tr := NewTranslator(pattern, "") - return tr.Translate(str) -} - -// Count how many runes in str match the pattern. -// Pattern is defined in Translate function. -// -// Samples: -// Count("hello", "aeiou") => 3 -// Count("hello", "a-k") => 3 -// Count("hello", "^a-k") => 2 -func Count(str, pattern string) int { - if pattern == "" || str == "" { - return 0 - } - - var r rune - var size int - var matched bool - - tr := NewTranslator(pattern, "") - cnt := 0 - - for len(str) > 0 { - r, size = utf8.DecodeRuneInString(str) - str = str[size:] - - if _, matched = tr.TranslateRune(r); matched { - cnt++ - } - } - - return cnt -} - -// Squeeze deletes adjacent repeated runes in str. -// If pattern is not empty, only runes matching the pattern will be squeezed. -// -// Samples: -// Squeeze("hello", "") => "helo" -// Squeeze("hello", "m-z") => "hello" -// Squeeze("hello world", " ") => "hello world" -func Squeeze(str, pattern string) string { - var last, r rune - var size int - var skipSqueeze, matched bool - var tr *Translator - var output *stringBuilder - - orig := str - last = -1 - - if len(pattern) > 0 { - tr = NewTranslator(pattern, "") - } - - for len(str) > 0 { - r, size = utf8.DecodeRuneInString(str) - - // Need to squeeze the str. - if last == r && !skipSqueeze { - if tr != nil { - if _, matched = tr.TranslateRune(r); !matched { - skipSqueeze = true - } - } - - if output == nil { - output = allocBuffer(orig, str) - } - - if skipSqueeze { - output.WriteRune(r) - } - } else { - if output != nil { - output.WriteRune(r) - } - - last = r - skipSqueeze = false - } - - str = str[size:] - } - - if output == nil { - return orig - } - - return output.String() -} diff --git a/vendor/github.com/imdario/mergo/.deepsource.toml b/vendor/github.com/imdario/mergo/.deepsource.toml deleted file mode 100644 index 8a0681af8..000000000 --- a/vendor/github.com/imdario/mergo/.deepsource.toml +++ /dev/null @@ -1,12 +0,0 @@ -version = 1 - -test_patterns = [ - "*_test.go" -] - -[[analyzers]] -name = "go" -enabled = true - - [analyzers.meta] - import_path = "github.com/imdario/mergo" \ No newline at end of file diff --git a/vendor/github.com/imdario/mergo/.gitignore b/vendor/github.com/imdario/mergo/.gitignore deleted file mode 100644 index 529c3412b..000000000 --- a/vendor/github.com/imdario/mergo/.gitignore +++ /dev/null @@ -1,33 +0,0 @@ -#### joe made this: http://goel.io/joe - -#### go #### -# Binaries for programs and plugins -*.exe -*.dll -*.so -*.dylib - -# Test binary, build with `go test -c` -*.test - -# Output of the go coverage tool, specifically when used with LiteIDE -*.out - -# Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736 -.glide/ - -#### vim #### -# Swap -[._]*.s[a-v][a-z] -[._]*.sw[a-p] -[._]s[a-v][a-z] -[._]sw[a-p] - -# Session -Session.vim - -# Temporary -.netrwhist -*~ -# Auto-generated tag files -tags diff --git a/vendor/github.com/imdario/mergo/.travis.yml b/vendor/github.com/imdario/mergo/.travis.yml deleted file mode 100644 index dad29725f..000000000 --- a/vendor/github.com/imdario/mergo/.travis.yml +++ /dev/null @@ -1,9 +0,0 @@ -language: go -install: - - go get -t - - go get golang.org/x/tools/cmd/cover - - go get github.com/mattn/goveralls -script: - - go test -race -v ./... -after_script: - - $HOME/gopath/bin/goveralls -service=travis-ci -repotoken $COVERALLS_TOKEN diff --git a/vendor/github.com/imdario/mergo/CODE_OF_CONDUCT.md b/vendor/github.com/imdario/mergo/CODE_OF_CONDUCT.md deleted file mode 100644 index 469b44907..000000000 --- a/vendor/github.com/imdario/mergo/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,46 +0,0 @@ -# Contributor Covenant Code of Conduct - -## Our Pledge - -In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. - -## Our Standards - -Examples of behavior that contributes to creating a positive environment include: - -* Using welcoming and inclusive language -* Being respectful of differing viewpoints and experiences -* Gracefully accepting constructive criticism -* Focusing on what is best for the community -* Showing empathy towards other community members - -Examples of unacceptable behavior by participants include: - -* The use of sexualized language or imagery and unwelcome sexual attention or advances -* Trolling, insulting/derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or electronic address, without explicit permission -* Other conduct which could reasonably be considered inappropriate in a professional setting - -## Our Responsibilities - -Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. - -Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. - -## Scope - -This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. - -## Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at i@dario.im. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. - -Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. - -## Attribution - -This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] - -[homepage]: http://contributor-covenant.org -[version]: http://contributor-covenant.org/version/1/4/ diff --git a/vendor/github.com/imdario/mergo/LICENSE b/vendor/github.com/imdario/mergo/LICENSE deleted file mode 100644 index 686680298..000000000 --- a/vendor/github.com/imdario/mergo/LICENSE +++ /dev/null @@ -1,28 +0,0 @@ -Copyright (c) 2013 Dario Castañé. All rights reserved. -Copyright (c) 2012 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/imdario/mergo/README.md b/vendor/github.com/imdario/mergo/README.md deleted file mode 100644 index 876abb500..000000000 --- a/vendor/github.com/imdario/mergo/README.md +++ /dev/null @@ -1,247 +0,0 @@ -# Mergo - - -[![GoDoc][3]][4] -[![GitHub release][5]][6] -[![GoCard][7]][8] -[![Build Status][1]][2] -[![Coverage Status][9]][10] -[![Sourcegraph][11]][12] -[![FOSSA Status][13]][14] - -[![GoCenter Kudos][15]][16] - -[1]: https://travis-ci.org/imdario/mergo.png -[2]: https://travis-ci.org/imdario/mergo -[3]: https://godoc.org/github.com/imdario/mergo?status.svg -[4]: https://godoc.org/github.com/imdario/mergo -[5]: https://img.shields.io/github/release/imdario/mergo.svg -[6]: https://github.com/imdario/mergo/releases -[7]: https://goreportcard.com/badge/imdario/mergo -[8]: https://goreportcard.com/report/github.com/imdario/mergo -[9]: https://coveralls.io/repos/github/imdario/mergo/badge.svg?branch=master -[10]: https://coveralls.io/github/imdario/mergo?branch=master -[11]: https://sourcegraph.com/github.com/imdario/mergo/-/badge.svg -[12]: https://sourcegraph.com/github.com/imdario/mergo?badge -[13]: https://app.fossa.io/api/projects/git%2Bgithub.com%2Fimdario%2Fmergo.svg?type=shield -[14]: https://app.fossa.io/projects/git%2Bgithub.com%2Fimdario%2Fmergo?ref=badge_shield -[15]: https://search.gocenter.io/api/ui/badge/github.com%2Fimdario%2Fmergo -[16]: https://search.gocenter.io/github.com/imdario/mergo - -A helper to merge structs and maps in Golang. Useful for configuration default values, avoiding messy if-statements. - -Mergo merges same-type structs and maps by setting default values in zero-value fields. Mergo won't merge unexported (private) fields. It will do recursively any exported one. It also won't merge structs inside maps (because they are not addressable using Go reflection). - -Also a lovely [comune](http://en.wikipedia.org/wiki/Mergo) (municipality) in the Province of Ancona in the Italian region of Marche. - -## Status - -It is ready for production use. [It is used in several projects by Docker, Google, The Linux Foundation, VMWare, Shopify, etc](https://github.com/imdario/mergo#mergo-in-the-wild). - -### Important note - -Please keep in mind that a problematic PR broke [0.3.9](//github.com/imdario/mergo/releases/tag/0.3.9). I reverted it in [0.3.10](//github.com/imdario/mergo/releases/tag/0.3.10), and I consider it stable but not bug-free. Also, this version adds suppot for go modules. - -Keep in mind that in [0.3.2](//github.com/imdario/mergo/releases/tag/0.3.2), Mergo changed `Merge()`and `Map()` signatures to support [transformers](#transformers). I added an optional/variadic argument so that it won't break the existing code. - -If you were using Mergo before April 6th, 2015, please check your project works as intended after updating your local copy with ```go get -u github.com/imdario/mergo```. I apologize for any issue caused by its previous behavior and any future bug that Mergo could cause in existing projects after the change (release 0.2.0). - -### Donations - -If Mergo is useful to you, consider buying me a coffee, a beer, or making a monthly donation to allow me to keep building great free software. :heart_eyes: - -Buy Me a Coffee at ko-fi.com -[![Beerpay](https://beerpay.io/imdario/mergo/badge.svg)](https://beerpay.io/imdario/mergo) -[![Beerpay](https://beerpay.io/imdario/mergo/make-wish.svg)](https://beerpay.io/imdario/mergo) -Donate using Liberapay - -### Mergo in the wild - -- [moby/moby](https://github.com/moby/moby) -- [kubernetes/kubernetes](https://github.com/kubernetes/kubernetes) -- [vmware/dispatch](https://github.com/vmware/dispatch) -- [Shopify/themekit](https://github.com/Shopify/themekit) -- [imdario/zas](https://github.com/imdario/zas) -- [matcornic/hermes](https://github.com/matcornic/hermes) -- [OpenBazaar/openbazaar-go](https://github.com/OpenBazaar/openbazaar-go) -- [kataras/iris](https://github.com/kataras/iris) -- [michaelsauter/crane](https://github.com/michaelsauter/crane) -- [go-task/task](https://github.com/go-task/task) -- [sensu/uchiwa](https://github.com/sensu/uchiwa) -- [ory/hydra](https://github.com/ory/hydra) -- [sisatech/vcli](https://github.com/sisatech/vcli) -- [dairycart/dairycart](https://github.com/dairycart/dairycart) -- [projectcalico/felix](https://github.com/projectcalico/felix) -- [resin-os/balena](https://github.com/resin-os/balena) -- [go-kivik/kivik](https://github.com/go-kivik/kivik) -- [Telefonica/govice](https://github.com/Telefonica/govice) -- [supergiant/supergiant](supergiant/supergiant) -- [SergeyTsalkov/brooce](https://github.com/SergeyTsalkov/brooce) -- [soniah/dnsmadeeasy](https://github.com/soniah/dnsmadeeasy) -- [ohsu-comp-bio/funnel](https://github.com/ohsu-comp-bio/funnel) -- [EagerIO/Stout](https://github.com/EagerIO/Stout) -- [lynndylanhurley/defsynth-api](https://github.com/lynndylanhurley/defsynth-api) -- [russross/canvasassignments](https://github.com/russross/canvasassignments) -- [rdegges/cryptly-api](https://github.com/rdegges/cryptly-api) -- [casualjim/exeggutor](https://github.com/casualjim/exeggutor) -- [divshot/gitling](https://github.com/divshot/gitling) -- [RWJMurphy/gorl](https://github.com/RWJMurphy/gorl) -- [andrerocker/deploy42](https://github.com/andrerocker/deploy42) -- [elwinar/rambler](https://github.com/elwinar/rambler) -- [tmaiaroto/gopartman](https://github.com/tmaiaroto/gopartman) -- [jfbus/impressionist](https://github.com/jfbus/impressionist) -- [Jmeyering/zealot](https://github.com/Jmeyering/zealot) -- [godep-migrator/rigger-host](https://github.com/godep-migrator/rigger-host) -- [Dronevery/MultiwaySwitch-Go](https://github.com/Dronevery/MultiwaySwitch-Go) -- [thoas/picfit](https://github.com/thoas/picfit) -- [mantasmatelis/whooplist-server](https://github.com/mantasmatelis/whooplist-server) -- [jnuthong/item_search](https://github.com/jnuthong/item_search) -- [bukalapak/snowboard](https://github.com/bukalapak/snowboard) -- [janoszen/containerssh](https://github.com/janoszen/containerssh) - -## Install - - go get github.com/imdario/mergo - - // use in your .go code - import ( - "github.com/imdario/mergo" - ) - -## Usage - -You can only merge same-type structs with exported fields initialized as zero value of their type and same-types maps. Mergo won't merge unexported (private) fields but will do recursively any exported one. It won't merge empty structs value as [they are zero values](https://golang.org/ref/spec#The_zero_value) too. Also, maps will be merged recursively except for structs inside maps (because they are not addressable using Go reflection). - -```go -if err := mergo.Merge(&dst, src); err != nil { - // ... -} -``` - -Also, you can merge overwriting values using the transformer `WithOverride`. - -```go -if err := mergo.Merge(&dst, src, mergo.WithOverride); err != nil { - // ... -} -``` - -Additionally, you can map a `map[string]interface{}` to a struct (and otherwise, from struct to map), following the same restrictions as in `Merge()`. Keys are capitalized to find each corresponding exported field. - -```go -if err := mergo.Map(&dst, srcMap); err != nil { - // ... -} -``` - -Warning: if you map a struct to map, it won't do it recursively. Don't expect Mergo to map struct members of your struct as `map[string]interface{}`. They will be just assigned as values. - -Here is a nice example: - -```go -package main - -import ( - "fmt" - "github.com/imdario/mergo" -) - -type Foo struct { - A string - B int64 -} - -func main() { - src := Foo{ - A: "one", - B: 2, - } - dest := Foo{ - A: "two", - } - mergo.Merge(&dest, src) - fmt.Println(dest) - // Will print - // {two 2} -} -``` - -Note: if test are failing due missing package, please execute: - - go get gopkg.in/yaml.v2 - -### Transformers - -Transformers allow to merge specific types differently than in the default behavior. In other words, now you can customize how some types are merged. For example, `time.Time` is a struct; it doesn't have zero value but IsZero can return true because it has fields with zero value. How can we merge a non-zero `time.Time`? - -```go -package main - -import ( - "fmt" - "github.com/imdario/mergo" - "reflect" - "time" -) - -type timeTransformer struct { -} - -func (t timeTransformer) Transformer(typ reflect.Type) func(dst, src reflect.Value) error { - if typ == reflect.TypeOf(time.Time{}) { - return func(dst, src reflect.Value) error { - if dst.CanSet() { - isZero := dst.MethodByName("IsZero") - result := isZero.Call([]reflect.Value{}) - if result[0].Bool() { - dst.Set(src) - } - } - return nil - } - } - return nil -} - -type Snapshot struct { - Time time.Time - // ... -} - -func main() { - src := Snapshot{time.Now()} - dest := Snapshot{} - mergo.Merge(&dest, src, mergo.WithTransformers(timeTransformer{})) - fmt.Println(dest) - // Will print - // { 2018-01-12 01:15:00 +0000 UTC m=+0.000000001 } -} -``` - - -## Contact me - -If I can help you, you have an idea or you are using Mergo in your projects, don't hesitate to drop me a line (or a pull request): [@im_dario](https://twitter.com/im_dario) - -## About - -Written by [Dario Castañé](http://dario.im). - -## Top Contributors - -[![0](https://sourcerer.io/fame/imdario/imdario/mergo/images/0)](https://sourcerer.io/fame/imdario/imdario/mergo/links/0) -[![1](https://sourcerer.io/fame/imdario/imdario/mergo/images/1)](https://sourcerer.io/fame/imdario/imdario/mergo/links/1) -[![2](https://sourcerer.io/fame/imdario/imdario/mergo/images/2)](https://sourcerer.io/fame/imdario/imdario/mergo/links/2) -[![3](https://sourcerer.io/fame/imdario/imdario/mergo/images/3)](https://sourcerer.io/fame/imdario/imdario/mergo/links/3) -[![4](https://sourcerer.io/fame/imdario/imdario/mergo/images/4)](https://sourcerer.io/fame/imdario/imdario/mergo/links/4) -[![5](https://sourcerer.io/fame/imdario/imdario/mergo/images/5)](https://sourcerer.io/fame/imdario/imdario/mergo/links/5) -[![6](https://sourcerer.io/fame/imdario/imdario/mergo/images/6)](https://sourcerer.io/fame/imdario/imdario/mergo/links/6) -[![7](https://sourcerer.io/fame/imdario/imdario/mergo/images/7)](https://sourcerer.io/fame/imdario/imdario/mergo/links/7) - - -## License - -[BSD 3-Clause](http://opensource.org/licenses/BSD-3-Clause) license, as [Go language](http://golang.org/LICENSE). - - -[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fimdario%2Fmergo.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fimdario%2Fmergo?ref=badge_large) diff --git a/vendor/github.com/imdario/mergo/doc.go b/vendor/github.com/imdario/mergo/doc.go deleted file mode 100644 index fcd985f99..000000000 --- a/vendor/github.com/imdario/mergo/doc.go +++ /dev/null @@ -1,143 +0,0 @@ -// Copyright 2013 Dario Castañé. All rights reserved. -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -/* -A helper to merge structs and maps in Golang. Useful for configuration default values, avoiding messy if-statements. - -Mergo merges same-type structs and maps by setting default values in zero-value fields. Mergo won't merge unexported (private) fields. It will do recursively any exported one. It also won't merge structs inside maps (because they are not addressable using Go reflection). - -Status - -It is ready for production use. It is used in several projects by Docker, Google, The Linux Foundation, VMWare, Shopify, etc. - -Important note - -Please keep in mind that a problematic PR broke 0.3.9. We reverted it in 0.3.10. We consider 0.3.10 as stable but not bug-free. . Also, this version adds suppot for go modules. - -Keep in mind that in 0.3.2, Mergo changed Merge() and Map() signatures to support transformers. We added an optional/variadic argument so that it won't break the existing code. - -If you were using Mergo before April 6th, 2015, please check your project works as intended after updating your local copy with go get -u github.com/imdario/mergo. I apologize for any issue caused by its previous behavior and any future bug that Mergo could cause in existing projects after the change (release 0.2.0). - -Install - -Do your usual installation procedure: - - go get github.com/imdario/mergo - - // use in your .go code - import ( - "github.com/imdario/mergo" - ) - -Usage - -You can only merge same-type structs with exported fields initialized as zero value of their type and same-types maps. Mergo won't merge unexported (private) fields but will do recursively any exported one. It won't merge empty structs value as they are zero values too. Also, maps will be merged recursively except for structs inside maps (because they are not addressable using Go reflection). - - if err := mergo.Merge(&dst, src); err != nil { - // ... - } - -Also, you can merge overwriting values using the transformer WithOverride. - - if err := mergo.Merge(&dst, src, mergo.WithOverride); err != nil { - // ... - } - -Additionally, you can map a map[string]interface{} to a struct (and otherwise, from struct to map), following the same restrictions as in Merge(). Keys are capitalized to find each corresponding exported field. - - if err := mergo.Map(&dst, srcMap); err != nil { - // ... - } - -Warning: if you map a struct to map, it won't do it recursively. Don't expect Mergo to map struct members of your struct as map[string]interface{}. They will be just assigned as values. - -Here is a nice example: - - package main - - import ( - "fmt" - "github.com/imdario/mergo" - ) - - type Foo struct { - A string - B int64 - } - - func main() { - src := Foo{ - A: "one", - B: 2, - } - dest := Foo{ - A: "two", - } - mergo.Merge(&dest, src) - fmt.Println(dest) - // Will print - // {two 2} - } - -Transformers - -Transformers allow to merge specific types differently than in the default behavior. In other words, now you can customize how some types are merged. For example, time.Time is a struct; it doesn't have zero value but IsZero can return true because it has fields with zero value. How can we merge a non-zero time.Time? - - package main - - import ( - "fmt" - "github.com/imdario/mergo" - "reflect" - "time" - ) - - type timeTransformer struct { - } - - func (t timeTransformer) Transformer(typ reflect.Type) func(dst, src reflect.Value) error { - if typ == reflect.TypeOf(time.Time{}) { - return func(dst, src reflect.Value) error { - if dst.CanSet() { - isZero := dst.MethodByName("IsZero") - result := isZero.Call([]reflect.Value{}) - if result[0].Bool() { - dst.Set(src) - } - } - return nil - } - } - return nil - } - - type Snapshot struct { - Time time.Time - // ... - } - - func main() { - src := Snapshot{time.Now()} - dest := Snapshot{} - mergo.Merge(&dest, src, mergo.WithTransformers(timeTransformer{})) - fmt.Println(dest) - // Will print - // { 2018-01-12 01:15:00 +0000 UTC m=+0.000000001 } - } - -Contact me - -If I can help you, you have an idea or you are using Mergo in your projects, don't hesitate to drop me a line (or a pull request): https://twitter.com/im_dario - -About - -Written by Dario Castañé: https://da.rio.hn - -License - -BSD 3-Clause license, as Go language. - -*/ -package mergo diff --git a/vendor/github.com/imdario/mergo/map.go b/vendor/github.com/imdario/mergo/map.go deleted file mode 100644 index a13a7ee46..000000000 --- a/vendor/github.com/imdario/mergo/map.go +++ /dev/null @@ -1,178 +0,0 @@ -// Copyright 2014 Dario Castañé. All rights reserved. -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Based on src/pkg/reflect/deepequal.go from official -// golang's stdlib. - -package mergo - -import ( - "fmt" - "reflect" - "unicode" - "unicode/utf8" -) - -func changeInitialCase(s string, mapper func(rune) rune) string { - if s == "" { - return s - } - r, n := utf8.DecodeRuneInString(s) - return string(mapper(r)) + s[n:] -} - -func isExported(field reflect.StructField) bool { - r, _ := utf8.DecodeRuneInString(field.Name) - return r >= 'A' && r <= 'Z' -} - -// Traverses recursively both values, assigning src's fields values to dst. -// The map argument tracks comparisons that have already been seen, which allows -// short circuiting on recursive types. -func deepMap(dst, src reflect.Value, visited map[uintptr]*visit, depth int, config *Config) (err error) { - overwrite := config.Overwrite - if dst.CanAddr() { - addr := dst.UnsafeAddr() - h := 17 * addr - seen := visited[h] - typ := dst.Type() - for p := seen; p != nil; p = p.next { - if p.ptr == addr && p.typ == typ { - return nil - } - } - // Remember, remember... - visited[h] = &visit{addr, typ, seen} - } - zeroValue := reflect.Value{} - switch dst.Kind() { - case reflect.Map: - dstMap := dst.Interface().(map[string]interface{}) - for i, n := 0, src.NumField(); i < n; i++ { - srcType := src.Type() - field := srcType.Field(i) - if !isExported(field) { - continue - } - fieldName := field.Name - fieldName = changeInitialCase(fieldName, unicode.ToLower) - if v, ok := dstMap[fieldName]; !ok || (isEmptyValue(reflect.ValueOf(v)) || overwrite) { - dstMap[fieldName] = src.Field(i).Interface() - } - } - case reflect.Ptr: - if dst.IsNil() { - v := reflect.New(dst.Type().Elem()) - dst.Set(v) - } - dst = dst.Elem() - fallthrough - case reflect.Struct: - srcMap := src.Interface().(map[string]interface{}) - for key := range srcMap { - config.overwriteWithEmptyValue = true - srcValue := srcMap[key] - fieldName := changeInitialCase(key, unicode.ToUpper) - dstElement := dst.FieldByName(fieldName) - if dstElement == zeroValue { - // We discard it because the field doesn't exist. - continue - } - srcElement := reflect.ValueOf(srcValue) - dstKind := dstElement.Kind() - srcKind := srcElement.Kind() - if srcKind == reflect.Ptr && dstKind != reflect.Ptr { - srcElement = srcElement.Elem() - srcKind = reflect.TypeOf(srcElement.Interface()).Kind() - } else if dstKind == reflect.Ptr { - // Can this work? I guess it can't. - if srcKind != reflect.Ptr && srcElement.CanAddr() { - srcPtr := srcElement.Addr() - srcElement = reflect.ValueOf(srcPtr) - srcKind = reflect.Ptr - } - } - - if !srcElement.IsValid() { - continue - } - if srcKind == dstKind { - if err = deepMerge(dstElement, srcElement, visited, depth+1, config); err != nil { - return - } - } else if dstKind == reflect.Interface && dstElement.Kind() == reflect.Interface { - if err = deepMerge(dstElement, srcElement, visited, depth+1, config); err != nil { - return - } - } else if srcKind == reflect.Map { - if err = deepMap(dstElement, srcElement, visited, depth+1, config); err != nil { - return - } - } else { - return fmt.Errorf("type mismatch on %s field: found %v, expected %v", fieldName, srcKind, dstKind) - } - } - } - return -} - -// Map sets fields' values in dst from src. -// src can be a map with string keys or a struct. dst must be the opposite: -// if src is a map, dst must be a valid pointer to struct. If src is a struct, -// dst must be map[string]interface{}. -// It won't merge unexported (private) fields and will do recursively -// any exported field. -// If dst is a map, keys will be src fields' names in lower camel case. -// Missing key in src that doesn't match a field in dst will be skipped. This -// doesn't apply if dst is a map. -// This is separated method from Merge because it is cleaner and it keeps sane -// semantics: merging equal types, mapping different (restricted) types. -func Map(dst, src interface{}, opts ...func(*Config)) error { - return _map(dst, src, opts...) -} - -// MapWithOverwrite will do the same as Map except that non-empty dst attributes will be overridden by -// non-empty src attribute values. -// Deprecated: Use Map(…) with WithOverride -func MapWithOverwrite(dst, src interface{}, opts ...func(*Config)) error { - return _map(dst, src, append(opts, WithOverride)...) -} - -func _map(dst, src interface{}, opts ...func(*Config)) error { - if dst != nil && reflect.ValueOf(dst).Kind() != reflect.Ptr { - return ErrNonPointerAgument - } - var ( - vDst, vSrc reflect.Value - err error - ) - config := &Config{} - - for _, opt := range opts { - opt(config) - } - - if vDst, vSrc, err = resolveValues(dst, src); err != nil { - return err - } - // To be friction-less, we redirect equal-type arguments - // to deepMerge. Only because arguments can be anything. - if vSrc.Kind() == vDst.Kind() { - return deepMerge(vDst, vSrc, make(map[uintptr]*visit), 0, config) - } - switch vSrc.Kind() { - case reflect.Struct: - if vDst.Kind() != reflect.Map { - return ErrExpectedMapAsDestination - } - case reflect.Map: - if vDst.Kind() != reflect.Struct { - return ErrExpectedStructAsDestination - } - default: - return ErrNotSupported - } - return deepMap(vDst, vSrc, make(map[uintptr]*visit), 0, config) -} diff --git a/vendor/github.com/imdario/mergo/merge.go b/vendor/github.com/imdario/mergo/merge.go deleted file mode 100644 index afa84a1e2..000000000 --- a/vendor/github.com/imdario/mergo/merge.go +++ /dev/null @@ -1,375 +0,0 @@ -// Copyright 2013 Dario Castañé. All rights reserved. -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Based on src/pkg/reflect/deepequal.go from official -// golang's stdlib. - -package mergo - -import ( - "fmt" - "reflect" -) - -func hasMergeableFields(dst reflect.Value) (exported bool) { - for i, n := 0, dst.NumField(); i < n; i++ { - field := dst.Type().Field(i) - if field.Anonymous && dst.Field(i).Kind() == reflect.Struct { - exported = exported || hasMergeableFields(dst.Field(i)) - } else if isExportedComponent(&field) { - exported = exported || len(field.PkgPath) == 0 - } - } - return -} - -func isExportedComponent(field *reflect.StructField) bool { - pkgPath := field.PkgPath - if len(pkgPath) > 0 { - return false - } - c := field.Name[0] - if 'a' <= c && c <= 'z' || c == '_' { - return false - } - return true -} - -type Config struct { - Overwrite bool - AppendSlice bool - TypeCheck bool - Transformers Transformers - overwriteWithEmptyValue bool - overwriteSliceWithEmptyValue bool - sliceDeepCopy bool - debug bool -} - -type Transformers interface { - Transformer(reflect.Type) func(dst, src reflect.Value) error -} - -// Traverses recursively both values, assigning src's fields values to dst. -// The map argument tracks comparisons that have already been seen, which allows -// short circuiting on recursive types. -func deepMerge(dst, src reflect.Value, visited map[uintptr]*visit, depth int, config *Config) (err error) { - overwrite := config.Overwrite - typeCheck := config.TypeCheck - overwriteWithEmptySrc := config.overwriteWithEmptyValue - overwriteSliceWithEmptySrc := config.overwriteSliceWithEmptyValue - sliceDeepCopy := config.sliceDeepCopy - - if !src.IsValid() { - return - } - if dst.CanAddr() { - addr := dst.UnsafeAddr() - h := 17 * addr - seen := visited[h] - typ := dst.Type() - for p := seen; p != nil; p = p.next { - if p.ptr == addr && p.typ == typ { - return nil - } - } - // Remember, remember... - visited[h] = &visit{addr, typ, seen} - } - - if config.Transformers != nil && !isEmptyValue(dst) { - if fn := config.Transformers.Transformer(dst.Type()); fn != nil { - err = fn(dst, src) - return - } - } - - switch dst.Kind() { - case reflect.Struct: - if hasMergeableFields(dst) { - for i, n := 0, dst.NumField(); i < n; i++ { - if err = deepMerge(dst.Field(i), src.Field(i), visited, depth+1, config); err != nil { - return - } - } - } else { - if (isReflectNil(dst) || overwrite) && (!isEmptyValue(src) || overwriteWithEmptySrc) { - dst.Set(src) - } - } - case reflect.Map: - if dst.IsNil() && !src.IsNil() { - dst.Set(reflect.MakeMap(dst.Type())) - } - - if src.Kind() != reflect.Map { - if overwrite { - dst.Set(src) - } - return - } - - for _, key := range src.MapKeys() { - srcElement := src.MapIndex(key) - if !srcElement.IsValid() { - continue - } - dstElement := dst.MapIndex(key) - switch srcElement.Kind() { - case reflect.Chan, reflect.Func, reflect.Map, reflect.Interface, reflect.Slice: - if srcElement.IsNil() { - if overwrite { - dst.SetMapIndex(key, srcElement) - } - continue - } - fallthrough - default: - if !srcElement.CanInterface() { - continue - } - switch reflect.TypeOf(srcElement.Interface()).Kind() { - case reflect.Struct: - fallthrough - case reflect.Ptr: - fallthrough - case reflect.Map: - srcMapElm := srcElement - dstMapElm := dstElement - if srcMapElm.CanInterface() { - srcMapElm = reflect.ValueOf(srcMapElm.Interface()) - if dstMapElm.IsValid() { - dstMapElm = reflect.ValueOf(dstMapElm.Interface()) - } - } - if err = deepMerge(dstMapElm, srcMapElm, visited, depth+1, config); err != nil { - return - } - case reflect.Slice: - srcSlice := reflect.ValueOf(srcElement.Interface()) - - var dstSlice reflect.Value - if !dstElement.IsValid() || dstElement.IsNil() { - dstSlice = reflect.MakeSlice(srcSlice.Type(), 0, srcSlice.Len()) - } else { - dstSlice = reflect.ValueOf(dstElement.Interface()) - } - - if (!isEmptyValue(src) || overwriteWithEmptySrc || overwriteSliceWithEmptySrc) && (overwrite || isEmptyValue(dst)) && !config.AppendSlice && !sliceDeepCopy { - if typeCheck && srcSlice.Type() != dstSlice.Type() { - return fmt.Errorf("cannot override two slices with different type (%s, %s)", srcSlice.Type(), dstSlice.Type()) - } - dstSlice = srcSlice - } else if config.AppendSlice { - if srcSlice.Type() != dstSlice.Type() { - return fmt.Errorf("cannot append two slices with different type (%s, %s)", srcSlice.Type(), dstSlice.Type()) - } - dstSlice = reflect.AppendSlice(dstSlice, srcSlice) - } else if sliceDeepCopy { - i := 0 - for ; i < srcSlice.Len() && i < dstSlice.Len(); i++ { - srcElement := srcSlice.Index(i) - dstElement := dstSlice.Index(i) - - if srcElement.CanInterface() { - srcElement = reflect.ValueOf(srcElement.Interface()) - } - if dstElement.CanInterface() { - dstElement = reflect.ValueOf(dstElement.Interface()) - } - - if err = deepMerge(dstElement, srcElement, visited, depth+1, config); err != nil { - return - } - } - - } - dst.SetMapIndex(key, dstSlice) - } - } - if dstElement.IsValid() && !isEmptyValue(dstElement) && (reflect.TypeOf(srcElement.Interface()).Kind() == reflect.Map || reflect.TypeOf(srcElement.Interface()).Kind() == reflect.Slice) { - continue - } - - if srcElement.IsValid() && ((srcElement.Kind() != reflect.Ptr && overwrite) || !dstElement.IsValid() || isEmptyValue(dstElement)) { - if dst.IsNil() { - dst.Set(reflect.MakeMap(dst.Type())) - } - dst.SetMapIndex(key, srcElement) - } - } - case reflect.Slice: - if !dst.CanSet() { - break - } - if (!isEmptyValue(src) || overwriteWithEmptySrc || overwriteSliceWithEmptySrc) && (overwrite || isEmptyValue(dst)) && !config.AppendSlice && !sliceDeepCopy { - dst.Set(src) - } else if config.AppendSlice { - if src.Type() != dst.Type() { - return fmt.Errorf("cannot append two slice with different type (%s, %s)", src.Type(), dst.Type()) - } - dst.Set(reflect.AppendSlice(dst, src)) - } else if sliceDeepCopy { - for i := 0; i < src.Len() && i < dst.Len(); i++ { - srcElement := src.Index(i) - dstElement := dst.Index(i) - if srcElement.CanInterface() { - srcElement = reflect.ValueOf(srcElement.Interface()) - } - if dstElement.CanInterface() { - dstElement = reflect.ValueOf(dstElement.Interface()) - } - - if err = deepMerge(dstElement, srcElement, visited, depth+1, config); err != nil { - return - } - } - } - case reflect.Ptr: - fallthrough - case reflect.Interface: - if isReflectNil(src) { - if overwriteWithEmptySrc && dst.CanSet() && src.Type().AssignableTo(dst.Type()) { - dst.Set(src) - } - break - } - - if src.Kind() != reflect.Interface { - if dst.IsNil() || (src.Kind() != reflect.Ptr && overwrite) { - if dst.CanSet() && (overwrite || isEmptyValue(dst)) { - dst.Set(src) - } - } else if src.Kind() == reflect.Ptr { - if err = deepMerge(dst.Elem(), src.Elem(), visited, depth+1, config); err != nil { - return - } - } else if dst.Elem().Type() == src.Type() { - if err = deepMerge(dst.Elem(), src, visited, depth+1, config); err != nil { - return - } - } else { - return ErrDifferentArgumentsTypes - } - break - } - - if dst.IsNil() || overwrite { - if dst.CanSet() && (overwrite || isEmptyValue(dst)) { - dst.Set(src) - } - break - } - - if dst.Elem().Kind() == src.Elem().Kind() { - if err = deepMerge(dst.Elem(), src.Elem(), visited, depth+1, config); err != nil { - return - } - break - } - default: - mustSet := (isEmptyValue(dst) || overwrite) && (!isEmptyValue(src) || overwriteWithEmptySrc) - if mustSet { - if dst.CanSet() { - dst.Set(src) - } else { - dst = src - } - } - } - - return -} - -// Merge will fill any empty for value type attributes on the dst struct using corresponding -// src attributes if they themselves are not empty. dst and src must be valid same-type structs -// and dst must be a pointer to struct. -// It won't merge unexported (private) fields and will do recursively any exported field. -func Merge(dst, src interface{}, opts ...func(*Config)) error { - return merge(dst, src, opts...) -} - -// MergeWithOverwrite will do the same as Merge except that non-empty dst attributes will be overridden by -// non-empty src attribute values. -// Deprecated: use Merge(…) with WithOverride -func MergeWithOverwrite(dst, src interface{}, opts ...func(*Config)) error { - return merge(dst, src, append(opts, WithOverride)...) -} - -// WithTransformers adds transformers to merge, allowing to customize the merging of some types. -func WithTransformers(transformers Transformers) func(*Config) { - return func(config *Config) { - config.Transformers = transformers - } -} - -// WithOverride will make merge override non-empty dst attributes with non-empty src attributes values. -func WithOverride(config *Config) { - config.Overwrite = true -} - -// WithOverwriteWithEmptyValue will make merge override non empty dst attributes with empty src attributes values. -func WithOverwriteWithEmptyValue(config *Config) { - config.Overwrite = true - config.overwriteWithEmptyValue = true -} - -// WithOverrideEmptySlice will make merge override empty dst slice with empty src slice. -func WithOverrideEmptySlice(config *Config) { - config.overwriteSliceWithEmptyValue = true -} - -// WithAppendSlice will make merge append slices instead of overwriting it. -func WithAppendSlice(config *Config) { - config.AppendSlice = true -} - -// WithTypeCheck will make merge check types while overwriting it (must be used with WithOverride). -func WithTypeCheck(config *Config) { - config.TypeCheck = true -} - -// WithSliceDeepCopy will merge slice element one by one with Overwrite flag. -func WithSliceDeepCopy(config *Config) { - config.sliceDeepCopy = true - config.Overwrite = true -} - -func merge(dst, src interface{}, opts ...func(*Config)) error { - if dst != nil && reflect.ValueOf(dst).Kind() != reflect.Ptr { - return ErrNonPointerAgument - } - var ( - vDst, vSrc reflect.Value - err error - ) - - config := &Config{} - - for _, opt := range opts { - opt(config) - } - - if vDst, vSrc, err = resolveValues(dst, src); err != nil { - return err - } - if vDst.Type() != vSrc.Type() { - return ErrDifferentArgumentsTypes - } - return deepMerge(vDst, vSrc, make(map[uintptr]*visit), 0, config) -} - -// IsReflectNil is the reflect value provided nil -func isReflectNil(v reflect.Value) bool { - k := v.Kind() - switch k { - case reflect.Interface, reflect.Slice, reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr: - // Both interface and slice are nil if first word is 0. - // Both are always bigger than a word; assume flagIndir. - return v.IsNil() - default: - return false - } -} diff --git a/vendor/github.com/imdario/mergo/mergo.go b/vendor/github.com/imdario/mergo/mergo.go deleted file mode 100644 index 3cc926c7f..000000000 --- a/vendor/github.com/imdario/mergo/mergo.go +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2013 Dario Castañé. All rights reserved. -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Based on src/pkg/reflect/deepequal.go from official -// golang's stdlib. - -package mergo - -import ( - "errors" - "reflect" -) - -// Errors reported by Mergo when it finds invalid arguments. -var ( - ErrNilArguments = errors.New("src and dst must not be nil") - ErrDifferentArgumentsTypes = errors.New("src and dst must be of same type") - ErrNotSupported = errors.New("only structs and maps are supported") - ErrExpectedMapAsDestination = errors.New("dst was expected to be a map") - ErrExpectedStructAsDestination = errors.New("dst was expected to be a struct") - ErrNonPointerAgument = errors.New("dst must be a pointer") -) - -// During deepMerge, must keep track of checks that are -// in progress. The comparison algorithm assumes that all -// checks in progress are true when it reencounters them. -// Visited are stored in a map indexed by 17 * a1 + a2; -type visit struct { - ptr uintptr - typ reflect.Type - next *visit -} - -// From src/pkg/encoding/json/encode.go. -func isEmptyValue(v reflect.Value) bool { - switch v.Kind() { - case reflect.Array, reflect.Map, reflect.Slice, reflect.String: - return v.Len() == 0 - case reflect.Bool: - return !v.Bool() - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return v.Int() == 0 - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - return v.Uint() == 0 - case reflect.Float32, reflect.Float64: - return v.Float() == 0 - case reflect.Interface, reflect.Ptr: - if v.IsNil() { - return true - } - return isEmptyValue(v.Elem()) - case reflect.Func: - return v.IsNil() - case reflect.Invalid: - return true - } - return false -} - -func resolveValues(dst, src interface{}) (vDst, vSrc reflect.Value, err error) { - if dst == nil || src == nil { - err = ErrNilArguments - return - } - vDst = reflect.ValueOf(dst).Elem() - if vDst.Kind() != reflect.Struct && vDst.Kind() != reflect.Map { - err = ErrNotSupported - return - } - vSrc = reflect.ValueOf(src) - // We check if vSrc is a pointer to dereference it. - if vSrc.Kind() == reflect.Ptr { - vSrc = vSrc.Elem() - } - return -} diff --git a/vendor/github.com/inconshreveable/mousetrap/LICENSE b/vendor/github.com/inconshreveable/mousetrap/LICENSE deleted file mode 100644 index 5f920e973..000000000 --- a/vendor/github.com/inconshreveable/mousetrap/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2022 Alan Shreve (@inconshreveable) - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/github.com/inconshreveable/mousetrap/README.md b/vendor/github.com/inconshreveable/mousetrap/README.md deleted file mode 100644 index 7a950d177..000000000 --- a/vendor/github.com/inconshreveable/mousetrap/README.md +++ /dev/null @@ -1,23 +0,0 @@ -# mousetrap - -mousetrap is a tiny library that answers a single question. - -On a Windows machine, was the process invoked by someone double clicking on -the executable file while browsing in explorer? - -### Motivation - -Windows developers unfamiliar with command line tools will often "double-click" -the executable for a tool. Because most CLI tools print the help and then exit -when invoked without arguments, this is often very frustrating for those users. - -mousetrap provides a way to detect these invocations so that you can provide -more helpful behavior and instructions on how to run the CLI tool. To see what -this looks like, both from an organizational and a technical perspective, see -https://inconshreveable.com/09-09-2014/sweat-the-small-stuff/ - -### The interface - -The library exposes a single interface: - - func StartedByExplorer() (bool) diff --git a/vendor/github.com/inconshreveable/mousetrap/trap_others.go b/vendor/github.com/inconshreveable/mousetrap/trap_others.go deleted file mode 100644 index 9d2d8a4ba..000000000 --- a/vendor/github.com/inconshreveable/mousetrap/trap_others.go +++ /dev/null @@ -1,15 +0,0 @@ -// +build !windows - -package mousetrap - -// StartedByExplorer returns true if the program was invoked by the user -// double-clicking on the executable from explorer.exe -// -// It is conservative and returns false if any of the internal calls fail. -// It does not guarantee that the program was run from a terminal. It only can tell you -// whether it was launched from explorer.exe -// -// On non-Windows platforms, it always returns false. -func StartedByExplorer() bool { - return false -} diff --git a/vendor/github.com/inconshreveable/mousetrap/trap_windows.go b/vendor/github.com/inconshreveable/mousetrap/trap_windows.go deleted file mode 100644 index 336142a5e..000000000 --- a/vendor/github.com/inconshreveable/mousetrap/trap_windows.go +++ /dev/null @@ -1,98 +0,0 @@ -// +build windows -// +build !go1.4 - -package mousetrap - -import ( - "fmt" - "os" - "syscall" - "unsafe" -) - -const ( - // defined by the Win32 API - th32cs_snapprocess uintptr = 0x2 -) - -var ( - kernel = syscall.MustLoadDLL("kernel32.dll") - CreateToolhelp32Snapshot = kernel.MustFindProc("CreateToolhelp32Snapshot") - Process32First = kernel.MustFindProc("Process32FirstW") - Process32Next = kernel.MustFindProc("Process32NextW") -) - -// ProcessEntry32 structure defined by the Win32 API -type processEntry32 struct { - dwSize uint32 - cntUsage uint32 - th32ProcessID uint32 - th32DefaultHeapID int - th32ModuleID uint32 - cntThreads uint32 - th32ParentProcessID uint32 - pcPriClassBase int32 - dwFlags uint32 - szExeFile [syscall.MAX_PATH]uint16 -} - -func getProcessEntry(pid int) (pe *processEntry32, err error) { - snapshot, _, e1 := CreateToolhelp32Snapshot.Call(th32cs_snapprocess, uintptr(0)) - if snapshot == uintptr(syscall.InvalidHandle) { - err = fmt.Errorf("CreateToolhelp32Snapshot: %v", e1) - return - } - defer syscall.CloseHandle(syscall.Handle(snapshot)) - - var processEntry processEntry32 - processEntry.dwSize = uint32(unsafe.Sizeof(processEntry)) - ok, _, e1 := Process32First.Call(snapshot, uintptr(unsafe.Pointer(&processEntry))) - if ok == 0 { - err = fmt.Errorf("Process32First: %v", e1) - return - } - - for { - if processEntry.th32ProcessID == uint32(pid) { - pe = &processEntry - return - } - - ok, _, e1 = Process32Next.Call(snapshot, uintptr(unsafe.Pointer(&processEntry))) - if ok == 0 { - err = fmt.Errorf("Process32Next: %v", e1) - return - } - } -} - -func getppid() (pid int, err error) { - pe, err := getProcessEntry(os.Getpid()) - if err != nil { - return - } - - pid = int(pe.th32ParentProcessID) - return -} - -// StartedByExplorer returns true if the program was invoked by the user double-clicking -// on the executable from explorer.exe -// -// It is conservative and returns false if any of the internal calls fail. -// It does not guarantee that the program was run from a terminal. It only can tell you -// whether it was launched from explorer.exe -func StartedByExplorer() bool { - ppid, err := getppid() - if err != nil { - return false - } - - pe, err := getProcessEntry(ppid) - if err != nil { - return false - } - - name := syscall.UTF16ToString(pe.szExeFile[:]) - return name == "explorer.exe" -} diff --git a/vendor/github.com/inconshreveable/mousetrap/trap_windows_1.4.go b/vendor/github.com/inconshreveable/mousetrap/trap_windows_1.4.go deleted file mode 100644 index 9a28e57c3..000000000 --- a/vendor/github.com/inconshreveable/mousetrap/trap_windows_1.4.go +++ /dev/null @@ -1,46 +0,0 @@ -// +build windows -// +build go1.4 - -package mousetrap - -import ( - "os" - "syscall" - "unsafe" -) - -func getProcessEntry(pid int) (*syscall.ProcessEntry32, error) { - snapshot, err := syscall.CreateToolhelp32Snapshot(syscall.TH32CS_SNAPPROCESS, 0) - if err != nil { - return nil, err - } - defer syscall.CloseHandle(snapshot) - var procEntry syscall.ProcessEntry32 - procEntry.Size = uint32(unsafe.Sizeof(procEntry)) - if err = syscall.Process32First(snapshot, &procEntry); err != nil { - return nil, err - } - for { - if procEntry.ProcessID == uint32(pid) { - return &procEntry, nil - } - err = syscall.Process32Next(snapshot, &procEntry) - if err != nil { - return nil, err - } - } -} - -// StartedByExplorer returns true if the program was invoked by the user double-clicking -// on the executable from explorer.exe -// -// It is conservative and returns false if any of the internal calls fail. -// It does not guarantee that the program was run from a terminal. It only can tell you -// whether it was launched from explorer.exe -func StartedByExplorer() bool { - pe, err := getProcessEntry(os.Getppid()) - if err != nil { - return false - } - return "explorer.exe" == syscall.UTF16ToString(pe.ExeFile[:]) -} diff --git a/vendor/github.com/josharian/intern/README.md b/vendor/github.com/josharian/intern/README.md deleted file mode 100644 index ffc44b219..000000000 --- a/vendor/github.com/josharian/intern/README.md +++ /dev/null @@ -1,5 +0,0 @@ -Docs: https://godoc.org/github.com/josharian/intern - -See also [Go issue 5160](https://golang.org/issue/5160). - -License: MIT diff --git a/vendor/github.com/josharian/intern/intern.go b/vendor/github.com/josharian/intern/intern.go deleted file mode 100644 index 7acb1fe90..000000000 --- a/vendor/github.com/josharian/intern/intern.go +++ /dev/null @@ -1,44 +0,0 @@ -// Package intern interns strings. -// Interning is best effort only. -// Interned strings may be removed automatically -// at any time without notification. -// All functions may be called concurrently -// with themselves and each other. -package intern - -import "sync" - -var ( - pool sync.Pool = sync.Pool{ - New: func() interface{} { - return make(map[string]string) - }, - } -) - -// String returns s, interned. -func String(s string) string { - m := pool.Get().(map[string]string) - c, ok := m[s] - if ok { - pool.Put(m) - return c - } - m[s] = s - pool.Put(m) - return s -} - -// Bytes returns b converted to a string, interned. -func Bytes(b []byte) string { - m := pool.Get().(map[string]string) - c, ok := m[string(b)] - if ok { - pool.Put(m) - return c - } - s := string(b) - m[s] = s - pool.Put(m) - return s -} diff --git a/vendor/github.com/josharian/intern/license.md b/vendor/github.com/josharian/intern/license.md deleted file mode 100644 index 353d3055f..000000000 --- a/vendor/github.com/josharian/intern/license.md +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2019 Josh Bleecher Snyder - -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/vendor/github.com/json-iterator/go/.codecov.yml b/vendor/github.com/json-iterator/go/.codecov.yml deleted file mode 100644 index 955dc0be5..000000000 --- a/vendor/github.com/json-iterator/go/.codecov.yml +++ /dev/null @@ -1,3 +0,0 @@ -ignore: - - "output_tests/.*" - diff --git a/vendor/github.com/json-iterator/go/.gitignore b/vendor/github.com/json-iterator/go/.gitignore deleted file mode 100644 index 15556530a..000000000 --- a/vendor/github.com/json-iterator/go/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -/vendor -/bug_test.go -/coverage.txt -/.idea diff --git a/vendor/github.com/json-iterator/go/.travis.yml b/vendor/github.com/json-iterator/go/.travis.yml deleted file mode 100644 index 449e67cd0..000000000 --- a/vendor/github.com/json-iterator/go/.travis.yml +++ /dev/null @@ -1,14 +0,0 @@ -language: go - -go: - - 1.8.x - - 1.x - -before_install: - - go get -t -v ./... - -script: - - ./test.sh - -after_success: - - bash <(curl -s https://codecov.io/bash) diff --git a/vendor/github.com/json-iterator/go/Gopkg.lock b/vendor/github.com/json-iterator/go/Gopkg.lock deleted file mode 100644 index c8a9fbb38..000000000 --- a/vendor/github.com/json-iterator/go/Gopkg.lock +++ /dev/null @@ -1,21 +0,0 @@ -# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. - - -[[projects]] - name = "github.com/modern-go/concurrent" - packages = ["."] - revision = "e0a39a4cb4216ea8db28e22a69f4ec25610d513a" - version = "1.0.0" - -[[projects]] - name = "github.com/modern-go/reflect2" - packages = ["."] - revision = "4b7aa43c6742a2c18fdef89dd197aaae7dac7ccd" - version = "1.0.1" - -[solve-meta] - analyzer-name = "dep" - analyzer-version = 1 - inputs-digest = "ea54a775e5a354cb015502d2e7aa4b74230fc77e894f34a838b268c25ec8eeb8" - solver-name = "gps-cdcl" - solver-version = 1 diff --git a/vendor/github.com/json-iterator/go/Gopkg.toml b/vendor/github.com/json-iterator/go/Gopkg.toml deleted file mode 100644 index 313a0f887..000000000 --- a/vendor/github.com/json-iterator/go/Gopkg.toml +++ /dev/null @@ -1,26 +0,0 @@ -# Gopkg.toml example -# -# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md -# for detailed Gopkg.toml documentation. -# -# required = ["github.com/user/thing/cmd/thing"] -# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] -# -# [[constraint]] -# name = "github.com/user/project" -# version = "1.0.0" -# -# [[constraint]] -# name = "github.com/user/project2" -# branch = "dev" -# source = "github.com/myfork/project2" -# -# [[override]] -# name = "github.com/x/y" -# version = "2.4.0" - -ignored = ["github.com/davecgh/go-spew*","github.com/google/gofuzz*","github.com/stretchr/testify*"] - -[[constraint]] - name = "github.com/modern-go/reflect2" - version = "1.0.1" diff --git a/vendor/github.com/json-iterator/go/LICENSE b/vendor/github.com/json-iterator/go/LICENSE deleted file mode 100644 index 2cf4f5ab2..000000000 --- a/vendor/github.com/json-iterator/go/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2016 json-iterator - -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/vendor/github.com/json-iterator/go/README.md b/vendor/github.com/json-iterator/go/README.md deleted file mode 100644 index c589addf9..000000000 --- a/vendor/github.com/json-iterator/go/README.md +++ /dev/null @@ -1,85 +0,0 @@ -[![Sourcegraph](https://sourcegraph.com/github.com/json-iterator/go/-/badge.svg)](https://sourcegraph.com/github.com/json-iterator/go?badge) -[![GoDoc](http://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)](https://pkg.go.dev/github.com/json-iterator/go) -[![Build Status](https://travis-ci.org/json-iterator/go.svg?branch=master)](https://travis-ci.org/json-iterator/go) -[![codecov](https://codecov.io/gh/json-iterator/go/branch/master/graph/badge.svg)](https://codecov.io/gh/json-iterator/go) -[![rcard](https://goreportcard.com/badge/github.com/json-iterator/go)](https://goreportcard.com/report/github.com/json-iterator/go) -[![License](http://img.shields.io/badge/license-mit-blue.svg?style=flat-square)](https://raw.githubusercontent.com/json-iterator/go/master/LICENSE) -[![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/json-iterator/Lobby) - -A high-performance 100% compatible drop-in replacement of "encoding/json" - -# Benchmark - -![benchmark](http://jsoniter.com/benchmarks/go-benchmark.png) - -Source code: https://github.com/json-iterator/go-benchmark/blob/master/src/github.com/json-iterator/go-benchmark/benchmark_medium_payload_test.go - -Raw Result (easyjson requires static code generation) - -| | ns/op | allocation bytes | allocation times | -| --------------- | ----------- | ---------------- | ---------------- | -| std decode | 35510 ns/op | 1960 B/op | 99 allocs/op | -| easyjson decode | 8499 ns/op | 160 B/op | 4 allocs/op | -| jsoniter decode | 5623 ns/op | 160 B/op | 3 allocs/op | -| std encode | 2213 ns/op | 712 B/op | 5 allocs/op | -| easyjson encode | 883 ns/op | 576 B/op | 3 allocs/op | -| jsoniter encode | 837 ns/op | 384 B/op | 4 allocs/op | - -Always benchmark with your own workload. -The result depends heavily on the data input. - -# Usage - -100% compatibility with standard lib - -Replace - -```go -import "encoding/json" -json.Marshal(&data) -``` - -with - -```go -import jsoniter "github.com/json-iterator/go" - -var json = jsoniter.ConfigCompatibleWithStandardLibrary -json.Marshal(&data) -``` - -Replace - -```go -import "encoding/json" -json.Unmarshal(input, &data) -``` - -with - -```go -import jsoniter "github.com/json-iterator/go" - -var json = jsoniter.ConfigCompatibleWithStandardLibrary -json.Unmarshal(input, &data) -``` - -[More documentation](http://jsoniter.com/migrate-from-go-std.html) - -# How to get - -``` -go get github.com/json-iterator/go -``` - -# Contribution Welcomed ! - -Contributors - -- [thockin](https://github.com/thockin) -- [mattn](https://github.com/mattn) -- [cch123](https://github.com/cch123) -- [Oleg Shaldybin](https://github.com/olegshaldybin) -- [Jason Toffaletti](https://github.com/toffaletti) - -Report issue or pull request, or email taowen@gmail.com, or [![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/json-iterator/Lobby) diff --git a/vendor/github.com/json-iterator/go/adapter.go b/vendor/github.com/json-iterator/go/adapter.go deleted file mode 100644 index 92d2cc4a3..000000000 --- a/vendor/github.com/json-iterator/go/adapter.go +++ /dev/null @@ -1,150 +0,0 @@ -package jsoniter - -import ( - "bytes" - "io" -) - -// RawMessage to make replace json with jsoniter -type RawMessage []byte - -// Unmarshal adapts to json/encoding Unmarshal API -// -// Unmarshal parses the JSON-encoded data and stores the result in the value pointed to by v. -// Refer to https://godoc.org/encoding/json#Unmarshal for more information -func Unmarshal(data []byte, v interface{}) error { - return ConfigDefault.Unmarshal(data, v) -} - -// UnmarshalFromString is a convenient method to read from string instead of []byte -func UnmarshalFromString(str string, v interface{}) error { - return ConfigDefault.UnmarshalFromString(str, v) -} - -// Get quick method to get value from deeply nested JSON structure -func Get(data []byte, path ...interface{}) Any { - return ConfigDefault.Get(data, path...) -} - -// Marshal adapts to json/encoding Marshal API -// -// Marshal returns the JSON encoding of v, adapts to json/encoding Marshal API -// Refer to https://godoc.org/encoding/json#Marshal for more information -func Marshal(v interface{}) ([]byte, error) { - return ConfigDefault.Marshal(v) -} - -// MarshalIndent same as json.MarshalIndent. Prefix is not supported. -func MarshalIndent(v interface{}, prefix, indent string) ([]byte, error) { - return ConfigDefault.MarshalIndent(v, prefix, indent) -} - -// MarshalToString convenient method to write as string instead of []byte -func MarshalToString(v interface{}) (string, error) { - return ConfigDefault.MarshalToString(v) -} - -// NewDecoder adapts to json/stream NewDecoder API. -// -// NewDecoder returns a new decoder that reads from r. -// -// Instead of a json/encoding Decoder, an Decoder is returned -// Refer to https://godoc.org/encoding/json#NewDecoder for more information -func NewDecoder(reader io.Reader) *Decoder { - return ConfigDefault.NewDecoder(reader) -} - -// Decoder reads and decodes JSON values from an input stream. -// Decoder provides identical APIs with json/stream Decoder (Token() and UseNumber() are in progress) -type Decoder struct { - iter *Iterator -} - -// Decode decode JSON into interface{} -func (adapter *Decoder) Decode(obj interface{}) error { - if adapter.iter.head == adapter.iter.tail && adapter.iter.reader != nil { - if !adapter.iter.loadMore() { - return io.EOF - } - } - adapter.iter.ReadVal(obj) - err := adapter.iter.Error - if err == io.EOF { - return nil - } - return adapter.iter.Error -} - -// More is there more? -func (adapter *Decoder) More() bool { - iter := adapter.iter - if iter.Error != nil { - return false - } - c := iter.nextToken() - if c == 0 { - return false - } - iter.unreadByte() - return c != ']' && c != '}' -} - -// Buffered remaining buffer -func (adapter *Decoder) Buffered() io.Reader { - remaining := adapter.iter.buf[adapter.iter.head:adapter.iter.tail] - return bytes.NewReader(remaining) -} - -// UseNumber causes the Decoder to unmarshal a number into an interface{} as a -// Number instead of as a float64. -func (adapter *Decoder) UseNumber() { - cfg := adapter.iter.cfg.configBeforeFrozen - cfg.UseNumber = true - adapter.iter.cfg = cfg.frozeWithCacheReuse(adapter.iter.cfg.extraExtensions) -} - -// DisallowUnknownFields causes the Decoder to return an error when the destination -// is a struct and the input contains object keys which do not match any -// non-ignored, exported fields in the destination. -func (adapter *Decoder) DisallowUnknownFields() { - cfg := adapter.iter.cfg.configBeforeFrozen - cfg.DisallowUnknownFields = true - adapter.iter.cfg = cfg.frozeWithCacheReuse(adapter.iter.cfg.extraExtensions) -} - -// NewEncoder same as json.NewEncoder -func NewEncoder(writer io.Writer) *Encoder { - return ConfigDefault.NewEncoder(writer) -} - -// Encoder same as json.Encoder -type Encoder struct { - stream *Stream -} - -// Encode encode interface{} as JSON to io.Writer -func (adapter *Encoder) Encode(val interface{}) error { - adapter.stream.WriteVal(val) - adapter.stream.WriteRaw("\n") - adapter.stream.Flush() - return adapter.stream.Error -} - -// SetIndent set the indention. Prefix is not supported -func (adapter *Encoder) SetIndent(prefix, indent string) { - config := adapter.stream.cfg.configBeforeFrozen - config.IndentionStep = len(indent) - adapter.stream.cfg = config.frozeWithCacheReuse(adapter.stream.cfg.extraExtensions) -} - -// SetEscapeHTML escape html by default, set to false to disable -func (adapter *Encoder) SetEscapeHTML(escapeHTML bool) { - config := adapter.stream.cfg.configBeforeFrozen - config.EscapeHTML = escapeHTML - adapter.stream.cfg = config.frozeWithCacheReuse(adapter.stream.cfg.extraExtensions) -} - -// Valid reports whether data is a valid JSON encoding. -func Valid(data []byte) bool { - return ConfigDefault.Valid(data) -} diff --git a/vendor/github.com/json-iterator/go/any.go b/vendor/github.com/json-iterator/go/any.go deleted file mode 100644 index f6b8aeab0..000000000 --- a/vendor/github.com/json-iterator/go/any.go +++ /dev/null @@ -1,325 +0,0 @@ -package jsoniter - -import ( - "errors" - "fmt" - "github.com/modern-go/reflect2" - "io" - "reflect" - "strconv" - "unsafe" -) - -// Any generic object representation. -// The lazy json implementation holds []byte and parse lazily. -type Any interface { - LastError() error - ValueType() ValueType - MustBeValid() Any - ToBool() bool - ToInt() int - ToInt32() int32 - ToInt64() int64 - ToUint() uint - ToUint32() uint32 - ToUint64() uint64 - ToFloat32() float32 - ToFloat64() float64 - ToString() string - ToVal(val interface{}) - Get(path ...interface{}) Any - Size() int - Keys() []string - GetInterface() interface{} - WriteTo(stream *Stream) -} - -type baseAny struct{} - -func (any *baseAny) Get(path ...interface{}) Any { - return &invalidAny{baseAny{}, fmt.Errorf("GetIndex %v from simple value", path)} -} - -func (any *baseAny) Size() int { - return 0 -} - -func (any *baseAny) Keys() []string { - return []string{} -} - -func (any *baseAny) ToVal(obj interface{}) { - panic("not implemented") -} - -// WrapInt32 turn int32 into Any interface -func WrapInt32(val int32) Any { - return &int32Any{baseAny{}, val} -} - -// WrapInt64 turn int64 into Any interface -func WrapInt64(val int64) Any { - return &int64Any{baseAny{}, val} -} - -// WrapUint32 turn uint32 into Any interface -func WrapUint32(val uint32) Any { - return &uint32Any{baseAny{}, val} -} - -// WrapUint64 turn uint64 into Any interface -func WrapUint64(val uint64) Any { - return &uint64Any{baseAny{}, val} -} - -// WrapFloat64 turn float64 into Any interface -func WrapFloat64(val float64) Any { - return &floatAny{baseAny{}, val} -} - -// WrapString turn string into Any interface -func WrapString(val string) Any { - return &stringAny{baseAny{}, val} -} - -// Wrap turn a go object into Any interface -func Wrap(val interface{}) Any { - if val == nil { - return &nilAny{} - } - asAny, isAny := val.(Any) - if isAny { - return asAny - } - typ := reflect2.TypeOf(val) - switch typ.Kind() { - case reflect.Slice: - return wrapArray(val) - case reflect.Struct: - return wrapStruct(val) - case reflect.Map: - return wrapMap(val) - case reflect.String: - return WrapString(val.(string)) - case reflect.Int: - if strconv.IntSize == 32 { - return WrapInt32(int32(val.(int))) - } - return WrapInt64(int64(val.(int))) - case reflect.Int8: - return WrapInt32(int32(val.(int8))) - case reflect.Int16: - return WrapInt32(int32(val.(int16))) - case reflect.Int32: - return WrapInt32(val.(int32)) - case reflect.Int64: - return WrapInt64(val.(int64)) - case reflect.Uint: - if strconv.IntSize == 32 { - return WrapUint32(uint32(val.(uint))) - } - return WrapUint64(uint64(val.(uint))) - case reflect.Uintptr: - if ptrSize == 32 { - return WrapUint32(uint32(val.(uintptr))) - } - return WrapUint64(uint64(val.(uintptr))) - case reflect.Uint8: - return WrapUint32(uint32(val.(uint8))) - case reflect.Uint16: - return WrapUint32(uint32(val.(uint16))) - case reflect.Uint32: - return WrapUint32(uint32(val.(uint32))) - case reflect.Uint64: - return WrapUint64(val.(uint64)) - case reflect.Float32: - return WrapFloat64(float64(val.(float32))) - case reflect.Float64: - return WrapFloat64(val.(float64)) - case reflect.Bool: - if val.(bool) == true { - return &trueAny{} - } - return &falseAny{} - } - return &invalidAny{baseAny{}, fmt.Errorf("unsupported type: %v", typ)} -} - -// ReadAny read next JSON element as an Any object. It is a better json.RawMessage. -func (iter *Iterator) ReadAny() Any { - return iter.readAny() -} - -func (iter *Iterator) readAny() Any { - c := iter.nextToken() - switch c { - case '"': - iter.unreadByte() - return &stringAny{baseAny{}, iter.ReadString()} - case 'n': - iter.skipThreeBytes('u', 'l', 'l') // null - return &nilAny{} - case 't': - iter.skipThreeBytes('r', 'u', 'e') // true - return &trueAny{} - case 'f': - iter.skipFourBytes('a', 'l', 's', 'e') // false - return &falseAny{} - case '{': - return iter.readObjectAny() - case '[': - return iter.readArrayAny() - case '-': - return iter.readNumberAny(false) - case 0: - return &invalidAny{baseAny{}, errors.New("input is empty")} - default: - return iter.readNumberAny(true) - } -} - -func (iter *Iterator) readNumberAny(positive bool) Any { - iter.startCapture(iter.head - 1) - iter.skipNumber() - lazyBuf := iter.stopCapture() - return &numberLazyAny{baseAny{}, iter.cfg, lazyBuf, nil} -} - -func (iter *Iterator) readObjectAny() Any { - iter.startCapture(iter.head - 1) - iter.skipObject() - lazyBuf := iter.stopCapture() - return &objectLazyAny{baseAny{}, iter.cfg, lazyBuf, nil} -} - -func (iter *Iterator) readArrayAny() Any { - iter.startCapture(iter.head - 1) - iter.skipArray() - lazyBuf := iter.stopCapture() - return &arrayLazyAny{baseAny{}, iter.cfg, lazyBuf, nil} -} - -func locateObjectField(iter *Iterator, target string) []byte { - var found []byte - iter.ReadObjectCB(func(iter *Iterator, field string) bool { - if field == target { - found = iter.SkipAndReturnBytes() - return false - } - iter.Skip() - return true - }) - return found -} - -func locateArrayElement(iter *Iterator, target int) []byte { - var found []byte - n := 0 - iter.ReadArrayCB(func(iter *Iterator) bool { - if n == target { - found = iter.SkipAndReturnBytes() - return false - } - iter.Skip() - n++ - return true - }) - return found -} - -func locatePath(iter *Iterator, path []interface{}) Any { - for i, pathKeyObj := range path { - switch pathKey := pathKeyObj.(type) { - case string: - valueBytes := locateObjectField(iter, pathKey) - if valueBytes == nil { - return newInvalidAny(path[i:]) - } - iter.ResetBytes(valueBytes) - case int: - valueBytes := locateArrayElement(iter, pathKey) - if valueBytes == nil { - return newInvalidAny(path[i:]) - } - iter.ResetBytes(valueBytes) - case int32: - if '*' == pathKey { - return iter.readAny().Get(path[i:]...) - } - return newInvalidAny(path[i:]) - default: - return newInvalidAny(path[i:]) - } - } - if iter.Error != nil && iter.Error != io.EOF { - return &invalidAny{baseAny{}, iter.Error} - } - return iter.readAny() -} - -var anyType = reflect2.TypeOfPtr((*Any)(nil)).Elem() - -func createDecoderOfAny(ctx *ctx, typ reflect2.Type) ValDecoder { - if typ == anyType { - return &directAnyCodec{} - } - if typ.Implements(anyType) { - return &anyCodec{ - valType: typ, - } - } - return nil -} - -func createEncoderOfAny(ctx *ctx, typ reflect2.Type) ValEncoder { - if typ == anyType { - return &directAnyCodec{} - } - if typ.Implements(anyType) { - return &anyCodec{ - valType: typ, - } - } - return nil -} - -type anyCodec struct { - valType reflect2.Type -} - -func (codec *anyCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { - panic("not implemented") -} - -func (codec *anyCodec) Encode(ptr unsafe.Pointer, stream *Stream) { - obj := codec.valType.UnsafeIndirect(ptr) - any := obj.(Any) - any.WriteTo(stream) -} - -func (codec *anyCodec) IsEmpty(ptr unsafe.Pointer) bool { - obj := codec.valType.UnsafeIndirect(ptr) - any := obj.(Any) - return any.Size() == 0 -} - -type directAnyCodec struct { -} - -func (codec *directAnyCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { - *(*Any)(ptr) = iter.readAny() -} - -func (codec *directAnyCodec) Encode(ptr unsafe.Pointer, stream *Stream) { - any := *(*Any)(ptr) - if any == nil { - stream.WriteNil() - return - } - any.WriteTo(stream) -} - -func (codec *directAnyCodec) IsEmpty(ptr unsafe.Pointer) bool { - any := *(*Any)(ptr) - return any.Size() == 0 -} diff --git a/vendor/github.com/json-iterator/go/any_array.go b/vendor/github.com/json-iterator/go/any_array.go deleted file mode 100644 index 0449e9aa4..000000000 --- a/vendor/github.com/json-iterator/go/any_array.go +++ /dev/null @@ -1,278 +0,0 @@ -package jsoniter - -import ( - "reflect" - "unsafe" -) - -type arrayLazyAny struct { - baseAny - cfg *frozenConfig - buf []byte - err error -} - -func (any *arrayLazyAny) ValueType() ValueType { - return ArrayValue -} - -func (any *arrayLazyAny) MustBeValid() Any { - return any -} - -func (any *arrayLazyAny) LastError() error { - return any.err -} - -func (any *arrayLazyAny) ToBool() bool { - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - return iter.ReadArray() -} - -func (any *arrayLazyAny) ToInt() int { - if any.ToBool() { - return 1 - } - return 0 -} - -func (any *arrayLazyAny) ToInt32() int32 { - if any.ToBool() { - return 1 - } - return 0 -} - -func (any *arrayLazyAny) ToInt64() int64 { - if any.ToBool() { - return 1 - } - return 0 -} - -func (any *arrayLazyAny) ToUint() uint { - if any.ToBool() { - return 1 - } - return 0 -} - -func (any *arrayLazyAny) ToUint32() uint32 { - if any.ToBool() { - return 1 - } - return 0 -} - -func (any *arrayLazyAny) ToUint64() uint64 { - if any.ToBool() { - return 1 - } - return 0 -} - -func (any *arrayLazyAny) ToFloat32() float32 { - if any.ToBool() { - return 1 - } - return 0 -} - -func (any *arrayLazyAny) ToFloat64() float64 { - if any.ToBool() { - return 1 - } - return 0 -} - -func (any *arrayLazyAny) ToString() string { - return *(*string)(unsafe.Pointer(&any.buf)) -} - -func (any *arrayLazyAny) ToVal(val interface{}) { - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - iter.ReadVal(val) -} - -func (any *arrayLazyAny) Get(path ...interface{}) Any { - if len(path) == 0 { - return any - } - switch firstPath := path[0].(type) { - case int: - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - valueBytes := locateArrayElement(iter, firstPath) - if valueBytes == nil { - return newInvalidAny(path) - } - iter.ResetBytes(valueBytes) - return locatePath(iter, path[1:]) - case int32: - if '*' == firstPath { - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - arr := make([]Any, 0) - iter.ReadArrayCB(func(iter *Iterator) bool { - found := iter.readAny().Get(path[1:]...) - if found.ValueType() != InvalidValue { - arr = append(arr, found) - } - return true - }) - return wrapArray(arr) - } - return newInvalidAny(path) - default: - return newInvalidAny(path) - } -} - -func (any *arrayLazyAny) Size() int { - size := 0 - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - iter.ReadArrayCB(func(iter *Iterator) bool { - size++ - iter.Skip() - return true - }) - return size -} - -func (any *arrayLazyAny) WriteTo(stream *Stream) { - stream.Write(any.buf) -} - -func (any *arrayLazyAny) GetInterface() interface{} { - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - return iter.Read() -} - -type arrayAny struct { - baseAny - val reflect.Value -} - -func wrapArray(val interface{}) *arrayAny { - return &arrayAny{baseAny{}, reflect.ValueOf(val)} -} - -func (any *arrayAny) ValueType() ValueType { - return ArrayValue -} - -func (any *arrayAny) MustBeValid() Any { - return any -} - -func (any *arrayAny) LastError() error { - return nil -} - -func (any *arrayAny) ToBool() bool { - return any.val.Len() != 0 -} - -func (any *arrayAny) ToInt() int { - if any.val.Len() == 0 { - return 0 - } - return 1 -} - -func (any *arrayAny) ToInt32() int32 { - if any.val.Len() == 0 { - return 0 - } - return 1 -} - -func (any *arrayAny) ToInt64() int64 { - if any.val.Len() == 0 { - return 0 - } - return 1 -} - -func (any *arrayAny) ToUint() uint { - if any.val.Len() == 0 { - return 0 - } - return 1 -} - -func (any *arrayAny) ToUint32() uint32 { - if any.val.Len() == 0 { - return 0 - } - return 1 -} - -func (any *arrayAny) ToUint64() uint64 { - if any.val.Len() == 0 { - return 0 - } - return 1 -} - -func (any *arrayAny) ToFloat32() float32 { - if any.val.Len() == 0 { - return 0 - } - return 1 -} - -func (any *arrayAny) ToFloat64() float64 { - if any.val.Len() == 0 { - return 0 - } - return 1 -} - -func (any *arrayAny) ToString() string { - str, _ := MarshalToString(any.val.Interface()) - return str -} - -func (any *arrayAny) Get(path ...interface{}) Any { - if len(path) == 0 { - return any - } - switch firstPath := path[0].(type) { - case int: - if firstPath < 0 || firstPath >= any.val.Len() { - return newInvalidAny(path) - } - return Wrap(any.val.Index(firstPath).Interface()) - case int32: - if '*' == firstPath { - mappedAll := make([]Any, 0) - for i := 0; i < any.val.Len(); i++ { - mapped := Wrap(any.val.Index(i).Interface()).Get(path[1:]...) - if mapped.ValueType() != InvalidValue { - mappedAll = append(mappedAll, mapped) - } - } - return wrapArray(mappedAll) - } - return newInvalidAny(path) - default: - return newInvalidAny(path) - } -} - -func (any *arrayAny) Size() int { - return any.val.Len() -} - -func (any *arrayAny) WriteTo(stream *Stream) { - stream.WriteVal(any.val) -} - -func (any *arrayAny) GetInterface() interface{} { - return any.val.Interface() -} diff --git a/vendor/github.com/json-iterator/go/any_bool.go b/vendor/github.com/json-iterator/go/any_bool.go deleted file mode 100644 index 9452324af..000000000 --- a/vendor/github.com/json-iterator/go/any_bool.go +++ /dev/null @@ -1,137 +0,0 @@ -package jsoniter - -type trueAny struct { - baseAny -} - -func (any *trueAny) LastError() error { - return nil -} - -func (any *trueAny) ToBool() bool { - return true -} - -func (any *trueAny) ToInt() int { - return 1 -} - -func (any *trueAny) ToInt32() int32 { - return 1 -} - -func (any *trueAny) ToInt64() int64 { - return 1 -} - -func (any *trueAny) ToUint() uint { - return 1 -} - -func (any *trueAny) ToUint32() uint32 { - return 1 -} - -func (any *trueAny) ToUint64() uint64 { - return 1 -} - -func (any *trueAny) ToFloat32() float32 { - return 1 -} - -func (any *trueAny) ToFloat64() float64 { - return 1 -} - -func (any *trueAny) ToString() string { - return "true" -} - -func (any *trueAny) WriteTo(stream *Stream) { - stream.WriteTrue() -} - -func (any *trueAny) Parse() *Iterator { - return nil -} - -func (any *trueAny) GetInterface() interface{} { - return true -} - -func (any *trueAny) ValueType() ValueType { - return BoolValue -} - -func (any *trueAny) MustBeValid() Any { - return any -} - -type falseAny struct { - baseAny -} - -func (any *falseAny) LastError() error { - return nil -} - -func (any *falseAny) ToBool() bool { - return false -} - -func (any *falseAny) ToInt() int { - return 0 -} - -func (any *falseAny) ToInt32() int32 { - return 0 -} - -func (any *falseAny) ToInt64() int64 { - return 0 -} - -func (any *falseAny) ToUint() uint { - return 0 -} - -func (any *falseAny) ToUint32() uint32 { - return 0 -} - -func (any *falseAny) ToUint64() uint64 { - return 0 -} - -func (any *falseAny) ToFloat32() float32 { - return 0 -} - -func (any *falseAny) ToFloat64() float64 { - return 0 -} - -func (any *falseAny) ToString() string { - return "false" -} - -func (any *falseAny) WriteTo(stream *Stream) { - stream.WriteFalse() -} - -func (any *falseAny) Parse() *Iterator { - return nil -} - -func (any *falseAny) GetInterface() interface{} { - return false -} - -func (any *falseAny) ValueType() ValueType { - return BoolValue -} - -func (any *falseAny) MustBeValid() Any { - return any -} diff --git a/vendor/github.com/json-iterator/go/any_float.go b/vendor/github.com/json-iterator/go/any_float.go deleted file mode 100644 index 35fdb0949..000000000 --- a/vendor/github.com/json-iterator/go/any_float.go +++ /dev/null @@ -1,83 +0,0 @@ -package jsoniter - -import ( - "strconv" -) - -type floatAny struct { - baseAny - val float64 -} - -func (any *floatAny) Parse() *Iterator { - return nil -} - -func (any *floatAny) ValueType() ValueType { - return NumberValue -} - -func (any *floatAny) MustBeValid() Any { - return any -} - -func (any *floatAny) LastError() error { - return nil -} - -func (any *floatAny) ToBool() bool { - return any.ToFloat64() != 0 -} - -func (any *floatAny) ToInt() int { - return int(any.val) -} - -func (any *floatAny) ToInt32() int32 { - return int32(any.val) -} - -func (any *floatAny) ToInt64() int64 { - return int64(any.val) -} - -func (any *floatAny) ToUint() uint { - if any.val > 0 { - return uint(any.val) - } - return 0 -} - -func (any *floatAny) ToUint32() uint32 { - if any.val > 0 { - return uint32(any.val) - } - return 0 -} - -func (any *floatAny) ToUint64() uint64 { - if any.val > 0 { - return uint64(any.val) - } - return 0 -} - -func (any *floatAny) ToFloat32() float32 { - return float32(any.val) -} - -func (any *floatAny) ToFloat64() float64 { - return any.val -} - -func (any *floatAny) ToString() string { - return strconv.FormatFloat(any.val, 'E', -1, 64) -} - -func (any *floatAny) WriteTo(stream *Stream) { - stream.WriteFloat64(any.val) -} - -func (any *floatAny) GetInterface() interface{} { - return any.val -} diff --git a/vendor/github.com/json-iterator/go/any_int32.go b/vendor/github.com/json-iterator/go/any_int32.go deleted file mode 100644 index 1b56f3991..000000000 --- a/vendor/github.com/json-iterator/go/any_int32.go +++ /dev/null @@ -1,74 +0,0 @@ -package jsoniter - -import ( - "strconv" -) - -type int32Any struct { - baseAny - val int32 -} - -func (any *int32Any) LastError() error { - return nil -} - -func (any *int32Any) ValueType() ValueType { - return NumberValue -} - -func (any *int32Any) MustBeValid() Any { - return any -} - -func (any *int32Any) ToBool() bool { - return any.val != 0 -} - -func (any *int32Any) ToInt() int { - return int(any.val) -} - -func (any *int32Any) ToInt32() int32 { - return any.val -} - -func (any *int32Any) ToInt64() int64 { - return int64(any.val) -} - -func (any *int32Any) ToUint() uint { - return uint(any.val) -} - -func (any *int32Any) ToUint32() uint32 { - return uint32(any.val) -} - -func (any *int32Any) ToUint64() uint64 { - return uint64(any.val) -} - -func (any *int32Any) ToFloat32() float32 { - return float32(any.val) -} - -func (any *int32Any) ToFloat64() float64 { - return float64(any.val) -} - -func (any *int32Any) ToString() string { - return strconv.FormatInt(int64(any.val), 10) -} - -func (any *int32Any) WriteTo(stream *Stream) { - stream.WriteInt32(any.val) -} - -func (any *int32Any) Parse() *Iterator { - return nil -} - -func (any *int32Any) GetInterface() interface{} { - return any.val -} diff --git a/vendor/github.com/json-iterator/go/any_int64.go b/vendor/github.com/json-iterator/go/any_int64.go deleted file mode 100644 index c440d72b6..000000000 --- a/vendor/github.com/json-iterator/go/any_int64.go +++ /dev/null @@ -1,74 +0,0 @@ -package jsoniter - -import ( - "strconv" -) - -type int64Any struct { - baseAny - val int64 -} - -func (any *int64Any) LastError() error { - return nil -} - -func (any *int64Any) ValueType() ValueType { - return NumberValue -} - -func (any *int64Any) MustBeValid() Any { - return any -} - -func (any *int64Any) ToBool() bool { - return any.val != 0 -} - -func (any *int64Any) ToInt() int { - return int(any.val) -} - -func (any *int64Any) ToInt32() int32 { - return int32(any.val) -} - -func (any *int64Any) ToInt64() int64 { - return any.val -} - -func (any *int64Any) ToUint() uint { - return uint(any.val) -} - -func (any *int64Any) ToUint32() uint32 { - return uint32(any.val) -} - -func (any *int64Any) ToUint64() uint64 { - return uint64(any.val) -} - -func (any *int64Any) ToFloat32() float32 { - return float32(any.val) -} - -func (any *int64Any) ToFloat64() float64 { - return float64(any.val) -} - -func (any *int64Any) ToString() string { - return strconv.FormatInt(any.val, 10) -} - -func (any *int64Any) WriteTo(stream *Stream) { - stream.WriteInt64(any.val) -} - -func (any *int64Any) Parse() *Iterator { - return nil -} - -func (any *int64Any) GetInterface() interface{} { - return any.val -} diff --git a/vendor/github.com/json-iterator/go/any_invalid.go b/vendor/github.com/json-iterator/go/any_invalid.go deleted file mode 100644 index 1d859eac3..000000000 --- a/vendor/github.com/json-iterator/go/any_invalid.go +++ /dev/null @@ -1,82 +0,0 @@ -package jsoniter - -import "fmt" - -type invalidAny struct { - baseAny - err error -} - -func newInvalidAny(path []interface{}) *invalidAny { - return &invalidAny{baseAny{}, fmt.Errorf("%v not found", path)} -} - -func (any *invalidAny) LastError() error { - return any.err -} - -func (any *invalidAny) ValueType() ValueType { - return InvalidValue -} - -func (any *invalidAny) MustBeValid() Any { - panic(any.err) -} - -func (any *invalidAny) ToBool() bool { - return false -} - -func (any *invalidAny) ToInt() int { - return 0 -} - -func (any *invalidAny) ToInt32() int32 { - return 0 -} - -func (any *invalidAny) ToInt64() int64 { - return 0 -} - -func (any *invalidAny) ToUint() uint { - return 0 -} - -func (any *invalidAny) ToUint32() uint32 { - return 0 -} - -func (any *invalidAny) ToUint64() uint64 { - return 0 -} - -func (any *invalidAny) ToFloat32() float32 { - return 0 -} - -func (any *invalidAny) ToFloat64() float64 { - return 0 -} - -func (any *invalidAny) ToString() string { - return "" -} - -func (any *invalidAny) WriteTo(stream *Stream) { -} - -func (any *invalidAny) Get(path ...interface{}) Any { - if any.err == nil { - return &invalidAny{baseAny{}, fmt.Errorf("get %v from invalid", path)} - } - return &invalidAny{baseAny{}, fmt.Errorf("%v, get %v from invalid", any.err, path)} -} - -func (any *invalidAny) Parse() *Iterator { - return nil -} - -func (any *invalidAny) GetInterface() interface{} { - return nil -} diff --git a/vendor/github.com/json-iterator/go/any_nil.go b/vendor/github.com/json-iterator/go/any_nil.go deleted file mode 100644 index d04cb54c1..000000000 --- a/vendor/github.com/json-iterator/go/any_nil.go +++ /dev/null @@ -1,69 +0,0 @@ -package jsoniter - -type nilAny struct { - baseAny -} - -func (any *nilAny) LastError() error { - return nil -} - -func (any *nilAny) ValueType() ValueType { - return NilValue -} - -func (any *nilAny) MustBeValid() Any { - return any -} - -func (any *nilAny) ToBool() bool { - return false -} - -func (any *nilAny) ToInt() int { - return 0 -} - -func (any *nilAny) ToInt32() int32 { - return 0 -} - -func (any *nilAny) ToInt64() int64 { - return 0 -} - -func (any *nilAny) ToUint() uint { - return 0 -} - -func (any *nilAny) ToUint32() uint32 { - return 0 -} - -func (any *nilAny) ToUint64() uint64 { - return 0 -} - -func (any *nilAny) ToFloat32() float32 { - return 0 -} - -func (any *nilAny) ToFloat64() float64 { - return 0 -} - -func (any *nilAny) ToString() string { - return "" -} - -func (any *nilAny) WriteTo(stream *Stream) { - stream.WriteNil() -} - -func (any *nilAny) Parse() *Iterator { - return nil -} - -func (any *nilAny) GetInterface() interface{} { - return nil -} diff --git a/vendor/github.com/json-iterator/go/any_number.go b/vendor/github.com/json-iterator/go/any_number.go deleted file mode 100644 index 9d1e901a6..000000000 --- a/vendor/github.com/json-iterator/go/any_number.go +++ /dev/null @@ -1,123 +0,0 @@ -package jsoniter - -import ( - "io" - "unsafe" -) - -type numberLazyAny struct { - baseAny - cfg *frozenConfig - buf []byte - err error -} - -func (any *numberLazyAny) ValueType() ValueType { - return NumberValue -} - -func (any *numberLazyAny) MustBeValid() Any { - return any -} - -func (any *numberLazyAny) LastError() error { - return any.err -} - -func (any *numberLazyAny) ToBool() bool { - return any.ToFloat64() != 0 -} - -func (any *numberLazyAny) ToInt() int { - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - val := iter.ReadInt() - if iter.Error != nil && iter.Error != io.EOF { - any.err = iter.Error - } - return val -} - -func (any *numberLazyAny) ToInt32() int32 { - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - val := iter.ReadInt32() - if iter.Error != nil && iter.Error != io.EOF { - any.err = iter.Error - } - return val -} - -func (any *numberLazyAny) ToInt64() int64 { - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - val := iter.ReadInt64() - if iter.Error != nil && iter.Error != io.EOF { - any.err = iter.Error - } - return val -} - -func (any *numberLazyAny) ToUint() uint { - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - val := iter.ReadUint() - if iter.Error != nil && iter.Error != io.EOF { - any.err = iter.Error - } - return val -} - -func (any *numberLazyAny) ToUint32() uint32 { - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - val := iter.ReadUint32() - if iter.Error != nil && iter.Error != io.EOF { - any.err = iter.Error - } - return val -} - -func (any *numberLazyAny) ToUint64() uint64 { - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - val := iter.ReadUint64() - if iter.Error != nil && iter.Error != io.EOF { - any.err = iter.Error - } - return val -} - -func (any *numberLazyAny) ToFloat32() float32 { - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - val := iter.ReadFloat32() - if iter.Error != nil && iter.Error != io.EOF { - any.err = iter.Error - } - return val -} - -func (any *numberLazyAny) ToFloat64() float64 { - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - val := iter.ReadFloat64() - if iter.Error != nil && iter.Error != io.EOF { - any.err = iter.Error - } - return val -} - -func (any *numberLazyAny) ToString() string { - return *(*string)(unsafe.Pointer(&any.buf)) -} - -func (any *numberLazyAny) WriteTo(stream *Stream) { - stream.Write(any.buf) -} - -func (any *numberLazyAny) GetInterface() interface{} { - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - return iter.Read() -} diff --git a/vendor/github.com/json-iterator/go/any_object.go b/vendor/github.com/json-iterator/go/any_object.go deleted file mode 100644 index c44ef5c98..000000000 --- a/vendor/github.com/json-iterator/go/any_object.go +++ /dev/null @@ -1,374 +0,0 @@ -package jsoniter - -import ( - "reflect" - "unsafe" -) - -type objectLazyAny struct { - baseAny - cfg *frozenConfig - buf []byte - err error -} - -func (any *objectLazyAny) ValueType() ValueType { - return ObjectValue -} - -func (any *objectLazyAny) MustBeValid() Any { - return any -} - -func (any *objectLazyAny) LastError() error { - return any.err -} - -func (any *objectLazyAny) ToBool() bool { - return true -} - -func (any *objectLazyAny) ToInt() int { - return 0 -} - -func (any *objectLazyAny) ToInt32() int32 { - return 0 -} - -func (any *objectLazyAny) ToInt64() int64 { - return 0 -} - -func (any *objectLazyAny) ToUint() uint { - return 0 -} - -func (any *objectLazyAny) ToUint32() uint32 { - return 0 -} - -func (any *objectLazyAny) ToUint64() uint64 { - return 0 -} - -func (any *objectLazyAny) ToFloat32() float32 { - return 0 -} - -func (any *objectLazyAny) ToFloat64() float64 { - return 0 -} - -func (any *objectLazyAny) ToString() string { - return *(*string)(unsafe.Pointer(&any.buf)) -} - -func (any *objectLazyAny) ToVal(obj interface{}) { - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - iter.ReadVal(obj) -} - -func (any *objectLazyAny) Get(path ...interface{}) Any { - if len(path) == 0 { - return any - } - switch firstPath := path[0].(type) { - case string: - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - valueBytes := locateObjectField(iter, firstPath) - if valueBytes == nil { - return newInvalidAny(path) - } - iter.ResetBytes(valueBytes) - return locatePath(iter, path[1:]) - case int32: - if '*' == firstPath { - mappedAll := map[string]Any{} - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - iter.ReadMapCB(func(iter *Iterator, field string) bool { - mapped := locatePath(iter, path[1:]) - if mapped.ValueType() != InvalidValue { - mappedAll[field] = mapped - } - return true - }) - return wrapMap(mappedAll) - } - return newInvalidAny(path) - default: - return newInvalidAny(path) - } -} - -func (any *objectLazyAny) Keys() []string { - keys := []string{} - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - iter.ReadMapCB(func(iter *Iterator, field string) bool { - iter.Skip() - keys = append(keys, field) - return true - }) - return keys -} - -func (any *objectLazyAny) Size() int { - size := 0 - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - iter.ReadObjectCB(func(iter *Iterator, field string) bool { - iter.Skip() - size++ - return true - }) - return size -} - -func (any *objectLazyAny) WriteTo(stream *Stream) { - stream.Write(any.buf) -} - -func (any *objectLazyAny) GetInterface() interface{} { - iter := any.cfg.BorrowIterator(any.buf) - defer any.cfg.ReturnIterator(iter) - return iter.Read() -} - -type objectAny struct { - baseAny - err error - val reflect.Value -} - -func wrapStruct(val interface{}) *objectAny { - return &objectAny{baseAny{}, nil, reflect.ValueOf(val)} -} - -func (any *objectAny) ValueType() ValueType { - return ObjectValue -} - -func (any *objectAny) MustBeValid() Any { - return any -} - -func (any *objectAny) Parse() *Iterator { - return nil -} - -func (any *objectAny) LastError() error { - return any.err -} - -func (any *objectAny) ToBool() bool { - return any.val.NumField() != 0 -} - -func (any *objectAny) ToInt() int { - return 0 -} - -func (any *objectAny) ToInt32() int32 { - return 0 -} - -func (any *objectAny) ToInt64() int64 { - return 0 -} - -func (any *objectAny) ToUint() uint { - return 0 -} - -func (any *objectAny) ToUint32() uint32 { - return 0 -} - -func (any *objectAny) ToUint64() uint64 { - return 0 -} - -func (any *objectAny) ToFloat32() float32 { - return 0 -} - -func (any *objectAny) ToFloat64() float64 { - return 0 -} - -func (any *objectAny) ToString() string { - str, err := MarshalToString(any.val.Interface()) - any.err = err - return str -} - -func (any *objectAny) Get(path ...interface{}) Any { - if len(path) == 0 { - return any - } - switch firstPath := path[0].(type) { - case string: - field := any.val.FieldByName(firstPath) - if !field.IsValid() { - return newInvalidAny(path) - } - return Wrap(field.Interface()) - case int32: - if '*' == firstPath { - mappedAll := map[string]Any{} - for i := 0; i < any.val.NumField(); i++ { - field := any.val.Field(i) - if field.CanInterface() { - mapped := Wrap(field.Interface()).Get(path[1:]...) - if mapped.ValueType() != InvalidValue { - mappedAll[any.val.Type().Field(i).Name] = mapped - } - } - } - return wrapMap(mappedAll) - } - return newInvalidAny(path) - default: - return newInvalidAny(path) - } -} - -func (any *objectAny) Keys() []string { - keys := make([]string, 0, any.val.NumField()) - for i := 0; i < any.val.NumField(); i++ { - keys = append(keys, any.val.Type().Field(i).Name) - } - return keys -} - -func (any *objectAny) Size() int { - return any.val.NumField() -} - -func (any *objectAny) WriteTo(stream *Stream) { - stream.WriteVal(any.val) -} - -func (any *objectAny) GetInterface() interface{} { - return any.val.Interface() -} - -type mapAny struct { - baseAny - err error - val reflect.Value -} - -func wrapMap(val interface{}) *mapAny { - return &mapAny{baseAny{}, nil, reflect.ValueOf(val)} -} - -func (any *mapAny) ValueType() ValueType { - return ObjectValue -} - -func (any *mapAny) MustBeValid() Any { - return any -} - -func (any *mapAny) Parse() *Iterator { - return nil -} - -func (any *mapAny) LastError() error { - return any.err -} - -func (any *mapAny) ToBool() bool { - return true -} - -func (any *mapAny) ToInt() int { - return 0 -} - -func (any *mapAny) ToInt32() int32 { - return 0 -} - -func (any *mapAny) ToInt64() int64 { - return 0 -} - -func (any *mapAny) ToUint() uint { - return 0 -} - -func (any *mapAny) ToUint32() uint32 { - return 0 -} - -func (any *mapAny) ToUint64() uint64 { - return 0 -} - -func (any *mapAny) ToFloat32() float32 { - return 0 -} - -func (any *mapAny) ToFloat64() float64 { - return 0 -} - -func (any *mapAny) ToString() string { - str, err := MarshalToString(any.val.Interface()) - any.err = err - return str -} - -func (any *mapAny) Get(path ...interface{}) Any { - if len(path) == 0 { - return any - } - switch firstPath := path[0].(type) { - case int32: - if '*' == firstPath { - mappedAll := map[string]Any{} - for _, key := range any.val.MapKeys() { - keyAsStr := key.String() - element := Wrap(any.val.MapIndex(key).Interface()) - mapped := element.Get(path[1:]...) - if mapped.ValueType() != InvalidValue { - mappedAll[keyAsStr] = mapped - } - } - return wrapMap(mappedAll) - } - return newInvalidAny(path) - default: - value := any.val.MapIndex(reflect.ValueOf(firstPath)) - if !value.IsValid() { - return newInvalidAny(path) - } - return Wrap(value.Interface()) - } -} - -func (any *mapAny) Keys() []string { - keys := make([]string, 0, any.val.Len()) - for _, key := range any.val.MapKeys() { - keys = append(keys, key.String()) - } - return keys -} - -func (any *mapAny) Size() int { - return any.val.Len() -} - -func (any *mapAny) WriteTo(stream *Stream) { - stream.WriteVal(any.val) -} - -func (any *mapAny) GetInterface() interface{} { - return any.val.Interface() -} diff --git a/vendor/github.com/json-iterator/go/any_str.go b/vendor/github.com/json-iterator/go/any_str.go deleted file mode 100644 index 1f12f6612..000000000 --- a/vendor/github.com/json-iterator/go/any_str.go +++ /dev/null @@ -1,166 +0,0 @@ -package jsoniter - -import ( - "fmt" - "strconv" -) - -type stringAny struct { - baseAny - val string -} - -func (any *stringAny) Get(path ...interface{}) Any { - if len(path) == 0 { - return any - } - return &invalidAny{baseAny{}, fmt.Errorf("GetIndex %v from simple value", path)} -} - -func (any *stringAny) Parse() *Iterator { - return nil -} - -func (any *stringAny) ValueType() ValueType { - return StringValue -} - -func (any *stringAny) MustBeValid() Any { - return any -} - -func (any *stringAny) LastError() error { - return nil -} - -func (any *stringAny) ToBool() bool { - str := any.ToString() - if str == "0" { - return false - } - for _, c := range str { - switch c { - case ' ', '\n', '\r', '\t': - default: - return true - } - } - return false -} - -func (any *stringAny) ToInt() int { - return int(any.ToInt64()) - -} - -func (any *stringAny) ToInt32() int32 { - return int32(any.ToInt64()) -} - -func (any *stringAny) ToInt64() int64 { - if any.val == "" { - return 0 - } - - flag := 1 - startPos := 0 - if any.val[0] == '+' || any.val[0] == '-' { - startPos = 1 - } - - if any.val[0] == '-' { - flag = -1 - } - - endPos := startPos - for i := startPos; i < len(any.val); i++ { - if any.val[i] >= '0' && any.val[i] <= '9' { - endPos = i + 1 - } else { - break - } - } - parsed, _ := strconv.ParseInt(any.val[startPos:endPos], 10, 64) - return int64(flag) * parsed -} - -func (any *stringAny) ToUint() uint { - return uint(any.ToUint64()) -} - -func (any *stringAny) ToUint32() uint32 { - return uint32(any.ToUint64()) -} - -func (any *stringAny) ToUint64() uint64 { - if any.val == "" { - return 0 - } - - startPos := 0 - - if any.val[0] == '-' { - return 0 - } - if any.val[0] == '+' { - startPos = 1 - } - - endPos := startPos - for i := startPos; i < len(any.val); i++ { - if any.val[i] >= '0' && any.val[i] <= '9' { - endPos = i + 1 - } else { - break - } - } - parsed, _ := strconv.ParseUint(any.val[startPos:endPos], 10, 64) - return parsed -} - -func (any *stringAny) ToFloat32() float32 { - return float32(any.ToFloat64()) -} - -func (any *stringAny) ToFloat64() float64 { - if len(any.val) == 0 { - return 0 - } - - // first char invalid - if any.val[0] != '+' && any.val[0] != '-' && (any.val[0] > '9' || any.val[0] < '0') { - return 0 - } - - // extract valid num expression from string - // eg 123true => 123, -12.12xxa => -12.12 - endPos := 1 - for i := 1; i < len(any.val); i++ { - if any.val[i] == '.' || any.val[i] == 'e' || any.val[i] == 'E' || any.val[i] == '+' || any.val[i] == '-' { - endPos = i + 1 - continue - } - - // end position is the first char which is not digit - if any.val[i] >= '0' && any.val[i] <= '9' { - endPos = i + 1 - } else { - endPos = i - break - } - } - parsed, _ := strconv.ParseFloat(any.val[:endPos], 64) - return parsed -} - -func (any *stringAny) ToString() string { - return any.val -} - -func (any *stringAny) WriteTo(stream *Stream) { - stream.WriteString(any.val) -} - -func (any *stringAny) GetInterface() interface{} { - return any.val -} diff --git a/vendor/github.com/json-iterator/go/any_uint32.go b/vendor/github.com/json-iterator/go/any_uint32.go deleted file mode 100644 index 656bbd33d..000000000 --- a/vendor/github.com/json-iterator/go/any_uint32.go +++ /dev/null @@ -1,74 +0,0 @@ -package jsoniter - -import ( - "strconv" -) - -type uint32Any struct { - baseAny - val uint32 -} - -func (any *uint32Any) LastError() error { - return nil -} - -func (any *uint32Any) ValueType() ValueType { - return NumberValue -} - -func (any *uint32Any) MustBeValid() Any { - return any -} - -func (any *uint32Any) ToBool() bool { - return any.val != 0 -} - -func (any *uint32Any) ToInt() int { - return int(any.val) -} - -func (any *uint32Any) ToInt32() int32 { - return int32(any.val) -} - -func (any *uint32Any) ToInt64() int64 { - return int64(any.val) -} - -func (any *uint32Any) ToUint() uint { - return uint(any.val) -} - -func (any *uint32Any) ToUint32() uint32 { - return any.val -} - -func (any *uint32Any) ToUint64() uint64 { - return uint64(any.val) -} - -func (any *uint32Any) ToFloat32() float32 { - return float32(any.val) -} - -func (any *uint32Any) ToFloat64() float64 { - return float64(any.val) -} - -func (any *uint32Any) ToString() string { - return strconv.FormatInt(int64(any.val), 10) -} - -func (any *uint32Any) WriteTo(stream *Stream) { - stream.WriteUint32(any.val) -} - -func (any *uint32Any) Parse() *Iterator { - return nil -} - -func (any *uint32Any) GetInterface() interface{} { - return any.val -} diff --git a/vendor/github.com/json-iterator/go/any_uint64.go b/vendor/github.com/json-iterator/go/any_uint64.go deleted file mode 100644 index 7df2fce33..000000000 --- a/vendor/github.com/json-iterator/go/any_uint64.go +++ /dev/null @@ -1,74 +0,0 @@ -package jsoniter - -import ( - "strconv" -) - -type uint64Any struct { - baseAny - val uint64 -} - -func (any *uint64Any) LastError() error { - return nil -} - -func (any *uint64Any) ValueType() ValueType { - return NumberValue -} - -func (any *uint64Any) MustBeValid() Any { - return any -} - -func (any *uint64Any) ToBool() bool { - return any.val != 0 -} - -func (any *uint64Any) ToInt() int { - return int(any.val) -} - -func (any *uint64Any) ToInt32() int32 { - return int32(any.val) -} - -func (any *uint64Any) ToInt64() int64 { - return int64(any.val) -} - -func (any *uint64Any) ToUint() uint { - return uint(any.val) -} - -func (any *uint64Any) ToUint32() uint32 { - return uint32(any.val) -} - -func (any *uint64Any) ToUint64() uint64 { - return any.val -} - -func (any *uint64Any) ToFloat32() float32 { - return float32(any.val) -} - -func (any *uint64Any) ToFloat64() float64 { - return float64(any.val) -} - -func (any *uint64Any) ToString() string { - return strconv.FormatUint(any.val, 10) -} - -func (any *uint64Any) WriteTo(stream *Stream) { - stream.WriteUint64(any.val) -} - -func (any *uint64Any) Parse() *Iterator { - return nil -} - -func (any *uint64Any) GetInterface() interface{} { - return any.val -} diff --git a/vendor/github.com/json-iterator/go/build.sh b/vendor/github.com/json-iterator/go/build.sh deleted file mode 100644 index b45ef6883..000000000 --- a/vendor/github.com/json-iterator/go/build.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -set -e -set -x - -if [ ! -d /tmp/build-golang/src/github.com/json-iterator ]; then - mkdir -p /tmp/build-golang/src/github.com/json-iterator - ln -s $PWD /tmp/build-golang/src/github.com/json-iterator/go -fi -export GOPATH=/tmp/build-golang -go get -u github.com/golang/dep/cmd/dep -cd /tmp/build-golang/src/github.com/json-iterator/go -exec $GOPATH/bin/dep ensure -update diff --git a/vendor/github.com/json-iterator/go/config.go b/vendor/github.com/json-iterator/go/config.go deleted file mode 100644 index 2adcdc3b7..000000000 --- a/vendor/github.com/json-iterator/go/config.go +++ /dev/null @@ -1,375 +0,0 @@ -package jsoniter - -import ( - "encoding/json" - "io" - "reflect" - "sync" - "unsafe" - - "github.com/modern-go/concurrent" - "github.com/modern-go/reflect2" -) - -// Config customize how the API should behave. -// The API is created from Config by Froze. -type Config struct { - IndentionStep int - MarshalFloatWith6Digits bool - EscapeHTML bool - SortMapKeys bool - UseNumber bool - DisallowUnknownFields bool - TagKey string - OnlyTaggedField bool - ValidateJsonRawMessage bool - ObjectFieldMustBeSimpleString bool - CaseSensitive bool -} - -// API the public interface of this package. -// Primary Marshal and Unmarshal. -type API interface { - IteratorPool - StreamPool - MarshalToString(v interface{}) (string, error) - Marshal(v interface{}) ([]byte, error) - MarshalIndent(v interface{}, prefix, indent string) ([]byte, error) - UnmarshalFromString(str string, v interface{}) error - Unmarshal(data []byte, v interface{}) error - Get(data []byte, path ...interface{}) Any - NewEncoder(writer io.Writer) *Encoder - NewDecoder(reader io.Reader) *Decoder - Valid(data []byte) bool - RegisterExtension(extension Extension) - DecoderOf(typ reflect2.Type) ValDecoder - EncoderOf(typ reflect2.Type) ValEncoder -} - -// ConfigDefault the default API -var ConfigDefault = Config{ - EscapeHTML: true, -}.Froze() - -// ConfigCompatibleWithStandardLibrary tries to be 100% compatible with standard library behavior -var ConfigCompatibleWithStandardLibrary = Config{ - EscapeHTML: true, - SortMapKeys: true, - ValidateJsonRawMessage: true, -}.Froze() - -// ConfigFastest marshals float with only 6 digits precision -var ConfigFastest = Config{ - EscapeHTML: false, - MarshalFloatWith6Digits: true, // will lose precession - ObjectFieldMustBeSimpleString: true, // do not unescape object field -}.Froze() - -type frozenConfig struct { - configBeforeFrozen Config - sortMapKeys bool - indentionStep int - objectFieldMustBeSimpleString bool - onlyTaggedField bool - disallowUnknownFields bool - decoderCache *concurrent.Map - encoderCache *concurrent.Map - encoderExtension Extension - decoderExtension Extension - extraExtensions []Extension - streamPool *sync.Pool - iteratorPool *sync.Pool - caseSensitive bool -} - -func (cfg *frozenConfig) initCache() { - cfg.decoderCache = concurrent.NewMap() - cfg.encoderCache = concurrent.NewMap() -} - -func (cfg *frozenConfig) addDecoderToCache(cacheKey uintptr, decoder ValDecoder) { - cfg.decoderCache.Store(cacheKey, decoder) -} - -func (cfg *frozenConfig) addEncoderToCache(cacheKey uintptr, encoder ValEncoder) { - cfg.encoderCache.Store(cacheKey, encoder) -} - -func (cfg *frozenConfig) getDecoderFromCache(cacheKey uintptr) ValDecoder { - decoder, found := cfg.decoderCache.Load(cacheKey) - if found { - return decoder.(ValDecoder) - } - return nil -} - -func (cfg *frozenConfig) getEncoderFromCache(cacheKey uintptr) ValEncoder { - encoder, found := cfg.encoderCache.Load(cacheKey) - if found { - return encoder.(ValEncoder) - } - return nil -} - -var cfgCache = concurrent.NewMap() - -func getFrozenConfigFromCache(cfg Config) *frozenConfig { - obj, found := cfgCache.Load(cfg) - if found { - return obj.(*frozenConfig) - } - return nil -} - -func addFrozenConfigToCache(cfg Config, frozenConfig *frozenConfig) { - cfgCache.Store(cfg, frozenConfig) -} - -// Froze forge API from config -func (cfg Config) Froze() API { - api := &frozenConfig{ - sortMapKeys: cfg.SortMapKeys, - indentionStep: cfg.IndentionStep, - objectFieldMustBeSimpleString: cfg.ObjectFieldMustBeSimpleString, - onlyTaggedField: cfg.OnlyTaggedField, - disallowUnknownFields: cfg.DisallowUnknownFields, - caseSensitive: cfg.CaseSensitive, - } - api.streamPool = &sync.Pool{ - New: func() interface{} { - return NewStream(api, nil, 512) - }, - } - api.iteratorPool = &sync.Pool{ - New: func() interface{} { - return NewIterator(api) - }, - } - api.initCache() - encoderExtension := EncoderExtension{} - decoderExtension := DecoderExtension{} - if cfg.MarshalFloatWith6Digits { - api.marshalFloatWith6Digits(encoderExtension) - } - if cfg.EscapeHTML { - api.escapeHTML(encoderExtension) - } - if cfg.UseNumber { - api.useNumber(decoderExtension) - } - if cfg.ValidateJsonRawMessage { - api.validateJsonRawMessage(encoderExtension) - } - api.encoderExtension = encoderExtension - api.decoderExtension = decoderExtension - api.configBeforeFrozen = cfg - return api -} - -func (cfg Config) frozeWithCacheReuse(extraExtensions []Extension) *frozenConfig { - api := getFrozenConfigFromCache(cfg) - if api != nil { - return api - } - api = cfg.Froze().(*frozenConfig) - for _, extension := range extraExtensions { - api.RegisterExtension(extension) - } - addFrozenConfigToCache(cfg, api) - return api -} - -func (cfg *frozenConfig) validateJsonRawMessage(extension EncoderExtension) { - encoder := &funcEncoder{func(ptr unsafe.Pointer, stream *Stream) { - rawMessage := *(*json.RawMessage)(ptr) - iter := cfg.BorrowIterator([]byte(rawMessage)) - defer cfg.ReturnIterator(iter) - iter.Read() - if iter.Error != nil && iter.Error != io.EOF { - stream.WriteRaw("null") - } else { - stream.WriteRaw(string(rawMessage)) - } - }, func(ptr unsafe.Pointer) bool { - return len(*((*json.RawMessage)(ptr))) == 0 - }} - extension[reflect2.TypeOfPtr((*json.RawMessage)(nil)).Elem()] = encoder - extension[reflect2.TypeOfPtr((*RawMessage)(nil)).Elem()] = encoder -} - -func (cfg *frozenConfig) useNumber(extension DecoderExtension) { - extension[reflect2.TypeOfPtr((*interface{})(nil)).Elem()] = &funcDecoder{func(ptr unsafe.Pointer, iter *Iterator) { - exitingValue := *((*interface{})(ptr)) - if exitingValue != nil && reflect.TypeOf(exitingValue).Kind() == reflect.Ptr { - iter.ReadVal(exitingValue) - return - } - if iter.WhatIsNext() == NumberValue { - *((*interface{})(ptr)) = json.Number(iter.readNumberAsString()) - } else { - *((*interface{})(ptr)) = iter.Read() - } - }} -} -func (cfg *frozenConfig) getTagKey() string { - tagKey := cfg.configBeforeFrozen.TagKey - if tagKey == "" { - return "json" - } - return tagKey -} - -func (cfg *frozenConfig) RegisterExtension(extension Extension) { - cfg.extraExtensions = append(cfg.extraExtensions, extension) - copied := cfg.configBeforeFrozen - cfg.configBeforeFrozen = copied -} - -type lossyFloat32Encoder struct { -} - -func (encoder *lossyFloat32Encoder) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteFloat32Lossy(*((*float32)(ptr))) -} - -func (encoder *lossyFloat32Encoder) IsEmpty(ptr unsafe.Pointer) bool { - return *((*float32)(ptr)) == 0 -} - -type lossyFloat64Encoder struct { -} - -func (encoder *lossyFloat64Encoder) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteFloat64Lossy(*((*float64)(ptr))) -} - -func (encoder *lossyFloat64Encoder) IsEmpty(ptr unsafe.Pointer) bool { - return *((*float64)(ptr)) == 0 -} - -// EnableLossyFloatMarshalling keeps 10**(-6) precision -// for float variables for better performance. -func (cfg *frozenConfig) marshalFloatWith6Digits(extension EncoderExtension) { - // for better performance - extension[reflect2.TypeOfPtr((*float32)(nil)).Elem()] = &lossyFloat32Encoder{} - extension[reflect2.TypeOfPtr((*float64)(nil)).Elem()] = &lossyFloat64Encoder{} -} - -type htmlEscapedStringEncoder struct { -} - -func (encoder *htmlEscapedStringEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - str := *((*string)(ptr)) - stream.WriteStringWithHTMLEscaped(str) -} - -func (encoder *htmlEscapedStringEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return *((*string)(ptr)) == "" -} - -func (cfg *frozenConfig) escapeHTML(encoderExtension EncoderExtension) { - encoderExtension[reflect2.TypeOfPtr((*string)(nil)).Elem()] = &htmlEscapedStringEncoder{} -} - -func (cfg *frozenConfig) cleanDecoders() { - typeDecoders = map[string]ValDecoder{} - fieldDecoders = map[string]ValDecoder{} - *cfg = *(cfg.configBeforeFrozen.Froze().(*frozenConfig)) -} - -func (cfg *frozenConfig) cleanEncoders() { - typeEncoders = map[string]ValEncoder{} - fieldEncoders = map[string]ValEncoder{} - *cfg = *(cfg.configBeforeFrozen.Froze().(*frozenConfig)) -} - -func (cfg *frozenConfig) MarshalToString(v interface{}) (string, error) { - stream := cfg.BorrowStream(nil) - defer cfg.ReturnStream(stream) - stream.WriteVal(v) - if stream.Error != nil { - return "", stream.Error - } - return string(stream.Buffer()), nil -} - -func (cfg *frozenConfig) Marshal(v interface{}) ([]byte, error) { - stream := cfg.BorrowStream(nil) - defer cfg.ReturnStream(stream) - stream.WriteVal(v) - if stream.Error != nil { - return nil, stream.Error - } - result := stream.Buffer() - copied := make([]byte, len(result)) - copy(copied, result) - return copied, nil -} - -func (cfg *frozenConfig) MarshalIndent(v interface{}, prefix, indent string) ([]byte, error) { - if prefix != "" { - panic("prefix is not supported") - } - for _, r := range indent { - if r != ' ' { - panic("indent can only be space") - } - } - newCfg := cfg.configBeforeFrozen - newCfg.IndentionStep = len(indent) - return newCfg.frozeWithCacheReuse(cfg.extraExtensions).Marshal(v) -} - -func (cfg *frozenConfig) UnmarshalFromString(str string, v interface{}) error { - data := []byte(str) - iter := cfg.BorrowIterator(data) - defer cfg.ReturnIterator(iter) - iter.ReadVal(v) - c := iter.nextToken() - if c == 0 { - if iter.Error == io.EOF { - return nil - } - return iter.Error - } - iter.ReportError("Unmarshal", "there are bytes left after unmarshal") - return iter.Error -} - -func (cfg *frozenConfig) Get(data []byte, path ...interface{}) Any { - iter := cfg.BorrowIterator(data) - defer cfg.ReturnIterator(iter) - return locatePath(iter, path) -} - -func (cfg *frozenConfig) Unmarshal(data []byte, v interface{}) error { - iter := cfg.BorrowIterator(data) - defer cfg.ReturnIterator(iter) - iter.ReadVal(v) - c := iter.nextToken() - if c == 0 { - if iter.Error == io.EOF { - return nil - } - return iter.Error - } - iter.ReportError("Unmarshal", "there are bytes left after unmarshal") - return iter.Error -} - -func (cfg *frozenConfig) NewEncoder(writer io.Writer) *Encoder { - stream := NewStream(cfg, writer, 512) - return &Encoder{stream} -} - -func (cfg *frozenConfig) NewDecoder(reader io.Reader) *Decoder { - iter := Parse(cfg, reader, 512) - return &Decoder{iter} -} - -func (cfg *frozenConfig) Valid(data []byte) bool { - iter := cfg.BorrowIterator(data) - defer cfg.ReturnIterator(iter) - iter.Skip() - return iter.Error == nil -} diff --git a/vendor/github.com/json-iterator/go/fuzzy_mode_convert_table.md b/vendor/github.com/json-iterator/go/fuzzy_mode_convert_table.md deleted file mode 100644 index 3095662b0..000000000 --- a/vendor/github.com/json-iterator/go/fuzzy_mode_convert_table.md +++ /dev/null @@ -1,7 +0,0 @@ -| json type \ dest type | bool | int | uint | float |string| -| --- | --- | --- | --- |--|--| -| number | positive => true
negative => true
zero => false| 23.2 => 23
-32.1 => -32| 12.1 => 12
-12.1 => 0|as normal|same as origin| -| string | empty string => false
string "0" => false
other strings => true | "123.32" => 123
"-123.4" => -123
"123.23xxxw" => 123
"abcde12" => 0
"-32.1" => -32| 13.2 => 13
-1.1 => 0 |12.1 => 12.1
-12.3 => -12.3
12.4xxa => 12.4
+1.1e2 =>110 |same as origin| -| bool | true => true
false => false| true => 1
false => 0 | true => 1
false => 0 |true => 1
false => 0|true => "true"
false => "false"| -| object | true | 0 | 0 |0|originnal json| -| array | empty array => false
nonempty array => true| [] => 0
[1,2] => 1 | [] => 0
[1,2] => 1 |[] => 0
[1,2] => 1|original json| \ No newline at end of file diff --git a/vendor/github.com/json-iterator/go/iter.go b/vendor/github.com/json-iterator/go/iter.go deleted file mode 100644 index 29b31cf78..000000000 --- a/vendor/github.com/json-iterator/go/iter.go +++ /dev/null @@ -1,349 +0,0 @@ -package jsoniter - -import ( - "encoding/json" - "fmt" - "io" -) - -// ValueType the type for JSON element -type ValueType int - -const ( - // InvalidValue invalid JSON element - InvalidValue ValueType = iota - // StringValue JSON element "string" - StringValue - // NumberValue JSON element 100 or 0.10 - NumberValue - // NilValue JSON element null - NilValue - // BoolValue JSON element true or false - BoolValue - // ArrayValue JSON element [] - ArrayValue - // ObjectValue JSON element {} - ObjectValue -) - -var hexDigits []byte -var valueTypes []ValueType - -func init() { - hexDigits = make([]byte, 256) - for i := 0; i < len(hexDigits); i++ { - hexDigits[i] = 255 - } - for i := '0'; i <= '9'; i++ { - hexDigits[i] = byte(i - '0') - } - for i := 'a'; i <= 'f'; i++ { - hexDigits[i] = byte((i - 'a') + 10) - } - for i := 'A'; i <= 'F'; i++ { - hexDigits[i] = byte((i - 'A') + 10) - } - valueTypes = make([]ValueType, 256) - for i := 0; i < len(valueTypes); i++ { - valueTypes[i] = InvalidValue - } - valueTypes['"'] = StringValue - valueTypes['-'] = NumberValue - valueTypes['0'] = NumberValue - valueTypes['1'] = NumberValue - valueTypes['2'] = NumberValue - valueTypes['3'] = NumberValue - valueTypes['4'] = NumberValue - valueTypes['5'] = NumberValue - valueTypes['6'] = NumberValue - valueTypes['7'] = NumberValue - valueTypes['8'] = NumberValue - valueTypes['9'] = NumberValue - valueTypes['t'] = BoolValue - valueTypes['f'] = BoolValue - valueTypes['n'] = NilValue - valueTypes['['] = ArrayValue - valueTypes['{'] = ObjectValue -} - -// Iterator is a io.Reader like object, with JSON specific read functions. -// Error is not returned as return value, but stored as Error member on this iterator instance. -type Iterator struct { - cfg *frozenConfig - reader io.Reader - buf []byte - head int - tail int - depth int - captureStartedAt int - captured []byte - Error error - Attachment interface{} // open for customized decoder -} - -// NewIterator creates an empty Iterator instance -func NewIterator(cfg API) *Iterator { - return &Iterator{ - cfg: cfg.(*frozenConfig), - reader: nil, - buf: nil, - head: 0, - tail: 0, - depth: 0, - } -} - -// Parse creates an Iterator instance from io.Reader -func Parse(cfg API, reader io.Reader, bufSize int) *Iterator { - return &Iterator{ - cfg: cfg.(*frozenConfig), - reader: reader, - buf: make([]byte, bufSize), - head: 0, - tail: 0, - depth: 0, - } -} - -// ParseBytes creates an Iterator instance from byte array -func ParseBytes(cfg API, input []byte) *Iterator { - return &Iterator{ - cfg: cfg.(*frozenConfig), - reader: nil, - buf: input, - head: 0, - tail: len(input), - depth: 0, - } -} - -// ParseString creates an Iterator instance from string -func ParseString(cfg API, input string) *Iterator { - return ParseBytes(cfg, []byte(input)) -} - -// Pool returns a pool can provide more iterator with same configuration -func (iter *Iterator) Pool() IteratorPool { - return iter.cfg -} - -// Reset reuse iterator instance by specifying another reader -func (iter *Iterator) Reset(reader io.Reader) *Iterator { - iter.reader = reader - iter.head = 0 - iter.tail = 0 - iter.depth = 0 - return iter -} - -// ResetBytes reuse iterator instance by specifying another byte array as input -func (iter *Iterator) ResetBytes(input []byte) *Iterator { - iter.reader = nil - iter.buf = input - iter.head = 0 - iter.tail = len(input) - iter.depth = 0 - return iter -} - -// WhatIsNext gets ValueType of relatively next json element -func (iter *Iterator) WhatIsNext() ValueType { - valueType := valueTypes[iter.nextToken()] - iter.unreadByte() - return valueType -} - -func (iter *Iterator) skipWhitespacesWithoutLoadMore() bool { - for i := iter.head; i < iter.tail; i++ { - c := iter.buf[i] - switch c { - case ' ', '\n', '\t', '\r': - continue - } - iter.head = i - return false - } - return true -} - -func (iter *Iterator) isObjectEnd() bool { - c := iter.nextToken() - if c == ',' { - return false - } - if c == '}' { - return true - } - iter.ReportError("isObjectEnd", "object ended prematurely, unexpected char "+string([]byte{c})) - return true -} - -func (iter *Iterator) nextToken() byte { - // a variation of skip whitespaces, returning the next non-whitespace token - for { - for i := iter.head; i < iter.tail; i++ { - c := iter.buf[i] - switch c { - case ' ', '\n', '\t', '\r': - continue - } - iter.head = i + 1 - return c - } - if !iter.loadMore() { - return 0 - } - } -} - -// ReportError record a error in iterator instance with current position. -func (iter *Iterator) ReportError(operation string, msg string) { - if iter.Error != nil { - if iter.Error != io.EOF { - return - } - } - peekStart := iter.head - 10 - if peekStart < 0 { - peekStart = 0 - } - peekEnd := iter.head + 10 - if peekEnd > iter.tail { - peekEnd = iter.tail - } - parsing := string(iter.buf[peekStart:peekEnd]) - contextStart := iter.head - 50 - if contextStart < 0 { - contextStart = 0 - } - contextEnd := iter.head + 50 - if contextEnd > iter.tail { - contextEnd = iter.tail - } - context := string(iter.buf[contextStart:contextEnd]) - iter.Error = fmt.Errorf("%s: %s, error found in #%v byte of ...|%s|..., bigger context ...|%s|...", - operation, msg, iter.head-peekStart, parsing, context) -} - -// CurrentBuffer gets current buffer as string for debugging purpose -func (iter *Iterator) CurrentBuffer() string { - peekStart := iter.head - 10 - if peekStart < 0 { - peekStart = 0 - } - return fmt.Sprintf("parsing #%v byte, around ...|%s|..., whole buffer ...|%s|...", iter.head, - string(iter.buf[peekStart:iter.head]), string(iter.buf[0:iter.tail])) -} - -func (iter *Iterator) readByte() (ret byte) { - if iter.head == iter.tail { - if iter.loadMore() { - ret = iter.buf[iter.head] - iter.head++ - return ret - } - return 0 - } - ret = iter.buf[iter.head] - iter.head++ - return ret -} - -func (iter *Iterator) loadMore() bool { - if iter.reader == nil { - if iter.Error == nil { - iter.head = iter.tail - iter.Error = io.EOF - } - return false - } - if iter.captured != nil { - iter.captured = append(iter.captured, - iter.buf[iter.captureStartedAt:iter.tail]...) - iter.captureStartedAt = 0 - } - for { - n, err := iter.reader.Read(iter.buf) - if n == 0 { - if err != nil { - if iter.Error == nil { - iter.Error = err - } - return false - } - } else { - iter.head = 0 - iter.tail = n - return true - } - } -} - -func (iter *Iterator) unreadByte() { - if iter.Error != nil { - return - } - iter.head-- - return -} - -// Read read the next JSON element as generic interface{}. -func (iter *Iterator) Read() interface{} { - valueType := iter.WhatIsNext() - switch valueType { - case StringValue: - return iter.ReadString() - case NumberValue: - if iter.cfg.configBeforeFrozen.UseNumber { - return json.Number(iter.readNumberAsString()) - } - return iter.ReadFloat64() - case NilValue: - iter.skipFourBytes('n', 'u', 'l', 'l') - return nil - case BoolValue: - return iter.ReadBool() - case ArrayValue: - arr := []interface{}{} - iter.ReadArrayCB(func(iter *Iterator) bool { - var elem interface{} - iter.ReadVal(&elem) - arr = append(arr, elem) - return true - }) - return arr - case ObjectValue: - obj := map[string]interface{}{} - iter.ReadMapCB(func(Iter *Iterator, field string) bool { - var elem interface{} - iter.ReadVal(&elem) - obj[field] = elem - return true - }) - return obj - default: - iter.ReportError("Read", fmt.Sprintf("unexpected value type: %v", valueType)) - return nil - } -} - -// limit maximum depth of nesting, as allowed by https://tools.ietf.org/html/rfc7159#section-9 -const maxDepth = 10000 - -func (iter *Iterator) incrementDepth() (success bool) { - iter.depth++ - if iter.depth <= maxDepth { - return true - } - iter.ReportError("incrementDepth", "exceeded max depth") - return false -} - -func (iter *Iterator) decrementDepth() (success bool) { - iter.depth-- - if iter.depth >= 0 { - return true - } - iter.ReportError("decrementDepth", "unexpected negative nesting") - return false -} diff --git a/vendor/github.com/json-iterator/go/iter_array.go b/vendor/github.com/json-iterator/go/iter_array.go deleted file mode 100644 index 204fe0e09..000000000 --- a/vendor/github.com/json-iterator/go/iter_array.go +++ /dev/null @@ -1,64 +0,0 @@ -package jsoniter - -// ReadArray read array element, tells if the array has more element to read. -func (iter *Iterator) ReadArray() (ret bool) { - c := iter.nextToken() - switch c { - case 'n': - iter.skipThreeBytes('u', 'l', 'l') - return false // null - case '[': - c = iter.nextToken() - if c != ']' { - iter.unreadByte() - return true - } - return false - case ']': - return false - case ',': - return true - default: - iter.ReportError("ReadArray", "expect [ or , or ] or n, but found "+string([]byte{c})) - return - } -} - -// ReadArrayCB read array with callback -func (iter *Iterator) ReadArrayCB(callback func(*Iterator) bool) (ret bool) { - c := iter.nextToken() - if c == '[' { - if !iter.incrementDepth() { - return false - } - c = iter.nextToken() - if c != ']' { - iter.unreadByte() - if !callback(iter) { - iter.decrementDepth() - return false - } - c = iter.nextToken() - for c == ',' { - if !callback(iter) { - iter.decrementDepth() - return false - } - c = iter.nextToken() - } - if c != ']' { - iter.ReportError("ReadArrayCB", "expect ] in the end, but found "+string([]byte{c})) - iter.decrementDepth() - return false - } - return iter.decrementDepth() - } - return iter.decrementDepth() - } - if c == 'n' { - iter.skipThreeBytes('u', 'l', 'l') - return true // null - } - iter.ReportError("ReadArrayCB", "expect [ or n, but found "+string([]byte{c})) - return false -} diff --git a/vendor/github.com/json-iterator/go/iter_float.go b/vendor/github.com/json-iterator/go/iter_float.go deleted file mode 100644 index 8a3d8b6fb..000000000 --- a/vendor/github.com/json-iterator/go/iter_float.go +++ /dev/null @@ -1,342 +0,0 @@ -package jsoniter - -import ( - "encoding/json" - "io" - "math/big" - "strconv" - "strings" - "unsafe" -) - -var floatDigits []int8 - -const invalidCharForNumber = int8(-1) -const endOfNumber = int8(-2) -const dotInNumber = int8(-3) - -func init() { - floatDigits = make([]int8, 256) - for i := 0; i < len(floatDigits); i++ { - floatDigits[i] = invalidCharForNumber - } - for i := int8('0'); i <= int8('9'); i++ { - floatDigits[i] = i - int8('0') - } - floatDigits[','] = endOfNumber - floatDigits[']'] = endOfNumber - floatDigits['}'] = endOfNumber - floatDigits[' '] = endOfNumber - floatDigits['\t'] = endOfNumber - floatDigits['\n'] = endOfNumber - floatDigits['.'] = dotInNumber -} - -// ReadBigFloat read big.Float -func (iter *Iterator) ReadBigFloat() (ret *big.Float) { - str := iter.readNumberAsString() - if iter.Error != nil && iter.Error != io.EOF { - return nil - } - prec := 64 - if len(str) > prec { - prec = len(str) - } - val, _, err := big.ParseFloat(str, 10, uint(prec), big.ToZero) - if err != nil { - iter.Error = err - return nil - } - return val -} - -// ReadBigInt read big.Int -func (iter *Iterator) ReadBigInt() (ret *big.Int) { - str := iter.readNumberAsString() - if iter.Error != nil && iter.Error != io.EOF { - return nil - } - ret = big.NewInt(0) - var success bool - ret, success = ret.SetString(str, 10) - if !success { - iter.ReportError("ReadBigInt", "invalid big int") - return nil - } - return ret -} - -//ReadFloat32 read float32 -func (iter *Iterator) ReadFloat32() (ret float32) { - c := iter.nextToken() - if c == '-' { - return -iter.readPositiveFloat32() - } - iter.unreadByte() - return iter.readPositiveFloat32() -} - -func (iter *Iterator) readPositiveFloat32() (ret float32) { - i := iter.head - // first char - if i == iter.tail { - return iter.readFloat32SlowPath() - } - c := iter.buf[i] - i++ - ind := floatDigits[c] - switch ind { - case invalidCharForNumber: - return iter.readFloat32SlowPath() - case endOfNumber: - iter.ReportError("readFloat32", "empty number") - return - case dotInNumber: - iter.ReportError("readFloat32", "leading dot is invalid") - return - case 0: - if i == iter.tail { - return iter.readFloat32SlowPath() - } - c = iter.buf[i] - switch c { - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - iter.ReportError("readFloat32", "leading zero is invalid") - return - } - } - value := uint64(ind) - // chars before dot -non_decimal_loop: - for ; i < iter.tail; i++ { - c = iter.buf[i] - ind := floatDigits[c] - switch ind { - case invalidCharForNumber: - return iter.readFloat32SlowPath() - case endOfNumber: - iter.head = i - return float32(value) - case dotInNumber: - break non_decimal_loop - } - if value > uint64SafeToMultiple10 { - return iter.readFloat32SlowPath() - } - value = (value << 3) + (value << 1) + uint64(ind) // value = value * 10 + ind; - } - // chars after dot - if c == '.' { - i++ - decimalPlaces := 0 - if i == iter.tail { - return iter.readFloat32SlowPath() - } - for ; i < iter.tail; i++ { - c = iter.buf[i] - ind := floatDigits[c] - switch ind { - case endOfNumber: - if decimalPlaces > 0 && decimalPlaces < len(pow10) { - iter.head = i - return float32(float64(value) / float64(pow10[decimalPlaces])) - } - // too many decimal places - return iter.readFloat32SlowPath() - case invalidCharForNumber, dotInNumber: - return iter.readFloat32SlowPath() - } - decimalPlaces++ - if value > uint64SafeToMultiple10 { - return iter.readFloat32SlowPath() - } - value = (value << 3) + (value << 1) + uint64(ind) - } - } - return iter.readFloat32SlowPath() -} - -func (iter *Iterator) readNumberAsString() (ret string) { - strBuf := [16]byte{} - str := strBuf[0:0] -load_loop: - for { - for i := iter.head; i < iter.tail; i++ { - c := iter.buf[i] - switch c { - case '+', '-', '.', 'e', 'E', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - str = append(str, c) - continue - default: - iter.head = i - break load_loop - } - } - if !iter.loadMore() { - break - } - } - if iter.Error != nil && iter.Error != io.EOF { - return - } - if len(str) == 0 { - iter.ReportError("readNumberAsString", "invalid number") - } - return *(*string)(unsafe.Pointer(&str)) -} - -func (iter *Iterator) readFloat32SlowPath() (ret float32) { - str := iter.readNumberAsString() - if iter.Error != nil && iter.Error != io.EOF { - return - } - errMsg := validateFloat(str) - if errMsg != "" { - iter.ReportError("readFloat32SlowPath", errMsg) - return - } - val, err := strconv.ParseFloat(str, 32) - if err != nil { - iter.Error = err - return - } - return float32(val) -} - -// ReadFloat64 read float64 -func (iter *Iterator) ReadFloat64() (ret float64) { - c := iter.nextToken() - if c == '-' { - return -iter.readPositiveFloat64() - } - iter.unreadByte() - return iter.readPositiveFloat64() -} - -func (iter *Iterator) readPositiveFloat64() (ret float64) { - i := iter.head - // first char - if i == iter.tail { - return iter.readFloat64SlowPath() - } - c := iter.buf[i] - i++ - ind := floatDigits[c] - switch ind { - case invalidCharForNumber: - return iter.readFloat64SlowPath() - case endOfNumber: - iter.ReportError("readFloat64", "empty number") - return - case dotInNumber: - iter.ReportError("readFloat64", "leading dot is invalid") - return - case 0: - if i == iter.tail { - return iter.readFloat64SlowPath() - } - c = iter.buf[i] - switch c { - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - iter.ReportError("readFloat64", "leading zero is invalid") - return - } - } - value := uint64(ind) - // chars before dot -non_decimal_loop: - for ; i < iter.tail; i++ { - c = iter.buf[i] - ind := floatDigits[c] - switch ind { - case invalidCharForNumber: - return iter.readFloat64SlowPath() - case endOfNumber: - iter.head = i - return float64(value) - case dotInNumber: - break non_decimal_loop - } - if value > uint64SafeToMultiple10 { - return iter.readFloat64SlowPath() - } - value = (value << 3) + (value << 1) + uint64(ind) // value = value * 10 + ind; - } - // chars after dot - if c == '.' { - i++ - decimalPlaces := 0 - if i == iter.tail { - return iter.readFloat64SlowPath() - } - for ; i < iter.tail; i++ { - c = iter.buf[i] - ind := floatDigits[c] - switch ind { - case endOfNumber: - if decimalPlaces > 0 && decimalPlaces < len(pow10) { - iter.head = i - return float64(value) / float64(pow10[decimalPlaces]) - } - // too many decimal places - return iter.readFloat64SlowPath() - case invalidCharForNumber, dotInNumber: - return iter.readFloat64SlowPath() - } - decimalPlaces++ - if value > uint64SafeToMultiple10 { - return iter.readFloat64SlowPath() - } - value = (value << 3) + (value << 1) + uint64(ind) - if value > maxFloat64 { - return iter.readFloat64SlowPath() - } - } - } - return iter.readFloat64SlowPath() -} - -func (iter *Iterator) readFloat64SlowPath() (ret float64) { - str := iter.readNumberAsString() - if iter.Error != nil && iter.Error != io.EOF { - return - } - errMsg := validateFloat(str) - if errMsg != "" { - iter.ReportError("readFloat64SlowPath", errMsg) - return - } - val, err := strconv.ParseFloat(str, 64) - if err != nil { - iter.Error = err - return - } - return val -} - -func validateFloat(str string) string { - // strconv.ParseFloat is not validating `1.` or `1.e1` - if len(str) == 0 { - return "empty number" - } - if str[0] == '-' { - return "-- is not valid" - } - dotPos := strings.IndexByte(str, '.') - if dotPos != -1 { - if dotPos == len(str)-1 { - return "dot can not be last character" - } - switch str[dotPos+1] { - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - default: - return "missing digit after dot" - } - } - return "" -} - -// ReadNumber read json.Number -func (iter *Iterator) ReadNumber() (ret json.Number) { - return json.Number(iter.readNumberAsString()) -} diff --git a/vendor/github.com/json-iterator/go/iter_int.go b/vendor/github.com/json-iterator/go/iter_int.go deleted file mode 100644 index d786a89fe..000000000 --- a/vendor/github.com/json-iterator/go/iter_int.go +++ /dev/null @@ -1,346 +0,0 @@ -package jsoniter - -import ( - "math" - "strconv" -) - -var intDigits []int8 - -const uint32SafeToMultiply10 = uint32(0xffffffff)/10 - 1 -const uint64SafeToMultiple10 = uint64(0xffffffffffffffff)/10 - 1 -const maxFloat64 = 1<<53 - 1 - -func init() { - intDigits = make([]int8, 256) - for i := 0; i < len(intDigits); i++ { - intDigits[i] = invalidCharForNumber - } - for i := int8('0'); i <= int8('9'); i++ { - intDigits[i] = i - int8('0') - } -} - -// ReadUint read uint -func (iter *Iterator) ReadUint() uint { - if strconv.IntSize == 32 { - return uint(iter.ReadUint32()) - } - return uint(iter.ReadUint64()) -} - -// ReadInt read int -func (iter *Iterator) ReadInt() int { - if strconv.IntSize == 32 { - return int(iter.ReadInt32()) - } - return int(iter.ReadInt64()) -} - -// ReadInt8 read int8 -func (iter *Iterator) ReadInt8() (ret int8) { - c := iter.nextToken() - if c == '-' { - val := iter.readUint32(iter.readByte()) - if val > math.MaxInt8+1 { - iter.ReportError("ReadInt8", "overflow: "+strconv.FormatInt(int64(val), 10)) - return - } - return -int8(val) - } - val := iter.readUint32(c) - if val > math.MaxInt8 { - iter.ReportError("ReadInt8", "overflow: "+strconv.FormatInt(int64(val), 10)) - return - } - return int8(val) -} - -// ReadUint8 read uint8 -func (iter *Iterator) ReadUint8() (ret uint8) { - val := iter.readUint32(iter.nextToken()) - if val > math.MaxUint8 { - iter.ReportError("ReadUint8", "overflow: "+strconv.FormatInt(int64(val), 10)) - return - } - return uint8(val) -} - -// ReadInt16 read int16 -func (iter *Iterator) ReadInt16() (ret int16) { - c := iter.nextToken() - if c == '-' { - val := iter.readUint32(iter.readByte()) - if val > math.MaxInt16+1 { - iter.ReportError("ReadInt16", "overflow: "+strconv.FormatInt(int64(val), 10)) - return - } - return -int16(val) - } - val := iter.readUint32(c) - if val > math.MaxInt16 { - iter.ReportError("ReadInt16", "overflow: "+strconv.FormatInt(int64(val), 10)) - return - } - return int16(val) -} - -// ReadUint16 read uint16 -func (iter *Iterator) ReadUint16() (ret uint16) { - val := iter.readUint32(iter.nextToken()) - if val > math.MaxUint16 { - iter.ReportError("ReadUint16", "overflow: "+strconv.FormatInt(int64(val), 10)) - return - } - return uint16(val) -} - -// ReadInt32 read int32 -func (iter *Iterator) ReadInt32() (ret int32) { - c := iter.nextToken() - if c == '-' { - val := iter.readUint32(iter.readByte()) - if val > math.MaxInt32+1 { - iter.ReportError("ReadInt32", "overflow: "+strconv.FormatInt(int64(val), 10)) - return - } - return -int32(val) - } - val := iter.readUint32(c) - if val > math.MaxInt32 { - iter.ReportError("ReadInt32", "overflow: "+strconv.FormatInt(int64(val), 10)) - return - } - return int32(val) -} - -// ReadUint32 read uint32 -func (iter *Iterator) ReadUint32() (ret uint32) { - return iter.readUint32(iter.nextToken()) -} - -func (iter *Iterator) readUint32(c byte) (ret uint32) { - ind := intDigits[c] - if ind == 0 { - iter.assertInteger() - return 0 // single zero - } - if ind == invalidCharForNumber { - iter.ReportError("readUint32", "unexpected character: "+string([]byte{byte(ind)})) - return - } - value := uint32(ind) - if iter.tail-iter.head > 10 { - i := iter.head - ind2 := intDigits[iter.buf[i]] - if ind2 == invalidCharForNumber { - iter.head = i - iter.assertInteger() - return value - } - i++ - ind3 := intDigits[iter.buf[i]] - if ind3 == invalidCharForNumber { - iter.head = i - iter.assertInteger() - return value*10 + uint32(ind2) - } - //iter.head = i + 1 - //value = value * 100 + uint32(ind2) * 10 + uint32(ind3) - i++ - ind4 := intDigits[iter.buf[i]] - if ind4 == invalidCharForNumber { - iter.head = i - iter.assertInteger() - return value*100 + uint32(ind2)*10 + uint32(ind3) - } - i++ - ind5 := intDigits[iter.buf[i]] - if ind5 == invalidCharForNumber { - iter.head = i - iter.assertInteger() - return value*1000 + uint32(ind2)*100 + uint32(ind3)*10 + uint32(ind4) - } - i++ - ind6 := intDigits[iter.buf[i]] - if ind6 == invalidCharForNumber { - iter.head = i - iter.assertInteger() - return value*10000 + uint32(ind2)*1000 + uint32(ind3)*100 + uint32(ind4)*10 + uint32(ind5) - } - i++ - ind7 := intDigits[iter.buf[i]] - if ind7 == invalidCharForNumber { - iter.head = i - iter.assertInteger() - return value*100000 + uint32(ind2)*10000 + uint32(ind3)*1000 + uint32(ind4)*100 + uint32(ind5)*10 + uint32(ind6) - } - i++ - ind8 := intDigits[iter.buf[i]] - if ind8 == invalidCharForNumber { - iter.head = i - iter.assertInteger() - return value*1000000 + uint32(ind2)*100000 + uint32(ind3)*10000 + uint32(ind4)*1000 + uint32(ind5)*100 + uint32(ind6)*10 + uint32(ind7) - } - i++ - ind9 := intDigits[iter.buf[i]] - value = value*10000000 + uint32(ind2)*1000000 + uint32(ind3)*100000 + uint32(ind4)*10000 + uint32(ind5)*1000 + uint32(ind6)*100 + uint32(ind7)*10 + uint32(ind8) - iter.head = i - if ind9 == invalidCharForNumber { - iter.assertInteger() - return value - } - } - for { - for i := iter.head; i < iter.tail; i++ { - ind = intDigits[iter.buf[i]] - if ind == invalidCharForNumber { - iter.head = i - iter.assertInteger() - return value - } - if value > uint32SafeToMultiply10 { - value2 := (value << 3) + (value << 1) + uint32(ind) - if value2 < value { - iter.ReportError("readUint32", "overflow") - return - } - value = value2 - continue - } - value = (value << 3) + (value << 1) + uint32(ind) - } - if !iter.loadMore() { - iter.assertInteger() - return value - } - } -} - -// ReadInt64 read int64 -func (iter *Iterator) ReadInt64() (ret int64) { - c := iter.nextToken() - if c == '-' { - val := iter.readUint64(iter.readByte()) - if val > math.MaxInt64+1 { - iter.ReportError("ReadInt64", "overflow: "+strconv.FormatUint(uint64(val), 10)) - return - } - return -int64(val) - } - val := iter.readUint64(c) - if val > math.MaxInt64 { - iter.ReportError("ReadInt64", "overflow: "+strconv.FormatUint(uint64(val), 10)) - return - } - return int64(val) -} - -// ReadUint64 read uint64 -func (iter *Iterator) ReadUint64() uint64 { - return iter.readUint64(iter.nextToken()) -} - -func (iter *Iterator) readUint64(c byte) (ret uint64) { - ind := intDigits[c] - if ind == 0 { - iter.assertInteger() - return 0 // single zero - } - if ind == invalidCharForNumber { - iter.ReportError("readUint64", "unexpected character: "+string([]byte{byte(ind)})) - return - } - value := uint64(ind) - if iter.tail-iter.head > 10 { - i := iter.head - ind2 := intDigits[iter.buf[i]] - if ind2 == invalidCharForNumber { - iter.head = i - iter.assertInteger() - return value - } - i++ - ind3 := intDigits[iter.buf[i]] - if ind3 == invalidCharForNumber { - iter.head = i - iter.assertInteger() - return value*10 + uint64(ind2) - } - //iter.head = i + 1 - //value = value * 100 + uint32(ind2) * 10 + uint32(ind3) - i++ - ind4 := intDigits[iter.buf[i]] - if ind4 == invalidCharForNumber { - iter.head = i - iter.assertInteger() - return value*100 + uint64(ind2)*10 + uint64(ind3) - } - i++ - ind5 := intDigits[iter.buf[i]] - if ind5 == invalidCharForNumber { - iter.head = i - iter.assertInteger() - return value*1000 + uint64(ind2)*100 + uint64(ind3)*10 + uint64(ind4) - } - i++ - ind6 := intDigits[iter.buf[i]] - if ind6 == invalidCharForNumber { - iter.head = i - iter.assertInteger() - return value*10000 + uint64(ind2)*1000 + uint64(ind3)*100 + uint64(ind4)*10 + uint64(ind5) - } - i++ - ind7 := intDigits[iter.buf[i]] - if ind7 == invalidCharForNumber { - iter.head = i - iter.assertInteger() - return value*100000 + uint64(ind2)*10000 + uint64(ind3)*1000 + uint64(ind4)*100 + uint64(ind5)*10 + uint64(ind6) - } - i++ - ind8 := intDigits[iter.buf[i]] - if ind8 == invalidCharForNumber { - iter.head = i - iter.assertInteger() - return value*1000000 + uint64(ind2)*100000 + uint64(ind3)*10000 + uint64(ind4)*1000 + uint64(ind5)*100 + uint64(ind6)*10 + uint64(ind7) - } - i++ - ind9 := intDigits[iter.buf[i]] - value = value*10000000 + uint64(ind2)*1000000 + uint64(ind3)*100000 + uint64(ind4)*10000 + uint64(ind5)*1000 + uint64(ind6)*100 + uint64(ind7)*10 + uint64(ind8) - iter.head = i - if ind9 == invalidCharForNumber { - iter.assertInteger() - return value - } - } - for { - for i := iter.head; i < iter.tail; i++ { - ind = intDigits[iter.buf[i]] - if ind == invalidCharForNumber { - iter.head = i - iter.assertInteger() - return value - } - if value > uint64SafeToMultiple10 { - value2 := (value << 3) + (value << 1) + uint64(ind) - if value2 < value { - iter.ReportError("readUint64", "overflow") - return - } - value = value2 - continue - } - value = (value << 3) + (value << 1) + uint64(ind) - } - if !iter.loadMore() { - iter.assertInteger() - return value - } - } -} - -func (iter *Iterator) assertInteger() { - if iter.head < iter.tail && iter.buf[iter.head] == '.' { - iter.ReportError("assertInteger", "can not decode float as int") - } -} diff --git a/vendor/github.com/json-iterator/go/iter_object.go b/vendor/github.com/json-iterator/go/iter_object.go deleted file mode 100644 index 58ee89c84..000000000 --- a/vendor/github.com/json-iterator/go/iter_object.go +++ /dev/null @@ -1,267 +0,0 @@ -package jsoniter - -import ( - "fmt" - "strings" -) - -// ReadObject read one field from object. -// If object ended, returns empty string. -// Otherwise, returns the field name. -func (iter *Iterator) ReadObject() (ret string) { - c := iter.nextToken() - switch c { - case 'n': - iter.skipThreeBytes('u', 'l', 'l') - return "" // null - case '{': - c = iter.nextToken() - if c == '"' { - iter.unreadByte() - field := iter.ReadString() - c = iter.nextToken() - if c != ':' { - iter.ReportError("ReadObject", "expect : after object field, but found "+string([]byte{c})) - } - return field - } - if c == '}' { - return "" // end of object - } - iter.ReportError("ReadObject", `expect " after {, but found `+string([]byte{c})) - return - case ',': - field := iter.ReadString() - c = iter.nextToken() - if c != ':' { - iter.ReportError("ReadObject", "expect : after object field, but found "+string([]byte{c})) - } - return field - case '}': - return "" // end of object - default: - iter.ReportError("ReadObject", fmt.Sprintf(`expect { or , or } or n, but found %s`, string([]byte{c}))) - return - } -} - -// CaseInsensitive -func (iter *Iterator) readFieldHash() int64 { - hash := int64(0x811c9dc5) - c := iter.nextToken() - if c != '"' { - iter.ReportError("readFieldHash", `expect ", but found `+string([]byte{c})) - return 0 - } - for { - for i := iter.head; i < iter.tail; i++ { - // require ascii string and no escape - b := iter.buf[i] - if b == '\\' { - iter.head = i - for _, b := range iter.readStringSlowPath() { - if 'A' <= b && b <= 'Z' && !iter.cfg.caseSensitive { - b += 'a' - 'A' - } - hash ^= int64(b) - hash *= 0x1000193 - } - c = iter.nextToken() - if c != ':' { - iter.ReportError("readFieldHash", `expect :, but found `+string([]byte{c})) - return 0 - } - return hash - } - if b == '"' { - iter.head = i + 1 - c = iter.nextToken() - if c != ':' { - iter.ReportError("readFieldHash", `expect :, but found `+string([]byte{c})) - return 0 - } - return hash - } - if 'A' <= b && b <= 'Z' && !iter.cfg.caseSensitive { - b += 'a' - 'A' - } - hash ^= int64(b) - hash *= 0x1000193 - } - if !iter.loadMore() { - iter.ReportError("readFieldHash", `incomplete field name`) - return 0 - } - } -} - -func calcHash(str string, caseSensitive bool) int64 { - if !caseSensitive { - str = strings.ToLower(str) - } - hash := int64(0x811c9dc5) - for _, b := range []byte(str) { - hash ^= int64(b) - hash *= 0x1000193 - } - return int64(hash) -} - -// ReadObjectCB read object with callback, the key is ascii only and field name not copied -func (iter *Iterator) ReadObjectCB(callback func(*Iterator, string) bool) bool { - c := iter.nextToken() - var field string - if c == '{' { - if !iter.incrementDepth() { - return false - } - c = iter.nextToken() - if c == '"' { - iter.unreadByte() - field = iter.ReadString() - c = iter.nextToken() - if c != ':' { - iter.ReportError("ReadObject", "expect : after object field, but found "+string([]byte{c})) - } - if !callback(iter, field) { - iter.decrementDepth() - return false - } - c = iter.nextToken() - for c == ',' { - field = iter.ReadString() - c = iter.nextToken() - if c != ':' { - iter.ReportError("ReadObject", "expect : after object field, but found "+string([]byte{c})) - } - if !callback(iter, field) { - iter.decrementDepth() - return false - } - c = iter.nextToken() - } - if c != '}' { - iter.ReportError("ReadObjectCB", `object not ended with }`) - iter.decrementDepth() - return false - } - return iter.decrementDepth() - } - if c == '}' { - return iter.decrementDepth() - } - iter.ReportError("ReadObjectCB", `expect " after {, but found `+string([]byte{c})) - iter.decrementDepth() - return false - } - if c == 'n' { - iter.skipThreeBytes('u', 'l', 'l') - return true // null - } - iter.ReportError("ReadObjectCB", `expect { or n, but found `+string([]byte{c})) - return false -} - -// ReadMapCB read map with callback, the key can be any string -func (iter *Iterator) ReadMapCB(callback func(*Iterator, string) bool) bool { - c := iter.nextToken() - if c == '{' { - if !iter.incrementDepth() { - return false - } - c = iter.nextToken() - if c == '"' { - iter.unreadByte() - field := iter.ReadString() - if iter.nextToken() != ':' { - iter.ReportError("ReadMapCB", "expect : after object field, but found "+string([]byte{c})) - iter.decrementDepth() - return false - } - if !callback(iter, field) { - iter.decrementDepth() - return false - } - c = iter.nextToken() - for c == ',' { - field = iter.ReadString() - if iter.nextToken() != ':' { - iter.ReportError("ReadMapCB", "expect : after object field, but found "+string([]byte{c})) - iter.decrementDepth() - return false - } - if !callback(iter, field) { - iter.decrementDepth() - return false - } - c = iter.nextToken() - } - if c != '}' { - iter.ReportError("ReadMapCB", `object not ended with }`) - iter.decrementDepth() - return false - } - return iter.decrementDepth() - } - if c == '}' { - return iter.decrementDepth() - } - iter.ReportError("ReadMapCB", `expect " after {, but found `+string([]byte{c})) - iter.decrementDepth() - return false - } - if c == 'n' { - iter.skipThreeBytes('u', 'l', 'l') - return true // null - } - iter.ReportError("ReadMapCB", `expect { or n, but found `+string([]byte{c})) - return false -} - -func (iter *Iterator) readObjectStart() bool { - c := iter.nextToken() - if c == '{' { - c = iter.nextToken() - if c == '}' { - return false - } - iter.unreadByte() - return true - } else if c == 'n' { - iter.skipThreeBytes('u', 'l', 'l') - return false - } - iter.ReportError("readObjectStart", "expect { or n, but found "+string([]byte{c})) - return false -} - -func (iter *Iterator) readObjectFieldAsBytes() (ret []byte) { - str := iter.ReadStringAsSlice() - if iter.skipWhitespacesWithoutLoadMore() { - if ret == nil { - ret = make([]byte, len(str)) - copy(ret, str) - } - if !iter.loadMore() { - return - } - } - if iter.buf[iter.head] != ':' { - iter.ReportError("readObjectFieldAsBytes", "expect : after object field, but found "+string([]byte{iter.buf[iter.head]})) - return - } - iter.head++ - if iter.skipWhitespacesWithoutLoadMore() { - if ret == nil { - ret = make([]byte, len(str)) - copy(ret, str) - } - if !iter.loadMore() { - return - } - } - if ret == nil { - return str - } - return ret -} diff --git a/vendor/github.com/json-iterator/go/iter_skip.go b/vendor/github.com/json-iterator/go/iter_skip.go deleted file mode 100644 index e91eefb15..000000000 --- a/vendor/github.com/json-iterator/go/iter_skip.go +++ /dev/null @@ -1,130 +0,0 @@ -package jsoniter - -import "fmt" - -// ReadNil reads a json object as nil and -// returns whether it's a nil or not -func (iter *Iterator) ReadNil() (ret bool) { - c := iter.nextToken() - if c == 'n' { - iter.skipThreeBytes('u', 'l', 'l') // null - return true - } - iter.unreadByte() - return false -} - -// ReadBool reads a json object as BoolValue -func (iter *Iterator) ReadBool() (ret bool) { - c := iter.nextToken() - if c == 't' { - iter.skipThreeBytes('r', 'u', 'e') - return true - } - if c == 'f' { - iter.skipFourBytes('a', 'l', 's', 'e') - return false - } - iter.ReportError("ReadBool", "expect t or f, but found "+string([]byte{c})) - return -} - -// SkipAndReturnBytes skip next JSON element, and return its content as []byte. -// The []byte can be kept, it is a copy of data. -func (iter *Iterator) SkipAndReturnBytes() []byte { - iter.startCapture(iter.head) - iter.Skip() - return iter.stopCapture() -} - -// SkipAndAppendBytes skips next JSON element and appends its content to -// buffer, returning the result. -func (iter *Iterator) SkipAndAppendBytes(buf []byte) []byte { - iter.startCaptureTo(buf, iter.head) - iter.Skip() - return iter.stopCapture() -} - -func (iter *Iterator) startCaptureTo(buf []byte, captureStartedAt int) { - if iter.captured != nil { - panic("already in capture mode") - } - iter.captureStartedAt = captureStartedAt - iter.captured = buf -} - -func (iter *Iterator) startCapture(captureStartedAt int) { - iter.startCaptureTo(make([]byte, 0, 32), captureStartedAt) -} - -func (iter *Iterator) stopCapture() []byte { - if iter.captured == nil { - panic("not in capture mode") - } - captured := iter.captured - remaining := iter.buf[iter.captureStartedAt:iter.head] - iter.captureStartedAt = -1 - iter.captured = nil - return append(captured, remaining...) -} - -// Skip skips a json object and positions to relatively the next json object -func (iter *Iterator) Skip() { - c := iter.nextToken() - switch c { - case '"': - iter.skipString() - case 'n': - iter.skipThreeBytes('u', 'l', 'l') // null - case 't': - iter.skipThreeBytes('r', 'u', 'e') // true - case 'f': - iter.skipFourBytes('a', 'l', 's', 'e') // false - case '0': - iter.unreadByte() - iter.ReadFloat32() - case '-', '1', '2', '3', '4', '5', '6', '7', '8', '9': - iter.skipNumber() - case '[': - iter.skipArray() - case '{': - iter.skipObject() - default: - iter.ReportError("Skip", fmt.Sprintf("do not know how to skip: %v", c)) - return - } -} - -func (iter *Iterator) skipFourBytes(b1, b2, b3, b4 byte) { - if iter.readByte() != b1 { - iter.ReportError("skipFourBytes", fmt.Sprintf("expect %s", string([]byte{b1, b2, b3, b4}))) - return - } - if iter.readByte() != b2 { - iter.ReportError("skipFourBytes", fmt.Sprintf("expect %s", string([]byte{b1, b2, b3, b4}))) - return - } - if iter.readByte() != b3 { - iter.ReportError("skipFourBytes", fmt.Sprintf("expect %s", string([]byte{b1, b2, b3, b4}))) - return - } - if iter.readByte() != b4 { - iter.ReportError("skipFourBytes", fmt.Sprintf("expect %s", string([]byte{b1, b2, b3, b4}))) - return - } -} - -func (iter *Iterator) skipThreeBytes(b1, b2, b3 byte) { - if iter.readByte() != b1 { - iter.ReportError("skipThreeBytes", fmt.Sprintf("expect %s", string([]byte{b1, b2, b3}))) - return - } - if iter.readByte() != b2 { - iter.ReportError("skipThreeBytes", fmt.Sprintf("expect %s", string([]byte{b1, b2, b3}))) - return - } - if iter.readByte() != b3 { - iter.ReportError("skipThreeBytes", fmt.Sprintf("expect %s", string([]byte{b1, b2, b3}))) - return - } -} diff --git a/vendor/github.com/json-iterator/go/iter_skip_sloppy.go b/vendor/github.com/json-iterator/go/iter_skip_sloppy.go deleted file mode 100644 index 9303de41e..000000000 --- a/vendor/github.com/json-iterator/go/iter_skip_sloppy.go +++ /dev/null @@ -1,163 +0,0 @@ -//+build jsoniter_sloppy - -package jsoniter - -// sloppy but faster implementation, do not validate the input json - -func (iter *Iterator) skipNumber() { - for { - for i := iter.head; i < iter.tail; i++ { - c := iter.buf[i] - switch c { - case ' ', '\n', '\r', '\t', ',', '}', ']': - iter.head = i - return - } - } - if !iter.loadMore() { - return - } - } -} - -func (iter *Iterator) skipArray() { - level := 1 - if !iter.incrementDepth() { - return - } - for { - for i := iter.head; i < iter.tail; i++ { - switch iter.buf[i] { - case '"': // If inside string, skip it - iter.head = i + 1 - iter.skipString() - i = iter.head - 1 // it will be i++ soon - case '[': // If open symbol, increase level - level++ - if !iter.incrementDepth() { - return - } - case ']': // If close symbol, increase level - level-- - if !iter.decrementDepth() { - return - } - - // If we have returned to the original level, we're done - if level == 0 { - iter.head = i + 1 - return - } - } - } - if !iter.loadMore() { - iter.ReportError("skipObject", "incomplete array") - return - } - } -} - -func (iter *Iterator) skipObject() { - level := 1 - if !iter.incrementDepth() { - return - } - - for { - for i := iter.head; i < iter.tail; i++ { - switch iter.buf[i] { - case '"': // If inside string, skip it - iter.head = i + 1 - iter.skipString() - i = iter.head - 1 // it will be i++ soon - case '{': // If open symbol, increase level - level++ - if !iter.incrementDepth() { - return - } - case '}': // If close symbol, increase level - level-- - if !iter.decrementDepth() { - return - } - - // If we have returned to the original level, we're done - if level == 0 { - iter.head = i + 1 - return - } - } - } - if !iter.loadMore() { - iter.ReportError("skipObject", "incomplete object") - return - } - } -} - -func (iter *Iterator) skipString() { - for { - end, escaped := iter.findStringEnd() - if end == -1 { - if !iter.loadMore() { - iter.ReportError("skipString", "incomplete string") - return - } - if escaped { - iter.head = 1 // skip the first char as last char read is \ - } - } else { - iter.head = end - return - } - } -} - -// adapted from: https://github.com/buger/jsonparser/blob/master/parser.go -// Tries to find the end of string -// Support if string contains escaped quote symbols. -func (iter *Iterator) findStringEnd() (int, bool) { - escaped := false - for i := iter.head; i < iter.tail; i++ { - c := iter.buf[i] - if c == '"' { - if !escaped { - return i + 1, false - } - j := i - 1 - for { - if j < iter.head || iter.buf[j] != '\\' { - // even number of backslashes - // either end of buffer, or " found - return i + 1, true - } - j-- - if j < iter.head || iter.buf[j] != '\\' { - // odd number of backslashes - // it is \" or \\\" - break - } - j-- - } - } else if c == '\\' { - escaped = true - } - } - j := iter.tail - 1 - for { - if j < iter.head || iter.buf[j] != '\\' { - // even number of backslashes - // either end of buffer, or " found - return -1, false // do not end with \ - } - j-- - if j < iter.head || iter.buf[j] != '\\' { - // odd number of backslashes - // it is \" or \\\" - break - } - j-- - - } - return -1, true // end with \ -} diff --git a/vendor/github.com/json-iterator/go/iter_skip_strict.go b/vendor/github.com/json-iterator/go/iter_skip_strict.go deleted file mode 100644 index 6cf66d043..000000000 --- a/vendor/github.com/json-iterator/go/iter_skip_strict.go +++ /dev/null @@ -1,99 +0,0 @@ -//+build !jsoniter_sloppy - -package jsoniter - -import ( - "fmt" - "io" -) - -func (iter *Iterator) skipNumber() { - if !iter.trySkipNumber() { - iter.unreadByte() - if iter.Error != nil && iter.Error != io.EOF { - return - } - iter.ReadFloat64() - if iter.Error != nil && iter.Error != io.EOF { - iter.Error = nil - iter.ReadBigFloat() - } - } -} - -func (iter *Iterator) trySkipNumber() bool { - dotFound := false - for i := iter.head; i < iter.tail; i++ { - c := iter.buf[i] - switch c { - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - case '.': - if dotFound { - iter.ReportError("validateNumber", `more than one dot found in number`) - return true // already failed - } - if i+1 == iter.tail { - return false - } - c = iter.buf[i+1] - switch c { - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - default: - iter.ReportError("validateNumber", `missing digit after dot`) - return true // already failed - } - dotFound = true - default: - switch c { - case ',', ']', '}', ' ', '\t', '\n', '\r': - if iter.head == i { - return false // if - without following digits - } - iter.head = i - return true // must be valid - } - return false // may be invalid - } - } - return false -} - -func (iter *Iterator) skipString() { - if !iter.trySkipString() { - iter.unreadByte() - iter.ReadString() - } -} - -func (iter *Iterator) trySkipString() bool { - for i := iter.head; i < iter.tail; i++ { - c := iter.buf[i] - if c == '"' { - iter.head = i + 1 - return true // valid - } else if c == '\\' { - return false - } else if c < ' ' { - iter.ReportError("trySkipString", - fmt.Sprintf(`invalid control character found: %d`, c)) - return true // already failed - } - } - return false -} - -func (iter *Iterator) skipObject() { - iter.unreadByte() - iter.ReadObjectCB(func(iter *Iterator, field string) bool { - iter.Skip() - return true - }) -} - -func (iter *Iterator) skipArray() { - iter.unreadByte() - iter.ReadArrayCB(func(iter *Iterator) bool { - iter.Skip() - return true - }) -} diff --git a/vendor/github.com/json-iterator/go/iter_str.go b/vendor/github.com/json-iterator/go/iter_str.go deleted file mode 100644 index adc487ea8..000000000 --- a/vendor/github.com/json-iterator/go/iter_str.go +++ /dev/null @@ -1,215 +0,0 @@ -package jsoniter - -import ( - "fmt" - "unicode/utf16" -) - -// ReadString read string from iterator -func (iter *Iterator) ReadString() (ret string) { - c := iter.nextToken() - if c == '"' { - for i := iter.head; i < iter.tail; i++ { - c := iter.buf[i] - if c == '"' { - ret = string(iter.buf[iter.head:i]) - iter.head = i + 1 - return ret - } else if c == '\\' { - break - } else if c < ' ' { - iter.ReportError("ReadString", - fmt.Sprintf(`invalid control character found: %d`, c)) - return - } - } - return iter.readStringSlowPath() - } else if c == 'n' { - iter.skipThreeBytes('u', 'l', 'l') - return "" - } - iter.ReportError("ReadString", `expects " or n, but found `+string([]byte{c})) - return -} - -func (iter *Iterator) readStringSlowPath() (ret string) { - var str []byte - var c byte - for iter.Error == nil { - c = iter.readByte() - if c == '"' { - return string(str) - } - if c == '\\' { - c = iter.readByte() - str = iter.readEscapedChar(c, str) - } else { - str = append(str, c) - } - } - iter.ReportError("readStringSlowPath", "unexpected end of input") - return -} - -func (iter *Iterator) readEscapedChar(c byte, str []byte) []byte { - switch c { - case 'u': - r := iter.readU4() - if utf16.IsSurrogate(r) { - c = iter.readByte() - if iter.Error != nil { - return nil - } - if c != '\\' { - iter.unreadByte() - str = appendRune(str, r) - return str - } - c = iter.readByte() - if iter.Error != nil { - return nil - } - if c != 'u' { - str = appendRune(str, r) - return iter.readEscapedChar(c, str) - } - r2 := iter.readU4() - if iter.Error != nil { - return nil - } - combined := utf16.DecodeRune(r, r2) - if combined == '\uFFFD' { - str = appendRune(str, r) - str = appendRune(str, r2) - } else { - str = appendRune(str, combined) - } - } else { - str = appendRune(str, r) - } - case '"': - str = append(str, '"') - case '\\': - str = append(str, '\\') - case '/': - str = append(str, '/') - case 'b': - str = append(str, '\b') - case 'f': - str = append(str, '\f') - case 'n': - str = append(str, '\n') - case 'r': - str = append(str, '\r') - case 't': - str = append(str, '\t') - default: - iter.ReportError("readEscapedChar", - `invalid escape char after \`) - return nil - } - return str -} - -// ReadStringAsSlice read string from iterator without copying into string form. -// The []byte can not be kept, as it will change after next iterator call. -func (iter *Iterator) ReadStringAsSlice() (ret []byte) { - c := iter.nextToken() - if c == '"' { - for i := iter.head; i < iter.tail; i++ { - // require ascii string and no escape - // for: field name, base64, number - if iter.buf[i] == '"' { - // fast path: reuse the underlying buffer - ret = iter.buf[iter.head:i] - iter.head = i + 1 - return ret - } - } - readLen := iter.tail - iter.head - copied := make([]byte, readLen, readLen*2) - copy(copied, iter.buf[iter.head:iter.tail]) - iter.head = iter.tail - for iter.Error == nil { - c := iter.readByte() - if c == '"' { - return copied - } - copied = append(copied, c) - } - return copied - } - iter.ReportError("ReadStringAsSlice", `expects " or n, but found `+string([]byte{c})) - return -} - -func (iter *Iterator) readU4() (ret rune) { - for i := 0; i < 4; i++ { - c := iter.readByte() - if iter.Error != nil { - return - } - if c >= '0' && c <= '9' { - ret = ret*16 + rune(c-'0') - } else if c >= 'a' && c <= 'f' { - ret = ret*16 + rune(c-'a'+10) - } else if c >= 'A' && c <= 'F' { - ret = ret*16 + rune(c-'A'+10) - } else { - iter.ReportError("readU4", "expects 0~9 or a~f, but found "+string([]byte{c})) - return - } - } - return ret -} - -const ( - t1 = 0x00 // 0000 0000 - tx = 0x80 // 1000 0000 - t2 = 0xC0 // 1100 0000 - t3 = 0xE0 // 1110 0000 - t4 = 0xF0 // 1111 0000 - t5 = 0xF8 // 1111 1000 - - maskx = 0x3F // 0011 1111 - mask2 = 0x1F // 0001 1111 - mask3 = 0x0F // 0000 1111 - mask4 = 0x07 // 0000 0111 - - rune1Max = 1<<7 - 1 - rune2Max = 1<<11 - 1 - rune3Max = 1<<16 - 1 - - surrogateMin = 0xD800 - surrogateMax = 0xDFFF - - maxRune = '\U0010FFFF' // Maximum valid Unicode code point. - runeError = '\uFFFD' // the "error" Rune or "Unicode replacement character" -) - -func appendRune(p []byte, r rune) []byte { - // Negative values are erroneous. Making it unsigned addresses the problem. - switch i := uint32(r); { - case i <= rune1Max: - p = append(p, byte(r)) - return p - case i <= rune2Max: - p = append(p, t2|byte(r>>6)) - p = append(p, tx|byte(r)&maskx) - return p - case i > maxRune, surrogateMin <= i && i <= surrogateMax: - r = runeError - fallthrough - case i <= rune3Max: - p = append(p, t3|byte(r>>12)) - p = append(p, tx|byte(r>>6)&maskx) - p = append(p, tx|byte(r)&maskx) - return p - default: - p = append(p, t4|byte(r>>18)) - p = append(p, tx|byte(r>>12)&maskx) - p = append(p, tx|byte(r>>6)&maskx) - p = append(p, tx|byte(r)&maskx) - return p - } -} diff --git a/vendor/github.com/json-iterator/go/jsoniter.go b/vendor/github.com/json-iterator/go/jsoniter.go deleted file mode 100644 index c2934f916..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter.go +++ /dev/null @@ -1,18 +0,0 @@ -// Package jsoniter implements encoding and decoding of JSON as defined in -// RFC 4627 and provides interfaces with identical syntax of standard lib encoding/json. -// Converting from encoding/json to jsoniter is no more than replacing the package with jsoniter -// and variable type declarations (if any). -// jsoniter interfaces gives 100% compatibility with code using standard lib. -// -// "JSON and Go" -// (https://golang.org/doc/articles/json_and_go.html) -// gives a description of how Marshal/Unmarshal operate -// between arbitrary or predefined json objects and bytes, -// and it applies to jsoniter.Marshal/Unmarshal as well. -// -// Besides, jsoniter.Iterator provides a different set of interfaces -// iterating given bytes/string/reader -// and yielding parsed elements one by one. -// This set of interfaces reads input as required and gives -// better performance. -package jsoniter diff --git a/vendor/github.com/json-iterator/go/pool.go b/vendor/github.com/json-iterator/go/pool.go deleted file mode 100644 index e2389b56c..000000000 --- a/vendor/github.com/json-iterator/go/pool.go +++ /dev/null @@ -1,42 +0,0 @@ -package jsoniter - -import ( - "io" -) - -// IteratorPool a thread safe pool of iterators with same configuration -type IteratorPool interface { - BorrowIterator(data []byte) *Iterator - ReturnIterator(iter *Iterator) -} - -// StreamPool a thread safe pool of streams with same configuration -type StreamPool interface { - BorrowStream(writer io.Writer) *Stream - ReturnStream(stream *Stream) -} - -func (cfg *frozenConfig) BorrowStream(writer io.Writer) *Stream { - stream := cfg.streamPool.Get().(*Stream) - stream.Reset(writer) - return stream -} - -func (cfg *frozenConfig) ReturnStream(stream *Stream) { - stream.out = nil - stream.Error = nil - stream.Attachment = nil - cfg.streamPool.Put(stream) -} - -func (cfg *frozenConfig) BorrowIterator(data []byte) *Iterator { - iter := cfg.iteratorPool.Get().(*Iterator) - iter.ResetBytes(data) - return iter -} - -func (cfg *frozenConfig) ReturnIterator(iter *Iterator) { - iter.Error = nil - iter.Attachment = nil - cfg.iteratorPool.Put(iter) -} diff --git a/vendor/github.com/json-iterator/go/reflect.go b/vendor/github.com/json-iterator/go/reflect.go deleted file mode 100644 index 39acb320a..000000000 --- a/vendor/github.com/json-iterator/go/reflect.go +++ /dev/null @@ -1,337 +0,0 @@ -package jsoniter - -import ( - "fmt" - "reflect" - "unsafe" - - "github.com/modern-go/reflect2" -) - -// ValDecoder is an internal type registered to cache as needed. -// Don't confuse jsoniter.ValDecoder with json.Decoder. -// For json.Decoder's adapter, refer to jsoniter.AdapterDecoder(todo link). -// -// Reflection on type to create decoders, which is then cached -// Reflection on value is avoided as we can, as the reflect.Value itself will allocate, with following exceptions -// 1. create instance of new value, for example *int will need a int to be allocated -// 2. append to slice, if the existing cap is not enough, allocate will be done using Reflect.New -// 3. assignment to map, both key and value will be reflect.Value -// For a simple struct binding, it will be reflect.Value free and allocation free -type ValDecoder interface { - Decode(ptr unsafe.Pointer, iter *Iterator) -} - -// ValEncoder is an internal type registered to cache as needed. -// Don't confuse jsoniter.ValEncoder with json.Encoder. -// For json.Encoder's adapter, refer to jsoniter.AdapterEncoder(todo godoc link). -type ValEncoder interface { - IsEmpty(ptr unsafe.Pointer) bool - Encode(ptr unsafe.Pointer, stream *Stream) -} - -type checkIsEmpty interface { - IsEmpty(ptr unsafe.Pointer) bool -} - -type ctx struct { - *frozenConfig - prefix string - encoders map[reflect2.Type]ValEncoder - decoders map[reflect2.Type]ValDecoder -} - -func (b *ctx) caseSensitive() bool { - if b.frozenConfig == nil { - // default is case-insensitive - return false - } - return b.frozenConfig.caseSensitive -} - -func (b *ctx) append(prefix string) *ctx { - return &ctx{ - frozenConfig: b.frozenConfig, - prefix: b.prefix + " " + prefix, - encoders: b.encoders, - decoders: b.decoders, - } -} - -// ReadVal copy the underlying JSON into go interface, same as json.Unmarshal -func (iter *Iterator) ReadVal(obj interface{}) { - depth := iter.depth - cacheKey := reflect2.RTypeOf(obj) - decoder := iter.cfg.getDecoderFromCache(cacheKey) - if decoder == nil { - typ := reflect2.TypeOf(obj) - if typ == nil || typ.Kind() != reflect.Ptr { - iter.ReportError("ReadVal", "can only unmarshal into pointer") - return - } - decoder = iter.cfg.DecoderOf(typ) - } - ptr := reflect2.PtrOf(obj) - if ptr == nil { - iter.ReportError("ReadVal", "can not read into nil pointer") - return - } - decoder.Decode(ptr, iter) - if iter.depth != depth { - iter.ReportError("ReadVal", "unexpected mismatched nesting") - return - } -} - -// WriteVal copy the go interface into underlying JSON, same as json.Marshal -func (stream *Stream) WriteVal(val interface{}) { - if nil == val { - stream.WriteNil() - return - } - cacheKey := reflect2.RTypeOf(val) - encoder := stream.cfg.getEncoderFromCache(cacheKey) - if encoder == nil { - typ := reflect2.TypeOf(val) - encoder = stream.cfg.EncoderOf(typ) - } - encoder.Encode(reflect2.PtrOf(val), stream) -} - -func (cfg *frozenConfig) DecoderOf(typ reflect2.Type) ValDecoder { - cacheKey := typ.RType() - decoder := cfg.getDecoderFromCache(cacheKey) - if decoder != nil { - return decoder - } - ctx := &ctx{ - frozenConfig: cfg, - prefix: "", - decoders: map[reflect2.Type]ValDecoder{}, - encoders: map[reflect2.Type]ValEncoder{}, - } - ptrType := typ.(*reflect2.UnsafePtrType) - decoder = decoderOfType(ctx, ptrType.Elem()) - cfg.addDecoderToCache(cacheKey, decoder) - return decoder -} - -func decoderOfType(ctx *ctx, typ reflect2.Type) ValDecoder { - decoder := getTypeDecoderFromExtension(ctx, typ) - if decoder != nil { - return decoder - } - decoder = createDecoderOfType(ctx, typ) - for _, extension := range extensions { - decoder = extension.DecorateDecoder(typ, decoder) - } - decoder = ctx.decoderExtension.DecorateDecoder(typ, decoder) - for _, extension := range ctx.extraExtensions { - decoder = extension.DecorateDecoder(typ, decoder) - } - return decoder -} - -func createDecoderOfType(ctx *ctx, typ reflect2.Type) ValDecoder { - decoder := ctx.decoders[typ] - if decoder != nil { - return decoder - } - placeholder := &placeholderDecoder{} - ctx.decoders[typ] = placeholder - decoder = _createDecoderOfType(ctx, typ) - placeholder.decoder = decoder - return decoder -} - -func _createDecoderOfType(ctx *ctx, typ reflect2.Type) ValDecoder { - decoder := createDecoderOfJsonRawMessage(ctx, typ) - if decoder != nil { - return decoder - } - decoder = createDecoderOfJsonNumber(ctx, typ) - if decoder != nil { - return decoder - } - decoder = createDecoderOfMarshaler(ctx, typ) - if decoder != nil { - return decoder - } - decoder = createDecoderOfAny(ctx, typ) - if decoder != nil { - return decoder - } - decoder = createDecoderOfNative(ctx, typ) - if decoder != nil { - return decoder - } - switch typ.Kind() { - case reflect.Interface: - ifaceType, isIFace := typ.(*reflect2.UnsafeIFaceType) - if isIFace { - return &ifaceDecoder{valType: ifaceType} - } - return &efaceDecoder{} - case reflect.Struct: - return decoderOfStruct(ctx, typ) - case reflect.Array: - return decoderOfArray(ctx, typ) - case reflect.Slice: - return decoderOfSlice(ctx, typ) - case reflect.Map: - return decoderOfMap(ctx, typ) - case reflect.Ptr: - return decoderOfOptional(ctx, typ) - default: - return &lazyErrorDecoder{err: fmt.Errorf("%s%s is unsupported type", ctx.prefix, typ.String())} - } -} - -func (cfg *frozenConfig) EncoderOf(typ reflect2.Type) ValEncoder { - cacheKey := typ.RType() - encoder := cfg.getEncoderFromCache(cacheKey) - if encoder != nil { - return encoder - } - ctx := &ctx{ - frozenConfig: cfg, - prefix: "", - decoders: map[reflect2.Type]ValDecoder{}, - encoders: map[reflect2.Type]ValEncoder{}, - } - encoder = encoderOfType(ctx, typ) - if typ.LikePtr() { - encoder = &onePtrEncoder{encoder} - } - cfg.addEncoderToCache(cacheKey, encoder) - return encoder -} - -type onePtrEncoder struct { - encoder ValEncoder -} - -func (encoder *onePtrEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return encoder.encoder.IsEmpty(unsafe.Pointer(&ptr)) -} - -func (encoder *onePtrEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - encoder.encoder.Encode(unsafe.Pointer(&ptr), stream) -} - -func encoderOfType(ctx *ctx, typ reflect2.Type) ValEncoder { - encoder := getTypeEncoderFromExtension(ctx, typ) - if encoder != nil { - return encoder - } - encoder = createEncoderOfType(ctx, typ) - for _, extension := range extensions { - encoder = extension.DecorateEncoder(typ, encoder) - } - encoder = ctx.encoderExtension.DecorateEncoder(typ, encoder) - for _, extension := range ctx.extraExtensions { - encoder = extension.DecorateEncoder(typ, encoder) - } - return encoder -} - -func createEncoderOfType(ctx *ctx, typ reflect2.Type) ValEncoder { - encoder := ctx.encoders[typ] - if encoder != nil { - return encoder - } - placeholder := &placeholderEncoder{} - ctx.encoders[typ] = placeholder - encoder = _createEncoderOfType(ctx, typ) - placeholder.encoder = encoder - return encoder -} -func _createEncoderOfType(ctx *ctx, typ reflect2.Type) ValEncoder { - encoder := createEncoderOfJsonRawMessage(ctx, typ) - if encoder != nil { - return encoder - } - encoder = createEncoderOfJsonNumber(ctx, typ) - if encoder != nil { - return encoder - } - encoder = createEncoderOfMarshaler(ctx, typ) - if encoder != nil { - return encoder - } - encoder = createEncoderOfAny(ctx, typ) - if encoder != nil { - return encoder - } - encoder = createEncoderOfNative(ctx, typ) - if encoder != nil { - return encoder - } - kind := typ.Kind() - switch kind { - case reflect.Interface: - return &dynamicEncoder{typ} - case reflect.Struct: - return encoderOfStruct(ctx, typ) - case reflect.Array: - return encoderOfArray(ctx, typ) - case reflect.Slice: - return encoderOfSlice(ctx, typ) - case reflect.Map: - return encoderOfMap(ctx, typ) - case reflect.Ptr: - return encoderOfOptional(ctx, typ) - default: - return &lazyErrorEncoder{err: fmt.Errorf("%s%s is unsupported type", ctx.prefix, typ.String())} - } -} - -type lazyErrorDecoder struct { - err error -} - -func (decoder *lazyErrorDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - if iter.WhatIsNext() != NilValue { - if iter.Error == nil { - iter.Error = decoder.err - } - } else { - iter.Skip() - } -} - -type lazyErrorEncoder struct { - err error -} - -func (encoder *lazyErrorEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - if ptr == nil { - stream.WriteNil() - } else if stream.Error == nil { - stream.Error = encoder.err - } -} - -func (encoder *lazyErrorEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return false -} - -type placeholderDecoder struct { - decoder ValDecoder -} - -func (decoder *placeholderDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - decoder.decoder.Decode(ptr, iter) -} - -type placeholderEncoder struct { - encoder ValEncoder -} - -func (encoder *placeholderEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - encoder.encoder.Encode(ptr, stream) -} - -func (encoder *placeholderEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return encoder.encoder.IsEmpty(ptr) -} diff --git a/vendor/github.com/json-iterator/go/reflect_array.go b/vendor/github.com/json-iterator/go/reflect_array.go deleted file mode 100644 index 13a0b7b08..000000000 --- a/vendor/github.com/json-iterator/go/reflect_array.go +++ /dev/null @@ -1,104 +0,0 @@ -package jsoniter - -import ( - "fmt" - "github.com/modern-go/reflect2" - "io" - "unsafe" -) - -func decoderOfArray(ctx *ctx, typ reflect2.Type) ValDecoder { - arrayType := typ.(*reflect2.UnsafeArrayType) - decoder := decoderOfType(ctx.append("[arrayElem]"), arrayType.Elem()) - return &arrayDecoder{arrayType, decoder} -} - -func encoderOfArray(ctx *ctx, typ reflect2.Type) ValEncoder { - arrayType := typ.(*reflect2.UnsafeArrayType) - if arrayType.Len() == 0 { - return emptyArrayEncoder{} - } - encoder := encoderOfType(ctx.append("[arrayElem]"), arrayType.Elem()) - return &arrayEncoder{arrayType, encoder} -} - -type emptyArrayEncoder struct{} - -func (encoder emptyArrayEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteEmptyArray() -} - -func (encoder emptyArrayEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return true -} - -type arrayEncoder struct { - arrayType *reflect2.UnsafeArrayType - elemEncoder ValEncoder -} - -func (encoder *arrayEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteArrayStart() - elemPtr := unsafe.Pointer(ptr) - encoder.elemEncoder.Encode(elemPtr, stream) - for i := 1; i < encoder.arrayType.Len(); i++ { - stream.WriteMore() - elemPtr = encoder.arrayType.UnsafeGetIndex(ptr, i) - encoder.elemEncoder.Encode(elemPtr, stream) - } - stream.WriteArrayEnd() - if stream.Error != nil && stream.Error != io.EOF { - stream.Error = fmt.Errorf("%v: %s", encoder.arrayType, stream.Error.Error()) - } -} - -func (encoder *arrayEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return false -} - -type arrayDecoder struct { - arrayType *reflect2.UnsafeArrayType - elemDecoder ValDecoder -} - -func (decoder *arrayDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - decoder.doDecode(ptr, iter) - if iter.Error != nil && iter.Error != io.EOF { - iter.Error = fmt.Errorf("%v: %s", decoder.arrayType, iter.Error.Error()) - } -} - -func (decoder *arrayDecoder) doDecode(ptr unsafe.Pointer, iter *Iterator) { - c := iter.nextToken() - arrayType := decoder.arrayType - if c == 'n' { - iter.skipThreeBytes('u', 'l', 'l') - return - } - if c != '[' { - iter.ReportError("decode array", "expect [ or n, but found "+string([]byte{c})) - return - } - c = iter.nextToken() - if c == ']' { - return - } - iter.unreadByte() - elemPtr := arrayType.UnsafeGetIndex(ptr, 0) - decoder.elemDecoder.Decode(elemPtr, iter) - length := 1 - for c = iter.nextToken(); c == ','; c = iter.nextToken() { - if length >= arrayType.Len() { - iter.Skip() - continue - } - idx := length - length += 1 - elemPtr = arrayType.UnsafeGetIndex(ptr, idx) - decoder.elemDecoder.Decode(elemPtr, iter) - } - if c != ']' { - iter.ReportError("decode array", "expect ], but found "+string([]byte{c})) - return - } -} diff --git a/vendor/github.com/json-iterator/go/reflect_dynamic.go b/vendor/github.com/json-iterator/go/reflect_dynamic.go deleted file mode 100644 index 8b6bc8b43..000000000 --- a/vendor/github.com/json-iterator/go/reflect_dynamic.go +++ /dev/null @@ -1,70 +0,0 @@ -package jsoniter - -import ( - "github.com/modern-go/reflect2" - "reflect" - "unsafe" -) - -type dynamicEncoder struct { - valType reflect2.Type -} - -func (encoder *dynamicEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - obj := encoder.valType.UnsafeIndirect(ptr) - stream.WriteVal(obj) -} - -func (encoder *dynamicEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return encoder.valType.UnsafeIndirect(ptr) == nil -} - -type efaceDecoder struct { -} - -func (decoder *efaceDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - pObj := (*interface{})(ptr) - obj := *pObj - if obj == nil { - *pObj = iter.Read() - return - } - typ := reflect2.TypeOf(obj) - if typ.Kind() != reflect.Ptr { - *pObj = iter.Read() - return - } - ptrType := typ.(*reflect2.UnsafePtrType) - ptrElemType := ptrType.Elem() - if iter.WhatIsNext() == NilValue { - if ptrElemType.Kind() != reflect.Ptr { - iter.skipFourBytes('n', 'u', 'l', 'l') - *pObj = nil - return - } - } - if reflect2.IsNil(obj) { - obj := ptrElemType.New() - iter.ReadVal(obj) - *pObj = obj - return - } - iter.ReadVal(obj) -} - -type ifaceDecoder struct { - valType *reflect2.UnsafeIFaceType -} - -func (decoder *ifaceDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - if iter.ReadNil() { - decoder.valType.UnsafeSet(ptr, decoder.valType.UnsafeNew()) - return - } - obj := decoder.valType.UnsafeIndirect(ptr) - if reflect2.IsNil(obj) { - iter.ReportError("decode non empty interface", "can not unmarshal into nil") - return - } - iter.ReadVal(obj) -} diff --git a/vendor/github.com/json-iterator/go/reflect_extension.go b/vendor/github.com/json-iterator/go/reflect_extension.go deleted file mode 100644 index 74a97bfe5..000000000 --- a/vendor/github.com/json-iterator/go/reflect_extension.go +++ /dev/null @@ -1,483 +0,0 @@ -package jsoniter - -import ( - "fmt" - "github.com/modern-go/reflect2" - "reflect" - "sort" - "strings" - "unicode" - "unsafe" -) - -var typeDecoders = map[string]ValDecoder{} -var fieldDecoders = map[string]ValDecoder{} -var typeEncoders = map[string]ValEncoder{} -var fieldEncoders = map[string]ValEncoder{} -var extensions = []Extension{} - -// StructDescriptor describe how should we encode/decode the struct -type StructDescriptor struct { - Type reflect2.Type - Fields []*Binding -} - -// GetField get one field from the descriptor by its name. -// Can not use map here to keep field orders. -func (structDescriptor *StructDescriptor) GetField(fieldName string) *Binding { - for _, binding := range structDescriptor.Fields { - if binding.Field.Name() == fieldName { - return binding - } - } - return nil -} - -// Binding describe how should we encode/decode the struct field -type Binding struct { - levels []int - Field reflect2.StructField - FromNames []string - ToNames []string - Encoder ValEncoder - Decoder ValDecoder -} - -// Extension the one for all SPI. Customize encoding/decoding by specifying alternate encoder/decoder. -// Can also rename fields by UpdateStructDescriptor. -type Extension interface { - UpdateStructDescriptor(structDescriptor *StructDescriptor) - CreateMapKeyDecoder(typ reflect2.Type) ValDecoder - CreateMapKeyEncoder(typ reflect2.Type) ValEncoder - CreateDecoder(typ reflect2.Type) ValDecoder - CreateEncoder(typ reflect2.Type) ValEncoder - DecorateDecoder(typ reflect2.Type, decoder ValDecoder) ValDecoder - DecorateEncoder(typ reflect2.Type, encoder ValEncoder) ValEncoder -} - -// DummyExtension embed this type get dummy implementation for all methods of Extension -type DummyExtension struct { -} - -// UpdateStructDescriptor No-op -func (extension *DummyExtension) UpdateStructDescriptor(structDescriptor *StructDescriptor) { -} - -// CreateMapKeyDecoder No-op -func (extension *DummyExtension) CreateMapKeyDecoder(typ reflect2.Type) ValDecoder { - return nil -} - -// CreateMapKeyEncoder No-op -func (extension *DummyExtension) CreateMapKeyEncoder(typ reflect2.Type) ValEncoder { - return nil -} - -// CreateDecoder No-op -func (extension *DummyExtension) CreateDecoder(typ reflect2.Type) ValDecoder { - return nil -} - -// CreateEncoder No-op -func (extension *DummyExtension) CreateEncoder(typ reflect2.Type) ValEncoder { - return nil -} - -// DecorateDecoder No-op -func (extension *DummyExtension) DecorateDecoder(typ reflect2.Type, decoder ValDecoder) ValDecoder { - return decoder -} - -// DecorateEncoder No-op -func (extension *DummyExtension) DecorateEncoder(typ reflect2.Type, encoder ValEncoder) ValEncoder { - return encoder -} - -type EncoderExtension map[reflect2.Type]ValEncoder - -// UpdateStructDescriptor No-op -func (extension EncoderExtension) UpdateStructDescriptor(structDescriptor *StructDescriptor) { -} - -// CreateDecoder No-op -func (extension EncoderExtension) CreateDecoder(typ reflect2.Type) ValDecoder { - return nil -} - -// CreateEncoder get encoder from map -func (extension EncoderExtension) CreateEncoder(typ reflect2.Type) ValEncoder { - return extension[typ] -} - -// CreateMapKeyDecoder No-op -func (extension EncoderExtension) CreateMapKeyDecoder(typ reflect2.Type) ValDecoder { - return nil -} - -// CreateMapKeyEncoder No-op -func (extension EncoderExtension) CreateMapKeyEncoder(typ reflect2.Type) ValEncoder { - return nil -} - -// DecorateDecoder No-op -func (extension EncoderExtension) DecorateDecoder(typ reflect2.Type, decoder ValDecoder) ValDecoder { - return decoder -} - -// DecorateEncoder No-op -func (extension EncoderExtension) DecorateEncoder(typ reflect2.Type, encoder ValEncoder) ValEncoder { - return encoder -} - -type DecoderExtension map[reflect2.Type]ValDecoder - -// UpdateStructDescriptor No-op -func (extension DecoderExtension) UpdateStructDescriptor(structDescriptor *StructDescriptor) { -} - -// CreateMapKeyDecoder No-op -func (extension DecoderExtension) CreateMapKeyDecoder(typ reflect2.Type) ValDecoder { - return nil -} - -// CreateMapKeyEncoder No-op -func (extension DecoderExtension) CreateMapKeyEncoder(typ reflect2.Type) ValEncoder { - return nil -} - -// CreateDecoder get decoder from map -func (extension DecoderExtension) CreateDecoder(typ reflect2.Type) ValDecoder { - return extension[typ] -} - -// CreateEncoder No-op -func (extension DecoderExtension) CreateEncoder(typ reflect2.Type) ValEncoder { - return nil -} - -// DecorateDecoder No-op -func (extension DecoderExtension) DecorateDecoder(typ reflect2.Type, decoder ValDecoder) ValDecoder { - return decoder -} - -// DecorateEncoder No-op -func (extension DecoderExtension) DecorateEncoder(typ reflect2.Type, encoder ValEncoder) ValEncoder { - return encoder -} - -type funcDecoder struct { - fun DecoderFunc -} - -func (decoder *funcDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - decoder.fun(ptr, iter) -} - -type funcEncoder struct { - fun EncoderFunc - isEmptyFunc func(ptr unsafe.Pointer) bool -} - -func (encoder *funcEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - encoder.fun(ptr, stream) -} - -func (encoder *funcEncoder) IsEmpty(ptr unsafe.Pointer) bool { - if encoder.isEmptyFunc == nil { - return false - } - return encoder.isEmptyFunc(ptr) -} - -// DecoderFunc the function form of TypeDecoder -type DecoderFunc func(ptr unsafe.Pointer, iter *Iterator) - -// EncoderFunc the function form of TypeEncoder -type EncoderFunc func(ptr unsafe.Pointer, stream *Stream) - -// RegisterTypeDecoderFunc register TypeDecoder for a type with function -func RegisterTypeDecoderFunc(typ string, fun DecoderFunc) { - typeDecoders[typ] = &funcDecoder{fun} -} - -// RegisterTypeDecoder register TypeDecoder for a typ -func RegisterTypeDecoder(typ string, decoder ValDecoder) { - typeDecoders[typ] = decoder -} - -// RegisterFieldDecoderFunc register TypeDecoder for a struct field with function -func RegisterFieldDecoderFunc(typ string, field string, fun DecoderFunc) { - RegisterFieldDecoder(typ, field, &funcDecoder{fun}) -} - -// RegisterFieldDecoder register TypeDecoder for a struct field -func RegisterFieldDecoder(typ string, field string, decoder ValDecoder) { - fieldDecoders[fmt.Sprintf("%s/%s", typ, field)] = decoder -} - -// RegisterTypeEncoderFunc register TypeEncoder for a type with encode/isEmpty function -func RegisterTypeEncoderFunc(typ string, fun EncoderFunc, isEmptyFunc func(unsafe.Pointer) bool) { - typeEncoders[typ] = &funcEncoder{fun, isEmptyFunc} -} - -// RegisterTypeEncoder register TypeEncoder for a type -func RegisterTypeEncoder(typ string, encoder ValEncoder) { - typeEncoders[typ] = encoder -} - -// RegisterFieldEncoderFunc register TypeEncoder for a struct field with encode/isEmpty function -func RegisterFieldEncoderFunc(typ string, field string, fun EncoderFunc, isEmptyFunc func(unsafe.Pointer) bool) { - RegisterFieldEncoder(typ, field, &funcEncoder{fun, isEmptyFunc}) -} - -// RegisterFieldEncoder register TypeEncoder for a struct field -func RegisterFieldEncoder(typ string, field string, encoder ValEncoder) { - fieldEncoders[fmt.Sprintf("%s/%s", typ, field)] = encoder -} - -// RegisterExtension register extension -func RegisterExtension(extension Extension) { - extensions = append(extensions, extension) -} - -func getTypeDecoderFromExtension(ctx *ctx, typ reflect2.Type) ValDecoder { - decoder := _getTypeDecoderFromExtension(ctx, typ) - if decoder != nil { - for _, extension := range extensions { - decoder = extension.DecorateDecoder(typ, decoder) - } - decoder = ctx.decoderExtension.DecorateDecoder(typ, decoder) - for _, extension := range ctx.extraExtensions { - decoder = extension.DecorateDecoder(typ, decoder) - } - } - return decoder -} -func _getTypeDecoderFromExtension(ctx *ctx, typ reflect2.Type) ValDecoder { - for _, extension := range extensions { - decoder := extension.CreateDecoder(typ) - if decoder != nil { - return decoder - } - } - decoder := ctx.decoderExtension.CreateDecoder(typ) - if decoder != nil { - return decoder - } - for _, extension := range ctx.extraExtensions { - decoder := extension.CreateDecoder(typ) - if decoder != nil { - return decoder - } - } - typeName := typ.String() - decoder = typeDecoders[typeName] - if decoder != nil { - return decoder - } - if typ.Kind() == reflect.Ptr { - ptrType := typ.(*reflect2.UnsafePtrType) - decoder := typeDecoders[ptrType.Elem().String()] - if decoder != nil { - return &OptionalDecoder{ptrType.Elem(), decoder} - } - } - return nil -} - -func getTypeEncoderFromExtension(ctx *ctx, typ reflect2.Type) ValEncoder { - encoder := _getTypeEncoderFromExtension(ctx, typ) - if encoder != nil { - for _, extension := range extensions { - encoder = extension.DecorateEncoder(typ, encoder) - } - encoder = ctx.encoderExtension.DecorateEncoder(typ, encoder) - for _, extension := range ctx.extraExtensions { - encoder = extension.DecorateEncoder(typ, encoder) - } - } - return encoder -} - -func _getTypeEncoderFromExtension(ctx *ctx, typ reflect2.Type) ValEncoder { - for _, extension := range extensions { - encoder := extension.CreateEncoder(typ) - if encoder != nil { - return encoder - } - } - encoder := ctx.encoderExtension.CreateEncoder(typ) - if encoder != nil { - return encoder - } - for _, extension := range ctx.extraExtensions { - encoder := extension.CreateEncoder(typ) - if encoder != nil { - return encoder - } - } - typeName := typ.String() - encoder = typeEncoders[typeName] - if encoder != nil { - return encoder - } - if typ.Kind() == reflect.Ptr { - typePtr := typ.(*reflect2.UnsafePtrType) - encoder := typeEncoders[typePtr.Elem().String()] - if encoder != nil { - return &OptionalEncoder{encoder} - } - } - return nil -} - -func describeStruct(ctx *ctx, typ reflect2.Type) *StructDescriptor { - structType := typ.(*reflect2.UnsafeStructType) - embeddedBindings := []*Binding{} - bindings := []*Binding{} - for i := 0; i < structType.NumField(); i++ { - field := structType.Field(i) - tag, hastag := field.Tag().Lookup(ctx.getTagKey()) - if ctx.onlyTaggedField && !hastag && !field.Anonymous() { - continue - } - if tag == "-" || field.Name() == "_" { - continue - } - tagParts := strings.Split(tag, ",") - if field.Anonymous() && (tag == "" || tagParts[0] == "") { - if field.Type().Kind() == reflect.Struct { - structDescriptor := describeStruct(ctx, field.Type()) - for _, binding := range structDescriptor.Fields { - binding.levels = append([]int{i}, binding.levels...) - omitempty := binding.Encoder.(*structFieldEncoder).omitempty - binding.Encoder = &structFieldEncoder{field, binding.Encoder, omitempty} - binding.Decoder = &structFieldDecoder{field, binding.Decoder} - embeddedBindings = append(embeddedBindings, binding) - } - continue - } else if field.Type().Kind() == reflect.Ptr { - ptrType := field.Type().(*reflect2.UnsafePtrType) - if ptrType.Elem().Kind() == reflect.Struct { - structDescriptor := describeStruct(ctx, ptrType.Elem()) - for _, binding := range structDescriptor.Fields { - binding.levels = append([]int{i}, binding.levels...) - omitempty := binding.Encoder.(*structFieldEncoder).omitempty - binding.Encoder = &dereferenceEncoder{binding.Encoder} - binding.Encoder = &structFieldEncoder{field, binding.Encoder, omitempty} - binding.Decoder = &dereferenceDecoder{ptrType.Elem(), binding.Decoder} - binding.Decoder = &structFieldDecoder{field, binding.Decoder} - embeddedBindings = append(embeddedBindings, binding) - } - continue - } - } - } - fieldNames := calcFieldNames(field.Name(), tagParts[0], tag) - fieldCacheKey := fmt.Sprintf("%s/%s", typ.String(), field.Name()) - decoder := fieldDecoders[fieldCacheKey] - if decoder == nil { - decoder = decoderOfType(ctx.append(field.Name()), field.Type()) - } - encoder := fieldEncoders[fieldCacheKey] - if encoder == nil { - encoder = encoderOfType(ctx.append(field.Name()), field.Type()) - } - binding := &Binding{ - Field: field, - FromNames: fieldNames, - ToNames: fieldNames, - Decoder: decoder, - Encoder: encoder, - } - binding.levels = []int{i} - bindings = append(bindings, binding) - } - return createStructDescriptor(ctx, typ, bindings, embeddedBindings) -} -func createStructDescriptor(ctx *ctx, typ reflect2.Type, bindings []*Binding, embeddedBindings []*Binding) *StructDescriptor { - structDescriptor := &StructDescriptor{ - Type: typ, - Fields: bindings, - } - for _, extension := range extensions { - extension.UpdateStructDescriptor(structDescriptor) - } - ctx.encoderExtension.UpdateStructDescriptor(structDescriptor) - ctx.decoderExtension.UpdateStructDescriptor(structDescriptor) - for _, extension := range ctx.extraExtensions { - extension.UpdateStructDescriptor(structDescriptor) - } - processTags(structDescriptor, ctx.frozenConfig) - // merge normal & embedded bindings & sort with original order - allBindings := sortableBindings(append(embeddedBindings, structDescriptor.Fields...)) - sort.Sort(allBindings) - structDescriptor.Fields = allBindings - return structDescriptor -} - -type sortableBindings []*Binding - -func (bindings sortableBindings) Len() int { - return len(bindings) -} - -func (bindings sortableBindings) Less(i, j int) bool { - left := bindings[i].levels - right := bindings[j].levels - k := 0 - for { - if left[k] < right[k] { - return true - } else if left[k] > right[k] { - return false - } - k++ - } -} - -func (bindings sortableBindings) Swap(i, j int) { - bindings[i], bindings[j] = bindings[j], bindings[i] -} - -func processTags(structDescriptor *StructDescriptor, cfg *frozenConfig) { - for _, binding := range structDescriptor.Fields { - shouldOmitEmpty := false - tagParts := strings.Split(binding.Field.Tag().Get(cfg.getTagKey()), ",") - for _, tagPart := range tagParts[1:] { - if tagPart == "omitempty" { - shouldOmitEmpty = true - } else if tagPart == "string" { - if binding.Field.Type().Kind() == reflect.String { - binding.Decoder = &stringModeStringDecoder{binding.Decoder, cfg} - binding.Encoder = &stringModeStringEncoder{binding.Encoder, cfg} - } else { - binding.Decoder = &stringModeNumberDecoder{binding.Decoder} - binding.Encoder = &stringModeNumberEncoder{binding.Encoder} - } - } - } - binding.Decoder = &structFieldDecoder{binding.Field, binding.Decoder} - binding.Encoder = &structFieldEncoder{binding.Field, binding.Encoder, shouldOmitEmpty} - } -} - -func calcFieldNames(originalFieldName string, tagProvidedFieldName string, wholeTag string) []string { - // ignore? - if wholeTag == "-" { - return []string{} - } - // rename? - var fieldNames []string - if tagProvidedFieldName == "" { - fieldNames = []string{originalFieldName} - } else { - fieldNames = []string{tagProvidedFieldName} - } - // private? - isNotExported := unicode.IsLower(rune(originalFieldName[0])) || originalFieldName[0] == '_' - if isNotExported { - fieldNames = []string{} - } - return fieldNames -} diff --git a/vendor/github.com/json-iterator/go/reflect_json_number.go b/vendor/github.com/json-iterator/go/reflect_json_number.go deleted file mode 100644 index 98d45c1ec..000000000 --- a/vendor/github.com/json-iterator/go/reflect_json_number.go +++ /dev/null @@ -1,112 +0,0 @@ -package jsoniter - -import ( - "encoding/json" - "github.com/modern-go/reflect2" - "strconv" - "unsafe" -) - -type Number string - -// String returns the literal text of the number. -func (n Number) String() string { return string(n) } - -// Float64 returns the number as a float64. -func (n Number) Float64() (float64, error) { - return strconv.ParseFloat(string(n), 64) -} - -// Int64 returns the number as an int64. -func (n Number) Int64() (int64, error) { - return strconv.ParseInt(string(n), 10, 64) -} - -func CastJsonNumber(val interface{}) (string, bool) { - switch typedVal := val.(type) { - case json.Number: - return string(typedVal), true - case Number: - return string(typedVal), true - } - return "", false -} - -var jsonNumberType = reflect2.TypeOfPtr((*json.Number)(nil)).Elem() -var jsoniterNumberType = reflect2.TypeOfPtr((*Number)(nil)).Elem() - -func createDecoderOfJsonNumber(ctx *ctx, typ reflect2.Type) ValDecoder { - if typ.AssignableTo(jsonNumberType) { - return &jsonNumberCodec{} - } - if typ.AssignableTo(jsoniterNumberType) { - return &jsoniterNumberCodec{} - } - return nil -} - -func createEncoderOfJsonNumber(ctx *ctx, typ reflect2.Type) ValEncoder { - if typ.AssignableTo(jsonNumberType) { - return &jsonNumberCodec{} - } - if typ.AssignableTo(jsoniterNumberType) { - return &jsoniterNumberCodec{} - } - return nil -} - -type jsonNumberCodec struct { -} - -func (codec *jsonNumberCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { - switch iter.WhatIsNext() { - case StringValue: - *((*json.Number)(ptr)) = json.Number(iter.ReadString()) - case NilValue: - iter.skipFourBytes('n', 'u', 'l', 'l') - *((*json.Number)(ptr)) = "" - default: - *((*json.Number)(ptr)) = json.Number([]byte(iter.readNumberAsString())) - } -} - -func (codec *jsonNumberCodec) Encode(ptr unsafe.Pointer, stream *Stream) { - number := *((*json.Number)(ptr)) - if len(number) == 0 { - stream.writeByte('0') - } else { - stream.WriteRaw(string(number)) - } -} - -func (codec *jsonNumberCodec) IsEmpty(ptr unsafe.Pointer) bool { - return len(*((*json.Number)(ptr))) == 0 -} - -type jsoniterNumberCodec struct { -} - -func (codec *jsoniterNumberCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { - switch iter.WhatIsNext() { - case StringValue: - *((*Number)(ptr)) = Number(iter.ReadString()) - case NilValue: - iter.skipFourBytes('n', 'u', 'l', 'l') - *((*Number)(ptr)) = "" - default: - *((*Number)(ptr)) = Number([]byte(iter.readNumberAsString())) - } -} - -func (codec *jsoniterNumberCodec) Encode(ptr unsafe.Pointer, stream *Stream) { - number := *((*Number)(ptr)) - if len(number) == 0 { - stream.writeByte('0') - } else { - stream.WriteRaw(string(number)) - } -} - -func (codec *jsoniterNumberCodec) IsEmpty(ptr unsafe.Pointer) bool { - return len(*((*Number)(ptr))) == 0 -} diff --git a/vendor/github.com/json-iterator/go/reflect_json_raw_message.go b/vendor/github.com/json-iterator/go/reflect_json_raw_message.go deleted file mode 100644 index eba434f2f..000000000 --- a/vendor/github.com/json-iterator/go/reflect_json_raw_message.go +++ /dev/null @@ -1,76 +0,0 @@ -package jsoniter - -import ( - "encoding/json" - "github.com/modern-go/reflect2" - "unsafe" -) - -var jsonRawMessageType = reflect2.TypeOfPtr((*json.RawMessage)(nil)).Elem() -var jsoniterRawMessageType = reflect2.TypeOfPtr((*RawMessage)(nil)).Elem() - -func createEncoderOfJsonRawMessage(ctx *ctx, typ reflect2.Type) ValEncoder { - if typ == jsonRawMessageType { - return &jsonRawMessageCodec{} - } - if typ == jsoniterRawMessageType { - return &jsoniterRawMessageCodec{} - } - return nil -} - -func createDecoderOfJsonRawMessage(ctx *ctx, typ reflect2.Type) ValDecoder { - if typ == jsonRawMessageType { - return &jsonRawMessageCodec{} - } - if typ == jsoniterRawMessageType { - return &jsoniterRawMessageCodec{} - } - return nil -} - -type jsonRawMessageCodec struct { -} - -func (codec *jsonRawMessageCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if iter.ReadNil() { - *((*json.RawMessage)(ptr)) = nil - } else { - *((*json.RawMessage)(ptr)) = iter.SkipAndReturnBytes() - } -} - -func (codec *jsonRawMessageCodec) Encode(ptr unsafe.Pointer, stream *Stream) { - if *((*json.RawMessage)(ptr)) == nil { - stream.WriteNil() - } else { - stream.WriteRaw(string(*((*json.RawMessage)(ptr)))) - } -} - -func (codec *jsonRawMessageCodec) IsEmpty(ptr unsafe.Pointer) bool { - return len(*((*json.RawMessage)(ptr))) == 0 -} - -type jsoniterRawMessageCodec struct { -} - -func (codec *jsoniterRawMessageCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if iter.ReadNil() { - *((*RawMessage)(ptr)) = nil - } else { - *((*RawMessage)(ptr)) = iter.SkipAndReturnBytes() - } -} - -func (codec *jsoniterRawMessageCodec) Encode(ptr unsafe.Pointer, stream *Stream) { - if *((*RawMessage)(ptr)) == nil { - stream.WriteNil() - } else { - stream.WriteRaw(string(*((*RawMessage)(ptr)))) - } -} - -func (codec *jsoniterRawMessageCodec) IsEmpty(ptr unsafe.Pointer) bool { - return len(*((*RawMessage)(ptr))) == 0 -} diff --git a/vendor/github.com/json-iterator/go/reflect_map.go b/vendor/github.com/json-iterator/go/reflect_map.go deleted file mode 100644 index 582967130..000000000 --- a/vendor/github.com/json-iterator/go/reflect_map.go +++ /dev/null @@ -1,346 +0,0 @@ -package jsoniter - -import ( - "fmt" - "github.com/modern-go/reflect2" - "io" - "reflect" - "sort" - "unsafe" -) - -func decoderOfMap(ctx *ctx, typ reflect2.Type) ValDecoder { - mapType := typ.(*reflect2.UnsafeMapType) - keyDecoder := decoderOfMapKey(ctx.append("[mapKey]"), mapType.Key()) - elemDecoder := decoderOfType(ctx.append("[mapElem]"), mapType.Elem()) - return &mapDecoder{ - mapType: mapType, - keyType: mapType.Key(), - elemType: mapType.Elem(), - keyDecoder: keyDecoder, - elemDecoder: elemDecoder, - } -} - -func encoderOfMap(ctx *ctx, typ reflect2.Type) ValEncoder { - mapType := typ.(*reflect2.UnsafeMapType) - if ctx.sortMapKeys { - return &sortKeysMapEncoder{ - mapType: mapType, - keyEncoder: encoderOfMapKey(ctx.append("[mapKey]"), mapType.Key()), - elemEncoder: encoderOfType(ctx.append("[mapElem]"), mapType.Elem()), - } - } - return &mapEncoder{ - mapType: mapType, - keyEncoder: encoderOfMapKey(ctx.append("[mapKey]"), mapType.Key()), - elemEncoder: encoderOfType(ctx.append("[mapElem]"), mapType.Elem()), - } -} - -func decoderOfMapKey(ctx *ctx, typ reflect2.Type) ValDecoder { - decoder := ctx.decoderExtension.CreateMapKeyDecoder(typ) - if decoder != nil { - return decoder - } - for _, extension := range ctx.extraExtensions { - decoder := extension.CreateMapKeyDecoder(typ) - if decoder != nil { - return decoder - } - } - - ptrType := reflect2.PtrTo(typ) - if ptrType.Implements(unmarshalerType) { - return &referenceDecoder{ - &unmarshalerDecoder{ - valType: ptrType, - }, - } - } - if typ.Implements(unmarshalerType) { - return &unmarshalerDecoder{ - valType: typ, - } - } - if ptrType.Implements(textUnmarshalerType) { - return &referenceDecoder{ - &textUnmarshalerDecoder{ - valType: ptrType, - }, - } - } - if typ.Implements(textUnmarshalerType) { - return &textUnmarshalerDecoder{ - valType: typ, - } - } - - switch typ.Kind() { - case reflect.String: - return decoderOfType(ctx, reflect2.DefaultTypeOfKind(reflect.String)) - case reflect.Bool, - reflect.Uint8, reflect.Int8, - reflect.Uint16, reflect.Int16, - reflect.Uint32, reflect.Int32, - reflect.Uint64, reflect.Int64, - reflect.Uint, reflect.Int, - reflect.Float32, reflect.Float64, - reflect.Uintptr: - typ = reflect2.DefaultTypeOfKind(typ.Kind()) - return &numericMapKeyDecoder{decoderOfType(ctx, typ)} - default: - return &lazyErrorDecoder{err: fmt.Errorf("unsupported map key type: %v", typ)} - } -} - -func encoderOfMapKey(ctx *ctx, typ reflect2.Type) ValEncoder { - encoder := ctx.encoderExtension.CreateMapKeyEncoder(typ) - if encoder != nil { - return encoder - } - for _, extension := range ctx.extraExtensions { - encoder := extension.CreateMapKeyEncoder(typ) - if encoder != nil { - return encoder - } - } - - if typ == textMarshalerType { - return &directTextMarshalerEncoder{ - stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")), - } - } - if typ.Implements(textMarshalerType) { - return &textMarshalerEncoder{ - valType: typ, - stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")), - } - } - - switch typ.Kind() { - case reflect.String: - return encoderOfType(ctx, reflect2.DefaultTypeOfKind(reflect.String)) - case reflect.Bool, - reflect.Uint8, reflect.Int8, - reflect.Uint16, reflect.Int16, - reflect.Uint32, reflect.Int32, - reflect.Uint64, reflect.Int64, - reflect.Uint, reflect.Int, - reflect.Float32, reflect.Float64, - reflect.Uintptr: - typ = reflect2.DefaultTypeOfKind(typ.Kind()) - return &numericMapKeyEncoder{encoderOfType(ctx, typ)} - default: - if typ.Kind() == reflect.Interface { - return &dynamicMapKeyEncoder{ctx, typ} - } - return &lazyErrorEncoder{err: fmt.Errorf("unsupported map key type: %v", typ)} - } -} - -type mapDecoder struct { - mapType *reflect2.UnsafeMapType - keyType reflect2.Type - elemType reflect2.Type - keyDecoder ValDecoder - elemDecoder ValDecoder -} - -func (decoder *mapDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - mapType := decoder.mapType - c := iter.nextToken() - if c == 'n' { - iter.skipThreeBytes('u', 'l', 'l') - *(*unsafe.Pointer)(ptr) = nil - mapType.UnsafeSet(ptr, mapType.UnsafeNew()) - return - } - if mapType.UnsafeIsNil(ptr) { - mapType.UnsafeSet(ptr, mapType.UnsafeMakeMap(0)) - } - if c != '{' { - iter.ReportError("ReadMapCB", `expect { or n, but found `+string([]byte{c})) - return - } - c = iter.nextToken() - if c == '}' { - return - } - iter.unreadByte() - key := decoder.keyType.UnsafeNew() - decoder.keyDecoder.Decode(key, iter) - c = iter.nextToken() - if c != ':' { - iter.ReportError("ReadMapCB", "expect : after object field, but found "+string([]byte{c})) - return - } - elem := decoder.elemType.UnsafeNew() - decoder.elemDecoder.Decode(elem, iter) - decoder.mapType.UnsafeSetIndex(ptr, key, elem) - for c = iter.nextToken(); c == ','; c = iter.nextToken() { - key := decoder.keyType.UnsafeNew() - decoder.keyDecoder.Decode(key, iter) - c = iter.nextToken() - if c != ':' { - iter.ReportError("ReadMapCB", "expect : after object field, but found "+string([]byte{c})) - return - } - elem := decoder.elemType.UnsafeNew() - decoder.elemDecoder.Decode(elem, iter) - decoder.mapType.UnsafeSetIndex(ptr, key, elem) - } - if c != '}' { - iter.ReportError("ReadMapCB", `expect }, but found `+string([]byte{c})) - } -} - -type numericMapKeyDecoder struct { - decoder ValDecoder -} - -func (decoder *numericMapKeyDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - c := iter.nextToken() - if c != '"' { - iter.ReportError("ReadMapCB", `expect ", but found `+string([]byte{c})) - return - } - decoder.decoder.Decode(ptr, iter) - c = iter.nextToken() - if c != '"' { - iter.ReportError("ReadMapCB", `expect ", but found `+string([]byte{c})) - return - } -} - -type numericMapKeyEncoder struct { - encoder ValEncoder -} - -func (encoder *numericMapKeyEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.writeByte('"') - encoder.encoder.Encode(ptr, stream) - stream.writeByte('"') -} - -func (encoder *numericMapKeyEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return false -} - -type dynamicMapKeyEncoder struct { - ctx *ctx - valType reflect2.Type -} - -func (encoder *dynamicMapKeyEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - obj := encoder.valType.UnsafeIndirect(ptr) - encoderOfMapKey(encoder.ctx, reflect2.TypeOf(obj)).Encode(reflect2.PtrOf(obj), stream) -} - -func (encoder *dynamicMapKeyEncoder) IsEmpty(ptr unsafe.Pointer) bool { - obj := encoder.valType.UnsafeIndirect(ptr) - return encoderOfMapKey(encoder.ctx, reflect2.TypeOf(obj)).IsEmpty(reflect2.PtrOf(obj)) -} - -type mapEncoder struct { - mapType *reflect2.UnsafeMapType - keyEncoder ValEncoder - elemEncoder ValEncoder -} - -func (encoder *mapEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - if *(*unsafe.Pointer)(ptr) == nil { - stream.WriteNil() - return - } - stream.WriteObjectStart() - iter := encoder.mapType.UnsafeIterate(ptr) - for i := 0; iter.HasNext(); i++ { - if i != 0 { - stream.WriteMore() - } - key, elem := iter.UnsafeNext() - encoder.keyEncoder.Encode(key, stream) - if stream.indention > 0 { - stream.writeTwoBytes(byte(':'), byte(' ')) - } else { - stream.writeByte(':') - } - encoder.elemEncoder.Encode(elem, stream) - } - stream.WriteObjectEnd() -} - -func (encoder *mapEncoder) IsEmpty(ptr unsafe.Pointer) bool { - iter := encoder.mapType.UnsafeIterate(ptr) - return !iter.HasNext() -} - -type sortKeysMapEncoder struct { - mapType *reflect2.UnsafeMapType - keyEncoder ValEncoder - elemEncoder ValEncoder -} - -func (encoder *sortKeysMapEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - if *(*unsafe.Pointer)(ptr) == nil { - stream.WriteNil() - return - } - stream.WriteObjectStart() - mapIter := encoder.mapType.UnsafeIterate(ptr) - subStream := stream.cfg.BorrowStream(nil) - subStream.Attachment = stream.Attachment - subIter := stream.cfg.BorrowIterator(nil) - keyValues := encodedKeyValues{} - for mapIter.HasNext() { - key, elem := mapIter.UnsafeNext() - subStreamIndex := subStream.Buffered() - encoder.keyEncoder.Encode(key, subStream) - if subStream.Error != nil && subStream.Error != io.EOF && stream.Error == nil { - stream.Error = subStream.Error - } - encodedKey := subStream.Buffer()[subStreamIndex:] - subIter.ResetBytes(encodedKey) - decodedKey := subIter.ReadString() - if stream.indention > 0 { - subStream.writeTwoBytes(byte(':'), byte(' ')) - } else { - subStream.writeByte(':') - } - encoder.elemEncoder.Encode(elem, subStream) - keyValues = append(keyValues, encodedKV{ - key: decodedKey, - keyValue: subStream.Buffer()[subStreamIndex:], - }) - } - sort.Sort(keyValues) - for i, keyValue := range keyValues { - if i != 0 { - stream.WriteMore() - } - stream.Write(keyValue.keyValue) - } - if subStream.Error != nil && stream.Error == nil { - stream.Error = subStream.Error - } - stream.WriteObjectEnd() - stream.cfg.ReturnStream(subStream) - stream.cfg.ReturnIterator(subIter) -} - -func (encoder *sortKeysMapEncoder) IsEmpty(ptr unsafe.Pointer) bool { - iter := encoder.mapType.UnsafeIterate(ptr) - return !iter.HasNext() -} - -type encodedKeyValues []encodedKV - -type encodedKV struct { - key string - keyValue []byte -} - -func (sv encodedKeyValues) Len() int { return len(sv) } -func (sv encodedKeyValues) Swap(i, j int) { sv[i], sv[j] = sv[j], sv[i] } -func (sv encodedKeyValues) Less(i, j int) bool { return sv[i].key < sv[j].key } diff --git a/vendor/github.com/json-iterator/go/reflect_marshaler.go b/vendor/github.com/json-iterator/go/reflect_marshaler.go deleted file mode 100644 index 3e21f3756..000000000 --- a/vendor/github.com/json-iterator/go/reflect_marshaler.go +++ /dev/null @@ -1,225 +0,0 @@ -package jsoniter - -import ( - "encoding" - "encoding/json" - "unsafe" - - "github.com/modern-go/reflect2" -) - -var marshalerType = reflect2.TypeOfPtr((*json.Marshaler)(nil)).Elem() -var unmarshalerType = reflect2.TypeOfPtr((*json.Unmarshaler)(nil)).Elem() -var textMarshalerType = reflect2.TypeOfPtr((*encoding.TextMarshaler)(nil)).Elem() -var textUnmarshalerType = reflect2.TypeOfPtr((*encoding.TextUnmarshaler)(nil)).Elem() - -func createDecoderOfMarshaler(ctx *ctx, typ reflect2.Type) ValDecoder { - ptrType := reflect2.PtrTo(typ) - if ptrType.Implements(unmarshalerType) { - return &referenceDecoder{ - &unmarshalerDecoder{ptrType}, - } - } - if ptrType.Implements(textUnmarshalerType) { - return &referenceDecoder{ - &textUnmarshalerDecoder{ptrType}, - } - } - return nil -} - -func createEncoderOfMarshaler(ctx *ctx, typ reflect2.Type) ValEncoder { - if typ == marshalerType { - checkIsEmpty := createCheckIsEmpty(ctx, typ) - var encoder ValEncoder = &directMarshalerEncoder{ - checkIsEmpty: checkIsEmpty, - } - return encoder - } - if typ.Implements(marshalerType) { - checkIsEmpty := createCheckIsEmpty(ctx, typ) - var encoder ValEncoder = &marshalerEncoder{ - valType: typ, - checkIsEmpty: checkIsEmpty, - } - return encoder - } - ptrType := reflect2.PtrTo(typ) - if ctx.prefix != "" && ptrType.Implements(marshalerType) { - checkIsEmpty := createCheckIsEmpty(ctx, ptrType) - var encoder ValEncoder = &marshalerEncoder{ - valType: ptrType, - checkIsEmpty: checkIsEmpty, - } - return &referenceEncoder{encoder} - } - if typ == textMarshalerType { - checkIsEmpty := createCheckIsEmpty(ctx, typ) - var encoder ValEncoder = &directTextMarshalerEncoder{ - checkIsEmpty: checkIsEmpty, - stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")), - } - return encoder - } - if typ.Implements(textMarshalerType) { - checkIsEmpty := createCheckIsEmpty(ctx, typ) - var encoder ValEncoder = &textMarshalerEncoder{ - valType: typ, - stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")), - checkIsEmpty: checkIsEmpty, - } - return encoder - } - // if prefix is empty, the type is the root type - if ctx.prefix != "" && ptrType.Implements(textMarshalerType) { - checkIsEmpty := createCheckIsEmpty(ctx, ptrType) - var encoder ValEncoder = &textMarshalerEncoder{ - valType: ptrType, - stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")), - checkIsEmpty: checkIsEmpty, - } - return &referenceEncoder{encoder} - } - return nil -} - -type marshalerEncoder struct { - checkIsEmpty checkIsEmpty - valType reflect2.Type -} - -func (encoder *marshalerEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - obj := encoder.valType.UnsafeIndirect(ptr) - if encoder.valType.IsNullable() && reflect2.IsNil(obj) { - stream.WriteNil() - return - } - marshaler := obj.(json.Marshaler) - bytes, err := marshaler.MarshalJSON() - if err != nil { - stream.Error = err - } else { - // html escape was already done by jsoniter - // but the extra '\n' should be trimed - l := len(bytes) - if l > 0 && bytes[l-1] == '\n' { - bytes = bytes[:l-1] - } - stream.Write(bytes) - } -} - -func (encoder *marshalerEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return encoder.checkIsEmpty.IsEmpty(ptr) -} - -type directMarshalerEncoder struct { - checkIsEmpty checkIsEmpty -} - -func (encoder *directMarshalerEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - marshaler := *(*json.Marshaler)(ptr) - if marshaler == nil { - stream.WriteNil() - return - } - bytes, err := marshaler.MarshalJSON() - if err != nil { - stream.Error = err - } else { - stream.Write(bytes) - } -} - -func (encoder *directMarshalerEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return encoder.checkIsEmpty.IsEmpty(ptr) -} - -type textMarshalerEncoder struct { - valType reflect2.Type - stringEncoder ValEncoder - checkIsEmpty checkIsEmpty -} - -func (encoder *textMarshalerEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - obj := encoder.valType.UnsafeIndirect(ptr) - if encoder.valType.IsNullable() && reflect2.IsNil(obj) { - stream.WriteNil() - return - } - marshaler := (obj).(encoding.TextMarshaler) - bytes, err := marshaler.MarshalText() - if err != nil { - stream.Error = err - } else { - str := string(bytes) - encoder.stringEncoder.Encode(unsafe.Pointer(&str), stream) - } -} - -func (encoder *textMarshalerEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return encoder.checkIsEmpty.IsEmpty(ptr) -} - -type directTextMarshalerEncoder struct { - stringEncoder ValEncoder - checkIsEmpty checkIsEmpty -} - -func (encoder *directTextMarshalerEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - marshaler := *(*encoding.TextMarshaler)(ptr) - if marshaler == nil { - stream.WriteNil() - return - } - bytes, err := marshaler.MarshalText() - if err != nil { - stream.Error = err - } else { - str := string(bytes) - encoder.stringEncoder.Encode(unsafe.Pointer(&str), stream) - } -} - -func (encoder *directTextMarshalerEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return encoder.checkIsEmpty.IsEmpty(ptr) -} - -type unmarshalerDecoder struct { - valType reflect2.Type -} - -func (decoder *unmarshalerDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - valType := decoder.valType - obj := valType.UnsafeIndirect(ptr) - unmarshaler := obj.(json.Unmarshaler) - iter.nextToken() - iter.unreadByte() // skip spaces - bytes := iter.SkipAndReturnBytes() - err := unmarshaler.UnmarshalJSON(bytes) - if err != nil { - iter.ReportError("unmarshalerDecoder", err.Error()) - } -} - -type textUnmarshalerDecoder struct { - valType reflect2.Type -} - -func (decoder *textUnmarshalerDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - valType := decoder.valType - obj := valType.UnsafeIndirect(ptr) - if reflect2.IsNil(obj) { - ptrType := valType.(*reflect2.UnsafePtrType) - elemType := ptrType.Elem() - elem := elemType.UnsafeNew() - ptrType.UnsafeSet(ptr, unsafe.Pointer(&elem)) - obj = valType.UnsafeIndirect(ptr) - } - unmarshaler := (obj).(encoding.TextUnmarshaler) - str := iter.ReadString() - err := unmarshaler.UnmarshalText([]byte(str)) - if err != nil { - iter.ReportError("textUnmarshalerDecoder", err.Error()) - } -} diff --git a/vendor/github.com/json-iterator/go/reflect_native.go b/vendor/github.com/json-iterator/go/reflect_native.go deleted file mode 100644 index f88722d14..000000000 --- a/vendor/github.com/json-iterator/go/reflect_native.go +++ /dev/null @@ -1,453 +0,0 @@ -package jsoniter - -import ( - "encoding/base64" - "reflect" - "strconv" - "unsafe" - - "github.com/modern-go/reflect2" -) - -const ptrSize = 32 << uintptr(^uintptr(0)>>63) - -func createEncoderOfNative(ctx *ctx, typ reflect2.Type) ValEncoder { - if typ.Kind() == reflect.Slice && typ.(reflect2.SliceType).Elem().Kind() == reflect.Uint8 { - sliceDecoder := decoderOfSlice(ctx, typ) - return &base64Codec{sliceDecoder: sliceDecoder} - } - typeName := typ.String() - kind := typ.Kind() - switch kind { - case reflect.String: - if typeName != "string" { - return encoderOfType(ctx, reflect2.TypeOfPtr((*string)(nil)).Elem()) - } - return &stringCodec{} - case reflect.Int: - if typeName != "int" { - return encoderOfType(ctx, reflect2.TypeOfPtr((*int)(nil)).Elem()) - } - if strconv.IntSize == 32 { - return &int32Codec{} - } - return &int64Codec{} - case reflect.Int8: - if typeName != "int8" { - return encoderOfType(ctx, reflect2.TypeOfPtr((*int8)(nil)).Elem()) - } - return &int8Codec{} - case reflect.Int16: - if typeName != "int16" { - return encoderOfType(ctx, reflect2.TypeOfPtr((*int16)(nil)).Elem()) - } - return &int16Codec{} - case reflect.Int32: - if typeName != "int32" { - return encoderOfType(ctx, reflect2.TypeOfPtr((*int32)(nil)).Elem()) - } - return &int32Codec{} - case reflect.Int64: - if typeName != "int64" { - return encoderOfType(ctx, reflect2.TypeOfPtr((*int64)(nil)).Elem()) - } - return &int64Codec{} - case reflect.Uint: - if typeName != "uint" { - return encoderOfType(ctx, reflect2.TypeOfPtr((*uint)(nil)).Elem()) - } - if strconv.IntSize == 32 { - return &uint32Codec{} - } - return &uint64Codec{} - case reflect.Uint8: - if typeName != "uint8" { - return encoderOfType(ctx, reflect2.TypeOfPtr((*uint8)(nil)).Elem()) - } - return &uint8Codec{} - case reflect.Uint16: - if typeName != "uint16" { - return encoderOfType(ctx, reflect2.TypeOfPtr((*uint16)(nil)).Elem()) - } - return &uint16Codec{} - case reflect.Uint32: - if typeName != "uint32" { - return encoderOfType(ctx, reflect2.TypeOfPtr((*uint32)(nil)).Elem()) - } - return &uint32Codec{} - case reflect.Uintptr: - if typeName != "uintptr" { - return encoderOfType(ctx, reflect2.TypeOfPtr((*uintptr)(nil)).Elem()) - } - if ptrSize == 32 { - return &uint32Codec{} - } - return &uint64Codec{} - case reflect.Uint64: - if typeName != "uint64" { - return encoderOfType(ctx, reflect2.TypeOfPtr((*uint64)(nil)).Elem()) - } - return &uint64Codec{} - case reflect.Float32: - if typeName != "float32" { - return encoderOfType(ctx, reflect2.TypeOfPtr((*float32)(nil)).Elem()) - } - return &float32Codec{} - case reflect.Float64: - if typeName != "float64" { - return encoderOfType(ctx, reflect2.TypeOfPtr((*float64)(nil)).Elem()) - } - return &float64Codec{} - case reflect.Bool: - if typeName != "bool" { - return encoderOfType(ctx, reflect2.TypeOfPtr((*bool)(nil)).Elem()) - } - return &boolCodec{} - } - return nil -} - -func createDecoderOfNative(ctx *ctx, typ reflect2.Type) ValDecoder { - if typ.Kind() == reflect.Slice && typ.(reflect2.SliceType).Elem().Kind() == reflect.Uint8 { - sliceDecoder := decoderOfSlice(ctx, typ) - return &base64Codec{sliceDecoder: sliceDecoder} - } - typeName := typ.String() - switch typ.Kind() { - case reflect.String: - if typeName != "string" { - return decoderOfType(ctx, reflect2.TypeOfPtr((*string)(nil)).Elem()) - } - return &stringCodec{} - case reflect.Int: - if typeName != "int" { - return decoderOfType(ctx, reflect2.TypeOfPtr((*int)(nil)).Elem()) - } - if strconv.IntSize == 32 { - return &int32Codec{} - } - return &int64Codec{} - case reflect.Int8: - if typeName != "int8" { - return decoderOfType(ctx, reflect2.TypeOfPtr((*int8)(nil)).Elem()) - } - return &int8Codec{} - case reflect.Int16: - if typeName != "int16" { - return decoderOfType(ctx, reflect2.TypeOfPtr((*int16)(nil)).Elem()) - } - return &int16Codec{} - case reflect.Int32: - if typeName != "int32" { - return decoderOfType(ctx, reflect2.TypeOfPtr((*int32)(nil)).Elem()) - } - return &int32Codec{} - case reflect.Int64: - if typeName != "int64" { - return decoderOfType(ctx, reflect2.TypeOfPtr((*int64)(nil)).Elem()) - } - return &int64Codec{} - case reflect.Uint: - if typeName != "uint" { - return decoderOfType(ctx, reflect2.TypeOfPtr((*uint)(nil)).Elem()) - } - if strconv.IntSize == 32 { - return &uint32Codec{} - } - return &uint64Codec{} - case reflect.Uint8: - if typeName != "uint8" { - return decoderOfType(ctx, reflect2.TypeOfPtr((*uint8)(nil)).Elem()) - } - return &uint8Codec{} - case reflect.Uint16: - if typeName != "uint16" { - return decoderOfType(ctx, reflect2.TypeOfPtr((*uint16)(nil)).Elem()) - } - return &uint16Codec{} - case reflect.Uint32: - if typeName != "uint32" { - return decoderOfType(ctx, reflect2.TypeOfPtr((*uint32)(nil)).Elem()) - } - return &uint32Codec{} - case reflect.Uintptr: - if typeName != "uintptr" { - return decoderOfType(ctx, reflect2.TypeOfPtr((*uintptr)(nil)).Elem()) - } - if ptrSize == 32 { - return &uint32Codec{} - } - return &uint64Codec{} - case reflect.Uint64: - if typeName != "uint64" { - return decoderOfType(ctx, reflect2.TypeOfPtr((*uint64)(nil)).Elem()) - } - return &uint64Codec{} - case reflect.Float32: - if typeName != "float32" { - return decoderOfType(ctx, reflect2.TypeOfPtr((*float32)(nil)).Elem()) - } - return &float32Codec{} - case reflect.Float64: - if typeName != "float64" { - return decoderOfType(ctx, reflect2.TypeOfPtr((*float64)(nil)).Elem()) - } - return &float64Codec{} - case reflect.Bool: - if typeName != "bool" { - return decoderOfType(ctx, reflect2.TypeOfPtr((*bool)(nil)).Elem()) - } - return &boolCodec{} - } - return nil -} - -type stringCodec struct { -} - -func (codec *stringCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { - *((*string)(ptr)) = iter.ReadString() -} - -func (codec *stringCodec) Encode(ptr unsafe.Pointer, stream *Stream) { - str := *((*string)(ptr)) - stream.WriteString(str) -} - -func (codec *stringCodec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*string)(ptr)) == "" -} - -type int8Codec struct { -} - -func (codec *int8Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*int8)(ptr)) = iter.ReadInt8() - } -} - -func (codec *int8Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteInt8(*((*int8)(ptr))) -} - -func (codec *int8Codec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*int8)(ptr)) == 0 -} - -type int16Codec struct { -} - -func (codec *int16Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*int16)(ptr)) = iter.ReadInt16() - } -} - -func (codec *int16Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteInt16(*((*int16)(ptr))) -} - -func (codec *int16Codec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*int16)(ptr)) == 0 -} - -type int32Codec struct { -} - -func (codec *int32Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*int32)(ptr)) = iter.ReadInt32() - } -} - -func (codec *int32Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteInt32(*((*int32)(ptr))) -} - -func (codec *int32Codec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*int32)(ptr)) == 0 -} - -type int64Codec struct { -} - -func (codec *int64Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*int64)(ptr)) = iter.ReadInt64() - } -} - -func (codec *int64Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteInt64(*((*int64)(ptr))) -} - -func (codec *int64Codec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*int64)(ptr)) == 0 -} - -type uint8Codec struct { -} - -func (codec *uint8Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*uint8)(ptr)) = iter.ReadUint8() - } -} - -func (codec *uint8Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteUint8(*((*uint8)(ptr))) -} - -func (codec *uint8Codec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*uint8)(ptr)) == 0 -} - -type uint16Codec struct { -} - -func (codec *uint16Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*uint16)(ptr)) = iter.ReadUint16() - } -} - -func (codec *uint16Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteUint16(*((*uint16)(ptr))) -} - -func (codec *uint16Codec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*uint16)(ptr)) == 0 -} - -type uint32Codec struct { -} - -func (codec *uint32Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*uint32)(ptr)) = iter.ReadUint32() - } -} - -func (codec *uint32Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteUint32(*((*uint32)(ptr))) -} - -func (codec *uint32Codec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*uint32)(ptr)) == 0 -} - -type uint64Codec struct { -} - -func (codec *uint64Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*uint64)(ptr)) = iter.ReadUint64() - } -} - -func (codec *uint64Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteUint64(*((*uint64)(ptr))) -} - -func (codec *uint64Codec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*uint64)(ptr)) == 0 -} - -type float32Codec struct { -} - -func (codec *float32Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*float32)(ptr)) = iter.ReadFloat32() - } -} - -func (codec *float32Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteFloat32(*((*float32)(ptr))) -} - -func (codec *float32Codec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*float32)(ptr)) == 0 -} - -type float64Codec struct { -} - -func (codec *float64Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*float64)(ptr)) = iter.ReadFloat64() - } -} - -func (codec *float64Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteFloat64(*((*float64)(ptr))) -} - -func (codec *float64Codec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*float64)(ptr)) == 0 -} - -type boolCodec struct { -} - -func (codec *boolCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*bool)(ptr)) = iter.ReadBool() - } -} - -func (codec *boolCodec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteBool(*((*bool)(ptr))) -} - -func (codec *boolCodec) IsEmpty(ptr unsafe.Pointer) bool { - return !(*((*bool)(ptr))) -} - -type base64Codec struct { - sliceType *reflect2.UnsafeSliceType - sliceDecoder ValDecoder -} - -func (codec *base64Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if iter.ReadNil() { - codec.sliceType.UnsafeSetNil(ptr) - return - } - switch iter.WhatIsNext() { - case StringValue: - src := iter.ReadString() - dst, err := base64.StdEncoding.DecodeString(src) - if err != nil { - iter.ReportError("decode base64", err.Error()) - } else { - codec.sliceType.UnsafeSet(ptr, unsafe.Pointer(&dst)) - } - case ArrayValue: - codec.sliceDecoder.Decode(ptr, iter) - default: - iter.ReportError("base64Codec", "invalid input") - } -} - -func (codec *base64Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - if codec.sliceType.UnsafeIsNil(ptr) { - stream.WriteNil() - return - } - src := *((*[]byte)(ptr)) - encoding := base64.StdEncoding - stream.writeByte('"') - if len(src) != 0 { - size := encoding.EncodedLen(len(src)) - buf := make([]byte, size) - encoding.Encode(buf, src) - stream.buf = append(stream.buf, buf...) - } - stream.writeByte('"') -} - -func (codec *base64Codec) IsEmpty(ptr unsafe.Pointer) bool { - return len(*((*[]byte)(ptr))) == 0 -} diff --git a/vendor/github.com/json-iterator/go/reflect_optional.go b/vendor/github.com/json-iterator/go/reflect_optional.go deleted file mode 100644 index fa71f4748..000000000 --- a/vendor/github.com/json-iterator/go/reflect_optional.go +++ /dev/null @@ -1,129 +0,0 @@ -package jsoniter - -import ( - "github.com/modern-go/reflect2" - "unsafe" -) - -func decoderOfOptional(ctx *ctx, typ reflect2.Type) ValDecoder { - ptrType := typ.(*reflect2.UnsafePtrType) - elemType := ptrType.Elem() - decoder := decoderOfType(ctx, elemType) - return &OptionalDecoder{elemType, decoder} -} - -func encoderOfOptional(ctx *ctx, typ reflect2.Type) ValEncoder { - ptrType := typ.(*reflect2.UnsafePtrType) - elemType := ptrType.Elem() - elemEncoder := encoderOfType(ctx, elemType) - encoder := &OptionalEncoder{elemEncoder} - return encoder -} - -type OptionalDecoder struct { - ValueType reflect2.Type - ValueDecoder ValDecoder -} - -func (decoder *OptionalDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - if iter.ReadNil() { - *((*unsafe.Pointer)(ptr)) = nil - } else { - if *((*unsafe.Pointer)(ptr)) == nil { - //pointer to null, we have to allocate memory to hold the value - newPtr := decoder.ValueType.UnsafeNew() - decoder.ValueDecoder.Decode(newPtr, iter) - *((*unsafe.Pointer)(ptr)) = newPtr - } else { - //reuse existing instance - decoder.ValueDecoder.Decode(*((*unsafe.Pointer)(ptr)), iter) - } - } -} - -type dereferenceDecoder struct { - // only to deference a pointer - valueType reflect2.Type - valueDecoder ValDecoder -} - -func (decoder *dereferenceDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - if *((*unsafe.Pointer)(ptr)) == nil { - //pointer to null, we have to allocate memory to hold the value - newPtr := decoder.valueType.UnsafeNew() - decoder.valueDecoder.Decode(newPtr, iter) - *((*unsafe.Pointer)(ptr)) = newPtr - } else { - //reuse existing instance - decoder.valueDecoder.Decode(*((*unsafe.Pointer)(ptr)), iter) - } -} - -type OptionalEncoder struct { - ValueEncoder ValEncoder -} - -func (encoder *OptionalEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - if *((*unsafe.Pointer)(ptr)) == nil { - stream.WriteNil() - } else { - encoder.ValueEncoder.Encode(*((*unsafe.Pointer)(ptr)), stream) - } -} - -func (encoder *OptionalEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return *((*unsafe.Pointer)(ptr)) == nil -} - -type dereferenceEncoder struct { - ValueEncoder ValEncoder -} - -func (encoder *dereferenceEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - if *((*unsafe.Pointer)(ptr)) == nil { - stream.WriteNil() - } else { - encoder.ValueEncoder.Encode(*((*unsafe.Pointer)(ptr)), stream) - } -} - -func (encoder *dereferenceEncoder) IsEmpty(ptr unsafe.Pointer) bool { - dePtr := *((*unsafe.Pointer)(ptr)) - if dePtr == nil { - return true - } - return encoder.ValueEncoder.IsEmpty(dePtr) -} - -func (encoder *dereferenceEncoder) IsEmbeddedPtrNil(ptr unsafe.Pointer) bool { - deReferenced := *((*unsafe.Pointer)(ptr)) - if deReferenced == nil { - return true - } - isEmbeddedPtrNil, converted := encoder.ValueEncoder.(IsEmbeddedPtrNil) - if !converted { - return false - } - fieldPtr := unsafe.Pointer(deReferenced) - return isEmbeddedPtrNil.IsEmbeddedPtrNil(fieldPtr) -} - -type referenceEncoder struct { - encoder ValEncoder -} - -func (encoder *referenceEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - encoder.encoder.Encode(unsafe.Pointer(&ptr), stream) -} - -func (encoder *referenceEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return encoder.encoder.IsEmpty(unsafe.Pointer(&ptr)) -} - -type referenceDecoder struct { - decoder ValDecoder -} - -func (decoder *referenceDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - decoder.decoder.Decode(unsafe.Pointer(&ptr), iter) -} diff --git a/vendor/github.com/json-iterator/go/reflect_slice.go b/vendor/github.com/json-iterator/go/reflect_slice.go deleted file mode 100644 index 9441d79df..000000000 --- a/vendor/github.com/json-iterator/go/reflect_slice.go +++ /dev/null @@ -1,99 +0,0 @@ -package jsoniter - -import ( - "fmt" - "github.com/modern-go/reflect2" - "io" - "unsafe" -) - -func decoderOfSlice(ctx *ctx, typ reflect2.Type) ValDecoder { - sliceType := typ.(*reflect2.UnsafeSliceType) - decoder := decoderOfType(ctx.append("[sliceElem]"), sliceType.Elem()) - return &sliceDecoder{sliceType, decoder} -} - -func encoderOfSlice(ctx *ctx, typ reflect2.Type) ValEncoder { - sliceType := typ.(*reflect2.UnsafeSliceType) - encoder := encoderOfType(ctx.append("[sliceElem]"), sliceType.Elem()) - return &sliceEncoder{sliceType, encoder} -} - -type sliceEncoder struct { - sliceType *reflect2.UnsafeSliceType - elemEncoder ValEncoder -} - -func (encoder *sliceEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - if encoder.sliceType.UnsafeIsNil(ptr) { - stream.WriteNil() - return - } - length := encoder.sliceType.UnsafeLengthOf(ptr) - if length == 0 { - stream.WriteEmptyArray() - return - } - stream.WriteArrayStart() - encoder.elemEncoder.Encode(encoder.sliceType.UnsafeGetIndex(ptr, 0), stream) - for i := 1; i < length; i++ { - stream.WriteMore() - elemPtr := encoder.sliceType.UnsafeGetIndex(ptr, i) - encoder.elemEncoder.Encode(elemPtr, stream) - } - stream.WriteArrayEnd() - if stream.Error != nil && stream.Error != io.EOF { - stream.Error = fmt.Errorf("%v: %s", encoder.sliceType, stream.Error.Error()) - } -} - -func (encoder *sliceEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return encoder.sliceType.UnsafeLengthOf(ptr) == 0 -} - -type sliceDecoder struct { - sliceType *reflect2.UnsafeSliceType - elemDecoder ValDecoder -} - -func (decoder *sliceDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - decoder.doDecode(ptr, iter) - if iter.Error != nil && iter.Error != io.EOF { - iter.Error = fmt.Errorf("%v: %s", decoder.sliceType, iter.Error.Error()) - } -} - -func (decoder *sliceDecoder) doDecode(ptr unsafe.Pointer, iter *Iterator) { - c := iter.nextToken() - sliceType := decoder.sliceType - if c == 'n' { - iter.skipThreeBytes('u', 'l', 'l') - sliceType.UnsafeSetNil(ptr) - return - } - if c != '[' { - iter.ReportError("decode slice", "expect [ or n, but found "+string([]byte{c})) - return - } - c = iter.nextToken() - if c == ']' { - sliceType.UnsafeSet(ptr, sliceType.UnsafeMakeSlice(0, 0)) - return - } - iter.unreadByte() - sliceType.UnsafeGrow(ptr, 1) - elemPtr := sliceType.UnsafeGetIndex(ptr, 0) - decoder.elemDecoder.Decode(elemPtr, iter) - length := 1 - for c = iter.nextToken(); c == ','; c = iter.nextToken() { - idx := length - length += 1 - sliceType.UnsafeGrow(ptr, length) - elemPtr = sliceType.UnsafeGetIndex(ptr, idx) - decoder.elemDecoder.Decode(elemPtr, iter) - } - if c != ']' { - iter.ReportError("decode slice", "expect ], but found "+string([]byte{c})) - return - } -} diff --git a/vendor/github.com/json-iterator/go/reflect_struct_decoder.go b/vendor/github.com/json-iterator/go/reflect_struct_decoder.go deleted file mode 100644 index 92ae912dc..000000000 --- a/vendor/github.com/json-iterator/go/reflect_struct_decoder.go +++ /dev/null @@ -1,1097 +0,0 @@ -package jsoniter - -import ( - "fmt" - "io" - "strings" - "unsafe" - - "github.com/modern-go/reflect2" -) - -func decoderOfStruct(ctx *ctx, typ reflect2.Type) ValDecoder { - bindings := map[string]*Binding{} - structDescriptor := describeStruct(ctx, typ) - for _, binding := range structDescriptor.Fields { - for _, fromName := range binding.FromNames { - old := bindings[fromName] - if old == nil { - bindings[fromName] = binding - continue - } - ignoreOld, ignoreNew := resolveConflictBinding(ctx.frozenConfig, old, binding) - if ignoreOld { - delete(bindings, fromName) - } - if !ignoreNew { - bindings[fromName] = binding - } - } - } - fields := map[string]*structFieldDecoder{} - for k, binding := range bindings { - fields[k] = binding.Decoder.(*structFieldDecoder) - } - - if !ctx.caseSensitive() { - for k, binding := range bindings { - if _, found := fields[strings.ToLower(k)]; !found { - fields[strings.ToLower(k)] = binding.Decoder.(*structFieldDecoder) - } - } - } - - return createStructDecoder(ctx, typ, fields) -} - -func createStructDecoder(ctx *ctx, typ reflect2.Type, fields map[string]*structFieldDecoder) ValDecoder { - if ctx.disallowUnknownFields { - return &generalStructDecoder{typ: typ, fields: fields, disallowUnknownFields: true} - } - knownHash := map[int64]struct{}{ - 0: {}, - } - - switch len(fields) { - case 0: - return &skipObjectDecoder{typ} - case 1: - for fieldName, fieldDecoder := range fields { - fieldHash := calcHash(fieldName, ctx.caseSensitive()) - _, known := knownHash[fieldHash] - if known { - return &generalStructDecoder{typ, fields, false} - } - knownHash[fieldHash] = struct{}{} - return &oneFieldStructDecoder{typ, fieldHash, fieldDecoder} - } - case 2: - var fieldHash1 int64 - var fieldHash2 int64 - var fieldDecoder1 *structFieldDecoder - var fieldDecoder2 *structFieldDecoder - for fieldName, fieldDecoder := range fields { - fieldHash := calcHash(fieldName, ctx.caseSensitive()) - _, known := knownHash[fieldHash] - if known { - return &generalStructDecoder{typ, fields, false} - } - knownHash[fieldHash] = struct{}{} - if fieldHash1 == 0 { - fieldHash1 = fieldHash - fieldDecoder1 = fieldDecoder - } else { - fieldHash2 = fieldHash - fieldDecoder2 = fieldDecoder - } - } - return &twoFieldsStructDecoder{typ, fieldHash1, fieldDecoder1, fieldHash2, fieldDecoder2} - case 3: - var fieldName1 int64 - var fieldName2 int64 - var fieldName3 int64 - var fieldDecoder1 *structFieldDecoder - var fieldDecoder2 *structFieldDecoder - var fieldDecoder3 *structFieldDecoder - for fieldName, fieldDecoder := range fields { - fieldHash := calcHash(fieldName, ctx.caseSensitive()) - _, known := knownHash[fieldHash] - if known { - return &generalStructDecoder{typ, fields, false} - } - knownHash[fieldHash] = struct{}{} - if fieldName1 == 0 { - fieldName1 = fieldHash - fieldDecoder1 = fieldDecoder - } else if fieldName2 == 0 { - fieldName2 = fieldHash - fieldDecoder2 = fieldDecoder - } else { - fieldName3 = fieldHash - fieldDecoder3 = fieldDecoder - } - } - return &threeFieldsStructDecoder{typ, - fieldName1, fieldDecoder1, - fieldName2, fieldDecoder2, - fieldName3, fieldDecoder3} - case 4: - var fieldName1 int64 - var fieldName2 int64 - var fieldName3 int64 - var fieldName4 int64 - var fieldDecoder1 *structFieldDecoder - var fieldDecoder2 *structFieldDecoder - var fieldDecoder3 *structFieldDecoder - var fieldDecoder4 *structFieldDecoder - for fieldName, fieldDecoder := range fields { - fieldHash := calcHash(fieldName, ctx.caseSensitive()) - _, known := knownHash[fieldHash] - if known { - return &generalStructDecoder{typ, fields, false} - } - knownHash[fieldHash] = struct{}{} - if fieldName1 == 0 { - fieldName1 = fieldHash - fieldDecoder1 = fieldDecoder - } else if fieldName2 == 0 { - fieldName2 = fieldHash - fieldDecoder2 = fieldDecoder - } else if fieldName3 == 0 { - fieldName3 = fieldHash - fieldDecoder3 = fieldDecoder - } else { - fieldName4 = fieldHash - fieldDecoder4 = fieldDecoder - } - } - return &fourFieldsStructDecoder{typ, - fieldName1, fieldDecoder1, - fieldName2, fieldDecoder2, - fieldName3, fieldDecoder3, - fieldName4, fieldDecoder4} - case 5: - var fieldName1 int64 - var fieldName2 int64 - var fieldName3 int64 - var fieldName4 int64 - var fieldName5 int64 - var fieldDecoder1 *structFieldDecoder - var fieldDecoder2 *structFieldDecoder - var fieldDecoder3 *structFieldDecoder - var fieldDecoder4 *structFieldDecoder - var fieldDecoder5 *structFieldDecoder - for fieldName, fieldDecoder := range fields { - fieldHash := calcHash(fieldName, ctx.caseSensitive()) - _, known := knownHash[fieldHash] - if known { - return &generalStructDecoder{typ, fields, false} - } - knownHash[fieldHash] = struct{}{} - if fieldName1 == 0 { - fieldName1 = fieldHash - fieldDecoder1 = fieldDecoder - } else if fieldName2 == 0 { - fieldName2 = fieldHash - fieldDecoder2 = fieldDecoder - } else if fieldName3 == 0 { - fieldName3 = fieldHash - fieldDecoder3 = fieldDecoder - } else if fieldName4 == 0 { - fieldName4 = fieldHash - fieldDecoder4 = fieldDecoder - } else { - fieldName5 = fieldHash - fieldDecoder5 = fieldDecoder - } - } - return &fiveFieldsStructDecoder{typ, - fieldName1, fieldDecoder1, - fieldName2, fieldDecoder2, - fieldName3, fieldDecoder3, - fieldName4, fieldDecoder4, - fieldName5, fieldDecoder5} - case 6: - var fieldName1 int64 - var fieldName2 int64 - var fieldName3 int64 - var fieldName4 int64 - var fieldName5 int64 - var fieldName6 int64 - var fieldDecoder1 *structFieldDecoder - var fieldDecoder2 *structFieldDecoder - var fieldDecoder3 *structFieldDecoder - var fieldDecoder4 *structFieldDecoder - var fieldDecoder5 *structFieldDecoder - var fieldDecoder6 *structFieldDecoder - for fieldName, fieldDecoder := range fields { - fieldHash := calcHash(fieldName, ctx.caseSensitive()) - _, known := knownHash[fieldHash] - if known { - return &generalStructDecoder{typ, fields, false} - } - knownHash[fieldHash] = struct{}{} - if fieldName1 == 0 { - fieldName1 = fieldHash - fieldDecoder1 = fieldDecoder - } else if fieldName2 == 0 { - fieldName2 = fieldHash - fieldDecoder2 = fieldDecoder - } else if fieldName3 == 0 { - fieldName3 = fieldHash - fieldDecoder3 = fieldDecoder - } else if fieldName4 == 0 { - fieldName4 = fieldHash - fieldDecoder4 = fieldDecoder - } else if fieldName5 == 0 { - fieldName5 = fieldHash - fieldDecoder5 = fieldDecoder - } else { - fieldName6 = fieldHash - fieldDecoder6 = fieldDecoder - } - } - return &sixFieldsStructDecoder{typ, - fieldName1, fieldDecoder1, - fieldName2, fieldDecoder2, - fieldName3, fieldDecoder3, - fieldName4, fieldDecoder4, - fieldName5, fieldDecoder5, - fieldName6, fieldDecoder6} - case 7: - var fieldName1 int64 - var fieldName2 int64 - var fieldName3 int64 - var fieldName4 int64 - var fieldName5 int64 - var fieldName6 int64 - var fieldName7 int64 - var fieldDecoder1 *structFieldDecoder - var fieldDecoder2 *structFieldDecoder - var fieldDecoder3 *structFieldDecoder - var fieldDecoder4 *structFieldDecoder - var fieldDecoder5 *structFieldDecoder - var fieldDecoder6 *structFieldDecoder - var fieldDecoder7 *structFieldDecoder - for fieldName, fieldDecoder := range fields { - fieldHash := calcHash(fieldName, ctx.caseSensitive()) - _, known := knownHash[fieldHash] - if known { - return &generalStructDecoder{typ, fields, false} - } - knownHash[fieldHash] = struct{}{} - if fieldName1 == 0 { - fieldName1 = fieldHash - fieldDecoder1 = fieldDecoder - } else if fieldName2 == 0 { - fieldName2 = fieldHash - fieldDecoder2 = fieldDecoder - } else if fieldName3 == 0 { - fieldName3 = fieldHash - fieldDecoder3 = fieldDecoder - } else if fieldName4 == 0 { - fieldName4 = fieldHash - fieldDecoder4 = fieldDecoder - } else if fieldName5 == 0 { - fieldName5 = fieldHash - fieldDecoder5 = fieldDecoder - } else if fieldName6 == 0 { - fieldName6 = fieldHash - fieldDecoder6 = fieldDecoder - } else { - fieldName7 = fieldHash - fieldDecoder7 = fieldDecoder - } - } - return &sevenFieldsStructDecoder{typ, - fieldName1, fieldDecoder1, - fieldName2, fieldDecoder2, - fieldName3, fieldDecoder3, - fieldName4, fieldDecoder4, - fieldName5, fieldDecoder5, - fieldName6, fieldDecoder6, - fieldName7, fieldDecoder7} - case 8: - var fieldName1 int64 - var fieldName2 int64 - var fieldName3 int64 - var fieldName4 int64 - var fieldName5 int64 - var fieldName6 int64 - var fieldName7 int64 - var fieldName8 int64 - var fieldDecoder1 *structFieldDecoder - var fieldDecoder2 *structFieldDecoder - var fieldDecoder3 *structFieldDecoder - var fieldDecoder4 *structFieldDecoder - var fieldDecoder5 *structFieldDecoder - var fieldDecoder6 *structFieldDecoder - var fieldDecoder7 *structFieldDecoder - var fieldDecoder8 *structFieldDecoder - for fieldName, fieldDecoder := range fields { - fieldHash := calcHash(fieldName, ctx.caseSensitive()) - _, known := knownHash[fieldHash] - if known { - return &generalStructDecoder{typ, fields, false} - } - knownHash[fieldHash] = struct{}{} - if fieldName1 == 0 { - fieldName1 = fieldHash - fieldDecoder1 = fieldDecoder - } else if fieldName2 == 0 { - fieldName2 = fieldHash - fieldDecoder2 = fieldDecoder - } else if fieldName3 == 0 { - fieldName3 = fieldHash - fieldDecoder3 = fieldDecoder - } else if fieldName4 == 0 { - fieldName4 = fieldHash - fieldDecoder4 = fieldDecoder - } else if fieldName5 == 0 { - fieldName5 = fieldHash - fieldDecoder5 = fieldDecoder - } else if fieldName6 == 0 { - fieldName6 = fieldHash - fieldDecoder6 = fieldDecoder - } else if fieldName7 == 0 { - fieldName7 = fieldHash - fieldDecoder7 = fieldDecoder - } else { - fieldName8 = fieldHash - fieldDecoder8 = fieldDecoder - } - } - return &eightFieldsStructDecoder{typ, - fieldName1, fieldDecoder1, - fieldName2, fieldDecoder2, - fieldName3, fieldDecoder3, - fieldName4, fieldDecoder4, - fieldName5, fieldDecoder5, - fieldName6, fieldDecoder6, - fieldName7, fieldDecoder7, - fieldName8, fieldDecoder8} - case 9: - var fieldName1 int64 - var fieldName2 int64 - var fieldName3 int64 - var fieldName4 int64 - var fieldName5 int64 - var fieldName6 int64 - var fieldName7 int64 - var fieldName8 int64 - var fieldName9 int64 - var fieldDecoder1 *structFieldDecoder - var fieldDecoder2 *structFieldDecoder - var fieldDecoder3 *structFieldDecoder - var fieldDecoder4 *structFieldDecoder - var fieldDecoder5 *structFieldDecoder - var fieldDecoder6 *structFieldDecoder - var fieldDecoder7 *structFieldDecoder - var fieldDecoder8 *structFieldDecoder - var fieldDecoder9 *structFieldDecoder - for fieldName, fieldDecoder := range fields { - fieldHash := calcHash(fieldName, ctx.caseSensitive()) - _, known := knownHash[fieldHash] - if known { - return &generalStructDecoder{typ, fields, false} - } - knownHash[fieldHash] = struct{}{} - if fieldName1 == 0 { - fieldName1 = fieldHash - fieldDecoder1 = fieldDecoder - } else if fieldName2 == 0 { - fieldName2 = fieldHash - fieldDecoder2 = fieldDecoder - } else if fieldName3 == 0 { - fieldName3 = fieldHash - fieldDecoder3 = fieldDecoder - } else if fieldName4 == 0 { - fieldName4 = fieldHash - fieldDecoder4 = fieldDecoder - } else if fieldName5 == 0 { - fieldName5 = fieldHash - fieldDecoder5 = fieldDecoder - } else if fieldName6 == 0 { - fieldName6 = fieldHash - fieldDecoder6 = fieldDecoder - } else if fieldName7 == 0 { - fieldName7 = fieldHash - fieldDecoder7 = fieldDecoder - } else if fieldName8 == 0 { - fieldName8 = fieldHash - fieldDecoder8 = fieldDecoder - } else { - fieldName9 = fieldHash - fieldDecoder9 = fieldDecoder - } - } - return &nineFieldsStructDecoder{typ, - fieldName1, fieldDecoder1, - fieldName2, fieldDecoder2, - fieldName3, fieldDecoder3, - fieldName4, fieldDecoder4, - fieldName5, fieldDecoder5, - fieldName6, fieldDecoder6, - fieldName7, fieldDecoder7, - fieldName8, fieldDecoder8, - fieldName9, fieldDecoder9} - case 10: - var fieldName1 int64 - var fieldName2 int64 - var fieldName3 int64 - var fieldName4 int64 - var fieldName5 int64 - var fieldName6 int64 - var fieldName7 int64 - var fieldName8 int64 - var fieldName9 int64 - var fieldName10 int64 - var fieldDecoder1 *structFieldDecoder - var fieldDecoder2 *structFieldDecoder - var fieldDecoder3 *structFieldDecoder - var fieldDecoder4 *structFieldDecoder - var fieldDecoder5 *structFieldDecoder - var fieldDecoder6 *structFieldDecoder - var fieldDecoder7 *structFieldDecoder - var fieldDecoder8 *structFieldDecoder - var fieldDecoder9 *structFieldDecoder - var fieldDecoder10 *structFieldDecoder - for fieldName, fieldDecoder := range fields { - fieldHash := calcHash(fieldName, ctx.caseSensitive()) - _, known := knownHash[fieldHash] - if known { - return &generalStructDecoder{typ, fields, false} - } - knownHash[fieldHash] = struct{}{} - if fieldName1 == 0 { - fieldName1 = fieldHash - fieldDecoder1 = fieldDecoder - } else if fieldName2 == 0 { - fieldName2 = fieldHash - fieldDecoder2 = fieldDecoder - } else if fieldName3 == 0 { - fieldName3 = fieldHash - fieldDecoder3 = fieldDecoder - } else if fieldName4 == 0 { - fieldName4 = fieldHash - fieldDecoder4 = fieldDecoder - } else if fieldName5 == 0 { - fieldName5 = fieldHash - fieldDecoder5 = fieldDecoder - } else if fieldName6 == 0 { - fieldName6 = fieldHash - fieldDecoder6 = fieldDecoder - } else if fieldName7 == 0 { - fieldName7 = fieldHash - fieldDecoder7 = fieldDecoder - } else if fieldName8 == 0 { - fieldName8 = fieldHash - fieldDecoder8 = fieldDecoder - } else if fieldName9 == 0 { - fieldName9 = fieldHash - fieldDecoder9 = fieldDecoder - } else { - fieldName10 = fieldHash - fieldDecoder10 = fieldDecoder - } - } - return &tenFieldsStructDecoder{typ, - fieldName1, fieldDecoder1, - fieldName2, fieldDecoder2, - fieldName3, fieldDecoder3, - fieldName4, fieldDecoder4, - fieldName5, fieldDecoder5, - fieldName6, fieldDecoder6, - fieldName7, fieldDecoder7, - fieldName8, fieldDecoder8, - fieldName9, fieldDecoder9, - fieldName10, fieldDecoder10} - } - return &generalStructDecoder{typ, fields, false} -} - -type generalStructDecoder struct { - typ reflect2.Type - fields map[string]*structFieldDecoder - disallowUnknownFields bool -} - -func (decoder *generalStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.readObjectStart() { - return - } - if !iter.incrementDepth() { - return - } - var c byte - for c = ','; c == ','; c = iter.nextToken() { - decoder.decodeOneField(ptr, iter) - } - if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { - iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) - } - if c != '}' { - iter.ReportError("struct Decode", `expect }, but found `+string([]byte{c})) - } - iter.decrementDepth() -} - -func (decoder *generalStructDecoder) decodeOneField(ptr unsafe.Pointer, iter *Iterator) { - var field string - var fieldDecoder *structFieldDecoder - if iter.cfg.objectFieldMustBeSimpleString { - fieldBytes := iter.ReadStringAsSlice() - field = *(*string)(unsafe.Pointer(&fieldBytes)) - fieldDecoder = decoder.fields[field] - if fieldDecoder == nil && !iter.cfg.caseSensitive { - fieldDecoder = decoder.fields[strings.ToLower(field)] - } - } else { - field = iter.ReadString() - fieldDecoder = decoder.fields[field] - if fieldDecoder == nil && !iter.cfg.caseSensitive { - fieldDecoder = decoder.fields[strings.ToLower(field)] - } - } - if fieldDecoder == nil { - if decoder.disallowUnknownFields { - msg := "found unknown field: " + field - iter.ReportError("ReadObject", msg) - } - c := iter.nextToken() - if c != ':' { - iter.ReportError("ReadObject", "expect : after object field, but found "+string([]byte{c})) - } - iter.Skip() - return - } - c := iter.nextToken() - if c != ':' { - iter.ReportError("ReadObject", "expect : after object field, but found "+string([]byte{c})) - } - fieldDecoder.Decode(ptr, iter) -} - -type skipObjectDecoder struct { - typ reflect2.Type -} - -func (decoder *skipObjectDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - valueType := iter.WhatIsNext() - if valueType != ObjectValue && valueType != NilValue { - iter.ReportError("skipObjectDecoder", "expect object or null") - return - } - iter.Skip() -} - -type oneFieldStructDecoder struct { - typ reflect2.Type - fieldHash int64 - fieldDecoder *structFieldDecoder -} - -func (decoder *oneFieldStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.readObjectStart() { - return - } - if !iter.incrementDepth() { - return - } - for { - if iter.readFieldHash() == decoder.fieldHash { - decoder.fieldDecoder.Decode(ptr, iter) - } else { - iter.Skip() - } - if iter.isObjectEnd() { - break - } - } - if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { - iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) - } - iter.decrementDepth() -} - -type twoFieldsStructDecoder struct { - typ reflect2.Type - fieldHash1 int64 - fieldDecoder1 *structFieldDecoder - fieldHash2 int64 - fieldDecoder2 *structFieldDecoder -} - -func (decoder *twoFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.readObjectStart() { - return - } - if !iter.incrementDepth() { - return - } - for { - switch iter.readFieldHash() { - case decoder.fieldHash1: - decoder.fieldDecoder1.Decode(ptr, iter) - case decoder.fieldHash2: - decoder.fieldDecoder2.Decode(ptr, iter) - default: - iter.Skip() - } - if iter.isObjectEnd() { - break - } - } - if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { - iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) - } - iter.decrementDepth() -} - -type threeFieldsStructDecoder struct { - typ reflect2.Type - fieldHash1 int64 - fieldDecoder1 *structFieldDecoder - fieldHash2 int64 - fieldDecoder2 *structFieldDecoder - fieldHash3 int64 - fieldDecoder3 *structFieldDecoder -} - -func (decoder *threeFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.readObjectStart() { - return - } - if !iter.incrementDepth() { - return - } - for { - switch iter.readFieldHash() { - case decoder.fieldHash1: - decoder.fieldDecoder1.Decode(ptr, iter) - case decoder.fieldHash2: - decoder.fieldDecoder2.Decode(ptr, iter) - case decoder.fieldHash3: - decoder.fieldDecoder3.Decode(ptr, iter) - default: - iter.Skip() - } - if iter.isObjectEnd() { - break - } - } - if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { - iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) - } - iter.decrementDepth() -} - -type fourFieldsStructDecoder struct { - typ reflect2.Type - fieldHash1 int64 - fieldDecoder1 *structFieldDecoder - fieldHash2 int64 - fieldDecoder2 *structFieldDecoder - fieldHash3 int64 - fieldDecoder3 *structFieldDecoder - fieldHash4 int64 - fieldDecoder4 *structFieldDecoder -} - -func (decoder *fourFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.readObjectStart() { - return - } - if !iter.incrementDepth() { - return - } - for { - switch iter.readFieldHash() { - case decoder.fieldHash1: - decoder.fieldDecoder1.Decode(ptr, iter) - case decoder.fieldHash2: - decoder.fieldDecoder2.Decode(ptr, iter) - case decoder.fieldHash3: - decoder.fieldDecoder3.Decode(ptr, iter) - case decoder.fieldHash4: - decoder.fieldDecoder4.Decode(ptr, iter) - default: - iter.Skip() - } - if iter.isObjectEnd() { - break - } - } - if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { - iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) - } - iter.decrementDepth() -} - -type fiveFieldsStructDecoder struct { - typ reflect2.Type - fieldHash1 int64 - fieldDecoder1 *structFieldDecoder - fieldHash2 int64 - fieldDecoder2 *structFieldDecoder - fieldHash3 int64 - fieldDecoder3 *structFieldDecoder - fieldHash4 int64 - fieldDecoder4 *structFieldDecoder - fieldHash5 int64 - fieldDecoder5 *structFieldDecoder -} - -func (decoder *fiveFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.readObjectStart() { - return - } - if !iter.incrementDepth() { - return - } - for { - switch iter.readFieldHash() { - case decoder.fieldHash1: - decoder.fieldDecoder1.Decode(ptr, iter) - case decoder.fieldHash2: - decoder.fieldDecoder2.Decode(ptr, iter) - case decoder.fieldHash3: - decoder.fieldDecoder3.Decode(ptr, iter) - case decoder.fieldHash4: - decoder.fieldDecoder4.Decode(ptr, iter) - case decoder.fieldHash5: - decoder.fieldDecoder5.Decode(ptr, iter) - default: - iter.Skip() - } - if iter.isObjectEnd() { - break - } - } - if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { - iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) - } - iter.decrementDepth() -} - -type sixFieldsStructDecoder struct { - typ reflect2.Type - fieldHash1 int64 - fieldDecoder1 *structFieldDecoder - fieldHash2 int64 - fieldDecoder2 *structFieldDecoder - fieldHash3 int64 - fieldDecoder3 *structFieldDecoder - fieldHash4 int64 - fieldDecoder4 *structFieldDecoder - fieldHash5 int64 - fieldDecoder5 *structFieldDecoder - fieldHash6 int64 - fieldDecoder6 *structFieldDecoder -} - -func (decoder *sixFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.readObjectStart() { - return - } - if !iter.incrementDepth() { - return - } - for { - switch iter.readFieldHash() { - case decoder.fieldHash1: - decoder.fieldDecoder1.Decode(ptr, iter) - case decoder.fieldHash2: - decoder.fieldDecoder2.Decode(ptr, iter) - case decoder.fieldHash3: - decoder.fieldDecoder3.Decode(ptr, iter) - case decoder.fieldHash4: - decoder.fieldDecoder4.Decode(ptr, iter) - case decoder.fieldHash5: - decoder.fieldDecoder5.Decode(ptr, iter) - case decoder.fieldHash6: - decoder.fieldDecoder6.Decode(ptr, iter) - default: - iter.Skip() - } - if iter.isObjectEnd() { - break - } - } - if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { - iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) - } - iter.decrementDepth() -} - -type sevenFieldsStructDecoder struct { - typ reflect2.Type - fieldHash1 int64 - fieldDecoder1 *structFieldDecoder - fieldHash2 int64 - fieldDecoder2 *structFieldDecoder - fieldHash3 int64 - fieldDecoder3 *structFieldDecoder - fieldHash4 int64 - fieldDecoder4 *structFieldDecoder - fieldHash5 int64 - fieldDecoder5 *structFieldDecoder - fieldHash6 int64 - fieldDecoder6 *structFieldDecoder - fieldHash7 int64 - fieldDecoder7 *structFieldDecoder -} - -func (decoder *sevenFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.readObjectStart() { - return - } - if !iter.incrementDepth() { - return - } - for { - switch iter.readFieldHash() { - case decoder.fieldHash1: - decoder.fieldDecoder1.Decode(ptr, iter) - case decoder.fieldHash2: - decoder.fieldDecoder2.Decode(ptr, iter) - case decoder.fieldHash3: - decoder.fieldDecoder3.Decode(ptr, iter) - case decoder.fieldHash4: - decoder.fieldDecoder4.Decode(ptr, iter) - case decoder.fieldHash5: - decoder.fieldDecoder5.Decode(ptr, iter) - case decoder.fieldHash6: - decoder.fieldDecoder6.Decode(ptr, iter) - case decoder.fieldHash7: - decoder.fieldDecoder7.Decode(ptr, iter) - default: - iter.Skip() - } - if iter.isObjectEnd() { - break - } - } - if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { - iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) - } - iter.decrementDepth() -} - -type eightFieldsStructDecoder struct { - typ reflect2.Type - fieldHash1 int64 - fieldDecoder1 *structFieldDecoder - fieldHash2 int64 - fieldDecoder2 *structFieldDecoder - fieldHash3 int64 - fieldDecoder3 *structFieldDecoder - fieldHash4 int64 - fieldDecoder4 *structFieldDecoder - fieldHash5 int64 - fieldDecoder5 *structFieldDecoder - fieldHash6 int64 - fieldDecoder6 *structFieldDecoder - fieldHash7 int64 - fieldDecoder7 *structFieldDecoder - fieldHash8 int64 - fieldDecoder8 *structFieldDecoder -} - -func (decoder *eightFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.readObjectStart() { - return - } - if !iter.incrementDepth() { - return - } - for { - switch iter.readFieldHash() { - case decoder.fieldHash1: - decoder.fieldDecoder1.Decode(ptr, iter) - case decoder.fieldHash2: - decoder.fieldDecoder2.Decode(ptr, iter) - case decoder.fieldHash3: - decoder.fieldDecoder3.Decode(ptr, iter) - case decoder.fieldHash4: - decoder.fieldDecoder4.Decode(ptr, iter) - case decoder.fieldHash5: - decoder.fieldDecoder5.Decode(ptr, iter) - case decoder.fieldHash6: - decoder.fieldDecoder6.Decode(ptr, iter) - case decoder.fieldHash7: - decoder.fieldDecoder7.Decode(ptr, iter) - case decoder.fieldHash8: - decoder.fieldDecoder8.Decode(ptr, iter) - default: - iter.Skip() - } - if iter.isObjectEnd() { - break - } - } - if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { - iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) - } - iter.decrementDepth() -} - -type nineFieldsStructDecoder struct { - typ reflect2.Type - fieldHash1 int64 - fieldDecoder1 *structFieldDecoder - fieldHash2 int64 - fieldDecoder2 *structFieldDecoder - fieldHash3 int64 - fieldDecoder3 *structFieldDecoder - fieldHash4 int64 - fieldDecoder4 *structFieldDecoder - fieldHash5 int64 - fieldDecoder5 *structFieldDecoder - fieldHash6 int64 - fieldDecoder6 *structFieldDecoder - fieldHash7 int64 - fieldDecoder7 *structFieldDecoder - fieldHash8 int64 - fieldDecoder8 *structFieldDecoder - fieldHash9 int64 - fieldDecoder9 *structFieldDecoder -} - -func (decoder *nineFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.readObjectStart() { - return - } - if !iter.incrementDepth() { - return - } - for { - switch iter.readFieldHash() { - case decoder.fieldHash1: - decoder.fieldDecoder1.Decode(ptr, iter) - case decoder.fieldHash2: - decoder.fieldDecoder2.Decode(ptr, iter) - case decoder.fieldHash3: - decoder.fieldDecoder3.Decode(ptr, iter) - case decoder.fieldHash4: - decoder.fieldDecoder4.Decode(ptr, iter) - case decoder.fieldHash5: - decoder.fieldDecoder5.Decode(ptr, iter) - case decoder.fieldHash6: - decoder.fieldDecoder6.Decode(ptr, iter) - case decoder.fieldHash7: - decoder.fieldDecoder7.Decode(ptr, iter) - case decoder.fieldHash8: - decoder.fieldDecoder8.Decode(ptr, iter) - case decoder.fieldHash9: - decoder.fieldDecoder9.Decode(ptr, iter) - default: - iter.Skip() - } - if iter.isObjectEnd() { - break - } - } - if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { - iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) - } - iter.decrementDepth() -} - -type tenFieldsStructDecoder struct { - typ reflect2.Type - fieldHash1 int64 - fieldDecoder1 *structFieldDecoder - fieldHash2 int64 - fieldDecoder2 *structFieldDecoder - fieldHash3 int64 - fieldDecoder3 *structFieldDecoder - fieldHash4 int64 - fieldDecoder4 *structFieldDecoder - fieldHash5 int64 - fieldDecoder5 *structFieldDecoder - fieldHash6 int64 - fieldDecoder6 *structFieldDecoder - fieldHash7 int64 - fieldDecoder7 *structFieldDecoder - fieldHash8 int64 - fieldDecoder8 *structFieldDecoder - fieldHash9 int64 - fieldDecoder9 *structFieldDecoder - fieldHash10 int64 - fieldDecoder10 *structFieldDecoder -} - -func (decoder *tenFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.readObjectStart() { - return - } - if !iter.incrementDepth() { - return - } - for { - switch iter.readFieldHash() { - case decoder.fieldHash1: - decoder.fieldDecoder1.Decode(ptr, iter) - case decoder.fieldHash2: - decoder.fieldDecoder2.Decode(ptr, iter) - case decoder.fieldHash3: - decoder.fieldDecoder3.Decode(ptr, iter) - case decoder.fieldHash4: - decoder.fieldDecoder4.Decode(ptr, iter) - case decoder.fieldHash5: - decoder.fieldDecoder5.Decode(ptr, iter) - case decoder.fieldHash6: - decoder.fieldDecoder6.Decode(ptr, iter) - case decoder.fieldHash7: - decoder.fieldDecoder7.Decode(ptr, iter) - case decoder.fieldHash8: - decoder.fieldDecoder8.Decode(ptr, iter) - case decoder.fieldHash9: - decoder.fieldDecoder9.Decode(ptr, iter) - case decoder.fieldHash10: - decoder.fieldDecoder10.Decode(ptr, iter) - default: - iter.Skip() - } - if iter.isObjectEnd() { - break - } - } - if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { - iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) - } - iter.decrementDepth() -} - -type structFieldDecoder struct { - field reflect2.StructField - fieldDecoder ValDecoder -} - -func (decoder *structFieldDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - fieldPtr := decoder.field.UnsafeGet(ptr) - decoder.fieldDecoder.Decode(fieldPtr, iter) - if iter.Error != nil && iter.Error != io.EOF { - iter.Error = fmt.Errorf("%s: %s", decoder.field.Name(), iter.Error.Error()) - } -} - -type stringModeStringDecoder struct { - elemDecoder ValDecoder - cfg *frozenConfig -} - -func (decoder *stringModeStringDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - decoder.elemDecoder.Decode(ptr, iter) - str := *((*string)(ptr)) - tempIter := decoder.cfg.BorrowIterator([]byte(str)) - defer decoder.cfg.ReturnIterator(tempIter) - *((*string)(ptr)) = tempIter.ReadString() -} - -type stringModeNumberDecoder struct { - elemDecoder ValDecoder -} - -func (decoder *stringModeNumberDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - if iter.WhatIsNext() == NilValue { - decoder.elemDecoder.Decode(ptr, iter) - return - } - - c := iter.nextToken() - if c != '"' { - iter.ReportError("stringModeNumberDecoder", `expect ", but found `+string([]byte{c})) - return - } - decoder.elemDecoder.Decode(ptr, iter) - if iter.Error != nil { - return - } - c = iter.readByte() - if c != '"' { - iter.ReportError("stringModeNumberDecoder", `expect ", but found `+string([]byte{c})) - return - } -} diff --git a/vendor/github.com/json-iterator/go/reflect_struct_encoder.go b/vendor/github.com/json-iterator/go/reflect_struct_encoder.go deleted file mode 100644 index 152e3ef5a..000000000 --- a/vendor/github.com/json-iterator/go/reflect_struct_encoder.go +++ /dev/null @@ -1,211 +0,0 @@ -package jsoniter - -import ( - "fmt" - "github.com/modern-go/reflect2" - "io" - "reflect" - "unsafe" -) - -func encoderOfStruct(ctx *ctx, typ reflect2.Type) ValEncoder { - type bindingTo struct { - binding *Binding - toName string - ignored bool - } - orderedBindings := []*bindingTo{} - structDescriptor := describeStruct(ctx, typ) - for _, binding := range structDescriptor.Fields { - for _, toName := range binding.ToNames { - new := &bindingTo{ - binding: binding, - toName: toName, - } - for _, old := range orderedBindings { - if old.toName != toName { - continue - } - old.ignored, new.ignored = resolveConflictBinding(ctx.frozenConfig, old.binding, new.binding) - } - orderedBindings = append(orderedBindings, new) - } - } - if len(orderedBindings) == 0 { - return &emptyStructEncoder{} - } - finalOrderedFields := []structFieldTo{} - for _, bindingTo := range orderedBindings { - if !bindingTo.ignored { - finalOrderedFields = append(finalOrderedFields, structFieldTo{ - encoder: bindingTo.binding.Encoder.(*structFieldEncoder), - toName: bindingTo.toName, - }) - } - } - return &structEncoder{typ, finalOrderedFields} -} - -func createCheckIsEmpty(ctx *ctx, typ reflect2.Type) checkIsEmpty { - encoder := createEncoderOfNative(ctx, typ) - if encoder != nil { - return encoder - } - kind := typ.Kind() - switch kind { - case reflect.Interface: - return &dynamicEncoder{typ} - case reflect.Struct: - return &structEncoder{typ: typ} - case reflect.Array: - return &arrayEncoder{} - case reflect.Slice: - return &sliceEncoder{} - case reflect.Map: - return encoderOfMap(ctx, typ) - case reflect.Ptr: - return &OptionalEncoder{} - default: - return &lazyErrorEncoder{err: fmt.Errorf("unsupported type: %v", typ)} - } -} - -func resolveConflictBinding(cfg *frozenConfig, old, new *Binding) (ignoreOld, ignoreNew bool) { - newTagged := new.Field.Tag().Get(cfg.getTagKey()) != "" - oldTagged := old.Field.Tag().Get(cfg.getTagKey()) != "" - if newTagged { - if oldTagged { - if len(old.levels) > len(new.levels) { - return true, false - } else if len(new.levels) > len(old.levels) { - return false, true - } else { - return true, true - } - } else { - return true, false - } - } else { - if oldTagged { - return true, false - } - if len(old.levels) > len(new.levels) { - return true, false - } else if len(new.levels) > len(old.levels) { - return false, true - } else { - return true, true - } - } -} - -type structFieldEncoder struct { - field reflect2.StructField - fieldEncoder ValEncoder - omitempty bool -} - -func (encoder *structFieldEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - fieldPtr := encoder.field.UnsafeGet(ptr) - encoder.fieldEncoder.Encode(fieldPtr, stream) - if stream.Error != nil && stream.Error != io.EOF { - stream.Error = fmt.Errorf("%s: %s", encoder.field.Name(), stream.Error.Error()) - } -} - -func (encoder *structFieldEncoder) IsEmpty(ptr unsafe.Pointer) bool { - fieldPtr := encoder.field.UnsafeGet(ptr) - return encoder.fieldEncoder.IsEmpty(fieldPtr) -} - -func (encoder *structFieldEncoder) IsEmbeddedPtrNil(ptr unsafe.Pointer) bool { - isEmbeddedPtrNil, converted := encoder.fieldEncoder.(IsEmbeddedPtrNil) - if !converted { - return false - } - fieldPtr := encoder.field.UnsafeGet(ptr) - return isEmbeddedPtrNil.IsEmbeddedPtrNil(fieldPtr) -} - -type IsEmbeddedPtrNil interface { - IsEmbeddedPtrNil(ptr unsafe.Pointer) bool -} - -type structEncoder struct { - typ reflect2.Type - fields []structFieldTo -} - -type structFieldTo struct { - encoder *structFieldEncoder - toName string -} - -func (encoder *structEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteObjectStart() - isNotFirst := false - for _, field := range encoder.fields { - if field.encoder.omitempty && field.encoder.IsEmpty(ptr) { - continue - } - if field.encoder.IsEmbeddedPtrNil(ptr) { - continue - } - if isNotFirst { - stream.WriteMore() - } - stream.WriteObjectField(field.toName) - field.encoder.Encode(ptr, stream) - isNotFirst = true - } - stream.WriteObjectEnd() - if stream.Error != nil && stream.Error != io.EOF { - stream.Error = fmt.Errorf("%v.%s", encoder.typ, stream.Error.Error()) - } -} - -func (encoder *structEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return false -} - -type emptyStructEncoder struct { -} - -func (encoder *emptyStructEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteEmptyObject() -} - -func (encoder *emptyStructEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return false -} - -type stringModeNumberEncoder struct { - elemEncoder ValEncoder -} - -func (encoder *stringModeNumberEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.writeByte('"') - encoder.elemEncoder.Encode(ptr, stream) - stream.writeByte('"') -} - -func (encoder *stringModeNumberEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return encoder.elemEncoder.IsEmpty(ptr) -} - -type stringModeStringEncoder struct { - elemEncoder ValEncoder - cfg *frozenConfig -} - -func (encoder *stringModeStringEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - tempStream := encoder.cfg.BorrowStream(nil) - tempStream.Attachment = stream.Attachment - defer encoder.cfg.ReturnStream(tempStream) - encoder.elemEncoder.Encode(ptr, tempStream) - stream.WriteString(string(tempStream.Buffer())) -} - -func (encoder *stringModeStringEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return encoder.elemEncoder.IsEmpty(ptr) -} diff --git a/vendor/github.com/json-iterator/go/stream.go b/vendor/github.com/json-iterator/go/stream.go deleted file mode 100644 index 23d8a3ad6..000000000 --- a/vendor/github.com/json-iterator/go/stream.go +++ /dev/null @@ -1,210 +0,0 @@ -package jsoniter - -import ( - "io" -) - -// stream is a io.Writer like object, with JSON specific write functions. -// Error is not returned as return value, but stored as Error member on this stream instance. -type Stream struct { - cfg *frozenConfig - out io.Writer - buf []byte - Error error - indention int - Attachment interface{} // open for customized encoder -} - -// NewStream create new stream instance. -// cfg can be jsoniter.ConfigDefault. -// out can be nil if write to internal buffer. -// bufSize is the initial size for the internal buffer in bytes. -func NewStream(cfg API, out io.Writer, bufSize int) *Stream { - return &Stream{ - cfg: cfg.(*frozenConfig), - out: out, - buf: make([]byte, 0, bufSize), - Error: nil, - indention: 0, - } -} - -// Pool returns a pool can provide more stream with same configuration -func (stream *Stream) Pool() StreamPool { - return stream.cfg -} - -// Reset reuse this stream instance by assign a new writer -func (stream *Stream) Reset(out io.Writer) { - stream.out = out - stream.buf = stream.buf[:0] -} - -// Available returns how many bytes are unused in the buffer. -func (stream *Stream) Available() int { - return cap(stream.buf) - len(stream.buf) -} - -// Buffered returns the number of bytes that have been written into the current buffer. -func (stream *Stream) Buffered() int { - return len(stream.buf) -} - -// Buffer if writer is nil, use this method to take the result -func (stream *Stream) Buffer() []byte { - return stream.buf -} - -// SetBuffer allows to append to the internal buffer directly -func (stream *Stream) SetBuffer(buf []byte) { - stream.buf = buf -} - -// Write writes the contents of p into the buffer. -// It returns the number of bytes written. -// If nn < len(p), it also returns an error explaining -// why the write is short. -func (stream *Stream) Write(p []byte) (nn int, err error) { - stream.buf = append(stream.buf, p...) - if stream.out != nil { - nn, err = stream.out.Write(stream.buf) - stream.buf = stream.buf[nn:] - return - } - return len(p), nil -} - -// WriteByte writes a single byte. -func (stream *Stream) writeByte(c byte) { - stream.buf = append(stream.buf, c) -} - -func (stream *Stream) writeTwoBytes(c1 byte, c2 byte) { - stream.buf = append(stream.buf, c1, c2) -} - -func (stream *Stream) writeThreeBytes(c1 byte, c2 byte, c3 byte) { - stream.buf = append(stream.buf, c1, c2, c3) -} - -func (stream *Stream) writeFourBytes(c1 byte, c2 byte, c3 byte, c4 byte) { - stream.buf = append(stream.buf, c1, c2, c3, c4) -} - -func (stream *Stream) writeFiveBytes(c1 byte, c2 byte, c3 byte, c4 byte, c5 byte) { - stream.buf = append(stream.buf, c1, c2, c3, c4, c5) -} - -// Flush writes any buffered data to the underlying io.Writer. -func (stream *Stream) Flush() error { - if stream.out == nil { - return nil - } - if stream.Error != nil { - return stream.Error - } - _, err := stream.out.Write(stream.buf) - if err != nil { - if stream.Error == nil { - stream.Error = err - } - return err - } - stream.buf = stream.buf[:0] - return nil -} - -// WriteRaw write string out without quotes, just like []byte -func (stream *Stream) WriteRaw(s string) { - stream.buf = append(stream.buf, s...) -} - -// WriteNil write null to stream -func (stream *Stream) WriteNil() { - stream.writeFourBytes('n', 'u', 'l', 'l') -} - -// WriteTrue write true to stream -func (stream *Stream) WriteTrue() { - stream.writeFourBytes('t', 'r', 'u', 'e') -} - -// WriteFalse write false to stream -func (stream *Stream) WriteFalse() { - stream.writeFiveBytes('f', 'a', 'l', 's', 'e') -} - -// WriteBool write true or false into stream -func (stream *Stream) WriteBool(val bool) { - if val { - stream.WriteTrue() - } else { - stream.WriteFalse() - } -} - -// WriteObjectStart write { with possible indention -func (stream *Stream) WriteObjectStart() { - stream.indention += stream.cfg.indentionStep - stream.writeByte('{') - stream.writeIndention(0) -} - -// WriteObjectField write "field": with possible indention -func (stream *Stream) WriteObjectField(field string) { - stream.WriteString(field) - if stream.indention > 0 { - stream.writeTwoBytes(':', ' ') - } else { - stream.writeByte(':') - } -} - -// WriteObjectEnd write } with possible indention -func (stream *Stream) WriteObjectEnd() { - stream.writeIndention(stream.cfg.indentionStep) - stream.indention -= stream.cfg.indentionStep - stream.writeByte('}') -} - -// WriteEmptyObject write {} -func (stream *Stream) WriteEmptyObject() { - stream.writeByte('{') - stream.writeByte('}') -} - -// WriteMore write , with possible indention -func (stream *Stream) WriteMore() { - stream.writeByte(',') - stream.writeIndention(0) -} - -// WriteArrayStart write [ with possible indention -func (stream *Stream) WriteArrayStart() { - stream.indention += stream.cfg.indentionStep - stream.writeByte('[') - stream.writeIndention(0) -} - -// WriteEmptyArray write [] -func (stream *Stream) WriteEmptyArray() { - stream.writeTwoBytes('[', ']') -} - -// WriteArrayEnd write ] with possible indention -func (stream *Stream) WriteArrayEnd() { - stream.writeIndention(stream.cfg.indentionStep) - stream.indention -= stream.cfg.indentionStep - stream.writeByte(']') -} - -func (stream *Stream) writeIndention(delta int) { - if stream.indention == 0 { - return - } - stream.writeByte('\n') - toWrite := stream.indention - delta - for i := 0; i < toWrite; i++ { - stream.buf = append(stream.buf, ' ') - } -} diff --git a/vendor/github.com/json-iterator/go/stream_float.go b/vendor/github.com/json-iterator/go/stream_float.go deleted file mode 100644 index 826aa594a..000000000 --- a/vendor/github.com/json-iterator/go/stream_float.go +++ /dev/null @@ -1,111 +0,0 @@ -package jsoniter - -import ( - "fmt" - "math" - "strconv" -) - -var pow10 []uint64 - -func init() { - pow10 = []uint64{1, 10, 100, 1000, 10000, 100000, 1000000} -} - -// WriteFloat32 write float32 to stream -func (stream *Stream) WriteFloat32(val float32) { - if math.IsInf(float64(val), 0) || math.IsNaN(float64(val)) { - stream.Error = fmt.Errorf("unsupported value: %f", val) - return - } - abs := math.Abs(float64(val)) - fmt := byte('f') - // Note: Must use float32 comparisons for underlying float32 value to get precise cutoffs right. - if abs != 0 { - if float32(abs) < 1e-6 || float32(abs) >= 1e21 { - fmt = 'e' - } - } - stream.buf = strconv.AppendFloat(stream.buf, float64(val), fmt, -1, 32) -} - -// WriteFloat32Lossy write float32 to stream with ONLY 6 digits precision although much much faster -func (stream *Stream) WriteFloat32Lossy(val float32) { - if math.IsInf(float64(val), 0) || math.IsNaN(float64(val)) { - stream.Error = fmt.Errorf("unsupported value: %f", val) - return - } - if val < 0 { - stream.writeByte('-') - val = -val - } - if val > 0x4ffffff { - stream.WriteFloat32(val) - return - } - precision := 6 - exp := uint64(1000000) // 6 - lval := uint64(float64(val)*float64(exp) + 0.5) - stream.WriteUint64(lval / exp) - fval := lval % exp - if fval == 0 { - return - } - stream.writeByte('.') - for p := precision - 1; p > 0 && fval < pow10[p]; p-- { - stream.writeByte('0') - } - stream.WriteUint64(fval) - for stream.buf[len(stream.buf)-1] == '0' { - stream.buf = stream.buf[:len(stream.buf)-1] - } -} - -// WriteFloat64 write float64 to stream -func (stream *Stream) WriteFloat64(val float64) { - if math.IsInf(val, 0) || math.IsNaN(val) { - stream.Error = fmt.Errorf("unsupported value: %f", val) - return - } - abs := math.Abs(val) - fmt := byte('f') - // Note: Must use float32 comparisons for underlying float32 value to get precise cutoffs right. - if abs != 0 { - if abs < 1e-6 || abs >= 1e21 { - fmt = 'e' - } - } - stream.buf = strconv.AppendFloat(stream.buf, float64(val), fmt, -1, 64) -} - -// WriteFloat64Lossy write float64 to stream with ONLY 6 digits precision although much much faster -func (stream *Stream) WriteFloat64Lossy(val float64) { - if math.IsInf(val, 0) || math.IsNaN(val) { - stream.Error = fmt.Errorf("unsupported value: %f", val) - return - } - if val < 0 { - stream.writeByte('-') - val = -val - } - if val > 0x4ffffff { - stream.WriteFloat64(val) - return - } - precision := 6 - exp := uint64(1000000) // 6 - lval := uint64(val*float64(exp) + 0.5) - stream.WriteUint64(lval / exp) - fval := lval % exp - if fval == 0 { - return - } - stream.writeByte('.') - for p := precision - 1; p > 0 && fval < pow10[p]; p-- { - stream.writeByte('0') - } - stream.WriteUint64(fval) - for stream.buf[len(stream.buf)-1] == '0' { - stream.buf = stream.buf[:len(stream.buf)-1] - } -} diff --git a/vendor/github.com/json-iterator/go/stream_int.go b/vendor/github.com/json-iterator/go/stream_int.go deleted file mode 100644 index d1059ee4c..000000000 --- a/vendor/github.com/json-iterator/go/stream_int.go +++ /dev/null @@ -1,190 +0,0 @@ -package jsoniter - -var digits []uint32 - -func init() { - digits = make([]uint32, 1000) - for i := uint32(0); i < 1000; i++ { - digits[i] = (((i / 100) + '0') << 16) + ((((i / 10) % 10) + '0') << 8) + i%10 + '0' - if i < 10 { - digits[i] += 2 << 24 - } else if i < 100 { - digits[i] += 1 << 24 - } - } -} - -func writeFirstBuf(space []byte, v uint32) []byte { - start := v >> 24 - if start == 0 { - space = append(space, byte(v>>16), byte(v>>8)) - } else if start == 1 { - space = append(space, byte(v>>8)) - } - space = append(space, byte(v)) - return space -} - -func writeBuf(buf []byte, v uint32) []byte { - return append(buf, byte(v>>16), byte(v>>8), byte(v)) -} - -// WriteUint8 write uint8 to stream -func (stream *Stream) WriteUint8(val uint8) { - stream.buf = writeFirstBuf(stream.buf, digits[val]) -} - -// WriteInt8 write int8 to stream -func (stream *Stream) WriteInt8(nval int8) { - var val uint8 - if nval < 0 { - val = uint8(-nval) - stream.buf = append(stream.buf, '-') - } else { - val = uint8(nval) - } - stream.buf = writeFirstBuf(stream.buf, digits[val]) -} - -// WriteUint16 write uint16 to stream -func (stream *Stream) WriteUint16(val uint16) { - q1 := val / 1000 - if q1 == 0 { - stream.buf = writeFirstBuf(stream.buf, digits[val]) - return - } - r1 := val - q1*1000 - stream.buf = writeFirstBuf(stream.buf, digits[q1]) - stream.buf = writeBuf(stream.buf, digits[r1]) - return -} - -// WriteInt16 write int16 to stream -func (stream *Stream) WriteInt16(nval int16) { - var val uint16 - if nval < 0 { - val = uint16(-nval) - stream.buf = append(stream.buf, '-') - } else { - val = uint16(nval) - } - stream.WriteUint16(val) -} - -// WriteUint32 write uint32 to stream -func (stream *Stream) WriteUint32(val uint32) { - q1 := val / 1000 - if q1 == 0 { - stream.buf = writeFirstBuf(stream.buf, digits[val]) - return - } - r1 := val - q1*1000 - q2 := q1 / 1000 - if q2 == 0 { - stream.buf = writeFirstBuf(stream.buf, digits[q1]) - stream.buf = writeBuf(stream.buf, digits[r1]) - return - } - r2 := q1 - q2*1000 - q3 := q2 / 1000 - if q3 == 0 { - stream.buf = writeFirstBuf(stream.buf, digits[q2]) - } else { - r3 := q2 - q3*1000 - stream.buf = append(stream.buf, byte(q3+'0')) - stream.buf = writeBuf(stream.buf, digits[r3]) - } - stream.buf = writeBuf(stream.buf, digits[r2]) - stream.buf = writeBuf(stream.buf, digits[r1]) -} - -// WriteInt32 write int32 to stream -func (stream *Stream) WriteInt32(nval int32) { - var val uint32 - if nval < 0 { - val = uint32(-nval) - stream.buf = append(stream.buf, '-') - } else { - val = uint32(nval) - } - stream.WriteUint32(val) -} - -// WriteUint64 write uint64 to stream -func (stream *Stream) WriteUint64(val uint64) { - q1 := val / 1000 - if q1 == 0 { - stream.buf = writeFirstBuf(stream.buf, digits[val]) - return - } - r1 := val - q1*1000 - q2 := q1 / 1000 - if q2 == 0 { - stream.buf = writeFirstBuf(stream.buf, digits[q1]) - stream.buf = writeBuf(stream.buf, digits[r1]) - return - } - r2 := q1 - q2*1000 - q3 := q2 / 1000 - if q3 == 0 { - stream.buf = writeFirstBuf(stream.buf, digits[q2]) - stream.buf = writeBuf(stream.buf, digits[r2]) - stream.buf = writeBuf(stream.buf, digits[r1]) - return - } - r3 := q2 - q3*1000 - q4 := q3 / 1000 - if q4 == 0 { - stream.buf = writeFirstBuf(stream.buf, digits[q3]) - stream.buf = writeBuf(stream.buf, digits[r3]) - stream.buf = writeBuf(stream.buf, digits[r2]) - stream.buf = writeBuf(stream.buf, digits[r1]) - return - } - r4 := q3 - q4*1000 - q5 := q4 / 1000 - if q5 == 0 { - stream.buf = writeFirstBuf(stream.buf, digits[q4]) - stream.buf = writeBuf(stream.buf, digits[r4]) - stream.buf = writeBuf(stream.buf, digits[r3]) - stream.buf = writeBuf(stream.buf, digits[r2]) - stream.buf = writeBuf(stream.buf, digits[r1]) - return - } - r5 := q4 - q5*1000 - q6 := q5 / 1000 - if q6 == 0 { - stream.buf = writeFirstBuf(stream.buf, digits[q5]) - } else { - stream.buf = writeFirstBuf(stream.buf, digits[q6]) - r6 := q5 - q6*1000 - stream.buf = writeBuf(stream.buf, digits[r6]) - } - stream.buf = writeBuf(stream.buf, digits[r5]) - stream.buf = writeBuf(stream.buf, digits[r4]) - stream.buf = writeBuf(stream.buf, digits[r3]) - stream.buf = writeBuf(stream.buf, digits[r2]) - stream.buf = writeBuf(stream.buf, digits[r1]) -} - -// WriteInt64 write int64 to stream -func (stream *Stream) WriteInt64(nval int64) { - var val uint64 - if nval < 0 { - val = uint64(-nval) - stream.buf = append(stream.buf, '-') - } else { - val = uint64(nval) - } - stream.WriteUint64(val) -} - -// WriteInt write int to stream -func (stream *Stream) WriteInt(val int) { - stream.WriteInt64(int64(val)) -} - -// WriteUint write uint to stream -func (stream *Stream) WriteUint(val uint) { - stream.WriteUint64(uint64(val)) -} diff --git a/vendor/github.com/json-iterator/go/stream_str.go b/vendor/github.com/json-iterator/go/stream_str.go deleted file mode 100644 index 54c2ba0b3..000000000 --- a/vendor/github.com/json-iterator/go/stream_str.go +++ /dev/null @@ -1,372 +0,0 @@ -package jsoniter - -import ( - "unicode/utf8" -) - -// htmlSafeSet holds the value true if the ASCII character with the given -// array position can be safely represented inside a JSON string, embedded -// inside of HTML